mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-07 21:15:19 +03:00
Shake.hs, tools/pandoc-demote-headers: switch to lua script filter
This commit is contained in:
parent
a4d30512bd
commit
33e08a7d86
8
Shake.hs
8
Shake.hs
@ -82,8 +82,8 @@ main = do
|
||||
-- <$> S.getDirectoryContents "tools"
|
||||
let pandocFilters =
|
||||
[
|
||||
"tools" </> "pandoc-demote-headers"
|
||||
,"tools" </> "pandoc-drop-html-blocks"
|
||||
--- "tools" </> "pandoc-demote-headers"
|
||||
"tools" </> "pandoc-drop-html-blocks"
|
||||
,"tools" </> "pandoc-drop-html-inlines"
|
||||
,"tools" </> "pandoc-drop-links"
|
||||
,"tools" </> "pandoc-drop-notes"
|
||||
@ -273,7 +273,7 @@ main = do
|
||||
cmd Shell
|
||||
"m4 -P -DMAN -DWEB -I" dir lib src "|"
|
||||
pandoc "-f markdown -t markdown-fenced_divs --atx-headers"
|
||||
"--filter tools/pandoc-demote-headers"
|
||||
"--lua-filter tools/pandoc-demote-headers.lua"
|
||||
-- "--filter tools/pandoc-add-toc"
|
||||
-- "--filter tools/pandoc-drop-man-blocks"
|
||||
">>" out
|
||||
@ -290,7 +290,7 @@ main = do
|
||||
-- "--filter tools/pandoc-drop-man-blocks"
|
||||
"--filter tools/pandoc-drop-toc"
|
||||
-- "--filter tools/pandoc-capitalize-headers"
|
||||
"--filter tools/pandoc-demote-headers"
|
||||
"--lua-filter tools/pandoc-demote-headers.lua"
|
||||
">>" webmanall :: Action ExitCode
|
||||
|
||||
-- adjust and combine recipe mds for single-page web output, using pandoc
|
||||
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env stack
|
||||
{- stack runghc --verbosity info --package pandoc-types -}
|
||||
|
||||
import Text.Pandoc.JSON
|
||||
import Text.Pandoc.Walk
|
||||
import Data.Char (toUpper)
|
||||
|
||||
main :: IO ()
|
||||
main = toJSONFilter demoteHeaders
|
||||
|
||||
demoteHeaders :: Block -> Block
|
||||
demoteHeaders (Header l attr xs) = Header (l+1) attr xs
|
||||
demoteHeaders x = x
|
||||
|
3
tools/pandoc-demote-headers.lua
Normal file
3
tools/pandoc-demote-headers.lua
Normal file
@ -0,0 +1,3 @@
|
||||
function Header(h)
|
||||
return pandoc.Header(h.level + 1, h.content, h.attrs)
|
||||
end
|
Loading…
Reference in New Issue
Block a user