pandoc-citeproc 0.12.2.2 → 0.12.2.3
raw patch · 6 files changed
+26/−11 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog +8/−1
- pandoc-citeproc.cabal +1/−1
- src/Text/CSL/Eval/Date.hs +1/−5
- src/Text/CSL/Reference.hs +5/−4
- tests/issue312.expected.native +9/−0
- tests/issue312.in.native +2/−0
changelog view
@@ -1,4 +1,11 @@-pandoc-citeproc (0.12.2.1)+pandoc-citeproc (0.12.2.3)++ * Fix month range problems (#312). Months in a range were being+ concatenated with no separator with some styles (e.g. apa.csl).++ * Use pseudo-months in CSL JSON output (#103).++pandoc-citeproc (0.12.2.2) * Allow pandoc 2.1.
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name: pandoc-citeproc-version: 0.12.2.2+version: 0.12.2.3 cabal-version: >= 1.12 synopsis: Supports using pandoc with citeproc
src/Text/CSL/Eval/Date.hs view
@@ -90,12 +90,8 @@ map (formatDatePart False a) x ++ map (formatDatePart False a) (init' y) ++ map (formatDatePart True a) (last' y) ++- map (formatDatePart False b) (rmPrefix y) +++ map (formatDatePart False b) y ++ map (formatDatePart False b) z- -- the point of rmPrefix is to remove the blank space that otherwise- -- gets added after the delimiter in a range: 24- 26.- rmPrefix (dp':rest) = dp'{ dpFormatting = (dpFormatting dp') { prefix = "" } } : rest- rmPrefix [] = [] diff a b = filter (flip elem (diffDate a b) . dpName) diffDate (RefDate ya ma sa da _ _) (RefDate yb mb sb db _ _) = case () of
src/Text/CSL/Reference.hs view
@@ -47,7 +47,7 @@ ) where -import Control.Monad ( guard )+import Control.Monad ( guard, mplus ) import Data.List ( elemIndex, intercalate ) import Data.List.Split ( splitWhen ) import Data.Maybe ( fromMaybe, isJust, isNothing )@@ -216,7 +216,9 @@ toDatePart :: RefDate -> [Int] toDatePart refdate = case (safeRead (unLiteral $ year refdate),- safeRead (unLiteral $ month refdate),+ safeRead (unLiteral $ month refdate)+ `mplus`+ ((+ 12) <$> safeRead (unLiteral $ season refdate)), safeRead (unLiteral $ day refdate)) of (Just (y :: Int), Just (m :: Int), Just (d :: Int)) -> [y, m, d]@@ -231,8 +233,7 @@ case filter (not . null) (map toDatePart xs) of [] -> ["literal" .= intercalate "; " (map (unLiteral . other) xs)] dps -> (["date-parts" .= dps ] ++- ["circa" .= (1 :: Int) | or (map circa xs)] ++- ["season" .= s | s <- map season xs, s /= mempty])+ ["circa" .= (1 :: Int) | or (map circa xs)]) setCirca :: Bool -> RefDate -> RefDate setCirca circa' rd = rd{ circa = circa' }
+ tests/issue312.expected.native view
@@ -0,0 +1,9 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/apa.csl"]),("references",MetaList [MetaMap (fromList [("id",MetaInlines [Str "item1"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "1"]),("year",MetaInlines [Str "-12"])]),MetaMap (fromList [("month",MetaInlines [Str "12"]),("year",MetaInlines [Str "12"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("id",MetaInlines [Str "item2"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "11"]),("year",MetaInlines [Str "2016"])]),MetaMap (fromList [("month",MetaInlines [Str "12"]),("year",MetaInlines [Str "2017"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("id",MetaInlines [Str "item3"]),("issued",MetaList [MetaMap (fromList [("season",MetaInlines [Str "1"]),("year",MetaInlines [Str "2016"])]),MetaMap (fromList [("season",MetaInlines [Str "2"]),("year",MetaInlines [Str "2017"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])])])]})+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "(",Str "\8220Title,\8221",Space,Str "12BC\8211\&12ADa)"],Str ";",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "(",Str "\8220Title,\8221",Space,Str "2016\8211\&2017b)"],Str ";",Space,Cite [Citation {citationId = "item3", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 3}] [Str "(",Str "\8220Title,\8221",Space,Str "2016\8211\&2017c)"]]+,Div ("refs",["references"],[])+ [Div ("ref-item1",[],[])+ [Para [Str "Title.",Space,Str "(12BC\8211\&12ADa,",Space,Str "January,",Space,Str "December)."]]+ ,Div ("ref-item2",[],[])+ [Para [Str "Title.",Space,Str "(2016\8211\&2017b,",Space,Str "November,",Space,Str "December)."]]+ ,Div ("ref-item3",[],[])+ [Para [Str "Title.",Space,Str "(2016\8211\&2017c,",Space,Str "Spring,",Space,Str "Summer)."]]]]
+ tests/issue312.in.native view
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/apa.csl"]),("references",MetaList [MetaMap (fromList [("id",MetaInlines [Str "item1"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "1"]),("year",MetaInlines [Str "-12"])]),MetaMap (fromList [("month",MetaInlines [Str "12"]),("year",MetaInlines [Str "12"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("id",MetaInlines [Str "item2"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "11"]),("year",MetaInlines [Str "2016"])]),MetaMap (fromList [("month",MetaInlines [Str "12"]),("year",MetaInlines [Str "2017"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("id",MetaInlines [Str "item3"]),("issued",MetaList [MetaMap (fromList [("season",MetaInlines [Str "1"]),("year",MetaInlines [Str "2016"])]),MetaMap (fromList [("season",MetaInlines [Str "2"]),("year",MetaInlines [Str "2017"])])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])])])]})+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item1"],Str ";",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item2"],Str ";",Space,Cite [Citation {citationId = "item3", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item3"]]]