packages feed

pandoc-citeproc 0.12.2 → 0.12.2.1

raw patch · 3 files changed

+26/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog view
@@ -1,3 +1,8 @@+pandoc-citeproc (0.12.2.1)++  * Handle pseudo-months in CSL date-range (see #103).+    Month 13 = season 1, 14 = 2, also 21 = 1, 22 = 2, ...+ pandoc-citeproc (0.12.2)    * Improved parsing of raw dates.  First we attempt to parse them@@ -19,7 +24,7 @@     + We now only parse 'raw' if `date-parts` is empty or missing.     + Code for parsing raw dates moved from Text.CSL.Eval.Date to       Text.CSL.Reference.-    + Use `literal` field if we can't parse data.+    + Use `other` field if we can't parse data.    * Support `all-names-with-initials` disambiguation. 
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name:               pandoc-citeproc-version:            0.12.2+version:            0.12.2.1 cabal-version:      >= 1.12 synopsis:           Supports using pandoc with citeproc 
src/Text/CSL/Reference.hs view
@@ -132,7 +132,7 @@             } deriving ( Show, Read, Eq, Typeable, Data, Generic )  instance FromJSON RefDate where-  parseJSON (Array v) =+  parseJSON (Array v) = handlePseudoMonths <$>      case fromJSON (Array v) of           Success [y]     -> RefDate <$> parseJSON y <*>                     pure "" <*> pure "" <*> pure "" <*> pure "" <*> pure False@@ -142,6 +142,17 @@                     pure "" <*> parseJSON d <*> pure "" <*> pure False           Error e         -> fail $ "Could not parse RefDate: " ++ e           _               -> fail "Could not parse RefDate"+     where handlePseudoMonths r =+              case unLiteral (month r) of+                   "13" -> r{ month = mempty, season = Literal "1" }+                   "14" -> r{ month = mempty, season = Literal "2" }+                   "15" -> r{ month = mempty, season = Literal "3" }+                   "16" -> r{ month = mempty, season = Literal "4" }+                   "21" -> r{ month = mempty, season = Literal "1" }+                   "22" -> r{ month = mempty, season = Literal "2" }+                   "23" -> r{ month = mempty, season = Literal "3" }+                   "24" -> r{ month = mempty, season = Literal "4" }+                   _    -> r   parseJSON (Object v) = RefDate <$>               v .:? "year" .!= "" <*>               v .:? "month" .!= "" <*>@@ -178,11 +189,11 @@     raw' <- v .:? "raw"     dateParts <- v .:? "date-parts"     circa' <- (v .: "circa" >>= parseBool) <|> pure False-    season' <- (v .: "season") <|> pure mempty+    season' <- v .:? "season"     case dateParts of          Just (Array xs) | not (isJust raw') && not (V.null xs)                           -> mapM (fmap (setCirca circa' .-                                        setSeason season') . parseJSON)+                                     maybe id setSeason season') . parseJSON)                              $ V.toList xs          _ -> case raw' of                   Nothing -> handleLiteral <$> parseJSON (Object v)@@ -877,7 +888,10 @@  isoDate :: P.Parser RefDate isoDate = P.try $ do-  y <- P.many1 P.digit+  y <- do+    sign <- P.option "" (P.string "-")+    rest <- P.count 4 P.digit+    return $ sign ++ rest   m' <- P.option Nothing $ Just <$> P.try (P.char '-' >> P.many1 P.digit)   (m,s) <- case m' >>= safeRead of                    Just (n::Int)@@ -920,7 +934,7 @@              Just (n::Int) | n >= 1 && n <= 31 -> return (show n)              _ -> fail "Improper day"   let pyear = P.many1 P.digit-  let sep = P.oneOf ['-',' ','/',','] >> P.spaces+  let sep = P.oneOf [' ','/',','] >> P.spaces   let rangesep = P.try $ P.spaces >> P.char '-' >> P.spaces   let refDate = RefDate mempty mempty mempty mempty mempty False   let date = P.choice $ map P.try [