public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Lua list traversal (was: ANN: pandoc 2.9.2)
Date: Mon, 17 Feb 2020 13:31:18 +0100	[thread overview]
Message-ID: <CADAJKhAM_TCUom3Ycutpp=Mr93rCcnMiSpFUzYr_6B8X-TA--A@mail.gmail.com> (raw)
In-Reply-To: <m2mu9ir0yz.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>

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

The Lua list traversing feature is very convenient, but it would be even
more convenient if filter functions were passed the parent and closest
siblings of the current element as extra arguments:

``````lua
function Space (elem, parent, prev, next)
  return 'Cite' == next.t and {} or elem
end
``````

With each of arguments #2–4 being nils if the current element doesn't have
one of those relatives, i.e. Pandoc element, first/last element in a list.

I have no idea how hard this would be to implement or how much overhead it
would add, but arguably it would make most use cases where you want to know
relatives of an element easy to handle. That's not to say that getting the
whole list of elements can't be useful, and it would be convenient if that
function too were passed the element containing the list and its nearest
siblings, and perhaps even its parent.






Den sön 16 feb. 2020 16:45John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev:

>
> I'm pleased to announce the release of pandoc 2.9.2,
> available in the usual places:
>
> Binary packages & changelog:
>   https://github.com/jgm/pandoc/releases/tag/2.9.2
> Source & API documentation:
>   http://hackage.haskell.org/package/pandoc-2.9.2
>
> Some highlights:
>
> * csv is now an input format. You can use pandoc to convert
>   CSV data into a simple table in any target format pandoc
>   supports.
>
> * Instead of a single jats output format, we now have
>   jats_archiving, jats_publishing, and jats_articleauthoring
>   for different tag sets.  The old jats defaults to
>   jats_archiving.
>
> * It is now much easier to create Lua filters that filter element
>   lists (e.g., removing spaces before citations).
>
> * 'bibliography' and 'csl' fields may now be used in defaults files.
>
> * Fixed some regressions from 2.7.x, including duplicate class names
>   and attributes, spurious dots in markdown_mmd metadata output,
>   columns in beamer slides, tight lists in docx output, and a change in the
>   behavior of reveal.js when there are more than two levels of nesting.
>
> * Lots of bug fixes and minor improvements.
>
> API changes:
>
> * Added Text.Pandoc.Readers.CSV, exporting readCSV.
>
> * Added new functions writeJatsArchiving, writeJatsPublishing,
>   and writeJatsArticleAuthoring in Text.Pandoc.Writers.JATS.
>
> * Export html5Attributes, html4Attributes, rdfaAttributes from
>   Text.Pandoc.XML.
>
> * Add FilterCompleted and RunningFilter constructors to Log
>   Message in Text.Pandoc.Logging.
>
> Thanks to everyone who contributed, and especially Albert Krewinkel
> and new contributors Joseph C. Sible and Ethan Riley.
>
> --
> 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/m2mu9ir0yz.fsf%40johnmacfarlane.net
> .
>

-- 
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/CADAJKhAM_TCUom3Ycutpp%3DMr93rCcnMiSpFUzYr_6B8X-TA--A%40mail.gmail.com.

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

      parent reply	other threads:[~2020-02-17 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16 15:44 ANN: pandoc 2.9.2 John MacFarlane
     [not found] ` <m2mu9ir0yz.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-02-17  9:52   ` Priv.-Doz. Dr. Maria Shinoto
2020-02-17 12:31   ` BPJ [this message]

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='CADAJKhAM_TCUom3Ycutpp=Mr93rCcnMiSpFUzYr_6B8X-TA--A@mail.gmail.com' \
    --to=bpj-j3h7gcxpsitlodktgw+v6w@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).