summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2018-10-20 03:25:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-10-20 03:25:00 (GMT)
commit66939ec4d424f04f3cd1ad5647cd3fcd029af5fc (patch)
tree4347862764820a4e5f8209c70849a7c425e2001a
parent0983a0e6da5bf1b7710cb4606087002186dcb0f9 (diff)
version 0.14.80.14.8
-rw-r--r--changelog4
-rw-r--r--man/man1/pandoc-citeproc.1222
-rw-r--r--pandoc-citeproc.cabal2
-rw-r--r--src/Text/CSL/Eval.hs3
-rw-r--r--src/Text/CSL/Eval/Names.hs10
-rw-r--r--src/Text/CSL/Proc/Disamb.hs4
-rw-r--r--tests/issue325.expected.native7
-rw-r--r--tests/issue325.in.native2
8 files changed, 144 insertions, 110 deletions
diff --git a/changelog b/changelog
index 03f02d3..8bcfe9f 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,7 @@
+pandoc-citeproc (0.14.8)
+
+ * Add disambiguation to undated references (n.d.a, n.d.b) (#325).
+
pandoc-citeproc (0.14.7)
* Support first-reference-note-number (#31).
diff --git a/man/man1/pandoc-citeproc.1 b/man/man1/pandoc-citeproc.1
index 2e72b3d..b34873c 100644
--- a/man/man1/pandoc-citeproc.1
+++ b/man/man1/pandoc-citeproc.1
@@ -1,7 +1,7 @@
.\"t
-.\" Automatically generated by Pandoc 2.1
+.\" Automatically generated by Pandoc 2.4
.\"
-.TH "pandoc\-citeproc" "1" "2018-01-09" "pandoc-citeproc 0.13" ""
+.TH "pandoc\-citeproc" "1" "2018-10-19" "pandoc-citeproc 0.14.7" ""
.hy
.SH NAME
.PP
@@ -11,7 +11,7 @@ pandoc\-citeproc \- filter to resolve citations in a pandoc document.
pandoc\-citeproc options [file..]
.SH DESCRIPTION
.PP
-The \f[C]pandoc\-citeproc\f[] executable has two modes, filter mode and
+The \f[C]pandoc\-citeproc\f[R] executable has two modes, filter mode and
convert mode.
.SS Filter mode
.PP
@@ -20,27 +20,28 @@ Pandoc document, formats citations and adds a bibliography, and returns
a JSON\-encoded pandoc document.
Citations will be resolved, and, assuming there are bibliography
entries, a bibliography will be inserted into a Div element with id
-\f[C]refs\f[].
+\f[C]refs\f[R].
If no such Div exists, one will be created and appended to the end of
-the document (unless the \f[C]suppress\-bibliography\f[] metadata field
+the document (unless the \f[C]suppress\-bibliography\f[R] metadata field
is set to a true value).
If you wish the bibliography to have a section header, put the section
header at the end of your document.
-(See the \f[C]pandoc_markdown\f[] (5) man page under \[lq]Citations\[rq]
-for details on how to encode citations in pandoc's markdown.)
+(See the \f[C]pandoc_markdown\f[R] (5) man page under
+\[lq]Citations\[rq] for details on how to encode citations in
+pandoc\[cq]s markdown.)
.PP
To process citations with pandoc, call pandoc\-citeproc as a filter:
.IP
.nf
\f[C]
pandoc\ \-\-filter\ pandoc\-citeproc\ input.md\ \-s\ \-o\ output.html
-\f[]
+\f[R]
.fi
.PP
pandoc\-citeproc will look for the following metadata fields in the
input:
.TP
-.B \f[C]bibliography\f[]
+.B \f[C]bibliography\f[R]
A path, or YAML list of paths, of bibliography files to use.
These may be in any of the formats supported by bibutils.
.RS
@@ -105,17 +106,22 @@ T}@T{
\&.mods
T}
T{
+NBIB
+T}@T{
+\&.nbib
+T}
+T{
RIS
T}@T{
\&.ris
T}
.TE
.PP
-Note that \f[C]\&.bib\f[] can generally be used with both BibTeX and
-BibLaTeX files, but you can use \f[C]\&.bibtex\f[] to force BibTeX.
+Note that \f[C]\&.bib\f[R] can generally be used with both BibTeX and
+BibLaTeX files, but you can use \f[C]\&.bibtex\f[R] to force BibTeX.
.RE
.TP
-.B \f[C]references\f[]
+.B \f[C]references\f[R]
A YAML list of references.
Each reference is a YAML object.
The format is essentially CSL JSON format.
@@ -135,7 +141,7 @@ Here is an example:
\ \ type:\ article\-journal
\ \ volume:\ 6
\ \ container\-title:\ Journal\ of\ Generic\ Studies
-\f[]
+\f[R]
.fi
.PP
The contents of fields will be interpreted as markdown when appropriate:
@@ -144,112 +150,116 @@ fields.
Simple tex math will also be parsed and rendered appropriately.
.RE
.TP
-.B \f[C]csl\f[] or \f[C]citation\-style\f[]
+.B \f[C]csl\f[R] or \f[C]citation\-style\f[R]
Path or URL of a CSL style file.
If the file is not found relative to the working directory,
-pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[] directory (or
-\f[C]C:\\Users\\USERNAME\\AppData\\Roaming\\csl\f[] in Windows 7).
+pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or
+\f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]csl\f[R] in
+Windows 7).
If this is left off, pandoc\-citeproc will look for
-\f[C]$HOME/.pandoc/default.csl\f[], and if this is not present, it will
-use \f[C]chicago\-author\-date.csl\f[], looking first in
-\f[C]$HOME/.csl\f[] and then in its own data files.
+\f[C]$HOME/.pandoc/default.csl\f[R], and if this is not present, it will
+use \f[C]chicago\-author\-date.csl\f[R], looking first in
+\f[C]$HOME/.csl\f[R] and then in its own data files.
.RS
.RE
.TP
-.B \f[C]link\-citations\f[]
+.B \f[C]link\-citations\f[R]
If this has a true value, citations in author\-date and numerical styles
will be hyperlinked to their corresponding bibliography entries.
The default is not to add hyperlinks.
.RS
.RE
.TP
-.B \f[C]citation\-abbreviations\f[]
+.B \f[C]citation\-abbreviations\f[R]
Path to a CSL abbreviations JSON file.
If the file is not found relative to the working directory,
-pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[] directory (or
-\f[C]C:\\Users\\USERNAME\\AppData\\Roaming\\csl\f[] in Windows 7).
+pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or
+\f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]csl\f[R] in
+Windows 7).
The format is described
here (http://citationstylist.org/2011/10/19/abbreviations-for-zotero-test-release).
-Abbreviations are only output if, in the \f[C]\&.csl\f[] file,
-\f[C]form="short"\f[] is set on the element that renders the variable.
+Abbreviations are only output if, in the \f[C]\&.csl\f[R] file,
+\f[C]form=\[dq]short\[dq]\f[R] is set on the element that renders the
+variable.
.RS
.PP
Here is a short example:
.IP
.nf
\f[C]
-{\ "default":\ {
-\ \ \ \ "container\-title":\ {
-\ \ \ \ \ \ \ \ \ \ \ \ "Lloyd\[aq]s\ Law\ Reports":\ "Lloyd\[aq]s\ Rep",
-\ \ \ \ \ \ \ \ \ \ \ \ "Estates\ Gazette":\ "EG",
-\ \ \ \ \ \ \ \ \ \ \ \ "Scots\ Law\ Times":\ "SLT"
+{\ \[dq]default\[dq]:\ {
+\ \ \ \ \[dq]container\-title\[dq]:\ {
+\ \ \ \ \ \ \ \ \ \ \ \ \[dq]Lloyd\[aq]s\ Law\ Reports\[dq]:\ \[dq]Lloyd\[aq]s\ Rep\[dq],
+\ \ \ \ \ \ \ \ \ \ \ \ \[dq]Estates\ Gazette\[dq]:\ \[dq]EG\[dq],
+\ \ \ \ \ \ \ \ \ \ \ \ \[dq]Scots\ Law\ Times\[dq]:\ \[dq]SLT\[dq]
\ \ \ \ }
\ \ }
}
-\f[]
+\f[R]
.fi
.RE
.TP
-.B \f[C]lang\f[]
+.B \f[C]lang\f[R]
Locale to use in formatting citations.
If this is not set, the locale is taken from the
-\f[C]default\-locale\f[] attribute of the CSL file.
-\f[C]en\-US\f[] is used if a locale is not specified in either the
+\f[C]default\-locale\f[R] attribute of the CSL file.
+\f[C]en\-US\f[R] is used if a locale is not specified in either the
metadata or the CSL file.
-(For backwards compatibility, the field \f[C]locale\f[] can be used
-instead of \f[C]lang\f[], but this \f[C]lang\f[] should be used going
+(For backwards compatibility, the field \f[C]locale\f[R] can be used
+instead of \f[C]lang\f[R], but this \f[C]lang\f[R] should be used going
forward.)
.RS
.RE
.TP
-.B \f[C]suppress\-bibliography\f[]
+.B \f[C]suppress\-bibliography\f[R]
If this has a true value, the bibliography will be left off.
Otherwise a bibliography will be inserted into each Div element with id
-\f[C]refs\f[].
+\f[C]refs\f[R].
If there is no such Div, one will be created at the end of the document.
.RS
.RE
.TP
-.B \f[C]reference\-section\-title\f[]
+.B \f[C]reference\-section\-title\f[R]
If this has a value, a section header with this title will be added
before the bibliography.
-If \f[C]reference\-section\-title\f[] is not specified and the document
+If \f[C]reference\-section\-title\f[R] is not specified and the document
ends with a section header, this final header will be treated as the
bibliography header.
.RS
.RE
.TP
-.B \f[C]notes\-after\-punctuation\f[]
+.B \f[C]notes\-after\-punctuation\f[R]
If true (the default), pandoc will put footnote citations after
following punctuation.
-For example, if the source contains \f[C]blah\ blah\ [\@jones99].\f[],
-the result will look like \f[C]blah\ blah.[^1]\f[], with the note moved
-after the period and the space collapsed.
+For example, if the source contains
+\f[C]blah\ blah\ [\[at]jones99].\f[R], the result will look like
+\f[C]blah\ blah.[\[ha]1]\f[R], with the note moved after the period and
+the space collapsed.
If false, the space will still be collapsed, but the footnote will not
be moved after the punctuation.
.RS
.RE
.PP
-The metadata must contain either \f[C]references\f[] or
-\f[C]bibliography\f[] or both as a source of references.
-\f[C]csl\f[] and \f[C]citation\-abbreviations\f[] are optional.
-If \f[C]csl\f[] is not provided, a default stylesheet will be used
-(either \f[C]~/.pandoc/default.csl\f[] or a version of
-\f[C]chicago\-author\-date.csl\f[]).
+The metadata must contain either \f[C]references\f[R] or
+\f[C]bibliography\f[R] or both as a source of references.
+\f[C]csl\f[R] and \f[C]citation\-abbreviations\f[R] are optional.
+If \f[C]csl\f[R] is not provided, a default stylesheet will be used
+(either \f[C]\[ti]/.pandoc/default.csl\f[R] or a version of
+\f[C]chicago\-author\-date.csl\f[R]).
.SS Convert mode
.PP
-If the option \f[C]\-\-bib2yaml\f[] or \f[C]\-\-bib2json\f[] is used,
-\f[C]pandoc\-citeproc\f[] will not process citations; instead, it will
+If the option \f[C]\-\-bib2yaml\f[R] or \f[C]\-\-bib2json\f[R] is used,
+\f[C]pandoc\-citeproc\f[R] will not process citations; instead, it will
treat its input (from stdin or files) as a bibliography and convert it
either to a pandoc YAML metadata section, suitable for inclusion in a
-pandoc document (\f[C]\-\-bib2yaml\f[]), or as a CSL JSON bibliography,
-suitable for import to zotero (\f[C]\-\-bib2json\f[]).
+pandoc document (\f[C]\-\-bib2yaml\f[R]), or as a CSL JSON bibliography,
+suitable for import to zotero (\f[C]\-\-bib2json\f[R]).
.PP
-The \f[C]\-\-format\f[] option can be used to specify the bibliography
-format, though when files are used, \f[C]pandoc\-citeproc\f[] can
+The \f[C]\-\-format\f[R] option can be used to specify the bibliography
+format, though when files are used, \f[C]pandoc\-citeproc\f[R] can
generally guess this from the extension.
.PP
-This mode supersedes the old \f[C]biblio2yaml\f[] program.
+This mode supersedes the old \f[C]biblio2yaml\f[R] program.
.SS Raw content (pandoc\-citeproc only)
.PP
To include raw content in a prefix, suffix, delimiter, or term, surround
@@ -258,7 +268,7 @@ it with these tags indicating the format:
.nf
\f[C]
{{jats}}&lt;ref&gt;{{/jats}}
-\f[]
+\f[R]
.fi
.PP
Without the tags, the string will be interpreted as a string and escaped
@@ -270,43 +280,49 @@ However, stylesheets customized in this way will not be useable by other
CSL implementations.
.SH OPTIONS
.TP
-.B \f[C]\-y,\ \-\-bib2yaml\f[]
+.B \f[C]\-y,\ \-\-bib2yaml\f[R]
Convert bibliography to YAML suitable for inclusion in pandoc metadata.
.RS
.RE
.TP
-.B \f[C]\-j,\ \-\-bib2json\f[]
+.B \f[C]\-j,\ \-\-bib2json\f[R]
Convert bibliography to CSL JSON suitable for import into Zotero.
.RS
.RE
.TP
-.B \f[C]\-f\f[] \f[I]FORMAT\f[], \f[C]\-\-format=\f[]\f[I]FORMAT\f[]
+.B \f[C]\-f\f[R] \f[I]FORMAT\f[R], \f[C]\-\-format=\f[R]\f[I]FORMAT\f[R]
Specify format of bibliography to be converted.
-Legal values are \f[C]biblatex\f[], \f[C]bibtex\f[], \f[C]ris\f[],
-\f[C]endnote\f[], \f[C]endnotexml\f[], \f[C]isi\f[], \f[C]medline\f[],
-\f[C]copac\f[], \f[C]mods\f[], and \f[C]json\f[].
+Legal values are \f[C]biblatex\f[R], \f[C]bibtex\f[R], \f[C]ris\f[R],
+\f[C]endnote\f[R], \f[C]endnotexml\f[R], \f[C]isi\f[R],
+\f[C]medline\f[R], \f[C]copac\f[R], \f[C]mods\f[R], \f[C]nbib\f[R], and
+\f[C]json\f[R].
.RS
.RE
.TP
-.B \f[C]\-h,\ \-\-help\f[]
+.B \f[C]\-h,\ \-\-help\f[R]
Print usage information.
.RS
.RE
.TP
-.B \f[C]\-\-man\f[]
+.B \f[C]\-\-man\f[R]
Print the man page in groff man format.
To get a plain text version,
-\f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Tutf8\f[].
-To \f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Thtml\f[].
+\f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Tutf8\f[R].
+To \f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Thtml\f[R].
.RS
.RE
.TP
-.B \f[C]\-\-license\f[]
+.B \f[C]\-\-license\f[R]
Print the license.
.RS
.RE
.TP
-.B \f[C]\-V,\ \-\-version\f[]
+.B \f[C]\-q,\ \-\-quiet\f[R]
+Silence all warnings.
+.RS
+.RE
+.TP
+.B \f[C]\-V,\ \-\-version\f[R]
Print version.
.RS
.RE
@@ -327,29 +343,29 @@ Particularly relevant are
fields) and
<http://citationstyles.org/downloads/specification.html#appendix-iv-variables>
(which does contain comments).
-.SS Titles: Title vs.\ Sentence Case
+.SS Titles: Title vs.\~Sentence Case
.PP
If you are using a bibtex or biblatex bibliography, then observe the
following rules:
.IP \[bu] 2
English titles should be in title case.
-Non\-English titles should be in sentence case, and the \f[C]langid\f[]
+Non\-English titles should be in sentence case, and the \f[C]langid\f[R]
field in biblatex should be set to the relevant language.
-(The following values are treated as English: \f[C]american\f[],
-\f[C]british\f[], \f[C]canadian\f[], \f[C]english\f[],
-\f[C]australian\f[], \f[C]newzealand\f[], \f[C]USenglish\f[], or
-\f[C]UKenglish\f[].)
+(The following values are treated as English: \f[C]american\f[R],
+\f[C]british\f[R], \f[C]canadian\f[R], \f[C]english\f[R],
+\f[C]australian\f[R], \f[C]newzealand\f[R], \f[C]USenglish\f[R], or
+\f[C]UKenglish\f[R].)
.IP \[bu] 2
As is standard with bibtex/biblatex, proper names should be protected
-with curly braces so that they won't be lowercased in styles that call
-for sentence case.
+with curly braces so that they won\[cq]t be lowercased in styles that
+call for sentence case.
For example:
.RS 2
.IP
.nf
\f[C]
title\ =\ {My\ Dinner\ with\ {Andre}}
-\f[]
+\f[R]
.fi
.RE
.IP \[bu] 2
@@ -360,13 +376,13 @@ protected:
.nf
\f[C]
title\ =\ {Spin\ Wave\ Dispersion\ on\ the\ {nm}\ Scale}
-\f[]
+\f[R]
.fi
.PP
Though this is not necessary in bibtex/biblatex, it is necessary with
citeproc, which stores titles internally in sentence case, and converts
to title case in styles that require it.
-Here we protect \[lq]nm\[rq] so that it doesn't get converted to
+Here we protect \[lq]nm\[rq] so that it doesn\[cq]t get converted to
\[lq]Nm\[rq] at this stage.
.RE
.PP
@@ -375,10 +391,10 @@ the following rules:
.IP \[bu] 2
All titles should be in sentence case.
.IP \[bu] 2
-Use the \f[C]language\f[] field for non\-English titles to prevent their
-conversion to title case in styles that call for this.
-(Conversion happens only if \f[C]language\f[] begins with \f[C]en\f[] or
-is left empty.)
+Use the \f[C]language\f[R] field for non\-English titles to prevent
+their conversion to title case in styles that call for this.
+(Conversion happens only if \f[C]language\f[R] begins with \f[C]en\f[R]
+or is left empty.)
.IP \[bu] 2
Protect words that should not be converted to title case using this
syntax:
@@ -386,37 +402,37 @@ syntax:
.IP
.nf
\f[C]
-Spin\ wave\ dispersion\ on\ the\ <span\ class="nocase">nm</span>\ scale
-\f[]
+Spin\ wave\ dispersion\ on\ the\ <span\ class=\[dq]nocase\[dq]>nm</span>\ scale
+\f[R]
.fi
.RE
-.SS Conference Papers, Published vs.\ Unpublished
+.SS Conference Papers, Published vs.\~Unpublished
.PP
For a formally published conference paper, use the biblatex entry type
-\f[C]inproceedings\f[] (which will be mapped to CSL
-\f[C]paper\-conference\f[]).
+\f[C]inproceedings\f[R] (which will be mapped to CSL
+\f[C]paper\-conference\f[R]).
.PP
For an unpublished manuscript, use the biblatex entry type
-\f[C]unpublished\f[] without an \f[C]eventtitle\f[] field (this entry
-type will be mapped to CSL \f[C]manuscript\f[]).
+\f[C]unpublished\f[R] without an \f[C]eventtitle\f[R] field (this entry
+type will be mapped to CSL \f[C]manuscript\f[R]).
.PP
For a talk, an unpublished conference paper, or a poster presentation,
-use the biblatex entry type \f[C]unpublished\f[] with an
-\f[C]eventtitle\f[] field (this entry type will be mapped to CSL
-\f[C]speech\f[]).
-Use the biblatex \f[C]type\f[] field to indicate the type, e.g.
-\[lq]Paper\[rq], or \[lq]Poster\[rq].
-\f[C]venue\f[] and \f[C]eventdate\f[] may be useful too, though
-\f[C]eventdate\f[] will not be rendered by most CSL styles.
-Note that \f[C]venue\f[] is for the event's venue, unlike
-\f[C]location\f[] which describes the publisher's location; do not use
-the latter for an unpublished conference paper.
+use the biblatex entry type \f[C]unpublished\f[R] with an
+\f[C]eventtitle\f[R] field (this entry type will be mapped to CSL
+\f[C]speech\f[R]).
+Use the biblatex \f[C]type\f[R] field to indicate the type,
+e.g.\~\[lq]Paper\[rq], or \[lq]Poster\[rq].
+\f[C]venue\f[R] and \f[C]eventdate\f[R] may be useful too, though
+\f[C]eventdate\f[R] will not be rendered by most CSL styles.
+Note that \f[C]venue\f[R] is for the event\[cq]s venue, unlike
+\f[C]location\f[R] which describes the publisher\[cq]s location; do not
+use the latter for an unpublished conference paper.
.SH AUTHORS
.PP
Andrea Rossato and John MacFarlane.
.SH SEE ALSO
.PP
-\f[C]pandoc\f[] (1), \f[C]pandoc_markdown\f[] (5).
+\f[C]pandoc\f[R] (1), \f[C]pandoc_markdown\f[R] (5).
.PP
The pandoc\-citeproc source code and all documentation may be downloaded
from <http://github.com/jgm/pandoc-citeproc/>.
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index e99c19b..e189d44 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.14.7
+version: 0.14.8
cabal-version: 1.12
synopsis: Supports using pandoc with citeproc
diff --git a/src/Text/CSL/Eval.hs b/src/Text/CSL/Eval.hs
index c1693df..6fb1293 100644
--- a/src/Text/CSL/Eval.hs
+++ b/src/Text/CSL/Eval.hs
@@ -131,7 +131,8 @@ evalElement el
| Group fm d l <- el = outputList fm d <$> tryGroup l
| Date{} <- el = evalDate el
| Label s f fm _ <- el = formatLabel f fm True s -- FIXME !!
- | Term s f fm p <- el = formatTerm f fm p s
+ | Term s f fm p <- el = getStringVar "ref-id" >>= \refid ->
+ formatTerm f fm p refid s
| Names s n fm d sub <- el = modify (\st -> st { contNum = [] }) >>
ifEmpty (evalNames False s n d)
(withNames s el $ evalElements sub)
diff --git a/src/Text/CSL/Eval/Names.hs b/src/Text/CSL/Eval/Names.hs
index cd4e7e3..b19c029 100644
--- a/src/Text/CSL/Eval/Names.hs
+++ b/src/Text/CSL/Eval/Names.hs
@@ -361,8 +361,9 @@ formatName m b f fm ops np n
| disWithGiven, isLong -> [longName givenLong]
| otherwise -> []
-formatTerm :: Form -> Formatting -> Bool -> String -> State EvalState [Output]
-formatTerm f fm p s = do
+formatTerm :: Form -> Formatting -> Bool -> String -> String
+ -> State EvalState [Output]
+formatTerm f fm p refid s = do
plural <- if s `elem` ["page", "volume", "issue"]
then do
varset <- isVarSet s
@@ -371,7 +372,10 @@ formatTerm f fm p s = do
else return p
else return p
t <- getTerm plural f s
- return $ oStr' t fm
+ return $
+ if s == "no date"
+ then [OYear t refid fm]
+ else oStr' t fm
formatLabel :: Form -> Formatting -> Bool -> String -> State EvalState [Output]
formatLabel f fm p s
diff --git a/src/Text/CSL/Proc/Disamb.hs b/src/Text/CSL/Proc/Disamb.hs
index 7befae8..05a99f1 100644
--- a/src/Text/CSL/Proc/Disamb.hs
+++ b/src/Text/CSL/Proc/Disamb.hs
@@ -28,7 +28,6 @@ import Data.List (elemIndex, find, findIndex, groupBy,
isPrefixOf, mapAccumL, nub, nubBy, sortBy)
import Data.Maybe
import Data.Ord (comparing)
-
import Text.CSL.Eval
import Text.CSL.Reference
import Text.CSL.Style
@@ -382,7 +381,8 @@ allTheSame (x:xs) = all (== x) xs
-- | Add the year suffix to the year. Needed for disambiguation.
addYearSuffix :: Output -> Output
addYearSuffix o
- | OYear y k f <- o = Output [OYear y k emptyFormatting, OYearSuf [] k [] emptyFormatting] f
+ | OYear y k f <- o = Output [ OYear y k emptyFormatting
+ , OYearSuf [] k [] emptyFormatting] f
| ODate (x:xs) <- o = if any hasYear xs
then Output (x : [addYearSuffix $ ODate xs]) emptyFormatting
else addYearSuffix (Output (x:xs) emptyFormatting)
diff --git a/tests/issue325.expected.native b/tests/issue325.expected.native
new file mode 100644
index 0000000..316011e
--- /dev/null
+++ b/tests/issue325.expected.native
@@ -0,0 +1,7 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Smith"]),("given",MetaInlines [Str "John"])])]),("id",MetaInlines [Str "item1"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Smith"]),("given",MetaInlines [Str "John"])])]),("id",MetaInlines [Str "item2"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 2}] [Str "(Smith,",Space,Str "n.d.a,",Space,Str "n.d.b)"]]
+,Div ("refs",["references"],[])
+ [Div ("ref-item1",[],[])
+ [Para [Str "Smith,",Space,Str "John.",Space,Str "n.d.a."]]
+ ,Div ("ref-item2",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "n.d.b."]]]]
diff --git a/tests/issue325.in.native b/tests/issue325.in.native
new file mode 100644
index 0000000..b5f0a8c
--- /dev/null
+++ b/tests/issue325.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Smith"]),("given",MetaInlines [Str "John"])])]),("id",MetaInlines [Str "item1"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Smith"]),("given",MetaInlines [Str "John"])])]),("id",MetaInlines [Str "item2"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@item1;",Space,Str "@item2]"]]]