diff options
author | Case Duckworth | 2015-04-01 23:16:18 -0700 |
---|---|---|
committer | Case Duckworth | 2015-04-01 23:20:18 -0700 |
commit | d161be120c22faf222ec15ca618ee367e4d56575 (patch) | |
tree | b945633e680e5682a967f63bad88a2b262b4d4c6 /trunk/forceascii.hs | |
parent | Merge branch 'gh-pages' of https://github.com/duckwork/autocento into gh-pages (diff) | |
download | autocento-d161be120c22faf222ec15ca618ee367e4d56575.tar.gz autocento-d161be120c22faf222ec15ca618ee367e4d56575.zip |
Refactor makefile; Add hapax preprocessor
Diffstat (limited to 'trunk/forceascii.hs')
-rw-r--r-- | trunk/forceascii.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/trunk/forceascii.hs b/trunk/forceascii.hs new file mode 100644 index 0000000..b5f1645 --- /dev/null +++ b/trunk/forceascii.hs | |||
@@ -0,0 +1,17 @@ | |||
1 | -- Preprocessor for hapax.lua writer | ||
2 | -- because for some damn reason, UTF-8 confuses things | ||
3 | |||
4 | import Text.Pandoc.JSON | ||
5 | import Data.Char (isAscii) | ||
6 | |||
7 | main :: IO () | ||
8 | main = toJSONFilter unFancy | ||
9 | |||
10 | unFancy :: Inline -> Inline | ||
11 | unFancy (Str s) = Str $ map makeAscii s | ||
12 | unFancy x = x | ||
13 | |||
14 | makeAscii :: Char -> Char | ||
15 | makeAscii c | ||
16 | | isAscii c = c | ||
17 | | otherwise = ' ' | ||