From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30622 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: msprev Newsgroups: gmane.text.pandoc Subject: Re: MWE for building a table using Lua Date: Thu, 26 May 2022 01:53:39 -0700 (PDT) Message-ID: <82a0d0eb-877a-47ff-8632-907322c40648n@googlegroups.com> References: <11978438-43d6-4943-aaac-659d51f05f43n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_122_1487676734.1653555219074" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19782"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBD2ORKWKWEDBBFEAXWKAMGQESCOV7AQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu May 26 10:53:43 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f63.google.com ([209.85.161.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nu9FX-00051a-BY for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 26 May 2022 10:53:43 +0200 Original-Received: by mail-oo1-f63.google.com with SMTP id y199-20020a4a45d0000000b0035e6f78ae62sf726891ooa.5 for ; Thu, 26 May 2022 01:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=7K6OFNxd28ngp9FIhdN3xPV+YUnd+KT6UkQHVvNjDNQ=; b=rvNFwwxh9o+2s36l4xO84qOaVePGE3dDTWxvzFTUCXG5Pqm9jhjW1EU/4S632yV8vo Sm7Cr8o+wcxVsLSKki/z+848DTjqoQxrQJvArOW9lP61YxNyFK4pbPMEAFCIa3dKafax v6rqlCsKbCr6EVSlDhXX9/dpDYfv9KZaAXV5APnIY+XgvFZBn4Ld9wTxtK3CogZd9BjZ h2T1KFrnLRNHpyQCEgGHmxqgAaSuK/dcbXqSe7+wm7pYlmOQxosnjTgI0vrL5guzBGHm qAitQf7QpJaZtqZw/EQu5AUgxK3f7wZDvX+3Vemh48ZCsmWL3c5zZAAKHBOv56zCdzF/ XCUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=7K6OFNxd28ngp9FIhdN3xPV+YUnd+KT6UkQHVvNjDNQ=; b=FegrISUO3F0+laikqLGqY3MAHiVH7rDtzYFskUCm8+kYDpLrA+PfLdHSPfgF91EkK7 k0mfyPxqpr3aKfsLRK16jmGu6cJEMQM4WS1JDsAJgfZ3RyqV8FQGildQSdVVfc86ycMh ECvP8wpoLIoiNyP/L7gp4pUsWlOuExqtxoNqd7Y+b13/ytwaey08BdepJ3I8nfFKFsAQ n7p+ySnpRbw/lmiNySfZ46ohxrAF3JnqAU0N0FbSXbVUOf0s6dfvqmVmp9JjQ/0QkJfA yo9No4xmSQn3MdJPeRJYBzQLGbE44jflksj2jDamiD0Stdw/+9QuvjpBRXBVPk74wQJ4 uuYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=7K6OFNxd28ngp9FIhdN3xPV+YUnd+KT6UkQHVvNjDNQ=; b=ewCJ9XRkMFE22LPKy2uM7AJwBz8Twkffe42yFRmyaJV8jM2t9tORmeCF70sr9GKZ0y 8AvjJrQzEJmdzNaxXCD1J7QX98aQe8kDc/tVMp1qPj2tPUF/aQG2uGKv6J8d02ZXf7UN AkXukpdXvKY/5hZtAtJPxrj7ruEkssJREzugU0NeyndW4LNFM8lxptUpDMTPm3guOhNQ cqPlHyTIi2Lnv4lAqWnDG+ALzVRndEUhajBWLjNGNDIr089NkGXgZqim7FugjsCVoTcE izg0CBoNAKCE1UJbCu1yZbpFSS0kG6tz6bbfkjvozAow/JvTjLrmQl44rXSNvYk91ZtF 4yAw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532QYWRk4ACZ8V3iwVJTluaVL8cDrtSd/JXaNBQgULES0emh8Cw6 2OVJY6/zKwMwW/JCa5QZ2nM= X-Google-Smtp-Source: ABdhPJxVXr0J3kkPcAWpLxzygtvSa3qTO16NtntpOg7FTotvBROGV3nFQmqHjMpPqCOtZtGEVVfesw== X-Received: by 2002:a9d:6543:0:b0:605:e789:271e with SMTP id q3-20020a9d6543000000b00605e789271emr14350814otl.200.1653555222368; Thu, 26 May 2022 01:53:42 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:e002:0:b0:326:84a7:4e6b with SMTP id x2-20020acae002000000b0032684a74e6bls8606949oig.8.gmail; Thu, 26 May 2022 01:53:39 -0700 (PDT) X-Received: by 2002:a05:6808:170b:b0:2fa:729a:a42e with SMTP id bc11-20020a056808170b00b002fa729aa42emr536661oib.0.1653555219721; Thu, 26 May 2022 01:53:39 -0700 (PDT) In-Reply-To: <11978438-43d6-4943-aaac-659d51f05f43n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: msprevak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30622 Archived-At: ------=_Part_122_1487676734.1653555219074 Content-Type: multipart/alternative; boundary="----=_Part_123_523672778.1653555219074" ------=_Part_123_523672778.1653555219074 Content-Type: text/plain; charset="UTF-8" This creates the following structure -- all ok, except the table body, which is empty ('[]'), and I cannot get it to appear. Any suggestions on what I'm doing wrong would be gratefully received. ``` Table ( "" , [] , [] ) (Caption Nothing []) [ ( AlignLeft , ColWidthDefault ) , ( AlignDefault , ColWidthDefault ) ] (TableHead ( "" , [] , [] ) []) [] (TableFoot ( "" , [] , [] ) []) ``` On Wednesday, May 25, 2022 at 12:48:06 PM UTC+1 msprev wrote: > I've been struggling to get my head around handling tables with Lua in > pandoc 2.18. I'm trying to write a minimal working example to create a > table as I can't seem to find one online. The code below does create a > table, but with any empty table body and I can't figure out how to get the > body to appear. Can anyone help tell me what has gone wrong here? > > BTW, I tried to call the pandoc.TableBody() constructor, but that throws > an error as it doesn't seem to be defined ("attempt to call a nil value > (field 'TableBody')") > > ``` > local caption = {long = {}} > local colspecs = {{pandoc.AlignLeft, pandoc.ColWidthDefault}, > {pandoc.AlignDefault, pandoc.ColWidthDefault}} > local head = pandoc.TableHead() > local cell1contents = { pandoc.Plain({pandoc.Str("cell1")}) } > local cell2contents = { pandoc.Plain({pandoc.Str("cell2")}) } > local cell1 = { alignment=pandoc.AlignDefault, contents=cell1contents, > col_span=1, row_span=1 } > local cell2 = { alignment=pandoc.AlignDefault, contents=cell2contents, > col_span=1, row_span=1 } > local row1 = { cells={pandoc.Cell(cell1), pandoc.Cell(cell2)} } > local rows = { pandoc.Row(row1) } > local bodies = { body=rows, head={}, row_head_columns=0 } > local foot = pandoc.TableFoot() > local mytable = pandoc.Table(caption, colspecs, head, bodies, foot) > table.insert(doc.blocks, mytable) > ``` > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com. ------=_Part_123_523672778.1653555219074 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This creates the following structure -- all ok, except the table body, whic= h is empty ('[]'), and I cannot get it to appear. Any suggestions on what I= 'm doing wrong would be gratefully received.

```
Table
    ( "" , [] , [] )
&n= bsp;   (Caption Nothing [])
    [ ( AlignLeft , ColWidthD= efault )
    , ( AlignDefault , ColWidthDefault )
  &n= bsp; ]
    (TableHead ( "" , [] , [] ) [])
    []=
    (TableFoot ( "" , [] , [] ) [])

```
On Wednesday, M= ay 25, 2022 at 12:48:06 PM UTC+1 msprev wrote:
I've been struggling to get my head = around handling tables with Lua in pandoc 2.18. I'm trying to write a m= inimal working example to create a table as I can't seem to find one on= line. The code below does create a table, but with any empty table body and= I can't figure out how to get the body to appear. Can anyone help tell= me what has gone wrong here?

BTW, I tried to call the p= andoc.TableBody() constructor, but that throws an error as it doesn't s= eem to be defined ("attempt to call a nil value (field 'TableBody&= #39;)")

```
local caption =3D {long =3D {}}
= local colspecs =3D {{pandoc.AlignLeft, pandoc.ColWidthDefault},
= {pandoc.AlignDefault, pandoc.ColWidthDefault}}
local= head =3D pandoc.TableHead()
local cell1contents =3D { pandoc.Plain(= {pandoc.Str("cell1")}) }
local cell2contents =3D { pandoc.= Plain({pandoc.Str("cell2")}) }
local cell1 =3D { alignment= =3Dpandoc.AlignDefault, contents=3Dcell1contents, col_span=3D1, row_span=3D= 1 }
local cell2 =3D { alignment=3Dpandoc.AlignDefault, contents=3Dce= ll2contents, col_span=3D1, row_span=3D1 }
local row1 =3D { cells=3D{= pandoc.Cell(cell1), pandoc.Cell(cell2)} }
local rows =3D { pandoc.Ro= w(row1) }
local bodies =3D { body=3Drows, head=3D{}, row_head_column= s=3D0 }
local foot =3D pandoc.TableFoot()
local mytable =3D p= andoc.Table(caption, colspecs, head, bodies, foot)
table.insert(doc.= blocks, mytable)
```

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.= com.
------=_Part_123_523672778.1653555219074-- ------=_Part_122_1487676734.1653555219074--