From 643d9ceb308c206a6e572c7c555168ff0ca60bc1 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 27 Mar 2015 15:40:42 -0700 Subject: Fix #5: Verse typesetting Thanks to the pandoc-discussion thread at , line breaks in verse have been converted to s, which enables the CSS to style them with hanging indents, given a too-small viewport. This commit also includes a makefile edit to reflect this change, and the Haskell source and executable of the pandoc filter. --- trunk/versify.exe | Bin 0 -> 13686106 bytes trunk/versify.hi | Bin 0 -> 2421 bytes trunk/versify.hs | 15 +++++++++++++++ trunk/versify.o | Bin 0 -> 5209 bytes 4 files changed, 15 insertions(+) create mode 100644 trunk/versify.exe create mode 100644 trunk/versify.hi create mode 100644 trunk/versify.hs create mode 100644 trunk/versify.o (limited to 'trunk') diff --git a/trunk/versify.exe b/trunk/versify.exe new file mode 100644 index 0000000..59850a2 Binary files /dev/null and b/trunk/versify.exe differ diff --git a/trunk/versify.hi b/trunk/versify.hi new file mode 100644 index 0000000..43853bd Binary files /dev/null and b/trunk/versify.hi differ diff --git a/trunk/versify.hs b/trunk/versify.hs new file mode 100644 index 0000000..def041c --- /dev/null +++ b/trunk/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"], []) diff --git a/trunk/versify.o b/trunk/versify.o new file mode 100644 index 0000000..4fb1421 Binary files /dev/null and b/trunk/versify.o differ -- cgit 1.4.1-21-gabe81