summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2017-11-08 16:38:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-11-08 16:38:00 (GMT)
commitb9942629a9506a97be97b9e71c996564f378af1f (patch)
tree85e53ef558526d55cf8d0069182009f15c75489f
parent2304e8072397f48137b0e0d994ada49d6cd29959 (diff)
version 0.120.12
-rw-r--r--changelog14
-rw-r--r--chicago-author-date.csl46
-rw-r--r--compat/Text/CSL/Compat/Pandoc.hs4
-rwxr-xr-xlocales/locales-id-ID.xml58
-rw-r--r--locales/locales-nb-NO.xml2
-rw-r--r--locales/locales-nl-NL.xml14
-rw-r--r--locales/locales-nn-NO.xml2
-rw-r--r--locales/locales-pl-PL.xml16
-rw-r--r--locales/locales-sl-SI.xml22
-rw-r--r--pandoc-citeproc.cabal2
-rw-r--r--pandoc-citeproc.hs6
-rw-r--r--src/Text/CSL/Exception.hs19
-rw-r--r--src/Text/CSL/Input/Bibtex.hs32
-rw-r--r--src/Text/CSL/Input/Bibutils.hs24
-rw-r--r--tests/chicago-author-date.expected.native12
-rw-r--r--tests/issue175.expected.native2
-rw-r--r--tests/issue51.expected.native6
-rw-r--r--tests/issue64.expected.native2
-rw-r--r--tests/issue7.expected.native4
-rw-r--r--tests/issue70.expected.native6
-rw-r--r--tests/jats.csl208
-rw-r--r--tests/no-author.expected.native14
-rw-r--r--tests/test-pandoc-citeproc.hs2
23 files changed, 182 insertions, 335 deletions
diff --git a/changelog b/changelog
index 6349456..96aa942 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,17 @@
+pandoc-citeproc (0.12)
+
+ * Text.CSL.Exception: add `renderError`.
+ * Text.CSL.Input.Bibtex: remove `readBibtexString'` (pure version).
+ We don't use this. And we've refactored to raise better errors.
+ * Improved error handling. Throw a CiteprocException instead of
+ using 'error', and render this nicely.
+ * Update chicago-author-date.csl and locales.
+ * Updated tests for chicago-author-date.csl and locale changes.
+ * Pandoc compat module: ensure `writeNative` includes the header.
+ * Use `--accept` instead of `--regenerate` in tests to regenerate test
+ cases.
+ * Bibtex parser: handle comments better (#306).
+
pandoc-citeproc (0.11.1.3)
* Align static flag with pandoc's.
diff --git a/chicago-author-date.csl b/chicago-author-date.csl
index a37684b..d066efa 100644
--- a/chicago-author-date.csl
+++ b/chicago-author-date.csl
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="display-and-sort" page-range-format="chicago">
<info>
- <title>Chicago Manual of Style 16th edition (author-date)</title>
+ <title>Chicago Manual of Style 17th edition (author-date)</title>
<id>http://www.zotero.org/styles/chicago-author-date</id>
<link href="http://www.zotero.org/styles/chicago-author-date" rel="self"/>
<link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
@@ -24,7 +24,7 @@
<category citation-format="author-date"/>
<category field="generic-base"/>
<summary>The author-date variant of the Chicago style</summary>
- <updated>2015-08-26T07:38:25+00:00</updated>
+ <updated>2017-10-12T12:00:00+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale xml:lang="en">
@@ -161,20 +161,14 @@
</choose>
<choose>
<if type="webpage post-weblog" match="any">
- <date variable="issued" delimiter=" ">
- <date-part name="month"/>
- <date-part name="day"/>
- </date>
+ <date variable="issued" form="text"/>
</if>
</choose>
<choose>
<if variable="issued" match="none">
<group delimiter=" ">
<text term="accessed" text-case="capitalize-first"/>
- <date variable="accessed" delimiter=" ">
- <date-part name="month"/>
- <date-part name="day"/>
- </date>
+ <date variable="accessed" form="text"/>
</group>
</if>
</choose>
@@ -182,7 +176,7 @@
<if type="legal_case" match="none">
<choose>
<if variable="DOI">
- <text variable="DOI" prefix="doi:"/>
+ <text variable="DOI" prefix="https://doi.org/"/>
</if>
<else>
<text variable="URL"/>
@@ -366,7 +360,7 @@
<else-if type="article-journal">
<choose>
<if variable="volume issue" match="any">
- <text variable="page" prefix=": "/>
+ <text variable="page" prefix=":"/>
</if>
<else>
<text variable="page" prefix=", "/>
@@ -418,9 +412,19 @@
</if>
</choose>
<choose>
- <if type="legal_case" match="none">
- <text variable="container-title" text-case="title" font-style="italic"/>
+ <if type="webpage">
+ <text variable="container-title" text-case="title"/>
</if>
+ <else-if type="legal_case" match="none">
+ <group delimiter=" ">
+ <text variable="container-title" text-case="title" font-style="italic"/>
+ <choose>
+ <if type="post-weblog">
+ <text value="(blog)"/>
+ </if>
+ </choose>
+ </group>
+ </else-if>
</choose>
</macro>
<macro name="publisher">
@@ -439,11 +443,6 @@
</date>
</group>
</if>
- <else-if variable="accessed">
- <date variable="accessed">
- <date-part name="year"/>
- </date>
- </else-if>
<else-if variable="status">
<text variable="status" text-case="capitalize-first"/>
</else-if>
@@ -462,11 +461,6 @@
</date>
</group>
</if>
- <else-if variable="accessed">
- <date variable="accessed">
- <date-part name="year"/>
- </date>
- </else-if>
<else-if variable="status">
<text variable="status"/>
</else-if>
@@ -566,7 +560,7 @@
</group>
</else-if>
<else-if type="article-newspaper article-magazine personal_communication" match="any">
- <text macro="day-month" prefix=", "/>
+ <date variable="issued" form="text" prefix=", "/>
</else-if>
<else-if type="patent">
<group delimiter=", " prefix=", ">
@@ -599,7 +593,7 @@
</else>
</choose>
</macro>
- <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" givenname-disambiguation-rule="primary-name">
+ <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" givenname-disambiguation-rule="primary-name" collapse="year">
<layout prefix="(" suffix=")" delimiter="; ">
<group delimiter=", ">
<choose>
diff --git a/compat/Text/CSL/Compat/Pandoc.hs b/compat/Text/CSL/Compat/Pandoc.hs
index 8effe7f..1dee8ce 100644
--- a/compat/Text/CSL/Compat/Pandoc.hs
+++ b/compat/Text/CSL/Compat/Pandoc.hs
@@ -67,7 +67,7 @@ writeMarkdown = either mempty T.unpack . runPure . Pandoc.writeMarkdown
writePlain = either mempty T.unpack . runPure . Pandoc.writePlain def
-writeNative = either mempty T.unpack . runPure . Pandoc.writeNative def
+writeNative = either mempty T.unpack . runPure . Pandoc.writeNative def{ writerTemplate = Just "" }
writeHtmlString = either mempty T.unpack . runPure . Pandoc.writeHtml4String
def{ writerExtensions = extensionsFromList
@@ -95,7 +95,7 @@ writeMarkdown = Pandoc.writeMarkdown def{
writePlain = Pandoc.writePlain def
-writeNative = Pandoc.writeNative def
+writeNative = Pandoc.writeNative def{ writerTemplate = Just "" }
writeHtmlString = Pandoc.writeHtmlString def
#endif
diff --git a/locales/locales-id-ID.xml b/locales/locales-id-ID.xml
index 383736c..b0ebde8 100755
--- a/locales/locales-id-ID.xml
+++ b/locales/locales-id-ID.xml
@@ -23,31 +23,31 @@
<term name="anonymous" form="short">anon.</term>
<term name="at">pada</term>
<term name="available at">tersedia pada</term>
- <term name="by">by</term>
+ <term name="by">oleh</term>
<term name="circa">circa</term>
- <term name="circa" form="short">c.</term>
+ <term name="circa" form="short">ca.</term>
<term name="cited">dikutip</term>
<term name="edition">
<single>edisi</single>
<multiple>edisi</multiple>
</term>
<term name="edition" form="short">ed.</term>
- <term name="et-al">et al.</term>
+ <term name="et-al">dkk.</term>
<term name="forthcoming">mendatang</term>
<term name="from">dari</term>
<term name="ibid">ibid.</term>
- <term name="in">in</term>
- <term name="in press">in press</term>
+ <term name="in">dalam</term>
+ <term name="in press">dalam proses cetakan</term>
<term name="internet">internet</term>
<term name="interview">wawancara</term>
<term name="letter">surat</term>
<term name="no date">tanpa tanggal</term>
- <term name="no date" form="short">n.d.</term>
+ <term name="no date" form="short">t.t.</term>
<term name="online">daring</term>
<term name="presented at">dipresentasikan pada</term>
<term name="reference">
- <single>reference</single>
- <multiple>references</multiple>
+ <single>referensi</single>
+ <multiple>referensi</multiple>
</term>
<term name="reference" form="short">
<single>ref.</single>
@@ -143,8 +143,8 @@
<multiple>bagian</multiple>
</term>
<term name="section">
- <single>section</single>
- <multiple>section</multiple>
+ <single>bagian</single>
+ <multiple>bagian</multiple>
</term>
<term name="sub verbo">
<single>sub verbo</single>
@@ -161,25 +161,25 @@
<!-- SHORT LOCATOR FORMS -->
<term name="book" form="short">bk.</term>
- <term name="chapter" form="short">chap.</term>
- <term name="column" form="short">col.</term>
- <term name="figure" form="short">gam.</term>
- <term name="folio" form="short">f.</term>
+ <term name="chapter" form="short">bb.</term>
+ <term name="column" form="short">kol.</term>
+ <term name="figure" form="short">gbr.</term>
+ <term name="folio" form="short">fol.</term>
<term name="issue" form="short">no.</term>
- <term name="line" form="short">l.</term>
- <term name="note" form="short">n.</term>
+ <term name="line" form="short">brs.</term>
+ <term name="note" form="short">ctt.</term>
<term name="opus" form="short">op.</term>
<term name="page" form="short">
- <single>hal.</single>
- <multiple>hal.</multiple>
+ <single>hlm.</single>
+ <multiple>hlm.</multiple>
</term>
<term name="number-of-pages" form="short">
- <single>hal.</single>
- <multiple>hal.</multiple>
+ <single>hlm.</single>
+ <multiple>hlm.</multiple>
</term>
<term name="paragraph" form="short">para.</term>
- <term name="part" form="short">pt.</term>
- <term name="section" form="short">sec.</term>
+ <term name="part" form="short">bag.</term>
+ <term name="section" form="short">bag.</term>
<term name="sub verbo" form="short">
<single>s.v.</single>
<multiple>s.vv.</multiple>
@@ -232,7 +232,7 @@
<!-- SHORT ROLE FORMS -->
<term name="director" form="short">
<single>dir.</single>
- <multiple>dirs.</multiple>
+ <multiple>dir.</multiple>
</term>
<term name="editor" form="short">
<single>ed.</single>
@@ -251,17 +251,17 @@
<multiple>penerj.</multiple>
</term>
<term name="editortranslator" form="short">
- <single>ed. &amp; tran.</single>
- <multiple>ed. &amp; tran.</multiple>
+ <single>ed. &amp; penerj.</single>
+ <multiple>ed. &amp; penerj.</multiple>
</term>
<!-- VERB ROLE FORMS -->
<term name="container-author" form="verb">oleh</term>
<term name="director" form="verb">diarahkan oleh</term>
- <term name="editor" form="verb">diedit oleh</term>
- <term name="editorial-director" form="verb">diedit oleh</term>
+ <term name="editor" form="verb">disunting oleh</term>
+ <term name="editorial-director" form="verb">disunting oleh</term>
<term name="illustrator" form="verb">diilustrasi oleh</term>
- <term name="interviewer" form="verb">interview oleh</term>
+ <term name="interviewer" form="verb">diwawancara oleh</term>
<term name="recipient" form="verb">kepada</term>
<term name="reviewed-author" form="verb">oleh</term>
<term name="translator" form="verb">diterjemahkan oleh</term>
@@ -273,7 +273,7 @@
<term name="editorial-director" form="verb-short">ed. oleh</term>
<term name="illustrator" form="verb-short">illus. oleh</term>
<term name="translator" form="verb-short">trans. oleh</term>
- <term name="editortranslator" form="verb-short">ed. &amp; trans. oleh</term>
+ <term name="editortranslator" form="verb-short">ed. &amp; penerj. oleh</term>
<!-- LONG MONTH FORMS -->
<term name="month-01">Januari</term>
diff --git a/locales/locales-nb-NO.xml b/locales/locales-nb-NO.xml
index 76afe45..838ecdc 100644
--- a/locales/locales-nb-NO.xml
+++ b/locales/locales-nb-NO.xml
@@ -122,7 +122,7 @@
</term>
<term name="page">
<single>side</single>
- <multiple>sider</multiple>
+ <multiple>side</multiple>
</term>
<term name="number-of-pages">
<single>side</single>
diff --git a/locales/locales-nl-NL.xml b/locales/locales-nl-NL.xml
index fc4598b..8685cf4 100644
--- a/locales/locales-nl-NL.xml
+++ b/locales/locales-nl-NL.xml
@@ -6,7 +6,7 @@
<uri>http://twitter.com/rintzezelle</uri>
</translator>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
- <updated>2012-07-04T23:31:02+00:00</updated>
+ <updated>2017-04-01T12:00:00+00:00</updated>
</info>
<style-options punctuation-in-quote="false"/>
<date form="text">
@@ -32,10 +32,10 @@
<term name="circa" form="short">c.</term>
<term name="cited">geciteerd</term>
<term name="edition">
- <single>editie</single>
- <multiple>edities</multiple>
+ <single>druk</single>
+ <multiple>drukken</multiple>
</term>
- <term name="edition" form="short">ed.</term>
+ <term name="edition" form="short">dr.</term>
<term name="et-al">e.a.</term>
<term name="forthcoming">in voorbereiding</term>
<term name="from">van</term>
@@ -274,8 +274,8 @@
<!-- VERB ROLE FORMS -->
<term name="container-author" form="verb">door</term>
<term name="director" form="verb">geregisseerd door</term>
- <term name="editor" form="verb">bewerkt door</term>
- <term name="editorial-director" form="verb">bewerkt door</term>
+ <term name="editor" form="verb">onder redactie van</term>
+ <term name="editorial-director" form="verb">onder redactie van</term>
<term name="illustrator" form="verb">geïllustreerd door</term>
<term name="interviewer" form="verb">geïnterviewd door</term>
<term name="recipient" form="verb">ontvangen door</term>
@@ -285,7 +285,7 @@
<!-- SHORT VERB ROLE FORMS -->
<term name="director" form="verb-short">geregisseerd door</term>
- <term name="editor" form="verb-short">bewerkt door</term>
+ <term name="editor" form="verb-short">onder redactie van</term>
<term name="editorial-director" form="verb-short">bewerkt door</term>
<term name="illustrator" form="verb-short">geïllustreerd door</term>
<term name="translator" form="verb-short">vertaald door</term>
diff --git a/locales/locales-nn-NO.xml b/locales/locales-nn-NO.xml
index e1be26a..98a8630 100644
--- a/locales/locales-nn-NO.xml
+++ b/locales/locales-nn-NO.xml
@@ -122,7 +122,7 @@
</term>
<term name="page">
<single>side</single>
- <multiple>sider</multiple>
+ <multiple>side</multiple>
</term>
<term name="number-of-pages">
<single>side</single>
diff --git a/locales/locales-pl-PL.xml b/locales/locales-pl-PL.xml
index 5690e7f..4d5f273 100644
--- a/locales/locales-pl-PL.xml
+++ b/locales/locales-pl-PL.xml
@@ -109,8 +109,8 @@
<multiple>numery</multiple>
</term>
<term name="line">
- <single>wers</single>
- <multiple>wersy</multiple>
+ <single>wiersz</single>
+ <multiple>wiersze</multiple>
</term>
<term name="note">
<single>notatka</single>
@@ -165,7 +165,7 @@
<term name="opus" form="short">op.</term>
<term name="page" form="short">
<single>s.</single>
- <multiple>ss.</multiple>
+ <multiple>s.</multiple>
</term>
<term name="number-of-pages" form="short">
<single>s.</single>
@@ -225,8 +225,8 @@
<!-- SHORT ROLE FORMS -->
<term name="director" form="short">
- <single>dyr.</single>
- <multiple>dyr.</multiple>
+ <single>reż.</single>
+ <multiple>reż.</multiple>
</term>
<term name="editor" form="short">
<single>red.</single>
@@ -251,10 +251,10 @@
<!-- VERB ROLE FORMS -->
<term name="container-author" form="verb">przez</term>
- <term name="director" form="verb">directed by</term>
+ <term name="director" form="verb">reżyserowane przez</term>
<term name="editor" form="verb">zredagowane przez</term>
<term name="editorial-director" form="verb">zredagowane przez</term>
- <term name="illustrator" form="verb">ilustrowane przez by</term>
+ <term name="illustrator" form="verb">ilustrowane przez</term>
<term name="interviewer" form="verb">przeprowadzony przez</term>
<term name="recipient" form="verb">dla</term>
<term name="reviewed-author" form="verb">przez</term>
@@ -262,7 +262,7 @@
<term name="editortranslator" form="verb">zredagowane i przetłumaczone przez</term>
<!-- SHORT VERB ROLE FORMS -->
- <term name="director" form="verb-short">dir.</term>
+ <term name="director" form="verb-short">reż.</term>
<term name="editor" form="verb-short">red.</term>
<term name="editorial-director" form="verb-short">red.</term>
<term name="illustrator" form="verb-short">il.</term>
diff --git a/locales/locales-sl-SI.xml b/locales/locales-sl-SI.xml
index 5e0cccb..684ac3c 100644
--- a/locales/locales-sl-SI.xml
+++ b/locales/locales-sl-SI.xml
@@ -16,23 +16,23 @@
<date-part name="year"/>
</date>
<terms>
- <term name="accessed">dostopano</term>
+ <term name="accessed">pridobljeno</term>
<term name="and">in</term>
<term name="and others">in drugi</term>
<term name="anonymous">anonimni</term>
<term name="anonymous" form="short">anon.</term>
<term name="at">pri</term>
- <term name="available at">dostopno</term>
+ <term name="available at">dostopno na</term>
<term name="by"></term>
- <term name="circa">circa</term>
- <term name="circa" form="short">ca.</term>
+ <term name="circa">približno</term>
+ <term name="circa" form="short">prib.</term>
<term name="cited">citirano</term>
<term name="edition">
<single>izdaja</single>
<multiple>izdaje</multiple>
</term>
<term name="edition" form="short">izd.</term>
- <term name="et-al">idr.</term>
+ <term name="et-al">in dr.</term>
<term name="forthcoming">pred izidom</term>
<term name="from">od</term>
<term name="ibid">isto</term>
@@ -156,7 +156,7 @@
<!-- SHORT LOCATOR FORMS -->
<term name="book" form="short">knj.</term>
<term name="chapter" form="short">pogl.</term>
- <term name="column" form="short">sto.</term>
+ <term name="column" form="short">stolp.</term>
<term name="figure" form="short">sl.</term>
<term name="folio" form="short">fol.</term>
<term name="issue" form="short">št.</term>
@@ -173,10 +173,10 @@
</term>
<term name="paragraph" form="short">odst.</term>
<term name="part" form="short">del</term>
- <term name="section" form="short">odsek</term>
+ <term name="section" form="short">ods.</term>
<term name="sub verbo" form="short">
- <single>s.v.</single>
- <multiple>s.v.</multiple>
+ <single>s. v.</single>
+ <multiple>s. v.</multiple>
</term>
<term name="verse" form="short">
<single>v.</single>
@@ -200,7 +200,7 @@
<!-- LONG ROLE FORMS -->
<term name="director">
<single>režiser</single>
- <multiple>režiser</multiple>
+ <multiple>režiserji</multiple>
</term>
<term name="editor">
<single>urednik</single>
@@ -257,7 +257,7 @@
<term name="illustrator" form="verb">ilustriral</term>
<term name="interviewer" form="verb">intervjuval</term>
<term name="recipient" form="verb">za</term>
- <term name="reviewed-author" form="verb"></term>
+ <term name="reviewed-author" form="verb">od</term>
<term name="translator" form="verb">prevedel</term>
<term name="editortranslator" form="verb">uredil &amp; prevedel</term>
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index 180c937..1d97838 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.11.1.3
+version: 0.12
cabal-version: >= 1.12
synopsis: Supports using pandoc with citeproc
diff --git a/pandoc-citeproc.hs b/pandoc-citeproc.hs
index 0299a2f..3717dac 100644
--- a/pandoc-citeproc.hs
+++ b/pandoc-citeproc.hs
@@ -2,6 +2,7 @@
module Main where
import Text.CSL.Input.Bibutils (readBiblioString, BibFormat(..))
import Text.CSL.Reference (Reference(refId), Literal(..))
+import Text.CSL.Exception
import Data.List (group, sort)
import Data.Char (chr, toLower)
import Data.Yaml.Builder (toByteString)
@@ -75,9 +76,8 @@ main = do
, confCompare = compare
, confNumFormat = Generic }
else E.catch (toJSONFilter doCites)
- (\(e :: SomeException) -> do
- UTF8.hPutStrLn stderr $
- "pandoc-citeproc: error running filter.\n" ++ show e
+ (\(e :: CiteprocException) -> do
+ UTF8.hPutStrLn stderr $ renderError e
exitWith (ExitFailure 1))
formatFromExtension :: FilePath -> Maybe BibFormat
diff --git a/src/Text/CSL/Exception.hs b/src/Text/CSL/Exception.hs
index 4faadd6..3b33476 100644
--- a/src/Text/CSL/Exception.hs
+++ b/src/Text/CSL/Exception.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
-module Text.CSL.Exception (CiteprocException(..)) where
+module Text.CSL.Exception (CiteprocException(..), renderError) where
import Control.Exception (Exception)
import Data.Data
@@ -17,3 +17,20 @@ data CiteprocException =
instance Exception CiteprocException
+renderError :: CiteprocException -> String
+renderError (ErrorParsingReferences s) =
+ "Error parsing references: " ++ s
+renderError (CouldNotFindAbbrevFile s) =
+ "Could not find abbreviation file: " ++ s
+renderError (CouldNotFindBibFile s) =
+ "Could not find bibliography file: " ++ s
+renderError (ErrorReadingBibFile f s) =
+ "Error reading bibliography " ++ f ++ " " ++ s
+renderError (ErrorReadingBib s) =
+ "Error reading bibliography " ++ s
+renderError ErrorSplittingDate =
+ "Error splitting date"
+renderError (MacroNotFound s) =
+ "Macro not found: " ++ s
+renderError (DependentStyleHasItselfAsParent s) =
+ "Dependent style " ++ s ++ " has itself as parent"
diff --git a/src/Text/CSL/Input/Bibtex.hs b/src/Text/CSL/Input/Bibtex.hs
index 3136cc5..37a7fb2 100644
--- a/src/Text/CSL/Input/Bibtex.hs
+++ b/src/Text/CSL/Input/Bibtex.hs
@@ -14,7 +14,6 @@
module Text.CSL.Input.Bibtex
( readBibtex
, readBibtexString
- , readBibtexString'
, Lang(..)
, langToLocale
, getLangFromEnv
@@ -23,7 +22,10 @@ module Text.CSL.Input.Bibtex
import Text.Parsec hiding (optional, (<|>), many, State)
import Control.Applicative
+import qualified Control.Exception as E
import Text.CSL.Compat.Pandoc (readLaTeX)
+import Text.CSL.Exception
+ (CiteprocException (ErrorReadingBib, ErrorReadingBibFile))
import Text.Pandoc.Definition
import Text.Pandoc.Generic (bottomUp)
import Data.List.Split (splitOn, splitWhen, wordsBy)
@@ -103,24 +105,24 @@ getLangFromEnv = do
-- BibTeX; otherwse as BibLaTeX. If the second parameter is
-- true, an "untitlecase" transformation will be performed.
readBibtex :: Bool -> Bool -> FilePath -> IO [Reference]
-readBibtex isBibtex caseTransform f =
- UTF8.readFile f >>= readBibtexString isBibtex caseTransform
+readBibtex isBibtex caseTransform f = do
+ contents <- UTF8.readFile f
+ E.catch (readBibtexString isBibtex caseTransform contents)
+ (\e -> case e of
+ ErrorReadingBib es -> E.throwIO $ ErrorReadingBibFile f es
+ _ -> E.throwIO e)
-- | Like 'readBibtex' but operates on a String rather than a file.
readBibtexString :: Bool -> Bool -> String -> IO [Reference]
readBibtexString isBibtex caseTransform contents = do
lang <- getLangFromEnv
locale <- parseLocale (langToLocale lang)
- return $ readBibtexString' isBibtex caseTransform lang locale contents
-
--- | Pure version of readBibtexString (does not try to get the language
--- from the environment).
-readBibtexString' :: Bool -> Bool -> Lang -> Locale -> String -> [Reference]
-readBibtexString' isBibtex caseTransform lang locale bibstring =
- let items = case runParser (bibEntries <* eof) [] "stdin" bibstring of
- Left err -> error (show err)
- Right xs -> resolveCrossRefs isBibtex xs
- in mapMaybe (itemToReference lang locale isBibtex caseTransform) items
+ case runParser (bibEntries <* eof) [] "stdin" contents of
+ -- drop 8 to remove "stdin" + space
+ Left err -> E.throwIO $ ErrorReadingBib $ drop 8 $ show err
+ Right xs -> return $ mapMaybe
+ (itemToReference lang locale isBibtex caseTransform)
+ (resolveCrossRefs isBibtex xs)
type BibParser = Parsec [Char] [(String, String)]
@@ -138,7 +140,8 @@ bibComment :: BibParser ()
bibComment = try $ do
char '@'
cistring "comment"
- skipMany (satisfy (/='\n'))
+ spaces
+ void inBraces <|> bibSkip <|> return ()
bibPreamble :: BibParser ()
bibPreamble = try $ do
@@ -146,7 +149,6 @@ bibPreamble = try $ do
cistring "preamble"
spaces
void inBraces
- return ()
bibString :: BibParser ()
bibString = try $ do
diff --git a/src/Text/CSL/Input/Bibutils.hs b/src/Text/CSL/Input/Bibutils.hs
index b36c1e6..07c939f 100644
--- a/src/Text/CSL/Input/Bibutils.hs
+++ b/src/Text/CSL/Input/Bibutils.hs
@@ -115,22 +115,22 @@ readBiblioString b s
readBiblioFile' :: FilePath -> BiblioIn -> IO [Reference]
readBiblioFile' fin bin
| bin == biblatex_in = readBibtex False True fin
- | otherwise = E.handle handleBibfileError
- $ withTempDir "citeproc"
+ | otherwise = withTempDir "citeproc"
$ \tdir -> do
let tfile = tdir </> "bibutils-tmp"
- param <- bibl_initparams bin bibtex_out "hs-bibutils"
- bibl <- bibl_init
- unsetBOM param
- setCharsetIn param bibl_charset_unicode
- setCharsetOut param bibl_charset_unicode
- _ <- bibl_read param bibl fin
- _ <- bibl_write param bibl tfile
- bibl_free bibl
- bibl_freeparams param
+ E.handle handleBibfileError $ do
+ param <- bibl_initparams bin bibtex_out "hs-bibutils"
+ bibl <- bibl_init
+ unsetBOM param
+ setCharsetIn param bibl_charset_unicode
+ setCharsetOut param bibl_charset_unicode
+ _ <- bibl_read param bibl fin
+ _ <- bibl_write param bibl tfile
+ bibl_free bibl
+ bibl_freeparams param
refs <- readBibtex True False tfile
return $! refs
- where handleBibfileError :: E.SomeException -> IO [Reference]
+ where handleBibfileError :: E.SomeException -> IO ()
handleBibfileError e = E.throwIO $ ErrorReadingBibFile fin (show e)
-- | Perform a function in a temporary directory and clean up.
diff --git a/tests/chicago-author-date.expected.native b/tests/chicago-author-date.expected.native
index 308964d..362bb0e 100644
--- a/tests/chicago-author-date.expected.native
+++ b/tests/chicago-author-date.expected.native
@@ -5,14 +5,20 @@ Pandoc (Meta {unMeta = fromList [("bibliography",MetaInlines [Str "tests/biblio.
,Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 3}] [Str "Doe",Space,Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ")"],Space,Str "says",Space,Str "blah."]
,Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "30"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 4}] [Str "Doe",Space,Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "30)"],Space,Str "says",Space,Str "blah."]
,Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "30,",Space,Str "with",Space,Str "suffix"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 5}] [Str "Doe",Space,Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "30,",Space,Str "with",Space,Str "suffix)"],Space,Str "says",Space,Str "blah."]
-,Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 6},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.",Space,Str "30"], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 7},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "see",Space,Str "also"], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 8}] [Str "Doe",Space,Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ";",Space,Link ("",[],[]) [Str "2006"] ("#ref-item2",""),Str ",",Space,Str "30;",Space,Str "see",Space,Str "also",Space,Str "Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ")"],Space,Str "says",Space,Str "blah."]
+,Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 6},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.",Space,Str "30"], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 7},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "see",Space,Str "also"], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 8}] [Str "Doe",Space,Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Link ("",[],[]) [Str "2006"] ("#ref-item2",""),Str ",",Space,Str "30;",Space,Str "see",Space,Str "also",Space,Str "Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ")"],Space,Str "says",Space,Str "blah."]
,Para [Str "In",Space,Str "a",Space,Str "note.",Note [Para [Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "12"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 9}] [Str "Doe",Space,Str "and",Space,Str "Roe",Space,Str "(",Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ",",Space,Str "12)"],Space,Str "and",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "locators",Space,Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 10}] [Str "(Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ")"],Str "."]]]
,Para [Str "A",Space,Str "citation",Space,Str "group",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.",Space,Str "3"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 11},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "also"], citationSuffix = [Space,Str "p.",Space,Str "34-35"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 12}] [Str "(see",Space,Str "Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "chap.",Space,Str "3;",Space,Str "also",Space,Str "Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ",",Space,Str "34\8211\&35)"],Str "."]
,Para [Str "Another",Space,Str "one",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "p.",Space,Str "34-35"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 13}] [Str "(see",Space,Str "Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "34\8211\&35)"],Str "."]
-,Para [Str "And",Space,Str "another",Space,Str "one",Space,Str "in",Space,Str "a",Space,Str "note.",Note [Para [Str "Some",Space,Str "citations",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.",Space,Str "3"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 14},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 15},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 16}] [Str "(see",Space,Str "Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "chap.",Space,Str "3;",Space,Str "Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ";",Space,Str "Doe",Space,Link ("",[],[]) [Str "2006"] ("#ref-item2",""),Str ")"],Str "."]]]
+,Para [Str "And",Space,Str "another",Space,Str "one",Space,Str "in",Space,Str "a",Space,Str "note.",Note [Para [Str "Some",Space,Str "citations",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.",Space,Str "3"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 14},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 15},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 16}] [Str "(see",Space,Str "Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "chap.",Space,Str "3,",Space,Link ("",[],[]) [Str "2006"] ("#ref-item2",""),Str ";",Space,Str "Doe",Space,Str "and",Space,Str "Roe",Space,Link ("",[],[]) [Str "2007"] ("#ref-\1087\1091\1085\1082\1090\&3",""),Str ")"],Str "."]]]
,Para [Str "Citation",Space,Str "with",Space,Str "a",Space,Str "suffix",Space,Str "and",Space,Str "locator",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "pp.",Space,Str "33,",Space,Str "35-37,",Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 17}] [Str "(Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "33,",Space,Str "35\8211\&37,",Space,Str "and",Space,Str "nowhere",Space,Str "else)"],Str "."]
,Para [Str "Citation",Space,Str "with",Space,Str "suffix",Space,Str "only",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 18}] [Str "(Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Space,Str "and",Space,Str "nowhere",Space,Str "else)"],Str "."]
,Para [Str "Now",Space,Str "some",Space,Str "modifiers.",Note [Para [Str "Like",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "author:",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 19}] [Str "(",Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ")"],Str ",",Space,Str "and",Space,Str "now",Space,Str "Doe",Space,Str "with",Space,Str "a",Space,Str "locator",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.",Space,Str "44"], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 20}] [Str "(",Link ("",[],[]) [Str "2006"] ("#ref-item2",""),Str ",",Space,Str "44)"],Str "."]]]
,Para [Str "With",Space,Str "some",Space,Str "markup",Space,Cite [Citation {citationId = "item1", citationPrefix = [Emph [Str "see"]], citationSuffix = [Space,Str "p.",Space,Strong [Str "32"]], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 21}] [Str "(",Emph [Str "see"],Space,Str "Doe",Space,Link ("",[],[]) [Str "2005"] ("#ref-item1",""),Str ",",Space,Str "32)"],Str "."]
,Header 1 ("references",["unnumbered"],[]) [Str "References"]
-,Div ("refs",["references"],[]) [Div ("ref-item1",[],[]) [Para [Str "Doe,",Space,Str "John.",Space,Str "2005.",Space,Emph [Str "First",Space,Str "Book"],Str ".",Space,Str "Cambridge:",Space,Str "Cambridge",Space,Str "University",Space,Str "Press."]],Div ("ref-item2",[],[]) [Para [Str "\8212\8212\8212.",Space,Str "2006.",Space,Str "\8220Article.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Generic",Space,Str "Studies"],Space,Str "6:",Space,Str "33\8211\&34."]],Div ("ref-\1087\1091\1085\1082\1090\&3",[],[]) [Para [Str "Doe,",Space,Str "John,",Space,Str "and",Space,Str "Jenny",Space,Str "Roe.",Space,Str "2007.",Space,Str "\8220Why",Space,Str "Water",Space,Str "Is",Space,Str "Wet.\8221",Space,Str "In",Space,Emph [Str "Third",Space,Str "Book"],Str ",",Space,Str "edited",Space,Str "by",Space,Str "Sam",Space,Str "Smith.",Space,Str "Oxford:",Space,Str "Oxford",Space,Str "University",Space,Str "Press."]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-item1",[],[])
+ [Para [Str "Doe,",Space,Str "John.",Space,Str "2005.",Space,Emph [Str "First",Space,Str "Book"],Str ".",Space,Str "Cambridge:",Space,Str "Cambridge",Space,Str "University",Space,Str "Press."]]
+ ,Div ("ref-item2",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006.",Space,Str "\8220Article.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Generic",Space,Str "Studies"],Space,Str "6:33\8211\&34."]]
+ ,Div ("ref-\1087\1091\1085\1082\1090\&3",[],[])
+ [Para [Str "Doe,",Space,Str "John,",Space,Str "and",Space,Str "Jenny",Space,Str "Roe.",Space,Str "2007.",Space,Str "\8220Why",Space,Str "Water",Space,Str "Is",Space,Str "Wet.\8221",Space,Str "In",Space,Emph [Str "Third",Space,Str "Book"],Str ",",Space,Str "edited",Space,Str "by",Space,Str "Sam",Space,Str "Smith.",Space,Str "Oxford:",Space,Str "Oxford",Space,Str "University",Space,Str "Press."]]]]
diff --git a/tests/issue175.expected.native b/tests/issue175.expected.native
index 9875fab..c3461a9 100644
--- a/tests/issue175.expected.native
+++ b/tests/issue175.expected.native
@@ -6,4 +6,4 @@ Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("au
[Para [Str "Doe,",Space,Str "Jane.",Space,Str "2011.",Space,Str "\8220A",Space,Str "Title.\8221",Space,Emph [Str "A",Space,Str "Magazine"],Str ",",Space,Str "January\8211February."]]
,Div ("refs",["references"],[])
[Div ("ref-item1",[],[])
- [Para [Str "Doe,",Space,Str "Jane.",Space,Str "2011.",Space,Str "\8220A",Space,Str "Title.\8221",Space,Emph [Str "A",Space,Str "Magazine"],Str ",",Space,Str "January\8211February."]]]]
+ [Para [Str "Doe,",Space,Str "Jane.",Space,Str "2011.",Space,Str "\8220A",Space,Str "Title.\8221",Space,Emph [Str "A",Space,Str "Magazine"],Str ",",Space,Str "January\8211February",Space,Str "2011."]]]]
diff --git a/tests/issue51.expected.native b/tests/issue51.expected.native
index 36dfe09..465f1cf 100644
--- a/tests/issue51.expected.native
+++ b/tests/issue51.expected.native
@@ -1,3 +1,7 @@
Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "Journal",Space,Str "of",Space,Str "Something"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "1987"],MetaList [MetaString "1988"]])])),("page",MetaInlines [Str "12-34"]),("title",MetaInlines [Str "The",Space,Str "title"]),("type",MetaInlines [Str "article-journal"]),("volume",MetaString "3")]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Roe"]),("given",MetaInlines [Str "Ron"])])]),("container-title",MetaInlines [Str "Journal",Space,Str "of",Space,Str "Something"]),("id",MetaInlines [Str "item2"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "1987"]])])),("page",MetaInlines [Str "12-34"]),("title",MetaInlines [Str "The",Space,Str "title"]),("type",MetaInlines [Str "article-journal"]),("volume",MetaString "4")])])]})
[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Doe",Space,Str "(1987\8211\&1988)"],Str ";",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "Roe",Space,Str "(1987)"]]
-,Div ("refs",["references"],[]) [Div ("ref-item1",[],[]) [Para [Str "Doe,",Space,Str "John.",Space,Str "1987\8211\&1988.",Space,Str "\8220The",Space,Str "Title.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Something"],Space,Str "3:",Space,Str "12\8211\&34."]],Div ("ref-item2",[],[]) [Para [Str "Roe,",Space,Str "Ron.",Space,Str "1987.",Space,Str "\8220The",Space,Str "Title.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Something"],Space,Str "4:",Space,Str "12\8211\&34."]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-item1",[],[])
+ [Para [Str "Doe,",Space,Str "John.",Space,Str "1987\8211\&1988.",Space,Str "\8220The",Space,Str "Title.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Something"],Space,Str "3:12\8211\&34."]]
+ ,Div ("ref-item2",[],[])
+ [Para [Str "Roe,",Space,Str "Ron.",Space,Str "1987.",Space,Str "\8220The",Space,Str "Title.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Something"],Space,Str "4:12\8211\&34."]]]]
diff --git a/tests/issue64.expected.native b/tests/issue64.expected.native
index b418c82..4940743 100644
--- a/tests/issue64.expected.native
+++ b/tests/issue64.expected.native
@@ -3,6 +3,6 @@ Pandoc (Meta {unMeta = fromList [("bibliography",MetaList [MetaInlines [Str "tes
[Div ("ref-item1",[],[])
[Para [Str "Doe,",Space,Str "John.",Space,Str "2005.",Space,Emph [Str "First",Space,Str "Book"],Str ".",Space,Str "Cambridge:",Space,Str "Cambridge",Space,Str "University",Space,Str "Press."]]
,Div ("ref-item2",[],[])
- [Para [Str "\8212\8212\8212.",Space,Str "2006.",Space,Str "\8220Article.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Generic",Space,Str "Studies"],Space,Str "6:",Space,Str "33\8211\&34."]]
+ [Para [Str "\8212\8212\8212.",Space,Str "2006.",Space,Str "\8220Article.\8221",Space,Emph [Str "Journal",Space,Str "of",Space,Str "Generic",Space,Str "Studies"],Space,Str "6:33\8211\&34."]]
,Div ("ref-\1087\1091\1085\1082\1090\&3",[],[])
[Para [Str "Doe,",Space,Str "John,",Space,Str "and",Space,Str "Jenny",Space,Str "Roe.",Space,Str "2007.",Space,Str "\8220Why",Space,Str "Water",Space,Str "Is",Space,Str "Wet.\8221",Space,Str "In",Space,Emph [Str "Third",Space,Str "Book"],Str ",",Space,Str "edited",Space,Str "by",Space,Str "Sam",Space,Str "Smith.",Space,Str "Oxford:",Space,Str "Oxford",Space,Str "University",Space,Str "Press."]]]]
diff --git a/tests/issue7.expected.native b/tests/issue7.expected.native
index f8f754e..cb69e3c 100644
--- a/tests/issue7.expected.native
+++ b/tests/issue7.expected.native
@@ -1,3 +1,5 @@
Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaMap (fromList [("family",MetaInlines [Str "Author"]),("given",MetaList [MetaInlines [Str "Ann"]])])),("container-title",MetaInlines [Str "Journal"]),("id",MetaInlines [Str "item1"]),("issued",MetaList [MetaMap (fromList [("day",MetaString "24"),("month",MetaString "9"),("year",MetaString "2011")]),MetaMap (fromList [("day",MetaString "26"),("month",MetaString "9"),("year",MetaString "2011")])]),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-magazine"])])])]})
[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Author",Space,Str "(2011)"]]
-,Div ("refs",["references"],[]) [Div ("ref-item1",[],[]) [Para [Str "Author,",Space,Str "Ann.",Space,Str "2011.",Space,Str "\8220Title.\8221",Space,Emph [Str "Journal"],Str ",",Space,Str "September",Space,Str "24\8211\&26."]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-item1",[],[])
+ [Para [Str "Author,",Space,Str "Ann.",Space,Str "2011.",Space,Str "\8220Title.\8221",Space,Emph [Str "Journal"],Str ",",Space,Str "September",Space,Str "24\8211\&26,",Space,Str "2011."]]]]
diff --git a/tests/issue70.expected.native b/tests/issue70.expected.native
index 75d36b9..3829765 100644
--- a/tests/issue70.expected.native
+++ b/tests/issue70.expected.native
@@ -1,3 +1,7 @@
Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("ISBN",MetaInlines [Str "9782503531465"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Dinkova-Bruun"]),("given",MetaInlines [Str "Greti"])])]),("call-number",MetaInlines [Str "CB351",Space,Str ".F564",Space,Str "2009"]),("collection-number",MetaInlines [Str "50"]),("collection-title",MetaInlines [Str "Textes",Space,Str "et",Space,Str "\233tudes",Space,Str "du",Space,Str "moyen",Space,Str "\226ge"]),("container-title",MetaInlines [Str "Florilegium",Space,Str "mediaevale:",Space,Str "\201tudes",Space,Str "offertes",Space,Str "\224",Space,Str "Jacqueline",Space,Str "Hamesse",Space,Str "\224",Space,Str "l\8217occasion",Space,Str "de",Space,Str "son",Space,Str "\233m\233ritat"]),("editor",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Meirinhos"]),("given",MetaInlines [Str "Jos\233",Space,Str "Francisco"])]),MetaMap (fromList [("family",MetaInlines [Str "Weijers"]),("given",MetaInlines [Str "Olga"])])]),("event-place",MetaInlines [Str "Louvain-la-Neuve"]),("first-reference-note-number",MetaString "1"),("id",MetaInlines [Str "bruun:2009samuel"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2009"]])])),("language",MetaInlines [Str "French"]),("page",MetaInlines [Str "155\8211\&174"]),("publisher",MetaInlines [Str "F\233d\233ration",Space,Str "Internationale",Space,Str "des",Space,Str "Instituts",Space,Str "d\8217\201tudes",Space,Str "M\233di\233vales"]),("publisher-place",MetaInlines [Str "Louvain-la-Neuve"]),("source",MetaInlines [Str "Library",Space,Str "of",Space,Str "Congress",Space,Str "ISBN"]),("title",MetaInlines [Str "Samuel",Space,Str "Presbyter",Space,Str "and",Space,Str "the",Space,Str "Glosses",Space,Str "to",Space,Str "His",Space,Str "Versification",Space,Str "of",Space,Str "Psalm",Space,Str "1:",Space,Str "An",Space,Str "Anti-Church",Space,Str "Invective?"]),("title-short",MetaInlines [Str "Samuel",Space,Str "Presbyter"]),("type",MetaInlines [Str "chapter"])]),MetaMap (fromList [("ISSN",MetaInlines [Str "0362-1529"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Thorndike"]),("given",MetaInlines [Str "Lynn"])])]),("container-title",MetaInlines [Str "Traditio"]),("first-reference-note-number",MetaString "1"),("id",MetaInlines [Str "thorndike:1955unde"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "1955"]])])),("language",MetaInlines [Str "Latin"]),("note",MetaInlines [Str "ArticleType:",Space,Str "research-article",Space,Str "/",Space,Str "Full",Space,Str "publication",Space,Str "date:",Space,Str "1955",Space,Str "/",Space,Str "Copyright",Space,Str "\169",Space,Str "1955",Space,Str "Fordham",Space,Str "University"]),("page",MetaInlines [Str "163\8211\&193"]),("source",MetaInlines [Str "JSTOR"]),("title",MetaInlines [Str "Unde",Space,Str "versus"]),("type",MetaInlines [Str "article-journal"]),("volume",MetaInlines [Str "11"])])])]})
[Para [Cite [Citation {citationId = "thorndike:1955unde", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1},Citation {citationId = "bruun:2009samuel", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 2}] [Str "(Thorndike",Space,Str "1955;",Space,Str "Dinkova-Bruun",Space,Str "2009)"]]
-,Div ("refs",["references"],[]) [Div ("ref-bruun:2009samuel",[],[]) [Para [Str "Dinkova-Bruun,",Space,Str "Greti.",Space,Str "2009.",Space,Str "\8220Samuel",Space,Str "Presbyter",Space,Str "and",Space,Str "the",Space,Str "Glosses",Space,Str "to",Space,Str "His",Space,Str "Versification",Space,Str "of",Space,Str "Psalm",Space,Str "1:",Space,Str "An",Space,Str "Anti-Church",Space,Str "Invective?\8221",Space,Str "In",Space,Emph [Str "Florilegium",Space,Str "mediaevale:",Space,Str "\201tudes",Space,Str "offertes",Space,Str "\224",Space,Str "Jacqueline",Space,Str "Hamesse",Space,Str "\224",Space,Str "l\8217occasion",Space,Str "de",Space,Str "son",Space,Str "\233m\233ritat"],Str ",",Space,Str "edited",Space,Str "by",Space,Str "Jos\233",Space,Str "Francisco",Space,Str "Meirinhos",Space,Str "and",Space,Str "Olga",Space,Str "Weijers,",Space,Str "155\8211\&74.",Space,Str "Textes",Space,Str "et",Space,Str "\233tudes",Space,Str "du",Space,Str "moyen",Space,Str "\226ge",Space,Str "50.",Space,Str "Louvain-la-Neuve:",Space,Str "F\233d\233ration",Space,Str "Internationale",Space,Str "des",Space,Str "Instituts",Space,Str "d\8217\201tudes",Space,Str "M\233di\233vales."]],Div ("ref-thorndike:1955unde",[],[]) [Para [Str "Thorndike,",Space,Str "Lynn.",Space,Str "1955.",Space,Str "\8220Unde",Space,Str "versus.\8221",Space,Emph [Str "Traditio"],Space,Str "11:",Space,Str "163\8211\&93."]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-bruun:2009samuel",[],[])
+ [Para [Str "Dinkova-Bruun,",Space,Str "Greti.",Space,Str "2009.",Space,Str "\8220Samuel",Space,Str "Presbyter",Space,Str "and",Space,Str "the",Space,Str "Glosses",Space,Str "to",Space,Str "His",Space,Str "Versification",Space,Str "of",Space,Str "Psalm",Space,Str "1:",Space,Str "An",Space,Str "Anti-Church",Space,Str "Invective?\8221",Space,Str "In",Space,Emph [Str "Florilegium",Space,Str "mediaevale:",Space,Str "\201tudes",Space,Str "offertes",Space,Str "\224",Space,Str "Jacqueline",Space,Str "Hamesse",Space,Str "\224",Space,Str "l\8217occasion",Space,Str "de",Space,Str "son",Space,Str "\233m\233ritat"],Str ",",Space,Str "edited",Space,Str "by",Space,Str "Jos\233",Space,Str "Francisco",Space,Str "Meirinhos",Space,Str "and",Space,Str "Olga",Space,Str "Weijers,",Space,Str "155\8211\&74.",Space,Str "Textes",Space,Str "et",Space,Str "\233tudes",Space,Str "du",Space,Str "moyen",Space,Str "\226ge",Space,Str "50.",Space,Str "Louvain-la-Neuve:",Space,Str "F\233d\233ration",Space,Str "Internationale",Space,Str "des",Space,Str "Instituts",Space,Str "d\8217\201tudes",Space,Str "M\233di\233vales."]]
+ ,Div ("ref-thorndike:1955unde",[],[])
+ [Para [Str "Thorndike,",Space,Str "Lynn.",Space,Str "1955.",Space,Str "\8220Unde",Space,Str "versus.\8221",Space,Emph [Str "Traditio"],Space,Str "11:163\8211\&93."]]]]
diff --git a/tests/jats.csl b/tests/jats.csl
deleted file mode 100644
index 6487286..0000000
--- a/tests/jats.csl
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" default-locale="en-US">
- <info>
- <title>Journal Article Tag Suite</title>
- <title-short>JATS</title-short>
- <id>http://www.zotero.org/styles/journal-article-tag-suite</id>
- <link href="https://github.com/MartinPaulEve/JATS-CSL/blob/master/jats.csl" rel="self"/>
- <link rel="documentation" href="http://jats.nlm.nih.gov/archiving/tag-library/1.0/index.html"/>
- <author>
- <name>Martin Paul Eve</name>
- <email>martin@martineve.com</email>
- </author>
- <category citation-format="numeric"/>
- <category field="medicine"/>
- <category field="biology"/>
- <summary>Use this style to generate bibliographic data in Journal Article Tagging Suite (JATS) 1.0 XML format</summary>
- <updated>2014-06-21T17:41:26+00:00</updated>
- <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Originally by Martin Fenner.</rights>
- </info>
- <locale xml:lang="en">
- <terms>
- <term name="et-al">{{jats}}&lt;etal/&gt;{{/jats}}</term>
- </terms>
- </locale>
- <macro name="citation-number">
- <text variable="citation-number" prefix="{{jats}}id=&quot;ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>
- </macro>
- <macro name="author">
- <names variable="author">
- <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator="">
- <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
- <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>
- </name>
- <substitute>
- <names variable="editor"/>
- </substitute>
- </names>
- </macro>
-
- <macro name="editor">
- <names variable="editor" prefix="{{jats}}&lt;person-group person-group-type=&quot;editor&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}">
- <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator="">
- <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
- <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>
- </name>
- <substitute>
- <names variable="editor"/>
- </substitute>
- </names>
- </macro>
-
- <macro name="editor">
- <group delimiter=": ">
- <names variable="editor">
- <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator="">
- <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
- <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;given-names&gt;{{/jats}}"/>
- </name>
- </names>
- </group>
- </macro>
- <macro name="title">
- <choose>
- <if type="book" match="any">
- <group prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}">
- <text variable="title"/>
- </group>
- </if>
- <else>
- <group prefix="{{jats}}&lt;article-title&gt;{{/jats}}" suffix="{{jats}}&lt;/article-title&gt;{{/jats}}">
- <text variable="title"/>
- </group>
- </else>
- </choose>
- </macro>
- <macro name="container-title">
- <text variable="container-title" form="short" prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}"/>
- </macro>
- <macro name="publisher">
- <text variable="publisher" prefix="{{jats}}&lt;publisher-name&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-name&gt;{{/jats}}"/>
- <text variable="publisher-place" prefix="{{jats}}&lt;publisher-loc&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-loc&gt;{{/jats}}"/>
- </macro>
- <macro name="link">
- <choose>
- <if match="any" variable="DOI">
- <group prefix="{{jats}}&lt;pub-id pub-id-type=&quot;doi&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/pub-id&gt;{{/jats}}">
- <text variable="DOI"/>
- </group>
- </if>
- </choose>
- <choose>
- <if match="any" variable="PMID">
- <group prefix="{{jats}}&lt;ext-link ext-link-type=&quot;pmid&quot; {{/jats}}" suffix="{{jats}}&lt;/ext-link&gt;{{/jats}}">
- <text variable="PMID" prefix="{{jats}}xlink:href=&quot;http://www.ncbi.nlm.nih.gov/pubmed/{{/jats}}" suffix="{{jats}}&quot; xlink:type=&quot;simple&quot;&gt;{{/jats}}"/>
- <text variable="PMID"/>
- </group>
- </if>
- </choose>
- <choose>
- <if variable="URL" match="any">
- <group prefix="{{jats}}&lt;ext-link ext-link-type=&quot;uri&quot; {{/jats}}" suffix="{{jats}}&lt;/ext-link&gt;{{/jats}}">
- <text variable="URL" prefix="{{jats}}xlink:href=&quot;{{/jats}}" suffix="{{jats}}&quot; xlink:type=&quot;simple&quot;&gt;{{/jats}}"/>
- <text variable="URL"/>
- </group>
- </if>
- </choose>
- </macro>
- <macro name="date">
- <choose>
- <if type="article-journal article-magazine article-newspaper report patent book" match="any">
- <group prefix="{{jats}}&lt;date&gt;{{/jats}}" suffix="{{jats}}&lt;/date&gt;{{/jats}}">
- <date variable="issued">
- <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>
- <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>
- <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>
- </date>
- </group>
- </if>
- <else>
- <group prefix="{{jats}}&lt;date-in-citation content-type=&quot;access-date&quot;{{/jats}}" suffix="{{jats}}&lt;/date-in-citation&gt;{{/jats}}">
- <date variable="accessed" prefix="{{jats}} iso-8601-date=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">
- <date-part name="year"/>
- <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>
- <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>
- </date>
- <date variable="accessed">
- <date-part name="day" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>
- <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>
- <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>
- </date>
- </group>
- </else>
- </choose>
- </macro>
- <macro name="location">
- <choose>
- <if type="article-journal article-magazine" match="any">
- <text variable="volume" prefix="{{jats}}&lt;volume&gt;{{/jats}}" suffix="{{jats}}&lt;/volume&gt;{{/jats}}"/>
- <text variable="issue" prefix="{{jats}}&lt;issue&gt;{{/jats}}" suffix="{{jats}}&lt;/issue&gt;{{/jats}}"/>
- </if>
- </choose>
- <choose>
- <if type="article-journal article-magazine article-newspaper chapter" match="any">
- <text variable="page-first" prefix="{{jats}}&lt;fpage&gt;{{/jats}}" suffix="{{jats}}&lt;/fpage&gt;{{/jats}}"/>
- </if>
- </choose>
- </macro>
- <macro name="publication-type">
- <group prefix="{{jats}} publication-type=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">
- <choose>
- <if type="article-journal article-magazine article-newspaper" match="any">
- <text value="journal"/>
- </if>
- <else-if type="book" match="any">
- <text value="book"/>
- </else-if>
- <else-if type="chapter" match="any">
- <text value="bookchapter"/>
- </else-if>
- <else-if type="dataset" match="any">
- <text value="dataset"/>
- </else-if>
- <else-if type="patent" match="any">
- <text value="patent"/>
- </else-if>
- <else-if type="report" match="any">
- <text value="report"/>
- </else-if>
- <else-if type="review" match="any">
- <text value="review"/>
- </else-if>
- <else>
- <text value="standard"/>
- </else>
- </choose>
- </group>
- </macro>
- <citation collapse="citation-number">
- <sort>
- <key variable="citation-number"/>
- </sort>
- <layout delimiter=",">
- <group prefix="{{jats}}&lt;xref ref-type=&quot;bibr&quot; rid=&quot;{{/jats}}" suffix="{{jats}}&lt;/xref&gt;{{/jats}}">
- <text variable="citation-number" prefix="{{jats}}ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>
- <text variable="citation-number"/>
- </group>
- </layout>
- </citation>
- <bibliography sort-separator="">
- <layout>
- <group prefix="{{jats}}&lt;ref {{/jats}}" suffix="{{jats}}&lt;/ref&gt;{{/jats}}">
- <text macro="citation-number"/>
- <group prefix="{{jats}}&lt;element-citation{{/jats}}" suffix="{{jats}}&lt;/element-citation&gt;{{/jats}}">
- <text macro="publication-type"/>
- <text macro="author" prefix="{{jats}}&lt;person-group person-group-type=&quot;author&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}"/>
- <text macro="title" />
- <text macro="container-title"/>
- <text macro="editor"/>
- <text macro="publisher"/>
- <text macro="date"/>
- <text macro="location"/>
- <text macro="link"/>
- </group>
- </group>
- </layout>
- </bibliography>
-</style>
-
diff --git a/tests/no-author.expected.native b/tests/no-author.expected.native
index 9d24c13..ec909c2 100644
--- a/tests/no-author.expected.native
+++ b/tests/no-author.expected.native
@@ -1,3 +1,15 @@
Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "A"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item2"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "B"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item3"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "C"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item4"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "D"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item5"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "E"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Magazine"]),("id",MetaInlines [Str "item4"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "D"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Newspaper"]),("id",MetaInlines [Str "item5"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "E"]),("type",MetaInlines [Str "article-magazine"])]),MetaMap (fromList [("container-title",MetaInlines [Str "Newspaper"]),("id",MetaInlines [Str "item6"]),("issued",MetaMap (fromList [("year",MetaString "2012")])),("title",MetaInlines [Str "Title",Space,Str "F"]),("type",MetaInlines [Str "article-magazine"])])])]})
[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "3"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "(",Emph [Str "Magazine"],Space,Str "2012a,",Space,Str "3)"],Str ",",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "(",Emph [Str "Magazine"],Space,Str "2012b)"],Str ",",Space,Cite [Citation {citationId = "item3", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 3}] [Str "(",Emph [Str "Magazine"],Space,Str "2012c)"],Str ",",Space,Cite [Citation {citationId = "item4", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 4}] [Str "(",Emph [Str "Magazine"],Space,Str "2012d)"],Str ",",Space,Cite [Citation {citationId = "item5", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 5}] [Str "(",Emph [Str "Magazine"],Space,Str "2012e)"],Str ",",Space,Cite [Citation {citationId = "item6", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 6}] [Str "(",Emph [Str "Newspaper"],Space,Str "2012)"]]
-,Div ("refs",["references"],[]) [Div ("ref-item1",[],[]) [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012a.",Space,Str "\8220Title",Space,Str "A.\8221"]],Div ("ref-item2",[],[]) [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012b.",Space,Str "\8220Title",Space,Str "B.\8221"]],Div ("ref-item3",[],[]) [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012c.",Space,Str "\8220Title",Space,Str "C.\8221"]],Div ("ref-item4",[],[]) [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012d.",Space,Str "\8220Title",Space,Str "D.\8221"]],Div ("ref-item5",[],[]) [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012e.",Space,Str "\8220Title",Space,Str "E.\8221"]],Div ("ref-item6",[],[]) [Para [Emph [Str "Newspaper"],Str ".",Space,Str "2012.",Space,Str "\8220Title",Space,Str "F.\8221"]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-item1",[],[])
+ [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012a.",Space,Str "\8220Title",Space,Str "A,\8221",Space,Str "2012."]]
+ ,Div ("ref-item2",[],[])
+ [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012b.",Space,Str "\8220Title",Space,Str "B,\8221",Space,Str "2012."]]
+ ,Div ("ref-item3",[],[])
+ [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012c.",Space,Str "\8220Title",Space,Str "C,\8221",Space,Str "2012."]]
+ ,Div ("ref-item4",[],[])
+ [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012d.",Space,Str "\8220Title",Space,Str "D,\8221",Space,Str "2012."]]
+ ,Div ("ref-item5",[],[])
+ [Para [Emph [Str "Magazine"],Str ".",Space,Str "2012e.",Space,Str "\8220Title",Space,Str "E,\8221",Space,Str "2012."]]
+ ,Div ("ref-item6",[],[])
+ [Para [Emph [Str "Newspaper"],Str ".",Space,Str "2012.",Space,Str "\8220Title",Space,Str "F,\8221",Space,Str "2012."]]]]
diff --git a/tests/test-pandoc-citeproc.hs b/tests/test-pandoc-citeproc.hs
index 8ee41e5..2ac6f96 100644
--- a/tests/test-pandoc-citeproc.hs
+++ b/tests/test-pandoc-citeproc.hs
@@ -22,7 +22,7 @@ import qualified Control.Exception as E
main :: IO ()
main = do
args <- getArgs
- let regenerate = args == ["--regenerate"]
+ let regenerate = "--accept" `elem` args
testnames <- fmap (map (dropExtension . takeBaseName) .
filter (".in.native" `isSuffixOf`)) $
getDirectoryContents "tests"