diff options
-rwxr-xr-x | build/extract-title.hs | 2 | ||||
-rwxr-xr-x | build/tex-filter.hs | 2 | ||||
-rw-r--r-- | default.html.do | 2 | ||||
-rw-r--r-- | lists/default.md.do | 6 |
4 files changed, 8 insertions, 4 deletions
diff --git a/build/extract-title.hs b/build/extract-title.hs index f3ca1ba..a84442e 100755 --- a/build/extract-title.hs +++ b/build/extract-title.hs | |||
@@ -5,7 +5,7 @@ import Text.Pandoc.JSON | |||
5 | import System.IO | 5 | import System.IO |
6 | 6 | ||
7 | extract_title :: Pandoc -> IO Pandoc | 7 | extract_title :: Pandoc -> IO Pandoc |
8 | extract_title d@(Pandoc m _) = do hPutStrLn stderr $ render Nothing $ cat $ map pretty (docTitle m) | 8 | extract_title d@(Pandoc m _) = do hPutStrLn stderr $ (++) "title: " $ render Nothing $ cat $ map pretty (docTitle m) |
9 | return d | 9 | return d |
10 | where pretty :: Inline -> Doc | 10 | where pretty :: Inline -> Doc |
11 | pretty (Str s) = text s | 11 | pretty (Str s) = text s |
diff --git a/build/tex-filter.hs b/build/tex-filter.hs index 5d11f07..1e2face 100755 --- a/build/tex-filter.hs +++ b/build/tex-filter.hs | |||
@@ -47,7 +47,7 @@ compileToSVG basepath t s = let tex = Data.Text.unpack $ Data.Text.strip $ Data. | |||
47 | (do writeFile expr_path $ (display t) ++ tex | 47 | (do writeFile expr_path $ (display t) ++ tex |
48 | writeFile align_path "0") | 48 | writeFile align_path "0") |
49 | alignment <- head.lines <$> readFile align_path | 49 | alignment <- head.lines <$> readFile align_path |
50 | SIO.hPutStrLn SIO.stderr path | 50 | SIO.hPutStrLn SIO.stdout path |
51 | return $ printf "<object data=\"/%s\" type=\"image/svg+xml\" style=\"vertical-align:-%s\">%s</object>" svg_web_path alignment tex | 51 | return $ printf "<object data=\"/%s\" type=\"image/svg+xml\" style=\"vertical-align:-%s\">%s</object>" svg_web_path alignment tex |
52 | 52 | ||
53 | texify :: [String] -> Inline -> IO Inline | 53 | texify :: [String] -> Inline -> IO Inline |
diff --git a/default.html.do b/default.html.do index b7e46ae..da9d0b2 100644 --- a/default.html.do +++ b/default.html.do | |||
@@ -1,7 +1,7 @@ | |||
1 | redo-ifchange $2.md build/tex-filter.hs build/template.html5 | 1 | redo-ifchange $2.md build/tex-filter.hs build/template.html5 |
2 | 2 | ||
3 | texfilter() { | 3 | texfilter() { |
4 | runhaskell -package-conf=$(find .cabal-sandbox -maxdepth 1 -iname '*.conf.d' | head -n 1) build/tex-filter.hs $@ | 4 | runhaskell -package-conf=$(find .cabal-sandbox -maxdepth 1 -iname '*.conf.d' | head -n 1) build/tex-filter.hs $@ 2>/dev/null |
5 | } | 5 | } |
6 | 6 | ||
7 | CSS=/style.css | 7 | CSS=/style.css |
diff --git a/lists/default.md.do b/lists/default.md.do index fffd6e2..121955e 100644 --- a/lists/default.md.do +++ b/lists/default.md.do | |||
@@ -1,6 +1,10 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
2 | redo-ifchange "$2/title" | 2 | redo-ifchange "$2/title" |
3 | 3 | ||
4 | extracttitle() { | ||
5 | runhaskell -package-conf=$(find ../.cabal-sandbox -maxdepth 1 -iname '*.conf.d' | head -n 1) ../build/extract-title.hs $@ 2>&1 | grep 'title: ' | cut -d ' ' -f '2-' | ||
6 | } | ||
7 | |||
4 | POSTS=() | 8 | POSTS=() |
5 | while read -r -d $'\0'; do | 9 | while read -r -d $'\0'; do |
6 | post=$(realpath --relative-to=. "$REPLY") | 10 | post=$(realpath --relative-to=. "$REPLY") |
@@ -20,7 +24,7 @@ EOF | |||
20 | 24 | ||
21 | POST_TITLES=() | 25 | POST_TITLES=() |
22 | for x in "${POSTS[@]}"; do | 26 | for x in "${POSTS[@]}"; do |
23 | title=$(pandoc -t json "$x" | ../build/extract-title.hs 2>&1 >/dev/null) | 27 | title=$(pandoc -t json "$x" | extracttitle) |
24 | POST_TITLES+=("$title") | 28 | POST_TITLES+=("$title") |
25 | done | 29 | done |
26 | 30 | ||