All, Here's a shameless plug to let everyone know that these pandoc-aware logging functions are now available at https://github.com/wlupton/pandoc-lua-logging and will soon be referenced from https://pandoc.org/lua-filters.html#debugging-lua-filters. Things have moved on a bit since I sent the message below. Please do take a look; I hope that people will find them useful. All feedback is welcome. Thanks, William PS, These functions work with (at least) pandoc 2.16.1 and 2.18. On Thu, 23 Jun 2022 at 13:25, William Lupton wrote: > I've created https://github.com/jgm/pandoc/issues/8146 to continue this > discussion. > > On Tue, 7 Jun 2022 at 16:24, William Lupton > wrote: > >> All, >> >> I've split this out into two functions (each currently in its own >> [attached as .lua.txt] file): >> >> - dump(value, maxlen=70) that returns a possibly multi-line string >> representation of a value >> - output(...) that's a utility function that outputs space-separated >> arguments, each passed to dump() and with a terminating newline if needed >> >> Here's an updated example filter (it uses output() and doesn't call >> dump() directly): >> >> local output = require 'output' >> function Pandoc(doc) >> output('meta', doc.meta) >> output('blocks', doc.blocks) >> end >> >> Please feel free to do whatever you like with these functions. >> >> In my environment I have an additional layer in which I derive a >> log-level from PANDOC_STATE.{trace,verbosity} and use this in a set of >> logging functions like this one (*please let me know if you'd like me to >> supply these too*): >> >> function error(...) >> if logLevel >= -1 then >> output('(E)', ...) >> end >> end >> >> Cheers, >> William >> >> On Tue, 7 Jun 2022 at 15:13, William Lupton >> wrote: >> >>> I'll need to extract the reporting functions. I'll do that soon, and >>> post the result. This is currently working in pandoc 2.16.1 (and earlier). >>> I haven't yet bitten the bullet of the move to 2.18. >>> >>> On Tue, 7 Jun 2022 at 14:55, John MacFarlane wrote: >>> >>>> >>>> That looks nice. Can you share your utils.lua? >>>> >>>> William Lupton writes: >>>> >>>> > I think I've mentioned this before... but I'd be happy to contribute >>>> (in a >>>> > suitable form) the somewhat-pandoc-aware utility that I use for this. >>>> > >>>> > Given this input: >>>> > >>>> > *% *cat doc.md >>>> > >>>> > --- >>>> > >>>> > a: 1 >>>> > >>>> > b: | >>>> > >>>> > 2 3 4 >>>> > >>>> > --- >>>> > >>>> > >>>> > # Header >>>> > >>>> > >>>> > This is a sentence (and a paragraph). >>>> > >>>> > >>>> > * This is a list item >>>> > >>>> > * And another >>>> > >>>> > >>>> > | Right | Left | Default | Center | >>>> > >>>> > |------:|:-----|---------|:------:| >>>> > >>>> > | 12 | 12 | 12 | 12 | >>>> > >>>> > | 123 | 123 | 123 | 123 | >>>> > >>>> > | 1 | 1 | 1 | 1 | >>>> > >>>> > >>>> > : Demonstration of pipe table syntax. >>>> > >>>> > and this filter: >>>> > >>>> > *% *cat rep.lua >>>> > >>>> > local utils = require 'utils' >>>> > >>>> > >>>> > -- do it this way to avoid reporting MetaBlocks twice >>>> > >>>> > function Pandoc(doc) >>>> > >>>> > utils.temp('meta', doc.meta) >>>> > >>>> > utils.temp('blocks', doc.blocks) >>>> > >>>> > end >>>> > >>>> > this command: >>>> > >>>> > pandoc doc.md -L rep.lua >/dev/null 2>doc.txt >>>> > >>>> > generates the attached. >>>> > >>>> > On Tue, 7 Jun 2022 at 08:57, wrote: >>>> > >>>> >> Hi, >>>> >> >>>> >> When playing around with filters I use pprint.lua or inspect.lua to >>>> >> visualize lua tables. Would it make sense to include some sort of >>>> «print >>>> >> the contents of this table» to pandoc ? >>>> >> >>>> >> Best, >>>> >> >>>> >> Denis >>>> >> >>>> >> -- >>>> >>> -- 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/CAEe_xxhWAxdJJ5LYj0QXoLTfUSpREBqDwxiUfPFoMB8GQNrdJA%40mail.gmail.com.