public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
To: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
Cc: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Printing lua tables
Date: Tue, 7 Jun 2022 15:13:57 +0100	[thread overview]
Message-ID: <CAEe_xxiVFhQ8PqSq_37yhMm-8-Pnb2ZgY4eDkO7kdCZQt6bNkA@mail.gmail.com> (raw)
In-Reply-To: <m2y1y8fuij.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 14611 bytes --]

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 <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> That looks nice.  Can you share your utils.lua?
>
> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> 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, <denis.maier-NSENcxR/0n0@public.gmane.org> 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/551a3f2a8d364717bcc569baa974573a%40unibe.ch
> >> <
> https://groups.google.com/d/msgid/pandoc-discuss/551a3f2a8d364717bcc569baa974573a%40unibe.ch?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/CAEe_xxiL81rUdVtCeKovjYeo%3DKaKP1GAbwEiM6_9byZY8t_XvA%40mail.gmail.com
> .
> > (#) meta {
> >   a: MetaInlines {
> >     [1] Str text: "1"
> >   }
> >   b: MetaBlocks {
> >     [1] content: Para {
> >       [1] Str text: "2"
> >       [2] Space {}
> >       [3] Str text: "3"
> >       [4] Space {}
> >       [5] Str text: "4"
> >     }
> >   }
> > }
> > (#) blocks {
> >   [1] Header {
> >     attr: Attr {
> >       attributes: {}
> >       classes: {}
> >       identifier: "header"
> >     }
> >     content: {
> >       [1] Str text: "Header"
> >     }
> >     level: 1
> >   }
> >   [2] content: Para {
> >     [1] Str text: "This"
> >     [2] Space {}
> >     [3] Str text: "is"
> >     [4] Space {}
> >     [5] Str text: "a"
> >     [6] Space {}
> >     [7] Str text: "sentence"
> >     [8] Space {}
> >     [9] Str text: "(and"
> >     [10] Space {}
> >     [11] Str text: "a"
> >     [12] Space {}
> >     [13] Str text: "paragraph)."
> >   }
> >   [3] content: BulletList {
> >     [1] {
> >       [1] content: Plain {
> >         [1] Str text: "This"
> >         [2] Space {}
> >         [3] Str text: "is"
> >         [4] Space {}
> >         [5] Str text: "a"
> >         [6] Space {}
> >         [7] Str text: "list"
> >         [8] Space {}
> >         [9] Str text: "item"
> >       }
> >     }
> >     [2] {
> >       [1] content: Plain {
> >         [1] Str text: "And"
> >         [2] Space {}
> >         [3] Str text: "another"
> >       }
> >     }
> >   }
> >   [4] Table {
> >     attr: Attr {
> >       attributes: {}
> >       classes: {}
> >       identifier: ""
> >     }
> >     bodies: {
> >       [1] {
> >         body: {
> >           [1] {
> >             [1] Attr {
> >               attributes: {}
> >               classes: {}
> >               identifier: ""
> >             }
> >             [2] {
> >               [1] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "12"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [2] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "12"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [3] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "12"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [4] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "12"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >             }
> >           }
> >           [2] {
> >             [1] Attr {
> >               attributes: {}
> >               classes: {}
> >               identifier: ""
> >             }
> >             [2] {
> >               [1] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "123"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [2] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "123"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [3] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "123"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [4] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "123"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >             }
> >           }
> >           [3] {
> >             [1] Attr {
> >               attributes: {}
> >               classes: {}
> >               identifier: ""
> >             }
> >             [2] {
> >               [1] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "1"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [2] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "1"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [3] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "1"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >               [4] {
> >                 col_span: 1
> >                 contents: {
> >                   [1] content: Plain {
> >                     [1] Str text: "1"
> >                   }
> >                 }
> >                 alignment: "AlignDefault"
> >                 row_span: 1
> >                 attr: {
> >                   [1] ""
> >                   [2] {}
> >                   [3] {}
> >                 }
> >               }
> >             }
> >           }
> >         }
> >         row_head_columns: 0
> >         head: {}
> >         attr: {
> >           [1] ""
> >           [2] {}
> >           [3] {}
> >         }
> >       }
> >     }
> >     caption: {
> >       long: {
> >         [1] content: Plain {
> >           [1] Str text: "Demonstration"
> >           [2] Space {}
> >           [3] Str text: "of"
> >           [4] Space {}
> >           [5] Str text: "pipe"
> >           [6] Space {}
> >           [7] Str text: "table"
> >           [8] Space {}
> >           [9] Str text: "syntax."
> >         }
> >       }
> >     }
> >     colspecs: {
> >       [1] {
> >         [1] "AlignRight"
> >       }
> >       [2] {
> >         [1] "AlignLeft"
> >       }
> >       [3] {
> >         [1] "AlignDefault"
> >       }
> >       [4] {
> >         [1] "AlignCenter"
> >       }
> >     }
> >     foot: {
> >       [1] Attr {
> >         attributes: {}
> >         classes: {}
> >         identifier: ""
> >       }
> >       [2] {}
> >     }
> >     head: {
> >       [1] Attr {
> >         attributes: {}
> >         classes: {}
> >         identifier: ""
> >       }
> >       [2] {
> >         [1] {
> >           [1] Attr {
> >             attributes: {}
> >             classes: {}
> >             identifier: ""
> >           }
> >           [2] {
> >             [1] {
> >               col_span: 1
> >               contents: {
> >                 [1] content: Plain {
> >                   [1] Str text: "Right"
> >                 }
> >               }
> >               alignment: "AlignDefault"
> >               row_span: 1
> >               attr: {
> >                 [1] ""
> >                 [2] {}
> >                 [3] {}
> >               }
> >             }
> >             [2] {
> >               col_span: 1
> >               contents: {
> >                 [1] content: Plain {
> >                   [1] Str text: "Left"
> >                 }
> >               }
> >               alignment: "AlignDefault"
> >               row_span: 1
> >               attr: {
> >                 [1] ""
> >                 [2] {}
> >                 [3] {}
> >               }
> >             }
> >             [3] {
> >               col_span: 1
> >               contents: {
> >                 [1] content: Plain {
> >                   [1] Str text: "Default"
> >                 }
> >               }
> >               alignment: "AlignDefault"
> >               row_span: 1
> >               attr: {
> >                 [1] ""
> >                 [2] {}
> >                 [3] {}
> >               }
> >             }
> >             [4] {
> >               col_span: 1
> >               contents: {
> >                 [1] content: Plain {
> >                   [1] Str text: "Center"
> >                 }
> >               }
> >               alignment: "AlignDefault"
> >               row_span: 1
> >               attr: {
> >                 [1] ""
> >                 [2] {}
> >                 [3] {}
> >               }
> >             }
> >           }
> >         }
> >       }
> >     }
> >   }
> > }
>

-- 
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_xxiVFhQ8PqSq_37yhMm-8-Pnb2ZgY4eDkO7kdCZQt6bNkA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 22193 bytes --]

  parent reply	other threads:[~2022-06-07 14:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  7:57 denis.maier-NSENcxR/0n0
     [not found] ` <551a3f2a8d364717bcc569baa974573a-NSENcxR/0n0@public.gmane.org>
2022-06-07 10:44   ` William Lupton
     [not found]     ` <CAEe_xxiL81rUdVtCeKovjYeo=KaKP1GAbwEiM6_9byZY8t_XvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-07 13:55       ` John MacFarlane
     [not found]         ` <m2y1y8fuij.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2022-06-07 14:13           ` William Lupton [this message]
     [not found]             ` <CAEe_xxiVFhQ8PqSq_37yhMm-8-Pnb2ZgY4eDkO7kdCZQt6bNkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-07 15:24               ` William Lupton
     [not found]                 ` <CAEe_xxjopWC0y3Nk-ZrHSWDoAAj71szfHhivi=c42zK_aFpZ4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-23 12:25                   ` William Lupton
     [not found]                     ` <CAEe_xxhcoCqPPYx5Ob-ZT083vTx9wDbnBg+8-cVGnhExLFnXXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-18  8:46                       ` William Lupton

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=CAEe_xxiVFhQ8PqSq_37yhMm-8-Pnb2ZgY4eDkO7kdCZQt6bNkA@mail.gmail.com \
    --to=wlupton-qst+ys/numyeuisrzh9sikb+6bgklq7r@public.gmane.org \
    --cc=jgm-TVLZxgkOlNX2fBVCVOL8/A@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).