* MWE for building a table using Lua @ 2022-05-25 11:48 msprev [not found] ` <11978438-43d6-4943-aaac-659d51f05f43n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: msprev @ 2022-05-25 11:48 UTC (permalink / raw) To: pandoc-discuss [-- 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 --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <11978438-43d6-4943-aaac-659d51f05f43n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: MWE for building a table using Lua [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> 0 siblings, 1 reply; 6+ messages in thread From: msprev @ 2022-05-26 8:53 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2266 bytes --] 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. [-- Attachment #1.2: Type: text/html, Size: 3086 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <82a0d0eb-877a-47ff-8632-907322c40648n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: MWE for building a table using Lua [not found] ` <82a0d0eb-877a-47ff-8632-907322c40648n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-05-26 9:05 ` Bastien DUMONT 2022-05-26 10:52 ` K4zuki 0 siblings, 1 reply; 6+ messages in thread From: Bastien DUMONT @ 2022-05-26 9:05 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw The constructors don't take tables as their argument, but discrete values. I have not found the definition of the constructors in the official documentation, but you can look into this filter to see how they work: https://github.com/pandoc/lua-filters/blob/master/list-table/list-table.lua Le Thursday 26 May 2022 à 01:53:39AM, msprev a écrit : > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/msgid/ > pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com. > > References: > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/Yo9C1QJeUl%2BLbwKo%40localhost. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: MWE for building a table using Lua 2022-05-26 9:05 ` Bastien DUMONT @ 2022-05-26 10:52 ` K4zuki [not found] ` <8094d69c-8374-4662-9c5c-c099e14b19b2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: K4zuki @ 2022-05-26 10:52 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 4167 bytes --] hint 1 - my note about Table structure (might be inaccurate w/ 2.18): https://gist.github.com/K4zuki/04e1e1af2fcf06db1a6ea640aa8feadd hint 2 - my implementation in a filter (https://github.com/pandocker/pandocker-lua-filters/blob/master/lua/csv2table.lua): 1. prepare a minimum table markdown text as a local variable 2. let pandoc convert the text, then extract Table object ```lua local table_template = [==[ | table | |-------| | cell | Table: caption ]==] local my_table = pandoc.read(table_template, "markdown").blocks[1] ``` 3. clone the object and replace the contents 2022年5月26日木曜日 18:06:06 UTC+9 Bastien Dumont: > The constructors don't take tables as their argument, but discrete values. > I have not found the definition of the constructors in the official > documentation, but you can look into this filter to see how they work: > https://github.com/pandoc/lua-filters/blob/master/list-table/list-table.lua > > Le Thursday 26 May 2022 à 01:53:39AM, msprev a écrit : > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2] > https://groups.google.com/d/msgid/ > > pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] > https://groups.google.com/d/msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/8094d69c-8374-4662-9c5c-c099e14b19b2n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 6655 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <8094d69c-8374-4662-9c5c-c099e14b19b2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: MWE for building a table using Lua [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> 0 siblings, 1 reply; 6+ messages in thread From: BPJ @ 2022-05-27 10:42 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 5471 bytes --] Den tors 26 maj 2022 12:53K4zuki <k.yamamoto.08136891-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > hint 1 - my note about Table structure (might be inaccurate w/ 2.18): > https://gist.github.com/K4zuki/04e1e1af2fcf06db1a6ea640aa8feadd > Thanks for this! My own stab at this, which may be seriously outdated, is here: https://groups.google.com/g/pandoc-discuss/c/XE9YdlJNamU/m/oWZapmV5CwAJ I was aiming at the JSON structure because my intention was to implement support for complex tables in Perl JSON filters, which I still use from time to time because Perl has real Unicode support! As for col/row spans: doesn't the HTML reader/writer support them yet? hint 2 - my implementation in a filter ( > https://github.com/pandocker/pandocker-lua-filters/blob/master/lua/csv2table.lua > ): > 1. prepare a minimum table markdown text as a local variable > 2. let pandoc convert the text, then extract Table object > ```lua > local table_template = [==[ > | table | > |-------| > | cell | > > Table: caption > ]==] > > local my_table = pandoc.read(table_template, "markdown").blocks[1] > ``` > 3. clone the object and replace the contents > Nice trick — once you have grokked the structure. > 2022年5月26日木曜日 18:06:06 UTC+9 Bastien Dumont: > >> The constructors don't take tables as their argument, but discrete >> values. I have not found the definition of the constructors in the official >> documentation, but you can look into this filter to see how they work: >> https://github.com/pandoc/lua-filters/blob/master/list-table/list-table.lua >> >> Le Thursday 26 May 2022 à 01:53:39AM, msprev a écrit : >> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit [2] >> https://groups.google.com/d/msgid/ >> > pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com. >> >> > >> > References: >> > >> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [2] >> https://groups.google.com/d/msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com?utm_medium=email&utm_source=footer >> >> -- > 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/8094d69c-8374-4662-9c5c-c099e14b19b2n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/8094d69c-8374-4662-9c5c-c099e14b19b2n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhDw3GKsUnfBhu6bdh7mJrGmtrOeHzz2ygTuUAZX-muEUA%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 8485 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CADAJKhDw3GKsUnfBhu6bdh7mJrGmtrOeHzz2ygTuUAZX-muEUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: MWE for building a table using Lua [not found] ` <CADAJKhDw3GKsUnfBhu6bdh7mJrGmtrOeHzz2ygTuUAZX-muEUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-05-29 16:48 ` msprev 0 siblings, 0 replies; 6+ messages in thread From: msprev @ 2022-05-29 16:48 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5842 bytes --] Thanks for the replies, and the hints. I'll continue to experiment to see if I can build a table in lua. On Friday, May 27, 2022 at 11:43:11 AM UTC+1 BPJ wrote: > > > Den tors 26 maj 2022 12:53K4zuki <k.yamamot...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > >> hint 1 - my note about Table structure (might be inaccurate w/ 2.18): >> https://gist.github.com/K4zuki/04e1e1af2fcf06db1a6ea640aa8feadd >> > > Thanks for this! My own stab at this, which may be seriously outdated, is > here: > > https://groups.google.com/g/pandoc-discuss/c/XE9YdlJNamU/m/oWZapmV5CwAJ > > I was aiming at the JSON structure because my intention was to implement > support for complex tables in Perl JSON filters, which I still use from > time to time because Perl has real Unicode support! > > As for col/row spans: doesn't the HTML reader/writer support them yet? > > > hint 2 - my implementation in a filter ( >> https://github.com/pandocker/pandocker-lua-filters/blob/master/lua/csv2table.lua >> ): >> 1. prepare a minimum table markdown text as a local variable >> 2. let pandoc convert the text, then extract Table object >> ```lua >> local table_template = [==[ >> | table | >> |-------| >> | cell | >> >> Table: caption >> ]==] >> >> local my_table = pandoc.read(table_template, "markdown").blocks[1] >> ``` >> 3. clone the object and replace the contents >> > > Nice trick — once you have grokked the structure. > > > >> 2022年5月26日木曜日 18:06:06 UTC+9 Bastien Dumont: >> >>> The constructors don't take tables as their argument, but discrete >>> values. I have not found the definition of the constructors in the official >>> documentation, but you can look into this filter to see how they work: >>> https://github.com/pandoc/lua-filters/blob/master/list-table/list-table.lua >>> >>> Le Thursday 26 May 2022 à 01:53:39AM, msprev a écrit : >>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> > To view this discussion on the web visit [2] >>> https://groups.google.com/d/msgid/ >>> > pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n% >>> 40googlegroups.com. >>> > >>> > References: >>> > >>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>> > [2] >>> https://groups.google.com/d/msgid/pandoc-discuss/82a0d0eb-877a-47ff-8632-907322c40648n%40googlegroups.com?utm_medium=email&utm_source=footer >>> >>> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/8094d69c-8374-4662-9c5c-c099e14b19b2n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/8094d69c-8374-4662-9c5c-c099e14b19b2n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/e812ee52-ecc7-42ae-a8a7-2ed0a01087f6n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 10985 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-29 16:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-05-25 11:48 MWE for building a table using Lua msprev [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
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).