summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2017-11-08 16:42:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-11-08 16:42:00 (GMT)
commit941471af53bc55464a15556f1cc03aa3dd6d9ee8 (patch)
treec65e7c7ef53a6018cb87555a42aec8f7b8a422bd
parentb9942629a9506a97be97b9e71c996564f378af1f (diff)
version 0.12.10.12.1
-rw-r--r--changelog5
-rw-r--r--pandoc-citeproc.cabal2
-rw-r--r--src/Text/CSL/Eval/Names.hs9
-rw-r--r--tests/issue307.expected.native5
-rw-r--r--tests/issue307.in.native2
5 files changed, 21 insertions, 2 deletions
diff --git a/changelog b/changelog
index 96aa942..124af2d 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+pandoc-citeproc (0.12.1)
+
+ * Fixed cases where we got plural instead of singular "issue"
+ or "volume" (#307).
+
pandoc-citeproc (0.12)
* Text.CSL.Exception: add `renderError`.
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index 1d97838..a0c13a0 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.12
+version: 0.12.1
cabal-version: >= 1.12
synopsis: Supports using pandoc with citeproc
diff --git a/src/Text/CSL/Eval/Names.hs b/src/Text/CSL/Eval/Names.hs
index e01ee92..6f5cf2a 100644
--- a/src/Text/CSL/Eval/Names.hs
+++ b/src/Text/CSL/Eval/Names.hs
@@ -337,7 +337,14 @@ formatName m b f fm ops np n
formatTerm :: Form -> Formatting -> Bool -> String -> State EvalState [Output]
formatTerm f fm p s = do
- t <- getTerm p f s
+ plural <- if s `elem` ["page", "volume", "issue"]
+ then do
+ varset <- isVarSet s
+ if varset
+ then isRange <$> getStringVar s
+ else return p
+ else return p
+ t <- getTerm plural f s
return $ oStr' t fm
formatLabel :: Form -> Formatting -> Bool -> String -> State EvalState [Output]
diff --git a/tests/issue307.expected.native b/tests/issue307.expected.native
new file mode 100644
index 0000000..c89340a
--- /dev/null
+++ b/tests/issue307.expected.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList [("lang",MetaInlines [Str "fr-FR"]),("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Bazin"]),("given",MetaInlines [Str "Andr\233"])])]),("container-title",MetaInlines [Str "Cahiers",Space,Str "du",Space,Str "cin\233ma"]),("id",MetaInlines [Str "bazin_cybernetique_1954"]),("issue",MetaInlines [Str "36"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "1954",MetaString "6"]])])),("page",MetaInlines [Str "22-27"]),("title",MetaInlines [Str "La",Space,Str "Cybern\233tique",Space,Str "d\8217Andr\233",Space,Str "Cayatte"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Str "Bonjour",Cite [Citation {citationId = "bazin_cybernetique_1954", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1}] [Str "(Bazin",Space,Str "1954)"],Space,Str "!"]
+,Div ("refs",["references"],[])
+ [Div ("ref-bazin_cybernetique_1954",[],[])
+ [Para [Str "Bazin,",Space,Str "Andr\233.",Space,Str "1954.",Space,Str "\171\160La",Space,Str "Cybern\233tique",Space,Str "d\8217Andr\233",Space,Str "Cayatte\160\187.",Space,Emph [Str "Cahiers",Space,Str "du",Space,Str "cin\233ma"],Str ",",Space,Str "n\7506",Space,Str "36",Space,Str "(juin):22\8209\&27."]]]]
diff --git a/tests/issue307.in.native b/tests/issue307.in.native
new file mode 100644
index 0000000..cb96421
--- /dev/null
+++ b/tests/issue307.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("lang",MetaInlines [Str "fr-FR"]),("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Bazin"]),("given",MetaInlines [Str "Andr\233"])])]),("container-title",MetaInlines [Str "Cahiers",Space,Str "du",Space,Str "cin\233ma"]),("id",MetaInlines [Str "bazin_cybernetique_1954"]),("issue",MetaInlines [Str "36"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "1954",MetaString "6"]])])),("page",MetaInlines [Str "22-27"]),("title",MetaInlines [Str "La",Space,Str "Cybern\233tique",Space,Str "d\8217Andr\233",Space,Str "Cayatte"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Str "Bonjour",Cite [Citation {citationId = "bazin_cybernetique_1954", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@bazin_cybernetique_1954]"],Space,Str "!"]]