ANN: jog – a Lua utility library to "take an energetic trot along the pandoc AST" #10159
tarleb
started this conversation in
Show and tell
Replies: 3 comments 6 replies
-
The ability to look at context would definitely have simplified some of the filters I've written. I will definitely consider jog the next time I have another problem like that to solve. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I should add that I'm looking for ways to integrate this (or somthing similar) into pandoc's Lua engine at some point, but that might take quite a while. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Do you have (even informal) benchmarks to show the performance improvement? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm happy to announce the first release of jog, a pure Lua library that provides functionality similar to pandoc's
:walk
method, but with different properties and features.Where pandoc's
:walk
leverages lazy marshaling and a functional programming style,jog
embraces mutability and strict traversal of elements. Both methods have their advantages, depending on the task at hand, and jog aims to fill the niche for whenwalk
is less suitable.Jog's primary use-case are repeated traversals of the same document object with different filters, especially when many nodes must be inspected and "filtered". Repeated lazy marshaling and evaluation can make built-in traversals comparatively slow, and
jog
allows to avoid much of that overhead in such cases.Additionally, users used to libraries such as panflute often find the lack of element contexts confusing, as finding the parent node of an AST object is not always straight-forward. With
jog
it's possible to enablecontext = true
in filters, which then gives access to the list of parent nodes via a second filter function argument:The library should be considered experimental for now. Feedback is most welcome, as usual.
Beta Was this translation helpful? Give feedback.
All reactions