From 79e46bb0fb6810b6a7220cc5e67f4fde71e0c027 Mon Sep 17 00:00:00 2001 From: Everett Hildenbrandt Date: Sat, 21 Apr 2018 16:17:00 -0600 Subject: [PATCH] Shake.hs, tools/pandoc-drop-html-inlines: switch to lua script filter --- Shake.hs | 8 ++++---- tools/pandoc-drop-html-inlines.hs | 12 ------------ tools/pandoc-drop-html-inlines.lua | 6 ++++++ 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100755 tools/pandoc-drop-html-inlines.hs create mode 100644 tools/pandoc-drop-html-inlines.lua diff --git a/Shake.hs b/Shake.hs index 191d2de8e..d3ee18177 100755 --- a/Shake.hs +++ b/Shake.hs @@ -84,8 +84,8 @@ main = do [ --- "tools" "pandoc-demote-headers" --- "tools" "pandoc-drop-html-blocks" - "tools" "pandoc-drop-html-inlines" - ,"tools" "pandoc-drop-links" + --- "tools" "pandoc-drop-html-inlines" + "tools" "pandoc-drop-links" ,"tools" "pandoc-drop-notes" ,"tools" "pandoc-drop-toc" ] @@ -205,7 +205,7 @@ main = do pandoc "-f markdown -s --template" tmpl -- "--filter tools/pandoc-drop-web-blocks" "--lua-filter tools/pandoc-drop-html-blocks.lua" - "--filter tools/pandoc-drop-html-inlines" + "--lua-filter tools/pandoc-drop-html-inlines.lua" "--filter tools/pandoc-drop-links" "--filter tools/pandoc-drop-notes" "-o" out @@ -233,7 +233,7 @@ main = do pandoc "-f markdown" -- "--filter tools/pandoc-drop-web-blocks" "--lua-filter tools/pandoc-drop-html-blocks.lua" - "--filter tools/pandoc-drop-html-inlines" + "--lua-filter tools/pandoc-drop-html-inlines.lua" "--filter tools/pandoc-drop-links" "--filter tools/pandoc-drop-notes" "-t texinfo |" diff --git a/tools/pandoc-drop-html-inlines.hs b/tools/pandoc-drop-html-inlines.hs deleted file mode 100755 index 90e7cfaa1..000000000 --- a/tools/pandoc-drop-html-inlines.hs +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env stack -{- stack runghc --verbosity info --package pandoc-types -} - -import Text.Pandoc.JSON - -main :: IO () -main = toJSONFilter dropHtmlInlines - -dropHtmlInlines :: Inline -> Inline -dropHtmlInlines (RawInline (Format "html") _) = Str "" -dropHtmlInlines x = x - diff --git a/tools/pandoc-drop-html-inlines.lua b/tools/pandoc-drop-html-inlines.lua new file mode 100644 index 000000000..595c917ed --- /dev/null +++ b/tools/pandoc-drop-html-inlines.lua @@ -0,0 +1,6 @@ +function RawInline(ri) + if ri.format == "html" + then return pandoc.Str("") + else return ri + end +end