{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Writers.LaTeX.Notes
( notesToLaTeX
) where
import Text.DocLayout ( Doc, braces, text, vcat )
import Data.Text (Text)
notesToLaTeX :: [(Int, Doc Text)] -> Doc Text
notesToLaTeX :: [(Int, Doc Text)] -> Doc Text
notesToLaTeX = [Doc Text] -> Doc Text
forall a. [Doc a] -> Doc a
vcat ([Doc Text] -> Doc Text)
-> ([(Int, Doc Text)] -> [Doc Text])
-> [(Int, Doc Text)]
-> Doc Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Int, Doc Text) -> Doc Text) -> [(Int, Doc Text)] -> [Doc Text]
forall a b. (a -> b) -> [a] -> [b]
map (Int, Doc Text) -> Doc Text
forall {a} {a}. (HasChars a, Show a) => (a, Doc a) -> Doc a
toNoteText ([(Int, Doc Text)] -> [Doc Text])
-> ([(Int, Doc Text)] -> [(Int, Doc Text)])
-> [(Int, Doc Text)]
-> [Doc Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Int, Doc Text)] -> [(Int, Doc Text)]
forall a. [a] -> [a]
reverse
where
toNoteText :: (a, Doc a) -> Doc a
toNoteText (a
num, Doc a
x) =
Doc a
"\\pandocfootnotetext" Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a -> Doc a
forall a. HasChars a => Doc a -> Doc a
braces (String -> Doc a
forall a. HasChars a => String -> Doc a
text (a -> String
forall a. Show a => a -> String
show a
num)) Doc a -> Doc a -> Doc a
forall a. Semigroup a => a -> a -> a
<> Doc a -> Doc a
forall a. HasChars a => Doc a -> Doc a
braces Doc a
x