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@googlegroups.com.
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-/JYPxA39Uh5TLH3MbocFFw@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.