diff options
Diffstat (limited to 'test/lua/inlines-filter.lua')
-rw-r--r-- | test/lua/inlines-filter.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lua/inlines-filter.lua b/test/lua/inlines-filter.lua new file mode 100644 index 000000000..69608bd77 --- /dev/null +++ b/test/lua/inlines-filter.lua @@ -0,0 +1,19 @@ +function isWorldAfterSpace (fst, snd) + return fst and fst.t == 'LineBreak' + and snd and snd.t == 'Str' and snd.text == 'World!' +end + +function Inlines (inlns) + -- verify that this looks like a `pandoc.List` + if not inlns.find or not inlns.map or not inlns.filter then + error("table doesn't seem to be an instance of pandoc.List") + end + + -- Remove spaces before string "World" + for i = #inlns-1,1,-1 do + if isWorldAfterSpace(inlns[i], inlns[i+1]) then + inlns[i] = pandoc.Space() + end + end + return inlns +end |