about summary refs log tree commit diff stats
path: root/scripts/versify.hs
diff options
context:
space:
mode:
authorCase Duckworth2015-04-14 16:36:17 -0700
committerCase Duckworth2015-04-14 16:36:17 -0700
commit9fce418b46c9f0894f429384ef9e3dabaeffbeb4 (patch)
treeb2339220ee50cf48b8887f0cc1fed4813a95901b /scripts/versify.hs
parentAdd toc metadata (diff)
downloadautocento-9fce418b46c9f0894f429384ef9e3dabaeffbeb4.tar.gz
autocento-9fce418b46c9f0894f429384ef9e3dabaeffbeb4.zip
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
Diffstat (limited to 'scripts/versify.hs')
-rw-r--r--scripts/versify.hs15
1 files changed, 15 insertions, 0 deletions
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 @@
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"], [])