From e9c58e49483563bb5bb36766668b91b968668f45 Mon Sep 17 00:00:00 2001 From: Justin Hsu Date: Thu, 18 Feb 2016 23:46:23 -0500 Subject: [PATCH] Expand month abbreviations. This is done by bibtex2html, but not bib2bib. --- HakyllBibTex.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/HakyllBibTex.hs b/HakyllBibTex.hs index d80e45c..b4a652f 100644 --- a/HakyllBibTex.hs +++ b/HakyllBibTex.hs @@ -50,6 +50,7 @@ bibEntryContext = Context $ \key _ item -> Nothing -> empty Just val -> case key of "author" -> return $ StringField $ formatAuthors val + "month" -> return $ StringField $ expandMonth val _ -> return $ StringField $ latexToHtml val -------------------------------------------------------------------------------- @@ -99,6 +100,22 @@ formatAuthor = intercalate " " . reverse . (splitOn ",") +-------------------------------------------------------------------------------- +expandMonth :: String -> String +expandMonth mon = case mon of + "jan" -> "January" + "feb" -> "February" + "mar" -> "March" + "apr" -> "April" + "may" -> "May" + "jun" -> "June" + "jul" -> "July" + "aug" -> "August" + "sep" -> "September" + "oct" -> "October" + "nov" -> "November" + "dec" -> "December" + -------------------------------------------------------------------------------- -- Inefficient... trimSpace :: String -> String