summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2019-01-30 20:33:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-01-30 20:33:00 (GMT)
commit89c0755afed2dde4fd7125025198e60a5d758667 (patch)
treeea73d401fc8b2ca9b4f26dfd8eb44203df0473c9
parentd3fa30f0181fee8e87c680005ca5f13335ee3510 (diff)
version 0.160.16
-rw-r--r--changelog14
-rw-r--r--pandoc-citeproc.cabal12
-rw-r--r--src/Text/CSL/Eval.hs10
-rw-r--r--src/Text/CSL/Eval/Output.hs2
-rw-r--r--src/Text/CSL/Pandoc.hs1
-rw-r--r--src/Text/CSL/Proc/Collapse.hs1
-rw-r--r--src/Text/CSL/Style.hs1
-rw-r--r--stack.yaml17
-rw-r--r--tests/issue371.expected.native8
-rw-r--r--tests/issue371.in.native3
-rw-r--r--tests/page-range.expected.native4
-rw-r--r--tests/page-range.in.native4
12 files changed, 56 insertions, 21 deletions
diff --git a/changelog b/changelog
index 702ee22..8b6a608 100644
--- a/changelog
+++ b/changelog
@@ -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)
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index acd1357..fcf71bf 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -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 @@ library
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 @@ executable pandoc-citeproc
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 @@ executable test-citeproc
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 @@ executable test-citeproc
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 @@ test-suite test-pandoc-citeproc
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 @@ test-suite test-pandoc-citeproc
default-language: Haskell2010
default-extensions: CPP, NoImplicitPrelude
other-modules: Text.CSL.Compat.Pandoc
+ build-tools: pandoc-citeproc
diff --git a/src/Text/CSL/Eval.hs b/src/Text/CSL/Eval.hs
index 1cbd031..793d48a 100644
--- a/src/Text/CSL/Eval.hs
+++ b/src/Text/CSL/Eval.hs
@@ -230,6 +230,12 @@ evalElement el
"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 @@ getFormattedValue o as f fm s val
$ 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)
diff --git a/src/Text/CSL/Eval/Output.hs b/src/Text/CSL/Eval/Output.hs
index 3f0184c..021525a 100644
--- a/src/Text/CSL/Eval/Output.hs
+++ b/src/Text/CSL/Eval/Output.hs
@@ -87,6 +87,7 @@ rmEmptyOutput o
| Output [] _ <- o = Nothing
| OStr [] _ <- o = Nothing
| OPan [] <- o = Nothing
+ | OStatus [] <- o = Nothing
| ODel [] <- o = Nothing
| otherwise = Just o
@@ -131,6 +132,7 @@ formatOutput o =
case o of
OSpace -> Formatted [Space]
OPan i -> Formatted i
+ OStatus i -> Formatted i
ODel [] -> Formatted []
ODel " " -> Formatted [Space]
ODel "\n" -> Formatted [SoftBreak]
diff --git a/src/Text/CSL/Pandoc.hs b/src/Text/CSL/Pandoc.hs
index 479afd6..1d51f16 100644
--- a/src/Text/CSL/Pandoc.hs
+++ b/src/Text/CSL/Pandoc.hs
@@ -630,6 +630,7 @@ pRoman = try $ do
isLocatorPunct :: Char -> Bool
isLocatorPunct '-' = False -- page range
+isLocatorPunct '–' = False -- page range, en dash
isLocatorPunct ':' = False -- vol:page-range hack
isLocatorPunct c = isPunctuation c -- includes [{()}]
diff --git a/src/Text/CSL/Proc/Collapse.hs b/src/Text/CSL/Proc/Collapse.hs
index 8f77e2f..05059ed 100644
--- a/src/Text/CSL/Proc/Collapse.hs
+++ b/src/Text/CSL/Proc/Collapse.hs
@@ -97,6 +97,7 @@ getYearAndSuf x
| OYearSuf {} : _ <- o = [head o]
| OLoc {} : _ <- o = [head o]
| ODel _ : OLoc {} : _ <- o = [head o]
+ | OStatus {} : _ <- o = [head o]
| otherwise = []
collapseYear :: Style -> String -> CitationGroup -> CitationGroup
diff --git a/src/Text/CSL/Style.hs b/src/Text/CSL/Style.hs
index e88c35c..95a6ce2 100644
--- a/src/Text/CSL/Style.hs
+++ b/src/Text/CSL/Style.hs
@@ -676,6 +676,7 @@ data Output
= ONull
| OSpace
| OPan [Inline]
+ | OStatus [Inline]
| ODel String -- ^ A delimiter string.
| OStr String Formatting -- ^ A simple 'String'
| OErr CiteprocError -- ^ Warning message
diff --git a/stack.yaml b/stack.yaml
index 3a25c56..48f67a4 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -8,20 +8,7 @@ flags:
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
diff --git a/tests/issue371.expected.native b/tests/issue371.expected.native
new file mode 100644
index 0000000..7fb5f33
--- /dev/null
+++ b/tests/issue371.expected.native
@@ -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 "."]]]]
diff --git a/tests/issue371.in.native b/tests/issue371.in.native
new file mode 100644
index 0000000..4842300
--- /dev/null
+++ b/tests/issue371.in.native
@@ -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"]]
diff --git a/tests/page-range.expected.native b/tests/page-range.expected.native
new file mode 100644
index 0000000..ce090b6
--- /dev/null
+++ b/tests/page-range.expected.native
@@ -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 "."]]]]]
diff --git a/tests/page-range.in.native b/tests/page-range.in.native
new file mode 100644
index 0000000..94d401f
--- /dev/null
+++ b/tests/page-range.in.native
@@ -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 "."]]