From: msprev <msprevak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: MWE for building a table using Lua
Date: Wed, 25 May 2022 04:48:06 -0700 (PDT) [thread overview]
Message-ID: <11978438-43d6-4943-aaac-659d51f05f43n@googlegroups.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1725 bytes --]
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/11978438-43d6-4943-aaac-659d51f05f43n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 2162 bytes --]
next reply other threads:[~2022-05-25 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 11:48 msprev [this message]
[not found] ` <11978438-43d6-4943-aaac-659d51f05f43n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-05-26 8:53 ` msprev
[not found] ` <82a0d0eb-877a-47ff-8632-907322c40648n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-05-26 9:05 ` Bastien DUMONT
2022-05-26 10:52 ` K4zuki
[not found] ` <8094d69c-8374-4662-9c5c-c099e14b19b2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-05-27 10:42 ` BPJ
[not found] ` <CADAJKhDw3GKsUnfBhu6bdh7mJrGmtrOeHzz2ygTuUAZX-muEUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-05-29 16:48 ` msprev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11978438-43d6-4943-aaac-659d51f05f43n@googlegroups.com \
--to=msprevak-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).