about summary refs log tree commit diff stats
path: root/trunk
diff options
context:
space:
mode:
authorCase Duckworth2015-03-27 15:40:42 -0700
committerCase Duckworth2015-03-27 15:40:42 -0700
commit643d9ceb308c206a6e572c7c555168ff0ca60bc1 (patch)
tree8878d45b3dcc5c894a21d4e379be0f7293c5d345 /trunk
parentChange verse lines '$' -> '^| ' (diff)
downloadautocento-643d9ceb308c206a6e572c7c555168ff0ca60bc1.tar.gz
autocento-643d9ceb308c206a6e572c7c555168ff0ca60bc1.zip
Fix #5: Verse typesetting
Thanks to the pandoc-discussion thread at
<https://groups.google.com/forum/#!topic/pandoc-discuss/_JnTJnsSK3k>,
line breaks in verse have been converted to <span class="line">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.
Diffstat (limited to 'trunk')
-rw-r--r--trunk/versify.exebin0 -> 13686106 bytes
-rw-r--r--trunk/versify.hibin0 -> 2421 bytes
-rw-r--r--trunk/versify.hs15
-rw-r--r--trunk/versify.obin0 -> 5209 bytes
4 files changed, 15 insertions, 0 deletions
diff --git a/trunk/versify.exe b/trunk/versify.exe new file mode 100644 index 0000000..59850a2 --- /dev/null +++ b/trunk/versify.exe
Binary files differ
diff --git a/trunk/versify.hi b/trunk/versify.hi new file mode 100644 index 0000000..43853bd --- /dev/null +++ b/trunk/versify.hi
Binary files 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 @@
1import Text.Pandoc.JSON
2import Data.List.Split
3
4main :: IO ()
5main = toJSONFilter transformVerseParas
6
7transformVerseParas :: Block -> Block
8transformVerseParas (Para xs)
9 | LineBreak `elem` xs = Para (addLineSpans xs)
10 | otherwise = Para xs
11transformVerseParas x = x
12
13addLineSpans :: [Inline] -> [Inline]
14addLineSpans = map encloseInSpan . splitWhen (== LineBreak)
15 where encloseInSpan = Span("", ["line"], [])
diff --git a/trunk/versify.o b/trunk/versify.o new file mode 100644 index 0000000..4fb1421 --- /dev/null +++ b/trunk/versify.o
Binary files differ