* Lua filter to remove captions from tables @ 2021-01-14 9:40 Stephan Boltzmann [not found] ` <82e61683-5190-45c6-8420-60243cf1bee3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Stephan Boltzmann @ 2021-01-14 9:40 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1353 bytes --] Hello everybody out there using Pandoc, I would like to remove the caption from tables in PDF output and tried a couple of things without success: if FORMAT:match 'latex' then function Table (elem) --caption = elem.caption caption = elem.c[2] -- caption seems to be second element print(pandoc.utils.stringify(caption)) --elem.c[2] = nil --elem.c[2] = pandoc.Str('Test') --elem.caption = nil --elem = nil --return {pandoc.Table(elem.c)} --return {elem} --elem:remove(2) --table.remove(elem.c,2) --[[ return { pandoc.Para(pandoc.Str('test')) } --]] return { --pandoc.Table(elem.caption, elem.aligns, elem.widths, elem.headers, elem.rows) } end end The main problem could actually rather be the construction of the table using the function pandoc.Table in the return statement: Could not read list: Could not get Block value: expected table, got 'nil' (nil) -- 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 2394 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <82e61683-5190-45c6-8420-60243cf1bee3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <82e61683-5190-45c6-8420-60243cf1bee3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-01-14 10:43 ` BPJ [not found] ` <CADAJKhAuKkpGQZfv0ptudJcH6U1iL+_tkd9Ubm6jGw8ky3_L8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: BPJ @ 2021-01-14 10:43 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 2198 bytes --] I think you should use `elem.caption = {}` -- Better --help|less than helpless Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2boltzmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > Hello everybody out there using Pandoc, > > I would like to remove the caption from tables in PDF output and tried a > couple of things without success: > > if FORMAT:match 'latex' then > function Table (elem) > --caption = elem.caption > caption = elem.c[2] -- caption seems to be second element > print(pandoc.utils.stringify(caption)) > --elem.c[2] = nil > --elem.c[2] = pandoc.Str('Test') > --elem.caption = nil > --elem = nil > --return {pandoc.Table(elem.c)} > --return {elem} > --elem:remove(2) > --table.remove(elem.c,2) > --[[ > return { > pandoc.Para(pandoc.Str('test')) > } > --]] > return { > --pandoc.Table(elem.caption, elem.aligns, elem.widths, elem.headers, > elem.rows) > } > end > end > > The main problem could actually rather be the construction of the table > using the function pandoc.Table in the return statement: > Could not read list: Could not get Block value: expected table, got 'nil' > (nil) > > -- > 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/CADAJKhAuKkpGQZfv0ptudJcH6U1iL%2B_tkd9Ubm6jGw8ky3_L8w%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 3507 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CADAJKhAuKkpGQZfv0ptudJcH6U1iL+_tkd9Ubm6jGw8ky3_L8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <CADAJKhAuKkpGQZfv0ptudJcH6U1iL+_tkd9Ubm6jGw8ky3_L8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2021-01-14 12:28 ` Stephan Boltzmann [not found] ` <7e2c1a91-6cb1-4344-aab5-8577f1b82905n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Stephan Boltzmann @ 2021-01-14 12:28 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2383 bytes --] Thanks a lot for your hint. Then I would still have to fix the return statement. BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: > I think you should use `elem.caption = {}` > > -- > Better --help|less than helpless > > Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > skrev: > >> Hello everybody out there using Pandoc, >> >> I would like to remove the caption from tables in PDF output and tried a >> couple of things without success: >> >> if FORMAT:match 'latex' then >> function Table (elem) >> --caption = elem.caption >> caption = elem.c[2] -- caption seems to be second element >> print(pandoc.utils.stringify(caption)) >> --elem.c[2] = nil >> --elem.c[2] = pandoc.Str('Test') >> --elem.caption = nil >> --elem = nil >> --return {pandoc.Table(elem.c)} >> --return {elem} >> --elem:remove(2) >> --table.remove(elem.c,2) >> --[[ >> return { >> pandoc.Para(pandoc.Str('test')) >> } >> --]] >> return { >> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >> elem.headers, elem.rows) >> } >> end >> end >> >> The main problem could actually rather be the construction of the table >> using the function pandoc.Table in the return statement: >> Could not read list: Could not get Block value: expected table, got 'nil' >> (nil) >> >> -- >> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 4299 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <7e2c1a91-6cb1-4344-aab5-8577f1b82905n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <7e2c1a91-6cb1-4344-aab5-8577f1b82905n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-01-14 21:59 ` BPJ [not found] ` <CADAJKhBczM9Li+FG_6rWrPnSOCG0Bo6rrPdRFc5poZpNrx8jVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: BPJ @ 2021-01-14 21:59 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 3268 bytes --] You can just return the original table having replaced the caption with an empty list in place. -- Better --help|less than helpless Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2boltzmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > Thanks a lot for your hint. > > Then I would still have to fix the return statement. > > BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: > >> I think you should use `elem.caption = {}` >> >> -- >> Better --help|less than helpless >> >> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> skrev: >> >>> Hello everybody out there using Pandoc, >>> >>> I would like to remove the caption from tables in PDF output and tried a >>> couple of things without success: >>> >>> if FORMAT:match 'latex' then >>> function Table (elem) >>> --caption = elem.caption >>> caption = elem.c[2] -- caption seems to be second element >>> print(pandoc.utils.stringify(caption)) >>> --elem.c[2] = nil >>> --elem.c[2] = pandoc.Str('Test') >>> --elem.caption = nil >>> --elem = nil >>> --return {pandoc.Table(elem.c)} >>> --return {elem} >>> --elem:remove(2) >>> --table.remove(elem.c,2) >>> --[[ >>> return { >>> pandoc.Para(pandoc.Str('test')) >>> } >>> --]] >>> return { >>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >>> elem.headers, elem.rows) >>> } >>> end >>> end >>> >>> The main problem could actually rather be the construction of the table >>> using the function pandoc.Table in the return statement: >>> Could not read list: Could not get Block value: expected table, got >>> 'nil' (nil) >>> >>> -- >>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/CADAJKhBczM9Li%2BFG_6rWrPnSOCG0Bo6rrPdRFc5poZpNrx8jVw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 5365 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CADAJKhBczM9Li+FG_6rWrPnSOCG0Bo6rrPdRFc5poZpNrx8jVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <CADAJKhBczM9Li+FG_6rWrPnSOCG0Bo6rrPdRFc5poZpNrx8jVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2021-01-16 9:23 ` Stephan Boltzmann [not found] ` <35c35036-590d-48d9-bddb-09e6e71b4982n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Stephan Boltzmann @ 2021-01-16 9:23 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3626 bytes --] Thanks again for your answer. I'm not sure whether I understood everything correctly. if FORMAT:match 'latex' then function Table (elem) elem.caption = {} return {elem} end end Gives me an error message. BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: > You can just return the original table having replaced the caption with an > empty list in place. > > > -- > Better --help|less than helpless > Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > skrev: > >> Thanks a lot for your hint. >> >> Then I would still have to fix the return statement. >> >> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: >> >>> I think you should use `elem.caption = {}` >>> >>> -- >>> Better --help|less than helpless >>> >>> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> skrev: >>> >>>> Hello everybody out there using Pandoc, >>>> >>>> I would like to remove the caption from tables in PDF output and tried >>>> a couple of things without success: >>>> >>>> if FORMAT:match 'latex' then >>>> function Table (elem) >>>> --caption = elem.caption >>>> caption = elem.c[2] -- caption seems to be second element >>>> print(pandoc.utils.stringify(caption)) >>>> --elem.c[2] = nil >>>> --elem.c[2] = pandoc.Str('Test') >>>> --elem.caption = nil >>>> --elem = nil >>>> --return {pandoc.Table(elem.c)} >>>> --return {elem} >>>> --elem:remove(2) >>>> --table.remove(elem.c,2) >>>> --[[ >>>> return { >>>> pandoc.Para(pandoc.Str('test')) >>>> } >>>> --]] >>>> return { >>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >>>> elem.headers, elem.rows) >>>> } >>>> end >>>> end >>>> >>>> The main problem could actually rather be the construction of the table >>>> using the function pandoc.Table in the return statement: >>>> Could not read list: Could not get Block value: expected table, got >>>> 'nil' (nil) >>>> >>>> -- >>>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 6710 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <35c35036-590d-48d9-bddb-09e6e71b4982n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <35c35036-590d-48d9-bddb-09e6e71b4982n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-01-16 9:31 ` BPJ [not found] ` <CADAJKhBTKO4irrpCpy-1NfwQLMWzrV-i3b=MYPrwsLjgROOaHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: BPJ @ 2021-01-16 9:31 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 4849 bytes --] It does? I'm away from my work computer ATM so I can't test. Have you tried to just return elem without wrapping it in a table? (Not that it should make any difference.) Also try to explicitly return nil as a fallback at the bottom of the function, although I'm not sure that should make any difference either. -- Better --help|less than helpless Den lör 16 jan. 2021 10:24Stephan Boltzmann <stephan2boltzmann@gmail.com> skrev: > Thanks again for your answer. > I'm not sure whether I understood everything correctly. > > if FORMAT:match 'latex' then > function Table (elem) > elem.caption = {} > return {elem} > end > end > > Gives me an error message. > > BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: > >> You can just return the original table having replaced the caption with >> an empty list in place. >> >> >> -- >> Better --help|less than helpless >> Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> skrev: >> >>> Thanks a lot for your hint. >>> >>> Then I would still have to fix the return statement. >>> >>> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: >>> >>>> I think you should use `elem.caption = {}` >>>> >>>> -- >>>> Better --help|less than helpless >>>> >>>> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>>> skrev: >>>> >>>>> Hello everybody out there using Pandoc, >>>>> >>>>> I would like to remove the caption from tables in PDF output and tried >>>>> a couple of things without success: >>>>> >>>>> if FORMAT:match 'latex' then >>>>> function Table (elem) >>>>> --caption = elem.caption >>>>> caption = elem.c[2] -- caption seems to be second element >>>>> print(pandoc.utils.stringify(caption)) >>>>> --elem.c[2] = nil >>>>> --elem.c[2] = pandoc.Str('Test') >>>>> --elem.caption = nil >>>>> --elem = nil >>>>> --return {pandoc.Table(elem.c)} >>>>> --return {elem} >>>>> --elem:remove(2) >>>>> --table.remove(elem.c,2) >>>>> --[[ >>>>> return { >>>>> pandoc.Para(pandoc.Str('test')) >>>>> } >>>>> --]] >>>>> return { >>>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >>>>> elem.headers, elem.rows) >>>>> } >>>>> end >>>>> end >>>>> >>>>> The main problem could actually rather be the construction of the >>>>> table using the function pandoc.Table in the return statement: >>>>> Could not read list: Could not get Block value: expected table, got >>>>> 'nil' (nil) >>>>> >>>>> -- >>>>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/35c35036-590d-48d9-bddb-09e6e71b4982n%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/CADAJKhBTKO4irrpCpy-1NfwQLMWzrV-i3b%3DMYPrwsLjgROOaHg%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 7729 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CADAJKhBTKO4irrpCpy-1NfwQLMWzrV-i3b=MYPrwsLjgROOaHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <CADAJKhBTKO4irrpCpy-1NfwQLMWzrV-i3b=MYPrwsLjgROOaHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2021-01-16 17:05 ` Albert Krewinkel [not found] ` <87czy43j9c.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Albert Krewinkel @ 2021-01-16 17:05 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw I didn't test it, but I believe this should prevent the error: elem.caption = {long = {}} I feel like BPJ's version is morally correct, so I'll create a PR that would allow it. BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > It does? I'm away from my work computer ATM so I can't test. Have you tried > to just return elem without wrapping it in a table? (Not that it should > make any difference.) Also try to explicitly return nil as a fallback at > the bottom of the function, although I'm not sure that should make any > difference either. > > -- > Better --help|less than helpless > > Den lör 16 jan. 2021 10:24Stephan Boltzmann <stephan2boltzmann@gmail.com> > skrev: > >> Thanks again for your answer. >> I'm not sure whether I understood everything correctly. >> >> if FORMAT:match 'latex' then >> function Table (elem) >> elem.caption = {} >> return {elem} >> end >> end >> >> Gives me an error message. >> >> BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: >> >>> You can just return the original table having replaced the caption with >>> an empty list in place. >>> >>> >>> -- >>> Better --help|less than helpless >>> Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> skrev: >>> >>>> Thanks a lot for your hint. >>>> >>>> Then I would still have to fix the return statement. >>>> >>>> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: >>>> >>>>> I think you should use `elem.caption = {}` >>>>> >>>>> -- >>>>> Better --help|less than helpless >>>>> >>>>> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>>>> skrev: >>>>> >>>>>> Hello everybody out there using Pandoc, >>>>>> >>>>>> I would like to remove the caption from tables in PDF output and tried >>>>>> a couple of things without success: >>>>>> >>>>>> if FORMAT:match 'latex' then >>>>>> function Table (elem) >>>>>> --caption = elem.caption >>>>>> caption = elem.c[2] -- caption seems to be second element >>>>>> print(pandoc.utils.stringify(caption)) >>>>>> --elem.c[2] = nil >>>>>> --elem.c[2] = pandoc.Str('Test') >>>>>> --elem.caption = nil >>>>>> --elem = nil >>>>>> --return {pandoc.Table(elem.c)} >>>>>> --return {elem} >>>>>> --elem:remove(2) >>>>>> --table.remove(elem.c,2) >>>>>> --[[ >>>>>> return { >>>>>> pandoc.Para(pandoc.Str('test')) >>>>>> } >>>>>> --]] >>>>>> return { >>>>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, >>>>>> elem.headers, elem.rows) >>>>>> } >>>>>> end >>>>>> end >>>>>> >>>>>> The main problem could actually rather be the construction of the >>>>>> table using the function pandoc.Table in the return statement: >>>>>> Could not read list: Could not get Block value: expected table, got >>>>>> 'nil' (nil) >>>>>> >>>>>> -- >>>>>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 -- 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/87czy43j9c.fsf%40zeitkraut.de. ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <87czy43j9c.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>]
* Re: Lua filter to remove captions from tables [not found] ` <87czy43j9c.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> @ 2021-01-16 17:46 ` Stephan Boltzmann 2021-01-17 9:57 ` BPJ 1 sibling, 0 replies; 9+ messages in thread From: Stephan Boltzmann @ 2021-01-16 17:46 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5929 bytes --] Thanks again for your answers - I would have never come up with Albert's solution. With this addition, the filter is working fine. (I should have specified the error message for completeness: Error running filter remove_tables.lua: Could not read list: Could not get Block value: expected table, got 'nil' (nil)) Albert Krewinkel schrieb am Samstag, 16. Januar 2021 um 18:05:13 UTC+1: > I didn't test it, but I believe this should prevent the error: > > elem.caption = {long = {}} > > I feel like BPJ's version is morally correct, so I'll create a PR that > would allow it. > > > BPJ <mel...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > It does? I'm away from my work computer ATM so I can't test. Have you > tried > > to just return elem without wrapping it in a table? (Not that it should > > make any difference.) Also try to explicitly return nil as a fallback at > > the bottom of the function, although I'm not sure that should make any > > difference either. > > > > -- > > Better --help|less than helpless > > > > Den lör 16 jan. 2021 10:24Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > skrev: > > > >> Thanks again for your answer. > >> I'm not sure whether I understood everything correctly. > >> > >> if FORMAT:match 'latex' then > >> function Table (elem) > >> elem.caption = {} > >> return {elem} > >> end > >> end > >> > >> Gives me an error message. > >> > >> BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: > >> > >>> You can just return the original table having replaced the caption with > >>> an empty list in place. > >>> > >>> > >>> -- > >>> Better --help|less than helpless > >>> Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>> skrev: > >>> > >>>> Thanks a lot for your hint. > >>>> > >>>> Then I would still have to fix the return statement. > >>>> > >>>> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: > >>>> > >>>>> I think you should use `elem.caption = {}` > >>>>> > >>>>> -- > >>>>> Better --help|less than helpless > >>>>> > >>>>> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>>>> skrev: > >>>>> > >>>>>> Hello everybody out there using Pandoc, > >>>>>> > >>>>>> I would like to remove the caption from tables in PDF output and > tried > >>>>>> a couple of things without success: > >>>>>> > >>>>>> if FORMAT:match 'latex' then > >>>>>> function Table (elem) > >>>>>> --caption = elem.caption > >>>>>> caption = elem.c[2] -- caption seems to be second element > >>>>>> print(pandoc.utils.stringify(caption)) > >>>>>> --elem.c[2] = nil > >>>>>> --elem.c[2] = pandoc.Str('Test') > >>>>>> --elem.caption = nil > >>>>>> --elem = nil > >>>>>> --return {pandoc.Table(elem.c)} > >>>>>> --return {elem} > >>>>>> --elem:remove(2) > >>>>>> --table.remove(elem.c,2) > >>>>>> --[[ > >>>>>> return { > >>>>>> pandoc.Para(pandoc.Str('test')) > >>>>>> } > >>>>>> --]] > >>>>>> return { > >>>>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, > >>>>>> elem.headers, elem.rows) > >>>>>> } > >>>>>> end > >>>>>> end > >>>>>> > >>>>>> The main problem could actually rather be the construction of the > >>>>>> table using the function pandoc.Table in the return statement: > >>>>>> Could not read list: Could not get Block value: expected table, got > >>>>>> 'nil' (nil) > >>>>>> > >>>>>> -- > >>>>>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com > >>>>>> < > https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com > >>>> < > https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com > >> < > https://groups.google.com/d/msgid/pandoc-discuss/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com?utm_medium=email&utm_source=footer > > > >> . > >> > > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > -- 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/f2bdf584-39fd-45da-87b0-e57f8bbea8f6n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 11345 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Lua filter to remove captions from tables [not found] ` <87czy43j9c.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-01-16 17:46 ` Stephan Boltzmann @ 2021-01-17 9:57 ` BPJ 1 sibling, 0 replies; 9+ messages in thread From: BPJ @ 2021-01-17 9:57 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 6821 bytes --] In fact I feel like removing something, like the captions(s) of a table or the identifier, classes or attributes of an element with Attr by assigning nil to it should also work, although that may be more complicated since the code would need to check, perhaps in multiple places, if some fields are nil and insert some default value if they are. If this is purely on the Lua side I might take a stab at implementing it if nobody minds. Also perhaps the `caption` field of "complex" Table should be renamed to `captions` to indicate that it contains both a short and a long version of the caption and isn't (just) a list? -- Better --help|less than helpless Den lör 16 jan. 2021 18:05Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> skrev: > I didn't test it, but I believe this should prevent the error: > > elem.caption = {long = {}} > > I feel like BPJ's version is morally correct, so I'll create a PR that > would allow it. > > > BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > It does? I'm away from my work computer ATM so I can't test. Have you > tried > > to just return elem without wrapping it in a table? (Not that it should > > make any difference.) Also try to explicitly return nil as a fallback at > > the bottom of the function, although I'm not sure that should make any > > difference either. > > > > -- > > Better --help|less than helpless > > > > Den lör 16 jan. 2021 10:24Stephan Boltzmann <stephan2boltzmann@gmail.com > > > > skrev: > > > >> Thanks again for your answer. > >> I'm not sure whether I understood everything correctly. > >> > >> if FORMAT:match 'latex' then > >> function Table (elem) > >> elem.caption = {} > >> return {elem} > >> end > >> end > >> > >> Gives me an error message. > >> > >> BPJ schrieb am Donnerstag, 14. Januar 2021 um 23:00:07 UTC+1: > >> > >>> You can just return the original table having replaced the caption with > >>> an empty list in place. > >>> > >>> > >>> -- > >>> Better --help|less than helpless > >>> Den tors 14 jan. 2021 13:29Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>> skrev: > >>> > >>>> Thanks a lot for your hint. > >>>> > >>>> Then I would still have to fix the return statement. > >>>> > >>>> BP schrieb am Donnerstag, 14. Januar 2021 um 11:43:32 UTC+1: > >>>> > >>>>> I think you should use `elem.caption = {}` > >>>>> > >>>>> -- > >>>>> Better --help|less than helpless > >>>>> > >>>>> Den tors 14 jan. 2021 10:41Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>>>> skrev: > >>>>> > >>>>>> Hello everybody out there using Pandoc, > >>>>>> > >>>>>> I would like to remove the caption from tables in PDF output and > tried > >>>>>> a couple of things without success: > >>>>>> > >>>>>> if FORMAT:match 'latex' then > >>>>>> function Table (elem) > >>>>>> --caption = elem.caption > >>>>>> caption = elem.c[2] -- caption seems to be second element > >>>>>> print(pandoc.utils.stringify(caption)) > >>>>>> --elem.c[2] = nil > >>>>>> --elem.c[2] = pandoc.Str('Test') > >>>>>> --elem.caption = nil > >>>>>> --elem = nil > >>>>>> --return {pandoc.Table(elem.c)} > >>>>>> --return {elem} > >>>>>> --elem:remove(2) > >>>>>> --table.remove(elem.c,2) > >>>>>> --[[ > >>>>>> return { > >>>>>> pandoc.Para(pandoc.Str('test')) > >>>>>> } > >>>>>> --]] > >>>>>> return { > >>>>>> --pandoc.Table(elem.caption, elem.aligns, elem.widths, > >>>>>> elem.headers, elem.rows) > >>>>>> } > >>>>>> end > >>>>>> end > >>>>>> > >>>>>> The main problem could actually rather be the construction of the > >>>>>> table using the function pandoc.Table in the return statement: > >>>>>> Could not read list: Could not get Block value: expected table, got > >>>>>> 'nil' (nil) > >>>>>> > >>>>>> -- > >>>>>> 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/82e61683-5190-45c6-8420-60243cf1bee3n%40googlegroups.com > >>>>>> < > https://groups.google.com/d/msgid/pandoc-discuss/82e61683-5190-45c6-8420-60243cf1bee3n%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/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%40googlegroups.com > >>>> < > https://groups.google.com/d/msgid/pandoc-discuss/7e2c1a91-6cb1-4344-aab5-8577f1b82905n%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/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com > >> < > https://groups.google.com/d/msgid/pandoc-discuss/35c35036-590d-48d9-bddb-09e6e71b4982n%40googlegroups.com?utm_medium=email&utm_source=footer > > > >> . > >> > > > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > > -- > 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/87czy43j9c.fsf%40zeitkraut.de > . > -- 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/CADAJKhAXsQdQSmA0d%3DfMV2FxAr9WY%3DWuZQmhLCrx%3Dweaigm1fg%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 11325 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-01-17 9:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-14 9:40 Lua filter to remove captions from tables Stephan Boltzmann [not found] ` <82e61683-5190-45c6-8420-60243cf1bee3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-01-14 10:43 ` BPJ [not found] ` <CADAJKhAuKkpGQZfv0ptudJcH6U1iL+_tkd9Ubm6jGw8ky3_L8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2021-01-14 12:28 ` Stephan Boltzmann [not found] ` <7e2c1a91-6cb1-4344-aab5-8577f1b82905n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-01-14 21:59 ` BPJ [not found] ` <CADAJKhBczM9Li+FG_6rWrPnSOCG0Bo6rrPdRFc5poZpNrx8jVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2021-01-16 9:23 ` Stephan Boltzmann [not found] ` <35c35036-590d-48d9-bddb-09e6e71b4982n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-01-16 9:31 ` BPJ [not found] ` <CADAJKhBTKO4irrpCpy-1NfwQLMWzrV-i3b=MYPrwsLjgROOaHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2021-01-16 17:05 ` Albert Krewinkel [not found] ` <87czy43j9c.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-01-16 17:46 ` Stephan Boltzmann 2021-01-17 9:57 ` BPJ
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).