summaryrefslogtreecommitdiff
path: root/src/Hakyll/TeX/HaTeX.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/TeX/HaTeX.hs')
-rw-r--r--src/Hakyll/TeX/HaTeX.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Hakyll/TeX/HaTeX.hs b/src/Hakyll/TeX/HaTeX.hs
new file mode 100644
index 0000000..9b83c62
--- /dev/null
+++ b/src/Hakyll/TeX/HaTeX.hs
@@ -0,0 +1,15 @@
+module Hakyll.TeX.HaTeX
+ ( hatexCompiler
+ , compileHatex
+ ) where
+
+import Prolog
+
+import Hakyll
+import Text.LaTeX.Base.Parser
+
+compileHatex :: (StringConv s Text, Traversable t) => t s -> Compiler (t LaTeX)
+compileHatex = traverse $ either (throwError . fmap messageString . errorMessages) pure . parseLaTeX . toSL
+
+hatexCompiler :: Compiler (Item LaTeX)
+hatexCompiler = getResourceLBS >>= compileHatex