aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-09-13 16:08:49 -0700
committerSean Whitton <spwhitton@spwhitton.name>2015-09-13 16:08:49 -0700
commit39d4085e124a80d4eda6838753e73b26b17ed14f (patch)
treea04799935fb94d6023e30b1fbf4b922ac265588c /src
downloadpandoc-citeproc-preamble-39d4085e124a80d4eda6838753e73b26b17ed14f.tar.gz
pandoc-citeproc-preamble proof of concept
Diffstat (limited to 'src')
-rw-r--r--src/pandoc-citeproc-preamble.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pandoc-citeproc-preamble.hs b/src/pandoc-citeproc-preamble.hs
new file mode 100644
index 0000000..a72314c
--- /dev/null
+++ b/src/pandoc-citeproc-preamble.hs
@@ -0,0 +1,24 @@
+import Text.Pandoc.JSON
+
+preamble = [ RawBlock (Format "latex") "\\section*{References}"
+ , Para [ RawInline (Format "tex") "\\setlength{\\parindent}{-0.2in}"
+ , Space
+ , RawInline (Format "tex") "\\setlength{\\leftskip}{0.2in}"
+ , Space
+ , RawInline (Format "tex") "\\setlength{\\parskip}{8pt}"
+ , Space
+ , RawInline (Format "tex") "\\vspace*{-0.2in}"
+ , Space
+ , RawInline (Format "tex") "\\noindent"
+ ]
+ ]
+
+insertPreamble :: [Block] -> [Block]
+insertPreamble = foldr step []
+ where
+ step refs@(Div (_, ["references"], _) _) xs = preamble ++ refs : xs
+ step x xs = x:xs
+
+main = toJSONFilter preamble
+ where
+ preamble (Pandoc meta blocks) = Pandoc meta (insertPreamble blocks)