diff options
author | Case Duckworth | 2015-03-27 15:40:42 -0700 |
---|---|---|
committer | Case Duckworth | 2015-03-27 15:40:42 -0700 |
commit | 643d9ceb308c206a6e572c7c555168ff0ca60bc1 (patch) | |
tree | 8878d45b3dcc5c894a21d4e379be0f7293c5d345 /trunk | |
parent | Change verse lines '$' -> '^| ' (diff) | |
download | autocento-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.exe | bin | 0 -> 13686106 bytes | |||
-rw-r--r-- | trunk/versify.hi | bin | 0 -> 2421 bytes | |||
-rw-r--r-- | trunk/versify.hs | 15 | ||||
-rw-r--r-- | trunk/versify.o | bin | 0 -> 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 @@ | |||
1 | import Text.Pandoc.JSON | ||
2 | import Data.List.Split | ||
3 | |||
4 | main :: IO () | ||
5 | main = toJSONFilter transformVerseParas | ||
6 | |||
7 | transformVerseParas :: Block -> Block | ||
8 | transformVerseParas (Para xs) | ||
9 | | LineBreak `elem` xs = Para (addLineSpans xs) | ||
10 | | otherwise = Para xs | ||
11 | transformVerseParas x = x | ||
12 | |||
13 | addLineSpans :: [Inline] -> [Inline] | ||
14 | addLineSpans = 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 | |||