From 9fce418b46c9f0894f429384ef9e3dabaeffbeb4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Apr 2015 16:36:17 -0700 Subject: Change file hierarchy and rewrite makefile - File hierarchy is now as follows: - / - appendix/ < appendix source files - backlinks/ < backlink sources & builds - hapax/ < *.hapax source files - scripts/ < scripts, like *.js, *.hs, etc. - templates/ < templates for outputs - text/ < source files - trunk/ < assets, like css, images, heads, etc. - index.html - *.html - Makefile --- scripts/versify.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/versify.hs (limited to 'scripts/versify.hs') diff --git a/scripts/versify.hs b/scripts/versify.hs new file mode 100644 index 0000000..48e9c00 --- /dev/null +++ b/scripts/versify.hs @@ -0,0 +1,15 @@ +import Text.Pandoc.JSON +import Data.List.Split + +main :: IO () +main = toJSONFilter transformVerseParas + +transformVerseParas :: Block -> Block +transformVerseParas (Para xs) + | LineBreak `elem` xs = Para (addLineSpans xs) + | otherwise = Para xs +transformVerseParas x = x + +addLineSpans :: [Inline] -> [Inline] +addLineSpans = map encloseInSpan . splitWhen (== LineBreak) + where encloseInSpan = Span ("", ["line"], []) -- cgit 1.4.1-21-gabe81