Update to new version of Hakyll.
Whew. I need to refactor this.
This commit is contained in:
parent
7a2f517346
commit
f70e1b7fd2
|
@ -18,6 +18,7 @@ import Data.Binary (Binary (..))
|
|||
import Data.Char (isSpace)
|
||||
import Data.List.Split (splitOn)
|
||||
import Data.List (intercalate)
|
||||
import Data.Map (empty)
|
||||
import Data.Typeable (Typeable)
|
||||
import Hakyll
|
||||
import qualified Bibtex as B
|
||||
|
@ -38,13 +39,14 @@ instance Binary BibEntry where
|
|||
get = BibEntry <$> (B.Item <$> get <*> get <*> get)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- XXX refactor to use Context monoid XXX
|
||||
bibEntryContext :: Context BibEntry
|
||||
bibEntryContext = Context $ \key _ item ->
|
||||
let BibEntry t = itemBody item
|
||||
in case key of
|
||||
"identifier" -> return $ StringField $ B.identifier t
|
||||
_ -> case lookup key (B.fields t) of
|
||||
Nothing -> empty
|
||||
Nothing -> Control.Applicative.empty
|
||||
Just val -> case key of
|
||||
"author" -> return $ StringField $ formatAuthors val
|
||||
"month" -> return $ StringField $ expandMonth val
|
||||
|
@ -62,6 +64,7 @@ bibFileEntryNames (BibFile es) = [B.identifier t | BibEntry t <- es]
|
|||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- XXX refactor to use Text.CSL.readBiblioFile XXX
|
||||
parseBibFile :: String -> BibFile
|
||||
parseBibFile string = case Parsec.runParser (B.bibEntries <* Parsec.eof)
|
||||
[] "<bib file>" string of
|
||||
|
@ -124,7 +127,8 @@ trimSpace = f . f
|
|||
--------------------------------------------------------------------------------
|
||||
latexToHtml tex =
|
||||
let p = case Pandoc.readLaTeX Pandoc.def tex of
|
||||
Pandoc.Pandoc meta [Pandoc.Para para] ->
|
||||
Right (Pandoc.Pandoc meta [Pandoc.Para para]) ->
|
||||
Pandoc.Pandoc meta [Pandoc.Plain para]
|
||||
x -> x
|
||||
Left _ ->
|
||||
Pandoc.Pandoc (Pandoc.Meta Data.Map.empty) []
|
||||
in Pandoc.writeHtmlString Pandoc.def p
|
||||
|
|
Loading…
Reference in New Issue