pandoc-citeproc 0.15.0.1 → 0.16
raw patch · 12 files changed
+56/−21 lines, 12 filesdep ~pandoc
Dependency ranges changed: pandoc
Files
- changelog +14/−0
- pandoc-citeproc.cabal +7/−5
- src/Text/CSL/Eval.hs +9/−1
- src/Text/CSL/Eval/Output.hs +2/−0
- src/Text/CSL/Pandoc.hs +1/−0
- src/Text/CSL/Proc/Collapse.hs +1/−0
- src/Text/CSL/Style.hs +1/−0
- stack.yaml +2/−15
- tests/issue371.expected.native +8/−0
- tests/issue371.in.native +3/−0
- tests/page-range.expected.native +4/−0
- tests/page-range.in.native +4/−0
changelog view
@@ -1,3 +1,17 @@+pandoc-citeproc (0.16)++ * Detect en dash in page range (Andrew Dunning). Ensure that `--` or `–`+ are detected as page ranges. This fixes a regression that caused the+ second half of the range to be appended to a URL in note styles.++ * Fix collapsing behavior with items with status but no year (#371).++ * Style: Add OStatus constructor to Output [API change].++ * Allow pandoc 2.6.++ * Added pandoc-citeproc to build-tools for test suite (#369).+ pandoc-citeproc (0.15.0.1)
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name: pandoc-citeproc-version: 0.15.0.1+version: 0.16 cabal-version: 1.12 synopsis: Supports using pandoc with citeproc @@ -103,7 +103,7 @@ build-depends: containers, directory, mtl, bytestring, filepath, pandoc-types >= 1.17.3 && < 1.18,- pandoc >= 1.16 && < 2.6,+ pandoc >= 1.16 && < 2.7, tagsoup, aeson >= 0.7 && < 1.5, text,@@ -153,7 +153,7 @@ ghc-prof-options: -fprof-auto-exported -rtsopts build-depends: base >= 4, pandoc-citeproc, pandoc-types >= 1.17.3 && < 1.18,- pandoc >= 1.16 && < 2.6,+ pandoc >= 1.16 && < 2.7, aeson, aeson-pretty >= 0.8, yaml, bytestring, syb, attoparsec, text, filepath@@ -182,7 +182,7 @@ Buildable: False build-depends: base >= 4, aeson, directory, text, mtl, pandoc-types >= 1.17.3 && < 1.18,- pandoc >= 1.16 && < 2.6,+ pandoc >= 1.16 && < 2.7, filepath, containers, bytestring, pandoc-citeproc, process, temporary >= 1.1, yaml >= 0.8.32, containers >= 0.4, vector >= 0.10@@ -196,6 +196,7 @@ default-language: Haskell2010 default-extensions: CPP, NoImplicitPrelude other-modules: Text.CSL.Compat.Pandoc+ build-tools: pandoc-citeproc test-suite test-pandoc-citeproc Type: exitcode-stdio-1.0@@ -204,7 +205,7 @@ Hs-Source-Dirs: tests, compat build-depends: base >= 4, aeson, directory, text, pandoc-types >= 1.17.3 && < 1.18, mtl,- pandoc >= 1.16 && < 2.6, filepath, containers,+ pandoc >= 1.16 && < 2.7, filepath, containers, bytestring, pandoc-citeproc, process, temporary >= 1.1, yaml >= 0.8.32 ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -threaded@@ -217,3 +218,4 @@ default-language: Haskell2010 default-extensions: CPP, NoImplicitPrelude other-modules: Text.CSL.Compat.Pandoc+ build-tools: pandoc-citeproc
src/Text/CSL/Eval.hs view
@@ -230,6 +230,12 @@ "year-suffix" -> getStringVar "ref-id" >>= \k -> return . return $ OYearSuf [] k [] fm+ "status" -> do+ (opts, as) <- gets (env >>> options &&& abbrevs)+ r <- getVar mempty (getFormattedValue opts as f fm s)+ "status"+ consumeVariable s+ return r "page" -> getStringVar "page" >>= formatRange fm "locator" -> getLocVar >>= formatRange fm . snd "url" -> getStringVar "url" >>= \k ->@@ -313,7 +319,9 @@ $ getAbbr (stringify $ unFormatted v) in if null ys then []- else [Output [OPan $ walk value' ys] fm]+ else [Output [(if s == "status"+ then OStatus+ else OPan) $ walk value' ys] fm] | Just v <- fromValue val :: Maybe String = maybe [] (\x -> [OStr x fm]) . getAbbr $ value v | Just v <- fromValue val :: Maybe Literal = maybe [] (\x -> [OStr x fm]) . getAbbr $ value $ unLiteral v | Just v <- fromValue val :: Maybe Int = output fm (if v == 0 then [] else show v)
src/Text/CSL/Eval/Output.hs view
@@ -87,6 +87,7 @@ | Output [] _ <- o = Nothing | OStr [] _ <- o = Nothing | OPan [] <- o = Nothing+ | OStatus [] <- o = Nothing | ODel [] <- o = Nothing | otherwise = Just o @@ -131,6 +132,7 @@ case o of OSpace -> Formatted [Space] OPan i -> Formatted i+ OStatus i -> Formatted i ODel [] -> Formatted [] ODel " " -> Formatted [Space] ODel "\n" -> Formatted [SoftBreak]
src/Text/CSL/Pandoc.hs view
@@ -630,6 +630,7 @@ isLocatorPunct :: Char -> Bool isLocatorPunct '-' = False -- page range+isLocatorPunct '–' = False -- page range, en dash isLocatorPunct ':' = False -- vol:page-range hack isLocatorPunct c = isPunctuation c -- includes [{()}]
src/Text/CSL/Proc/Collapse.hs view
@@ -97,6 +97,7 @@ | OYearSuf {} : _ <- o = [head o] | OLoc {} : _ <- o = [head o] | ODel _ : OLoc {} : _ <- o = [head o]+ | OStatus {} : _ <- o = [head o] | otherwise = [] collapseYear :: Style -> String -> CitationGroup -> CitationGroup
src/Text/CSL/Style.hs view
@@ -676,6 +676,7 @@ = ONull | OSpace | OPan [Inline]+ | OStatus [Inline] | ODel String -- ^ A delimiter string. | OStr String Formatting -- ^ A simple 'String' | OErr CiteprocError -- ^ Warning message
stack.yaml view
@@ -8,20 +8,7 @@ static: false packages: - '.'-extra-deps:-- rfc5051-0.1.0.3-- hs-bibutils-6.6.0.0-- pandoc-2.4-- haddock-library-1.7.0-- HsYAML-0.1.1.2-- texmath-0.11.1.2-- yaml-0.11.0.0-- libyaml-0.1.0.0-- cmark-gfm-0.1.6-- hslua-1.0.1-- hslua-module-text-0.2.0-- skylighting-0.7.4-- skylighting-core-0.7.4+extra-deps: [] ghc-options: "$locals": -fhide-source-paths-resolver: lts-12.18+resolver: lts-13.5
+ tests/issue371.expected.native view
@@ -0,0 +1,8 @@+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("id",MetaInlines [Str "item1"]),("status",MetaInlines [Str "in",Space,Str "press"]),("title",MetaInlines [Str "Title",Space,Str "one"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("id",MetaInlines [Str "item2"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2018"])])]),("title",MetaInlines [Str "Title",Space,Str "two"]),("type",MetaInlines [Str "book"])])])]})+[Para [Str "Foo",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1},Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 2}] [Str "(Doe",Space,Str "2018,",Space,Str "in",Space,Str "press)"],Str "."]+,Header 1 ("references",["unnumbered"],[]) [Str "References"]+,Div ("refs",["references"],[])+ [Div ("ref-item2",[],[])+ [Para [Str "Doe,",Space,Str "Jane.",Space,Str "2018.",Space,Emph [Str "Title",Space,Str "Two"],Str "."]]+ ,Div ("ref-item1",[],[])+ [Para [Str "\8212\8212\8212.",Space,Str "In",Space,Str "press.",Space,Emph [Str "Title",Space,Str "One"],Str "."]]]]
+ tests/issue371.in.native view
@@ -0,0 +1,3 @@+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("id",MetaInlines [Str "item1"]),("status",MetaInlines [Str "in",Space,Str "press"]),("title",MetaInlines [Str "Title",Space,Str "one"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("id",MetaInlines [Str "item2"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2018"])])]),("title",MetaInlines [Str "Title",Space,Str "two"]),("type",MetaInlines [Str "book"])])])]})+[Para [Str "Foo",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@item2;",Space,Str "@item1]"],Str "."]+,Header 1 ("references",["unnumbered"],[]) [Str "References"]]
+ tests/page-range.expected.native view
@@ -0,0 +1,4 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/chicago-fullnote-bibliography.csl"]),("references",MetaList [MetaMap (fromList [("URL",MetaInlines [Str "https://johnmacfarlane.net/vagueness.pdf"]),("id",MetaInlines [Str "test1"])]),MetaMap (fromList [("URL",MetaInlines [Str "https://pandoc.org"]),("id",MetaInlines [Str "test2"])]),MetaMap (fromList [("URL",MetaInlines [Str "https://johnmacfarlane.net"]),("id",MetaInlines [Str "test3"])])]),("suppress-bibliography",MetaBool True)]})+[Para [Str "Test",Space,Str "1",Str ".",Cite [Citation {citationId = "test1", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93\8211\&101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1}] [Note [Para [Str "N.d.,",Space,Str "93\8211\&101,",Space,Link ("",[],[]) [Str "https://johnmacfarlane.net/vagueness.pdf"] ("https://johnmacfarlane.net/vagueness.pdf",""),Str "."]]]]+,Para [Str "Test",Space,Str "2",Str ".",Cite [Citation {citationId = "test2", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93\8211\&101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 2}] [Note [Para [Str "N.d.,",Space,Str "93\8211\&101,",Space,Link ("",[],[]) [Str "https://pandoc.org"] ("https://pandoc.org",""),Str "."]]]]+,Para [Str "Test",Space,Str "3",Str ".",Cite [Citation {citationId = "test3", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93-101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 3}] [Note [Para [Str "N.d.,",Space,Str "93\8211\&101,",Space,Link ("",[],[]) [Str "https://johnmacfarlane.net"] ("https://johnmacfarlane.net",""),Str "."]]]]]
+ tests/page-range.in.native view
@@ -0,0 +1,4 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/chicago-fullnote-bibliography.csl"]),("references",MetaList [MetaMap (fromList [("URL",MetaInlines [Str "https://johnmacfarlane.net/vagueness.pdf"]),("id",MetaInlines [Str "test1"])]),MetaMap (fromList [("URL",MetaInlines [Str "https://pandoc.org"]),("id",MetaInlines [Str "test2"])]),MetaMap (fromList [("URL",MetaInlines [Str "https://johnmacfarlane.net"]),("id",MetaInlines [Str "test3"])])]),("suppress-bibliography",MetaBool True)]})+[Para [Str "Test",Space,Str "1",Space,Cite [Citation {citationId = "test1", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93\8211\&101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@test1,",Space,Str "pp.",Space,Str "93--101]"],Str "."]+,Para [Str "Test",Space,Str "2",Space,Cite [Citation {citationId = "test2", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93\8211\&101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@test2,",Space,Str "pp.",Space,Str "93\8211\&101]"],Str "."]+,Para [Str "Test",Space,Str "3",Space,Cite [Citation {citationId = "test3", citationPrefix = [], citationSuffix = [Str ",",Space,Str "pp.\160\&93-101"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@test3,",Space,Str "pp.",Space,Str "93-101]"],Str "."]]