aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pandoc-citeproc-preamble.hs
blob: 1bfa2f86a88f6e7f5afd5cd2e08c5feea38e3169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import           Text.Pandoc.JSON

preamble = [ RawBlock (Format "latex") "\\section*{References}"
           , Para [ RawInline (Format "tex") "\\setlength{\\parindent}{-0.2in}"
                  , Space
                  , RawInline (Format "tex") "\\singlespacing"
                  , Space
                  , RawInline (Format "tex") "\\small"
                  , Space
                  , RawInline (Format "tex") "\\setlength{\\leftskip}{0.2in}"
                  , Space
                  , RawInline (Format "tex") "\\setlength{\\parskip}{8pt}"
                  , Space
                  , RawInline (Format "tex") "\\vspace*{-0.4in}"
                  , 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)