summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2018-10-13 15:06:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-10-13 15:06:00 (GMT)
commite858b2e22eb5e7d4d80809e466aeaffec69868d0 (patch)
treeb75fe92cbdae6d8134e4b741ea22593f0546943f
parent5bf192247fd474888a096fb423b9fa2dbb568832 (diff)
version 0.14.60.14.6
-rw-r--r--changelog23
-rw-r--r--chicago-author-date.csl11
-rw-r--r--locales/locales-uk-UA.xml237
-rw-r--r--pandoc-citeproc.cabal10
-rw-r--r--src/Text/CSL/Eval.hs22
-rw-r--r--src/Text/CSL/Eval/Names.hs32
-rw-r--r--src/Text/CSL/Input/Bibtex.hs24
-rw-r--r--src/Text/CSL/Pandoc.hs2
-rw-r--r--src/Text/CSL/Parser.hs7
-rw-r--r--src/Text/CSL/Proc/Collapse.hs6
-rw-r--r--src/Text/CSL/Reference.hs14
-rw-r--r--src/Text/CSL/Style.hs22
-rw-r--r--src/Text/CSL/Util.hs8
-rw-r--r--tests/chinese-gb7714-2005-numeric.csl213
-rw-r--r--tests/din-1505-2.csl406
-rw-r--r--tests/issue327.expected.native5
-rw-r--r--tests/issue327.in.native2
-rw-r--r--tests/issue338.expected.native4
-rw-r--r--tests/issue338.in.native2
-rw-r--r--tests/issue351.expected.native5
-rw-r--r--tests/issue351.in.native2
-rw-r--r--tests/jats.csl208
-rw-r--r--tests/zeitschrift-fur-kunstgeschichte.csl346
23 files changed, 1403 insertions, 208 deletions
diff --git a/changelog b/changelog
index 9815fb5..6dbf261 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,26 @@
+pandoc-citeproc (0.14.6)
+
+ * Bibtex: Support jstor and pubmed as eprinttype.
+ * Bibtex: Resolve aliases on field names (#348).
+ 'primaryclass' -> 'eprintclass', 'archiveprefix' -> 'eprinttype'
+ * Util: Rename betterThan to orIfNull.
+ * Update chicago-author-date.csl and locale.
+ * Don't apply sort-separator between non-byzantine names (#327).
+ “As is the case for name-as-sort-order, this attribute [sort-separator]
+ only affects names written in the latin or Cyrillic alphabets.”
+ * Match zotero's regex for isByzantine.
+ Fix issue #338 tests.
+ * Explicitly use Text.XML.def in Parser.hs. (Eduard Nicodei, #331).
+ * Ensure that groups with only empty variables are skipped (#338).
+ * Make sure substitute works in nested contexts (#351).
+ Previously it only worked for names elements right
+ below it, not for names embedded in a conditional.
+ * Handle date-part of the form `[[]]` or `[ null ]`.
+ These seem to occur in the wild, and it seems better to parse them
+ as an empty date parts than to crash with a parse error.
+ See greenelab/manubot#66.
+ * Allow pandoc 2.4.x.
+
pandoc-citeproc (0.14.5)
* Add flag to silence all warnings (#350, Albert Krewinkel).
diff --git a/chicago-author-date.csl b/chicago-author-date.csl
index a410563..92ec51e 100644
--- a/chicago-author-date.csl
+++ b/chicago-author-date.csl
@@ -22,6 +22,11 @@
<email>andrew.dunning@utoronto.ca</email>
<uri>https://orcid.org/0000-0003-0464-5036</uri>
</contributor>
+ <contributor>
+ <name>Matthew Roth</name>
+ <email>matthew.g.roth@yale.edu</email>
+ <uri> https://orcid.org/0000-0001-7902-6331</uri>
+ </contributor>
<category citation-format="author-date"/>
<category field="generic-base"/>
<summary>The author-date variant of the Chicago style</summary>
@@ -33,10 +38,7 @@
<term name="editor" form="verb-short">ed.</term>
<term name="container-author" form="verb">by</term>
<term name="translator" form="verb-short">trans.</term>
- <term name="editortranslator" form="verb">
- <single>edited and translated by</single>
- <multiple>edited and translated by</multiple>
- </term>
+ <term name="editortranslator" form="verb">edited and translated by</term>
<term name="translator" form="short">trans.</term>
</terms>
</locale>
@@ -582,6 +584,7 @@
</group>
</group>
</else-if>
+ <else-if type="article-journal" match="any"/>
<else>
<group prefix=". " delimiter=", ">
<choose>
diff --git a/locales/locales-uk-UA.xml b/locales/locales-uk-UA.xml
index 208547c..84170eb 100644
--- a/locales/locales-uk-UA.xml
+++ b/locales/locales-uk-UA.xml
@@ -2,7 +2,7 @@
<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="uk-UA">
<info>
<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>2018-09-17T21:00:00+02:00</updated>
</info>
<style-options punctuation-in-quote="false"/>
<date form="text">
@@ -16,50 +16,41 @@
<date-part name="year"/>
</date>
<terms>
- <term name="accessed">accessed</term>
+ <term name="accessed">дата звернення</term>
<term name="and">і</term>
<term name="and others">та інші</term>
<term name="anonymous">анонімний</term>
<term name="anonymous" form="short">анон.</term>
<term name="at">на</term>
- <term name="available at">available at</term>
- <term name="by">by</term>
- <term name="circa">circa</term>
+ <term name="available at">доступний у</term>
+ <term name="by">відповідно до</term>
+ <term name="circa">близько</term>
<term name="circa" form="short">c.</term>
- <term name="cited">cited</term>
- <term name="edition">
- <single>edition</single>
- <multiple>editions</multiple>
- </term>
- <term name="edition" form="short">ed</term>
+ <term name="cited">цит. за</term>
+ <term name="edition">видання</term>
+ <term name="edition" form="short">вид.</term>
<term name="et-al">et al.</term>
- <term name="forthcoming">forthcoming</term>
+ <term name="forthcoming">майбутній</term>
<term name="from">із</term>
- <term name="ibid">ibid.</term>
+ <term name="ibid">там само</term>
<term name="in">в</term>
<term name="in press">у пресі</term>
<term name="internet">інтернет</term>
<term name="interview">інтервю</term>
<term name="letter">лист</term>
- <term name="no date">no date</term>
- <term name="no date" form="short">n.d.</term>
+ <term name="no date">без дати</term>
+ <term name="no date" form="short">б. д.</term>
<term name="online">online</term>
- <term name="presented at">presented at the</term>
- <term name="reference">
- <single>reference</single>
- <multiple>references</multiple>
- </term>
- <term name="reference" form="short">
- <single>ref.</single>
- <multiple>refs.</multiple>
- </term>
- <term name="retrieved">retrieved</term>
- <term name="scale">scale</term>
- <term name="version">version</term>
+ <term name="presented at">представлена на</term>
+ <term name="reference">список використаних джерел</term>
+ <term name="reference" form="short">джерела</term>
+ <term name="retrieved">вилучено</term>
+ <term name="scale">масштаб</term>
+ <term name="version">версія</term>
<!-- ANNO DOMINI; BEFORE CHRIST -->
- <term name="ad">AD</term>
- <term name="bc">BC</term>
+ <term name="ad">н. е.</term>
+ <term name="bc">до н. е.</term>
<!-- PUNCTUATION -->
<term name="open-quote">«</term>
@@ -69,82 +60,67 @@
<term name="page-range-delimiter">–</term>
<!-- ORDINALS -->
- <term name="ordinal">th</term>
- <term name="ordinal-01">st</term>
- <term name="ordinal-02">nd</term>
- <term name="ordinal-03">rd</term>
- <term name="ordinal-11">th</term>
- <term name="ordinal-12">th</term>
- <term name="ordinal-13">th</term>
+ <term name="ordinal">ий</term>
<!-- LONG ORDINALS -->
- <term name="long-ordinal-01">first</term>
- <term name="long-ordinal-02">second</term>
- <term name="long-ordinal-03">third</term>
- <term name="long-ordinal-04">fourth</term>
- <term name="long-ordinal-05">fifth</term>
- <term name="long-ordinal-06">sixth</term>
- <term name="long-ordinal-07">seventh</term>
- <term name="long-ordinal-08">eighth</term>
- <term name="long-ordinal-09">ninth</term>
- <term name="long-ordinal-10">tenth</term>
+ <term name="long-ordinal-01">перший</term>
+ <term name="long-ordinal-02">другий</term>
+ <term name="long-ordinal-03">третій</term>
+ <term name="long-ordinal-04">четвертий</term>
+ <term name="long-ordinal-05">п'ятий</term>
+ <term name="long-ordinal-06">шостий</term>
+ <term name="long-ordinal-07">сьомий</term>
+ <term name="long-ordinal-08">восьмий</term>
+ <term name="long-ordinal-09">дев'ятий</term>
+ <term name="long-ordinal-10">десятий</term>
<!-- LONG LOCATOR FORMS -->
<term name="book">
- <single>book</single>
- <multiple>books</multiple>
+ <single>книга</single>
+ <multiple>книги</multiple>
</term>
<term name="chapter">
- <single>chapter</single>
- <multiple>chapters</multiple>
+ <single>розділ</single>
+ <multiple>розділи</multiple>
</term>
<term name="column">
- <single>column</single>
- <multiple>columns</multiple>
+ <single>графа</single>
+ <multiple>графи</multiple>
</term>
<term name="figure">
- <single>figure</single>
- <multiple>figures</multiple>
+ <single>рисунок</single>
+ <multiple>рисунки</multiple>
</term>
<term name="folio">
- <single>folio</single>
- <multiple>folios</multiple>
- </term>
- <term name="issue">
- <single>number</single>
- <multiple>numbers</multiple>
+ <single>фоліант</single>
+ <multiple>фоліанти</multiple>
</term>
+ <term name="issue">випуск</term>
<term name="line">
- <single>line</single>
- <multiple>lines</multiple>
+ <single>Рядок</single>
+ <multiple>Рядки</multiple>
</term>
<term name="note">
- <single>note</single>
- <multiple>notes</multiple>
+ <single>примітка</single>
+ <multiple>примітки</multiple>
</term>
<term name="opus">
<single>opus</single>
<multiple>opera</multiple>
</term>
- <term name="page">
- <single>page</single>
- <multiple>pages</multiple>
- </term>
- <term name="number-of-pages">
- <single>page</single>
- <multiple>pages</multiple>
- </term>
+ <term name="page">С.</term>
+ <term name="number-of-pages">с.</term>
<term name="paragraph">
- <single>paragraph</single>
- <multiple>paragraph</multiple>
+ <single>параграф</single>
+ <multiple>параграфи</multiple>
</term>
<term name="part">
- <single>part</single>
- <multiple>parts</multiple>
+ <single>частина</single>
+ <multiple>частини</multiple>
</term>
<term name="section">
- <single>section</single>
- <multiple>sections</multiple>
+ <single>розділ</single>
+ <multiple>розділи</multiple>
</term>
<term name="sub verbo">
<single>sub verbo</single>
@@ -155,43 +131,31 @@
<multiple>verses</multiple>
</term>
<term name="volume">
- <single>volume</single>
- <multiple>volumes</multiple>
+ <single>Том</single>
+ <multiple>Томи</multiple>
</term>
<!-- 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">fig</term>
- <term name="folio" form="short">f</term>
- <term name="issue" form="short">no</term>
- <term name="line" form="short">l.</term>
- <term name="note" form="short">n.</term>
- <term name="opus" form="short">op</term>
- <term name="page" form="short">
- <single>p</single>
- <multiple>pp</multiple>
- </term>
- <term name="number-of-pages" form="short">
- <single>p</single>
- <multiple>pp</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="book" form="short">кн.</term>
+ <term name="chapter" form="short">розд.</term>
+ <term name="column" form="short">ряд.</term>
+ <term name="figure" form="short">рис.</term>
+ <term name="folio" form="short">ф.</term>
+ <term name="issue" form="short">вип.</term>
+ <term name="line" form="short">л.</term>
+ <term name="note" form="short">прим.</term>
+ <term name="opus" form="short">оп.</term>
+ <term name="page" form="short">с.</term>
+ <term name="number-of-pages" form="short">с.</term>
+ <term name="paragraph" form="short">пар.</term>
+ <term name="part" form="short">ч.</term>
+ <term name="section" form="short">сек.</term>
<term name="sub verbo" form="short">
<single>s.v.</single>
<multiple>s.vv.</multiple>
</term>
- <term name="verse" form="short">
- <single>v</single>
- <multiple>vv</multiple>
- </term>
- <term name="volume" form="short">
- <single>vol</single>
- <multiple>vols</multiple>
- </term>
+ <term name="verse" form="short">с.</term>
+ <term name="volume" form="short">вип.</term>
<!-- SYMBOL LOCATOR FORMS -->
<term name="paragraph" form="symbol">
@@ -205,55 +169,28 @@
<!-- LONG ROLE FORMS -->
<term name="director">
- <single>director</single>
- <multiple>directors</multiple>
- </term>
- <term name="editor">
- <single>editor</single>
- <multiple>editors</multiple>
- </term>
- <term name="editorial-director">
- <single>editor</single>
- <multiple>editors</multiple>
+ <single>режисер</single>
+ <multiple>режисери</multiple>
</term>
+ <term name="editor">за ред.</term>
+ <term name="editorial-director">за ред.</term>
<term name="illustrator">
- <single>illustrator</single>
- <multiple>illustrators</multiple>
+ <single>ілюстратор</single>
+ <multiple>ілюстратори</multiple>
</term>
<term name="translator">
- <single>translator</single>
- <multiple>translators</multiple>
- </term>
- <term name="editortranslator">
- <single>editor &amp; translator</single>
- <multiple>editors &amp; translators</multiple>
+ <single>перекладач</single>
+ <multiple>перекладачі</multiple>
</term>
+ <term name="editortranslator">За ред. &amp; переклад</term>
<!-- SHORT ROLE FORMS -->
- <term name="director" form="short">
- <single>dir.</single>
- <multiple>dirs.</multiple>
- </term>
- <term name="editor" form="short">
- <single>ed</single>
- <multiple>eds</multiple>
- </term>
- <term name="editorial-director" form="short">
- <single>ed.</single>
- <multiple>eds.</multiple>
- </term>
- <term name="illustrator" form="short">
- <single>ill.</single>
- <multiple>ills.</multiple>
- </term>
- <term name="translator" form="short">
- <single>tran</single>
- <multiple>trans</multiple>
- </term>
- <term name="editortranslator" form="short">
- <single>ed. &amp; tran.</single>
- <multiple>eds. &amp; trans.</multiple>
- </term>
+ <term name="director" form="short">реж.</term>
+ <term name="editor" form="short">ред.</term>
+ <term name="editorial-director" form="short">ред.</term>
+ <term name="illustrator" form="short">іл.</term>
+ <term name="translator" form="short">пер.</term>
+ <term name="editortranslator" form="short">ред. &amp; пер.</term>
<!-- VERB ROLE FORMS -->
<term name="container-author" form="verb">by</term>
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index f629632..e918287 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.14.5
+version: 0.14.6
cabal-version: 1.12
synopsis: Supports using pandoc with citeproc
@@ -108,7 +108,7 @@ library
build-depends: containers, directory, mtl,
bytestring, filepath,
pandoc-types >= 1.17.3 && < 1.18,
- pandoc >= 1.16 && < 2.4,
+ pandoc >= 1.16 && < 2.5,
tagsoup,
aeson >= 0.7 && < 1.5,
text,
@@ -158,7 +158,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.4,
+ pandoc >= 1.16 && < 2.5,
aeson,
aeson-pretty >= 0.8, yaml, bytestring, syb, attoparsec, text,
filepath
@@ -187,7 +187,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.4,
+ pandoc >= 1.16 && < 2.5,
filepath, containers,
bytestring, pandoc-citeproc, process, temporary >= 1.1,
yaml >= 0.8.32, containers >= 0.4, vector >= 0.10
@@ -209,7 +209,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.4, filepath, containers,
+ pandoc >= 1.16 && < 2.5, 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
diff --git a/src/Text/CSL/Eval.hs b/src/Text/CSL/Eval.hs
index 87a350d..3f5af62 100644
--- a/src/Text/CSL/Eval.hs
+++ b/src/Text/CSL/Eval.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
-----------------------------------------------------------------------------
-- |
@@ -44,7 +45,7 @@ import Text.CSL.Exception
import Text.CSL.Output.Plain
import Text.CSL.Reference
import Text.CSL.Style hiding (Any)
-import Text.CSL.Util (betterThan, isRange, last', proc,
+import Text.CSL.Util (orIfNull, isRange, last', proc,
proc', query, readNum, safeRead)
-- | Produce the output with a 'Layout', the 'EvalMode', a 'Bool'
@@ -159,12 +160,15 @@ evalElement el
where
addSpaces strng = (if take 1 strng == " " then (OSpace:) else id) .
(if last' strng == " " then (++[OSpace]) else id)
- substituteWith e = head <$> gets (names . env) >>= \(Names _ ns fm d _) ->
- case e of
- Names rs [Name NotSet fm'' [] [] []] fm' d' []
- -> let nfm = mergeFM fm'' $ mergeFM fm' fm in
- evalElement $ Names rs ns nfm (d' `betterThan` d) []
- _ -> evalElement e
+ substituteWith e =
+ gets (names . env) >>= \case
+ (Names _ ns fm d _ : _) -> evalElement $ proc replaceNames e
+ where
+ replaceNames (Names rs [Name NotSet fm'' [] [] []] fm' d' []) =
+ let nfm = mergeFM fm'' $ mergeFM fm' fm in
+ Names rs ns nfm (d' `orIfNull` d) []
+ replaceNames x = x
+ _ -> return []
-- from citeproc documentation: "cs:group implicitly acts as a
-- conditional: cs:group and its child elements are suppressed if
@@ -305,8 +309,8 @@ getFormattedValue o as f fm s val
in if null ys
then []
else [Output [OPan $ walk value' ys] fm]
- | Just v <- fromValue val :: Maybe String = (:[]) . flip OStr fm . Data.Maybe.fromMaybe v . getAbbr $ value v
- | Just v <- fromValue val :: Maybe Literal = (:[]) . flip OStr fm . Data.Maybe.fromMaybe (unLiteral v) . getAbbr $ value $ unLiteral v
+ | 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)
| Just v <- fromValue val :: Maybe Int = output fm (if v == 0 then [] else show v)
| Just v <- fromValue val :: Maybe CNum = if v == 0 then [] else [OCitNum (unCNum v) fm]
diff --git a/src/Text/CSL/Eval/Names.hs b/src/Text/CSL/Eval/Names.hs
index a8cb910..cd4e7e3 100644
--- a/src/Text/CSL/Eval/Names.hs
+++ b/src/Text/CSL/Eval/Names.hs
@@ -19,7 +19,7 @@ module Text.CSL.Eval.Names where
import Prelude
import Control.Monad.State
-import Data.Char (isLetter, isLower, isUpper)
+import Data.Char (isLower, isUpper)
import Data.List (intersperse, nub)
import Data.List.Split (wordsBy)
import Data.Maybe (isJust)
@@ -278,9 +278,12 @@ formatName m b f fm ops np n
$ splitStrWhen (=='-') x
sortSep g s = when_ g $ separator ++ addAffixes (g <+> s) "given" mempty
- separator = if null (getOptionVal "sort-separator" ops)
- then [OPan [Str ",", Space]]
- else [OPan $ B.toList $ B.text $ getOptionVal "sort-separator" ops]
+ separator = if any isByzantine (stringify family)
+ then
+ if null (getOptionVal "sort-separator" ops)
+ then [OPan [Str ",", Space]]
+ else [OPan $ B.toList $ B.text $ getOptionVal "sort-separator" ops]
+ else []
suff = if commaSuffix n && nameSuffix n /= mempty
then suffCom
@@ -302,9 +305,24 @@ formatName m b f fm ops np n
dropping = droppingPart n
nondropping = nonDroppingPart n
-- see src/load.js ROMANESQUE_REGEX in citeproc-js:
- isByzantine c = not (isLetter c) ||
- c <= '\x5FF' ||
- (c >= '\x1e00' && c <= '\x1fff')
+ -- /[-0-9a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/
+ isByzantine c = c == '-' ||
+ (c >= '0' && c <= '9') ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= '\x0e01' && c <= '\x0e5b') ||
+ (c >= '\x00c0' && c <= '\x017f') ||
+ (c >= '\x0370' && c <= '\x03ff') ||
+ (c >= '\x0400' && c <= '\x052f') ||
+ (c >= '\x0590' && c <= '\x05d4') ||
+ (c >= '\x05d6' && c <= '\x05ff') ||
+ (c >= '\x1f00' && c <= '\x1fff') ||
+ (c >= '\x0600' && c <= '\x06ff') ||
+ (c >= '\x200c' && c <= '\x200e') ||
+ (c >= '\x2018' && c <= '\x0219') ||
+ (c >= '\x021a' && c <= '\x021b') ||
+ (c >= '\x202a' && c <= '\x202e')
+
shortName = oPan' (unFormatted $ nondropping <+> family) (form "family")
longName g
diff --git a/src/Text/CSL/Input/Bibtex.hs b/src/Text/CSL/Input/Bibtex.hs
index 3eccd86..12f1735 100644
--- a/src/Text/CSL/Input/Bibtex.hs
+++ b/src/Text/CSL/Input/Bibtex.hs
@@ -193,7 +193,8 @@ inQuotes = do
) (char '"')
fieldName :: BibParser String
-fieldName = map toLower <$> many1 (letter <|> digit <|> oneOf "-_:+")
+fieldName =
+ resolveAlias . map toLower <$> many1 (letter <|> digit <|> oneOf "-_:+")
isBibtexKeyChar :: Char -> Bool
isBibtexKeyChar c = isAlphaNum c || c `elem` ".:;?!`'()/*@_+=-[]*&"
@@ -225,6 +226,11 @@ entField = do
spaces
return (k, concat vs)
+resolveAlias :: String -> String
+resolveAlias "archiveprefix" = "eprinttype"
+resolveAlias "primaryclass" = "eprintclass"
+resolveAlias s = s
+
rawWord :: BibParser String
rawWord = many1 alphaNum
@@ -1460,15 +1466,21 @@ itemToReference lang locale bibtex caseTransform = bib $ do
-- url, doi, isbn, etc.:
-- note that with eprinttype = arxiv, we take eprint to be a partial url
+ -- archivePrefix is an alias for eprinttype
url' <- (guard (et == "online" || lookup "url" opts /= Just "false")
>> getRawField "url")
<|> (do etype <- getRawField "eprinttype"
eprint <- getRawField "eprint"
- case map toLower etype of
- "arxiv" -> return $ "http://arxiv.org/abs/" ++ eprint
- "googlebooks" -> return $ "http://books.google.com?id=" ++
- eprint
- _ -> mzero)
+ let baseUrl =
+ case map toLower etype of
+ "arxiv" -> "http://arxiv.org/abs/"
+ "jstor" -> "http://www.jstor.org/stable/"
+ "pubmed" -> "http://www.ncbi.nlm.nih.gov/pubmed/"
+ "googlebooks" -> "http://books.google.com?id="
+ _ -> ""
+ if null baseUrl
+ then mzero
+ else return $ baseUrl ++ eprint)
<|> return mempty
doi' <- (guard (lookup "doi" opts /= Just "false") >> getRawField "doi")
<|> return mempty
diff --git a/src/Text/CSL/Pandoc.hs b/src/Text/CSL/Pandoc.hs
index 750da30..fce02ab 100644
--- a/src/Text/CSL/Pandoc.hs
+++ b/src/Text/CSL/Pandoc.hs
@@ -214,7 +214,7 @@ processCites' (Pandoc meta blocks) = do
either error return . eitherDecode . skipLeadingSpace)
cslAbbrevFile
let csl' = csl{ styleAbbrevs = abbrevs }
- return $ processCites csl' refs $ Pandoc meta blocks
+ return $ processCites (tr' "CSL" csl') refs $ Pandoc meta blocks
toPath :: MetaValue -> Maybe String
toPath (MetaString s) = Just s
diff --git a/src/Text/CSL/Parser.hs b/src/Text/CSL/Parser.hs
index 879dbe6..d81fe85 100644
--- a/src/Text/CSL/Parser.hs
+++ b/src/Text/CSL/Parser.hs
@@ -21,7 +21,6 @@ import Prelude
import qualified Control.Exception as E
import Control.Monad (when)
import qualified Data.ByteString.Lazy as L
-import Data.Default
import Data.Either (lefts, rights)
import qualified Data.Map as M
import Data.Maybe (fromMaybe, listToMaybe)
@@ -45,7 +44,7 @@ parseCSL = parseCSL' . fromStringLazy
-- | Parse locale. Raises 'CSLLocaleException' on error.
parseLocale :: String -> IO Locale
parseLocale locale =
- parseLocaleElement . fromDocument . X.parseLBS_ def <$> getLocale locale
+ parseLocaleElement . fromDocument . X.parseLBS_ X.def <$> getLocale locale
-- | Merge locale into a CSL style.
localizeCSL :: Maybe String -> Style -> IO Style
@@ -63,7 +62,7 @@ readCSLFile mbLocale src = do
f <- case fetchRes of
Left err -> E.throwIO err
Right (rawbs, _) -> return $ L.fromChunks [rawbs]
- let cur = fromDocument $ X.parseLBS_ def f
+ let cur = fromDocument $ X.parseLBS_ X.def f
-- see if it's a dependent style, and if so, try to fetch its parent:
let pickParentCur = get "link" >=> attributeIs (X.Name "rel" Nothing Nothing) "independent-parent"
let parentCur = cur $/ get "info" &/ pickParentCur
@@ -80,7 +79,7 @@ readCSLFile mbLocale src = do
readCSLFile mbLocale' y
parseCSL' :: L.ByteString -> Style
-parseCSL' = parseCSLCursor . fromDocument . X.parseLBS_ def
+parseCSL' = parseCSLCursor . fromDocument . X.parseLBS_ X.def
parseCSLCursor :: Cursor -> Style
parseCSLCursor cur =
diff --git a/src/Text/CSL/Proc/Collapse.hs b/src/Text/CSL/Proc/Collapse.hs
index 9ff8105..efb14ef 100644
--- a/src/Text/CSL/Proc/Collapse.hs
+++ b/src/Text/CSL/Proc/Collapse.hs
@@ -26,7 +26,7 @@ import Data.Ord (comparing)
import Text.CSL.Eval
import Text.CSL.Proc.Disamb
import Text.CSL.Style hiding (Any)
-import Text.CSL.Util (betterThan, proc, proc', query)
+import Text.CSL.Util (orIfNull, proc, proc', query)
import Text.Pandoc.Definition (Inline (Str))
-- | Collapse citations according to the style options.
@@ -103,9 +103,9 @@ collapseYear :: Style -> String -> CitationGroup -> CitationGroup
collapseYear s ranged (CG cs f d os) = CG cs f [] (process os)
where
styleYSD = getOptionVal "year-suffix-delimiter" . citOptions . citation $ s
- yearSufDel = styleYSD `betterThan` (layDelim . citLayout . citation $ s)
+ yearSufDel = styleYSD `orIfNull` (layDelim . citLayout . citation $ s)
afterCD = getOptionVal "after-collapse-delimiter" . citOptions . citation $ s
- afterColDel = afterCD `betterThan` d
+ afterColDel = afterCD `orIfNull` d
format [] = []
format (x:xs) = x : map getYearAndSuf xs
diff --git a/src/Text/CSL/Reference.hs b/src/Text/CSL/Reference.hs
index c107d78..4924a59 100644
--- a/src/Text/CSL/Reference.hs
+++ b/src/Text/CSL/Reference.hs
@@ -249,10 +249,16 @@ instance OVERLAPS
circa' <- (v .: "circa" >>= parseBool) <|> pure False
season' <- v .:? "season" >>= parseMaybeSeason
case dateParts of
- Just (Array xs) | isNothing raw' && not (V.null xs)
- -> mapM (fmap (setCirca circa' .
- maybe id setSeason season') . parseJSON)
- $ V.toList xs
+ Just (Array y) | isNothing raw' ->
+ case V.toList y of
+ [] -> return []
+ [Null] -> return []
+ [Array x]
+ | V.null x -> return []
+ -- [ null ] and [ [] ] are sometimes seen. See
+ -- https://github.com/greenelab/manubot/issues/66
+ ys -> mapM (fmap (setCirca circa' .
+ maybe id setSeason season') . parseJSON) ys
_ -> case raw' of
Nothing -> handleLiteral <$> parseJSON (Object v)
Just r -> return $ parseRawDate r
diff --git a/src/Text/CSL/Style.hs b/src/Text/CSL/Style.hs
index ac9e9e6..e88c35c 100644
--- a/src/Text/CSL/Style.hs
+++ b/src/Text/CSL/Style.hs
@@ -114,7 +114,7 @@ import Data.Yaml.Builder (ToYaml (..))
import qualified Data.Yaml.Builder as Y
import GHC.Generics (Generic)
import Text.CSL.Compat.Pandoc (readHtml, writeMarkdown)
-import Text.CSL.Util (betterThan, headInline, initInline,
+import Text.CSL.Util (orIfNull, headInline, initInline,
lastInline, mapping', mb, parseBool,
parseString, query, splitStrWhen,
tailInline, trimr, (.#:), (.#?),
@@ -635,16 +635,16 @@ emptyFormatting
mergeFM :: Formatting -> Formatting -> Formatting
mergeFM (Formatting aa ab ac ad ae af ag ah ai aj ak al am an ahl)
(Formatting ba bb bc bd be bf bg bh bi bj bk bl bm bn bhl) =
- Formatting (ba `betterThan` aa)
- (bb `betterThan` ab)
- (bc `betterThan` ac)
- (bd `betterThan` ad)
- (be `betterThan` ae)
- (bf `betterThan` af)
- (bg `betterThan` ag)
- (bh `betterThan` ah)
- (bi `betterThan` ai)
- (bj `betterThan` aj)
+ Formatting (ba `orIfNull` aa)
+ (bb `orIfNull` ab)
+ (bc `orIfNull` ac)
+ (bd `orIfNull` ad)
+ (be `orIfNull` ae)
+ (bf `orIfNull` af)
+ (bg `orIfNull` ag)
+ (bh `orIfNull` ah)
+ (bi `orIfNull` ai)
+ (bj `orIfNull` aj)
(if bk == NoQuote then ak else bk)
(bl || al)
(bm || am)
diff --git a/src/Text/CSL/Util.hs b/src/Text/CSL/Util.hs
index 00eed05..ea7ebb1 100644
--- a/src/Text/CSL/Util.hs
+++ b/src/Text/CSL/Util.hs
@@ -34,7 +34,7 @@ module Text.CSL.Util
, proc'
, procM
, query
- , betterThan
+ , orIfNull
, toRead
, inlinesToString
, headInline
@@ -379,9 +379,9 @@ procM f = everywhereM (mkM f)
query :: (Typeable a, Data b, Monoid m) => (a -> m) -> b -> m
query f = everything mappend (mempty `mkQ` f)
-betterThan :: [a] -> [a] -> [a]
-betterThan [] b = b
-betterThan a _ = a
+orIfNull :: [a] -> [a] -> [a]
+orIfNull [] b = b
+orIfNull a _ = a
toRead :: String -> String
toRead [] = []
diff --git a/tests/chinese-gb7714-2005-numeric.csl b/tests/chinese-gb7714-2005-numeric.csl
new file mode 100644
index 0000000..de295ea
--- /dev/null
+++ b/tests/chinese-gb7714-2005-numeric.csl
@@ -0,0 +1,213 @@
+<?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="sort-only" default-locale="zh-CN">
+ <info>
+ <title>Chinese Std GB/T 7714-2005 (numeric, Chinese)</title>
+ <id>http://www.zotero.org/styles/chinese-gb7714-2005-numeric</id>
+ <link href="http://www.zotero.org/styles/chinese-gb7714-2005-numeric" rel="self"/>
+ <link href="http://gradschool.ustc.edu.cn/ylb/material/xw/wdxz/19.pdf" rel="documentation"/>
+ <author>
+ <name>heromyth</name>
+ <email>zxpmyth@yahoo.com.cn</email>
+ </author>
+ <category citation-format="numeric"/>
+ <category field="engineering"/>
+ <category field="generic-base"/>
+ <category field="science"/>
+ <summary>This style just partly implemented what the Chinese GB/T 7714-2005 requires.</summary>
+ <updated>2012-10-11T09:38:41+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>
+ <macro name="author">
+ <names variable="author">
+ <name initialize-with=" " name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always">
+ <name-part name="family" text-case="uppercase"/>
+ </name>
+ </names>
+ </macro>
+ <macro name="recipient">
+ <names variable="recipient">
+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
+ <label form="short" prefix=", " text-case="lowercase"/>
+ </names>
+ </macro>
+ <macro name="interviewer">
+ <names variable="interviewer">
+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
+ <label form="short" prefix=", " text-case="lowercase"/>
+ </names>
+ </macro>
+ <macro name="composer">
+ <names variable="composer">
+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
+ <label form="short" prefix=", " text-case="lowercase"/>
+ </names>
+ </macro>
+ <macro name="original-author">
+ <names variable="original-author">
+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/>
+ <label form="short" prefix=", " text-case="lowercase"/>
+ </names>
+ </macro>
+ <macro name="title">
+ <text variable="title"/>
+ </macro>
+ <macro name="titleField">
+ <choose>
+ <if type="report">
+ <text macro="title" suffix="[R]. "/>
+ </if>
+ <else-if type="thesis">
+ <text macro="title" suffix="[D]. "/>
+ </else-if>
+ <else-if type="bill legislation" match="any">
+ <text variable="number" suffix=", "/>
+ <text macro="title" suffix="[S]"/>
+ </else-if>
+ <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
+ <text macro="title" suffix="[M]. "/>
+ </else-if>
+ <else-if type="paper-conference">
+ <text macro="title" suffix="[C]//"/>
+ </else-if>
+ <else-if type="chapter paper-conference" match="any">
+ <text macro="title" suffix="[G]//"/>
+ </else-if>
+ <else-if type="webpage">
+ <text macro="title" suffix="[EB/OL]. "/>
+ </else-if>
+ <else-if type="patent">
+ <text macro="title"/>
+ <text variable="number" prefix=": 中国, " suffix="[P]. "/>
+ </else-if>
+ <else>
+ <text macro="title" suffix="[J]. "/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="secondaryAuthor">
+ <names variable="editor">
+ <name initialize-with=" " name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always">
+ <name-part name="family" text-case="uppercase"/>
+ </name>
+ </names>
+ <names variable="translator">
+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always" suffix=", 译"/>
+ </names>
+ </macro>
+ <macro name="publisher">
+ <choose>
+ <if type="chapter paper-conference" match="any">
+ <text variable="container-title" suffix=". "/>
+ </if>
+ <else-if type="report">
+ <text variable="collection-title" suffix=", "/>
+ <text variable="number" suffix=", "/>
+ </else-if>
+ <else-if type="bill legislation" match="any">
+ <text variable="container-title" prefix=". "/>
+ </else-if>
+ <else>
+ <text variable="container-title" suffix=", "/>
+ </else>
+ </choose>
+ <!--
+
+<text variable="event" suffix="event "/>
+<text variable="event-place" suffix="event-place "/>
+<text variable="original-title" suffix="original-title"/>
+
+ -->
+ <text variable="publisher-place" suffix=": "/>
+ <group delimiter=", ">
+ <text variable="publisher"/>
+ <choose>
+ <if type="webpage" variable="container-title" match="all">
+ <date variable="issued" suffix=". ">
+ <date-part name="year"/>
+ <date-part name="month" form="numeric-leading-zeros" prefix="-"/>
+ <date-part name="day" form="numeric-leading-zeros" prefix="-"/>
+ </date>
+ </if>
+ <else-if type="webpage"/>
+ <else-if type="patent">
+ <date variable="issued">
+ <date-part name="year"/>
+ <date-part name="month" form="numeric-leading-zeros" prefix="-"/>
+ <date-part name="day" form="numeric-leading-zeros" prefix="-"/>
+ </date>
+ </else-if>
+ <else-if variable="publisher">
+ <date variable="issued">
+ <date-part name="year"/>
+ </date>
+ </else-if>
+ <else-if type="bill legislation" match="any"/>
+ <else>
+ <date variable="issued">
+ <date-part name="year"/>
+ </date>
+ </else>
+ </choose>
+ </group>
+ <text variable="volume" prefix=", "/>
+ <text variable="issue" prefix="(" suffix=")"/>
+ </macro>
+ <macro name="pageField">
+ <text variable="page"/>
+ </macro>
+ <macro name="referenceDate">
+ <choose>
+ <if type="webpage">
+ <date variable="issued" prefix="(" suffix=")">
+ <date-part name="year"/>
+ <date-part name="month" form="numeric-leading-zeros" prefix="-"/>
+ <date-part name="day" form="numeric-leading-zeros" prefix="-"/>
+ </date>
+ <date variable="accessed" prefix="[" suffix="]">
+ <date-part name="year"/>
+ <date-part name="month" form="numeric-leading-zeros" prefix="-"/>
+ <date-part name="day" form="numeric-leading-zeros" prefix="-"/>
+ </date>
+ </if>
+ </choose>
+ </macro>
+ <macro name="access">
+ <choose>
+ <if variable="DOI">
+ <text variable="DOI" prefix="doi:"/>
+ </if>
+ <else-if variable="URL">
+ <text variable="URL"/>
+ </else-if>
+ </choose>
+ </macro>
+ <citation collapse="citation-number">
+ <sort>
+ <key variable="citation-number" sort="ascending"/>
+ </sort>
+ <layout vertical-align="sup" prefix="[" suffix="]" delimiter=",">
+ <text variable="citation-number"/>
+ </layout>
+ </citation>
+ <bibliography et-al-min="4" et-al-use-first="3" second-field-align="flush" entry-spacing="0">
+ <layout suffix=".">
+ <text variable="citation-number" prefix="[" suffix="]"/>
+ <text macro="author" suffix=". "/>
+ <text macro="titleField"/>
+ <text macro="secondaryAuthor" suffix=". "/>
+ <text variable="edition" prefix="第" suffix="版. "/>
+ <text macro="publisher"/>
+ <text macro="pageField" prefix=": "/>
+ <text macro="referenceDate"/>
+ <choose>
+ <if type="webpage" match="any">
+ <text macro="access" prefix=". "/>
+ </if>
+ </choose>
+ <text macro="recipient"/>
+ <text macro="interviewer"/>
+ <text macro="composer"/>
+ <text macro="original-author"/>
+ </layout>
+ </bibliography>
+</style>
diff --git a/tests/din-1505-2.csl b/tests/din-1505-2.csl
new file mode 100644
index 0000000..8d17573
--- /dev/null
+++ b/tests/din-1505-2.csl
@@ -0,0 +1,406 @@
+<?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="sort-only" default-locale="de-DE">
+ <info>
+ <title>DIN 1505-2 (author-date, German)</title>
+ <id>http://www.zotero.org/styles/din-1505-2</id>
+ <link href="http://www.zotero.org/styles/din-1505-2" rel="self"/>
+ <link href="http://www.bui.haw-hamburg.de/fileadmin/redaktion/diplom/Lorenzen__litverz.pdf" rel="documentation"/>
+ <link href="http://bibliothek.fh-potsdam.de/fileadmin/fhp_bib/dokumente/Schulungen/wissenschaftliches_Arbeiten/Zitieren_Lorenzen.pdf" rel="documentation"/>
+ <link href="http://www.uni-muenster.de/imperia/md/content/fachbereich_physik/didaktik_physik/materialien/materialschlichting/zitierregeln.pdf" rel="documentation"/>
+ <link href="http://forums.zotero.org/discussion/1857" rel="documentation"/>
+ <author>
+ <name>Sven Rothe</name>
+ <email>mmoole@googlemail.com</email>
+ </author>
+ <contributor>
+ <name>Julian Onions</name>
+ <email>julian.onions@gmail.com</email>
+ </contributor>
+ <category citation-format="author-date"/>
+ <category field="generic-base"/>
+ <summary>Style following DIN 1505-2, for other media types on additional standards
+ Hinweise zur Benutzung:
+ * Zitieren von Gesetzen:
+ - hier müssen manuell §, Abs und S. zur Seitenangabe beim Zitieren eingetragen werden
+ - im Kurzbeleg wird der Kurztitel verwendet, dafür keine Autoren eintragen!
+ - als Jahresangabe wird 'Datum des Inkrafttretens' herangezogen, Verwenden nur bei Verweis auf nicht z.Z. gültige Gesetze, z.B. (idF. v. 12.12.1972)
+ * Zitieren von Normen und Standards - nicht vollständig nach DIN 1505
+ - Nutzen Sie den Typ 'Bericht' - als Abhilfe, da es keinen Typ 'Standard' gibt.
+ - als Autor die Kurzbezeichnung inkl. Nummer und Jahr eingeben (z.B. VDI 2222-1997), Vorname leer, Jahr leer
+ - als Titel den ausführlichen Titel bei Bedarf (z.B. VDI Richtlinie 2222 Blatt 1 - Konstruktionsmethodik - Methodisches Entwickeln von Lösungsprinzipien)</summary>
+ <!-- This is just a beginning to try to have a DIN 1505 citation style,
+ Feel free to send me any comments, suggestions etc...
+ todo:
+ * basic media types (book, journal article, etc..)
+ * more media types (according DINxxx) audio video etc...
+ * fine tuning
+ * correcting errors
+ known bugs, help appreciated
+ * Abbreviations (Mitarb.) & (Hrsg. der Reihe) are missing (contributor, seriesEditor labels)
+ * "contributor" is not valid as a name variable , nevertheless it works but doesnt validate!
+ * author etc. first names should not be abbreviated
+ * reviewed author seems to be not available as variable (newspaper article)
+ * thesis type does notoffer a PLACE or FACULTY as variable!
+ how to show the place if it is not included in the University title!?!?
+ * thesis type: publisher (university), genre (type) dont seem to get through!?
+ -->
+ <!-- useful things:
+ non breaking space: &#160;
+ narrow no break space: uni202F / &#8239; - but this is not supported widely!
+ em dash: &#8212;
+ space: &#032;
+ tab: &#009;
+
+ -->
+ <updated>2012-09-27T22:06:38+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="de">
+ <terms>
+ <term name="anonymous" form="short">o.&#160;A.</term>
+ <term name="no date" form="short">o.&#160;J.</term>
+ <term name="collection-editor" form="short">Hrsg.</term>
+ <term name="retrieved">abgerufen am</term>
+ <term name="composer" form="short">Komp.</term>
+ <term name="composer" form="long">Komponist</term>
+ </terms>
+ </locale>
+ <macro name="author">
+ <names variable="author" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </macro>
+ <macro name="author-container">
+ <names variable="container-author" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </macro>
+ <macro name="editor">
+ <names variable="editor" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ <!-- needed: Label should appear as suffix to EVERY name...!-->
+ </names>
+ </macro>
+ <macro name="editor-collection">
+ <names variable="collection-editor" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ <!-- needed: Label should appear as suffix to EVERY name...!-->
+ </names>
+ </macro>
+ <macro name="composer">
+ <names variable="composer" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="long" prefix=" (" suffix=")"/>
+ <!-- needed: Label should appear as suffix to EVERY name...!-->
+ </names>
+ </macro>
+ <!-- <macro name="contributor">
+ <names variable=" " delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; "
+ delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </macro>-->
+ <macro name="translator">
+ <names variable="translator" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ <!-- needed: Label should appear as suffix to EVERY name...!-->
+ </names>
+ </macro>
+ <macro name="recipient">
+ <names variable="recipient" delimiter=" ; ">
+ <name name-as-sort-order="all" sort-separator=", " initialize-with=". " delimiter=" ; " delimiter-precedes-last="always" font-variant="small-caps"/>
+ <!--<label form="long" prefix=" (" suffix=")"/>-->
+ <!-- needed: Label should appear as suffix to EVERY name...!-->
+ </names>
+ </macro>
+ <macro name="author-short">
+ <names variable="author">
+ <name form="short" and="symbol" delimiter=", " initialize-with=". " delimiter-precedes-last="never" font-variant="small-caps"/>
+ <et-al font-variant="normal"/>
+ <substitute>
+ <names variable="editor" font-variant="small-caps"/>
+ <names variable="translator" font-variant="small-caps"/>
+ <choose>
+ <if type="bill book graphic legal_case motion_picture report song" match="any">
+ <text variable="title" form="short" font-style="italic"/>
+ </if>
+ <else-if type="bill legal_case legislation" match="any">
+ <text variable="title" form="short" font-style="normal"/>
+ </else-if>
+ <else>
+ <text variable="title" form="short" quotes="true"/>
+ </else>
+ </choose>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="access">
+ <group>
+ <text term="retrieved" suffix=" "/>
+ <date variable="accessed">
+ <date-part name="year" form="long" suffix="-"/>
+ <date-part name="month" form="numeric-leading-zeros" suffix="-"/>
+ <date-part name="day" form="numeric-leading-zeros"/>
+ </date>
+ <!--<date variable="accessed" form="numeric" date-parts="year-month-day"/> // dd.mm.yyy -->
+ </group>
+ </macro>
+ <macro name="title">
+ <choose>
+ <if type="bill legislation" match="any">
+ <group delimiter=" &#8212; ">
+ <text variable="title-short" font-style="normal"/>
+ <text variable="title"/>
+ </group>
+ </if>
+ <else-if type="book graphic legal_case motion_picture report song" match="any">
+ <text variable="title" font-style="italic"/>
+ </else-if>
+ <else>
+ <text variable="title"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="genre">
+ <choose>
+ <if type="report thesis manuscript map" match="any">
+ <group>
+ <text variable="genre"/>
+ <!--<text term="number" form="short" suffix=" "/>-->
+ <text variable="number" prefix=" Nr. "/>
+ </group>
+ </if>
+ </choose>
+ </macro>
+ <macro name="volumes">
+ <group delimiter=" ">
+ <text term="volume" form="short" plural="false"/>
+ <number variable="volume" form="numeric"/>
+ <number variable="number-of-volumes" form="numeric" prefix="v. "/>
+ </group>
+ </macro>
+ <macro name="edition">
+ <group>
+ <number variable="edition" form="numeric" suffix=". "/>
+ <text term="edition" form="short" plural="false"/>
+ </group>
+ </macro>
+ <macro name="pages">
+ <choose>
+ <if type="chapter paper-conference article-journal" match="any">
+ <label variable="page" form="short" suffix="&#160;"/>
+ <text variable="page"/>
+ </if>
+ </choose>
+ </macro>
+ <macro name="dimensions">
+ <group>
+ <text variable="dimensions"/>
+ </group>
+ </macro>
+ <macro name="medium">
+ <group>
+ <text variable="medium"/>
+ </group>
+ </macro>
+ <macro name="scale">
+ <group>
+ <text term="scale"/>
+ <text prefix=" " variable="scale"/>
+ </group>
+ </macro>
+ <macro name="recipient-show">
+ <choose>
+ <if type="personal_communication">
+ <choose>
+ <if variable="genre">
+ <text variable="genre" text-case="capitalize-first"/>
+ </if>
+ <else>
+ <text term="letter" text-case="capitalize-first"/>
+ </else>
+ </choose>
+ </if>
+ </choose>
+ <text macro="recipient" prefix=", "/>
+ </macro>
+ <macro name="cite-year">
+ <group>
+ <choose>
+ <if type="bill legislation" match="any">
+ <date variable="issued" prefix=" (" suffix=")">
+ <date-part name="year" prefix="idF. v. "/>
+ </date>
+ </if>
+ <else>
+ <date variable="issued" prefix=", ">
+ <date-part name="year"/>
+ </date>
+ <text variable="year-suffix"/>
+ </else>
+ </choose>
+ </group>
+ </macro>
+ <macro name="bibliography-year">
+ <date variable="issued" form="numeric" date-parts="year"/>
+ <text variable="year-suffix"/>
+ </macro>
+ <macro name="locator">
+ <group>
+ <choose>
+ <if type="bill legislation" match="any">
+ <text variable="locator" prefix=" "/>
+ </if>
+ <else>
+ <label variable="locator" form="short" prefix=", "/>
+ <text variable="locator" prefix=" "/>
+ </else>
+ </choose>
+ </group>
+ </macro>
+ <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="false" disambiguate-add-givenname="false" collapse="year">
+ <sort>
+ <key macro="author"/>
+ <key variable="issued"/>
+ </sort>
+ <layout prefix="(" suffix=")" delimiter="; ">
+ <group>
+ <text macro="author-short"/>
+ <text macro="cite-year"/>
+ <text macro="locator"/>
+ </group>
+ </layout>
+ </citation>
+ <bibliography hanging-indent="true" et-al-min="9" et-al-use-first="8">
+ <sort>
+ <key macro="author"/>
+ <key variable="issued"/>
+ <key variable="title"/>
+ </sort>
+ <layout>
+ <group delimiter=" ; " suffix=":">
+ <text macro="author"/>
+ <choose>
+ <if type="bill book graphic legal_case legislation manuscript map motion_picture report song thesis webpage" match="any">
+ <!-- except type="chapter article " etc.... -->
+ <text macro="editor"/>
+ <text macro="editor-collection"/>
+ <text macro="composer"/>
+ </if>
+ </choose>
+ <!-- <text macro="contributor"/> -->
+ <text macro="translator"/>
+ </group>
+ <choose>
+ <!-- Tabelle 1 aus litverz.ps -->
+ <if type="bill book broadcast graphic legal_case legislation manuscript map motion_picture report song" match="any">
+ <text prefix=" " macro="title"/>
+ <text prefix=", " variable="collection-title" font-style="italic"/>
+ <!--Reihe-->
+ <text prefix=" (" macro="genre" suffix=")"/>
+ <text prefix=". " macro="volumes"/>
+ <text prefix=". " macro="edition"/>
+ <text prefix=". " macro="medium"/>
+ <text prefix=". " macro="dimensions"/>
+ <text prefix=". " variable="publisher-place"/>
+ <text prefix="&#160;: " variable="publisher"/>
+ <text macro="bibliography-year" prefix=", "/>
+ <!-- " (1. Gesamttitel mit Zählung)"
+ " (2. Gesamttitel mit Zählung)" -->
+ <text prefix=" &#8211;&#160;" macro="scale"/>
+ <text prefix=". &#8212;&#160;" variable="note"/>
+ <text prefix=" &#8212;&#160;ISBN&#160;" variable="ISBN"/>
+ </if>
+ <!-- Tabelle 3 aus litverz.ps -->
+ <else-if type="chapter paper-conference" match="any">
+ <text prefix=" " macro="title" suffix="."/>
+ <text prefix=". " term="in" text-case="capitalize-all" suffix=": "/>
+ <!-- verfahre nach Tabelle 1... -->
+ <group delimiter=" ; " suffix=": ">
+ <text macro="author-container"/>
+ <text macro="editor"/>
+ <text macro="editor-collection"/>
+ </group>
+ <text variable="container-title" font-style="italic"/>
+ <text prefix=", " variable="collection-title" font-style="italic"/>
+ <!-- Reihe -->
+ <text prefix=". " macro="volumes"/>
+ <!-- <text prefix=" : " variable="title of volumes"/> what is this? -->
+ <text prefix=". " macro="edition"/>
+ <text prefix=". " variable="publisher-place"/>
+ <text prefix="&#160;: " variable="publisher"/>
+ <text macro="bibliography-year" prefix=", "/>
+ <!-- " (1. Gesamttitel mit Zählung)"
+ " (2. Gesamttitel mit Zählung)" -->
+ <text prefix=". &#8212;&#160;" variable="note"/>
+ <text prefix=" &#8212;&#160;ISBN&#160;" variable="ISBN"/>
+ <text prefix=", " macro="pages"/>
+ </else-if>
+ <!-- Tabelle 5 aus litverz.ps - Hochschulschriften
+ (Diplomarbeiten, Dissertationen, Master-A., unverö. Studienarbeiten -->
+ <else-if type="thesis" match="any">
+ <text prefix=" " macro="title" font-style="italic"/>
+ <text prefix=". " macro="edition"/>
+ <text prefix=". " variable="publisher-place"/>
+ <text prefix=", " variable="publisher" form="long"/>
+ <!-- <text prefix=", " variable="faculty"/> -->
+ <text prefix=", " macro="genre"/>
+ <text macro="bibliography-year" prefix=", "/>
+ <text prefix=". &#8212;&#160;" variable="note"/>
+ </else-if>
+ <else-if type="webpage post post-weblog" match="any">
+ <text prefix=" " macro="title" suffix=". " font-style="italic"/>
+ <text prefix="URL " variable="URL"/>
+ <text prefix=". - " macro="access"/>
+ <text prefix=". &#8212;&#160;" variable="container-title"/>
+ <text prefix=". &#8212;&#160;" variable="note"/>
+ </else-if>
+ <!-- Tabelle 2 aus litverz.ps UND -->
+ <!-- Tabelle 4 aus litverz.ps - Schriften von Tagungen, Konferenzen, Symposien, ...-->
+ <else-if type="article article-journal article-magazine article-newspaper" match="any">
+ <text prefix=" " variable="title"/>
+ <!-- " : Zusatz zum Sachtitel"
+ ". Angabe des Teils"
+ " (Gesamttitelangabe)" -->
+ <group>
+ <text prefix=". " term="in" text-case="capitalize-first" suffix=": "/>
+ <text macro="editor" suffix=" "/>
+ <text variable="container-title" font-style="italic"/>
+ <text prefix=", " variable="collection-title" font-style="italic" suffix="."/>
+ <!--", unterreihe der zeitschrift/zeitung" -->
+ </group>
+ <text prefix=" " macro="volumes"/>
+ <text prefix=". " variable="publisher-place"/>
+ <text prefix=", " variable="publisher" form="long"/>
+ <text macro="bibliography-year" prefix=" (" suffix=")"/>
+ <text prefix=", Nr.&#160;" variable="issue"/>
+ <text prefix=", " macro="pages"/>
+ <text prefix=". &#8212;&#160;" variable="note"/>
+ <text prefix=" &#8212;&#160;ISBN&#160;" variable="ISBN"/>
+ </else-if>
+ <!-- keiner der oben genannten fälle -->
+ <else>
+ <group suffix=".">
+ <text prefix=" " macro="title"/>
+ <text prefix=", " macro="editor"/>
+ <text prefix=". " macro="recipient-show"/>
+ </group>
+ <group prefix=" " suffix=".">
+ <text variable="container-title" font-style="italic"/>
+ <group prefix=", ">
+ <text variable="volume" font-style="italic"/>
+ <text variable="issue" prefix="(" suffix=")"/>
+ </group>
+ <text prefix=", " macro="pages"/>
+ </group>
+ </else>
+ </choose>
+ </layout>
+ </bibliography>
+</style>
diff --git a/tests/issue327.expected.native b/tests/issue327.expected.native
new file mode 100644
index 0000000..3575485
--- /dev/null
+++ b/tests/issue327.expected.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/chinese-gb7714-2005-numeric.csl"]),("references",MetaList [MetaMap (fromList [("ISSN",MetaInlines [Str "1003-1111"]),("URL",MetaInlines [Str "http://kns.cnki.net/kns/detail/detail.aspx?QueryID=4&CurRec=4&recid=&FileName=CHAN201706006&DbName=CJFDLAST2018&DbCode=CJFQ&yx=Y&pr=&URLID=21.1110.S.20171129.1725.006"]),("abstract",MetaInlines [Str "\20026\20102\35299\36797\19996\28286\28023\22495\24213\26646\21160\29289\27425\32423\29983\20135\21147\27700\24179\21644\26102\31354\20998\24067\29305\28857,\26681\25454\&2007\24180\30340\&4\26376\21644\&10\26376\36797\19996\28286\28023\22495\22823\22411\24213\26646\21160\29289\35843\26597\25968\25454,\36816\29992Brey\32463\39564\20844\24335\35745\31639\22823\22411\24213\26646\21160\29289\27425\32423\29983\20135\21147\21644P/B\20540,\24182\32467\21512\28023\27915\29983\29289\25351\25968\26041\27861\23545\36797\19996\28286\28023\22495\36827\34892\29983\22659\36866\23452\24615\35780\20215\12290\20998\26512\32467\26524\34920\26126,\35813\28023\22495\22823\22411\24213\26646\21160\29289\24180\24179\22343\27425\32423\29983\20135\21147\20026\&5.59g/(m~2\183\24180),\24180\24179\22343P/B\20540\20026\&3.16,\36797\19996\28286\22823\22411\24213\26646\21160\29289\27425\32423\29983\20135\21147\31354\38388\20998\24067\21576\29616\20986\33258\27839\23736\21521\20013\37096\36882\22686\30340\36235\21183,P/B\20540\31354\38388\20998\24067\19982\24213\26646\21160\29289\27425\32423\29983\20135\21147\30456\21453,\21576\29616\20986\33258\27839\23736\21521\20013\37096\36882\20943\30340\36235\21183,\32676\33853\32452\25104\20013\20197\20010\20307\23567\12289\29983\27963\21490\30701\12289\20195\35874\24555\30340\24213\26646\21160\29289\20026\20027\12290"]),("accessed",MetaList [MetaMap (fromList [("day",MetaInlines [Str "27"]),("month",MetaInlines [Str "3"]),("year",MetaInlines [Str "2018"])])]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "\26446"]),("given",MetaInlines [Str "\36726\24179"])]),MetaMap (fromList [("family",MetaInlines [Str "\20110"]),("given",MetaInlines [Str "\26093\20809"])]),MetaMap (fromList [("family",MetaInlines [Str "\23385"]),("given",MetaInlines [Str "\26126"])]),MetaMap (fromList [("family",MetaInlines [Str "\37101"]),("given",MetaInlines [Str "\26635"])]),MetaMap (fromList [("family",MetaInlines [Str "\27573"]),("given",MetaInlines [Str "\22925"])]),MetaMap (fromList [("family",MetaInlines [Str "\33891"]),("given",MetaInlines [Str "\23143"])])]),("container-title",MetaInlines [Str "\27700\20135\31185\23398"]),("id",MetaInlines [Str "LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017"]),("issue",MetaInlines [Str "06"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2017"])])]),("keyword",MetaInlines [Str "\27425\32423\29983\20135\21147,\22823\22411\24213\26646\21160\29289,\28023\27915\29983\29289\25351\25968\26041\27861,AMBI,macrozoobenthos,P/B",Space,Str "value,P/B\20540,secondary",Space,Str "productivity"]),("language",MetaInlines [Str "\20013\25991;"]),("page",MetaInlines [Str "728-734"]),("title",MetaInlines [Str "\36797\19996\28286\28023\22495\24213\26646\21160\29289\27425\32423\29983\20135\21147\30740\31350\21450\29983\22659\36866\23452\24615\35780\20215"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Str "I",Space,Str "referenced",Space,Str "something",Space,Str "here",Cite [Citation {citationId = "LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1}] [Superscript [Str "[1]"]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017",[],[])
+ [Para [Str "[1]",Space,Str "\26446\36726,",Space,Str "\20110\26093,",Space,Str "\23385\26126,",Space,Str "\31561.",Space,Str "\36797\19996\28286\28023\22495\24213\26646\21160\29289\27425\32423\29983\20135\21147\30740\31350\21450\29983\22659\36866\23452\24615\35780\20215[J].",Space,Str "\27700\20135\31185\23398,",Space,Str "2017(06):",Space,Str "728\8211\&734."]]]]
diff --git a/tests/issue327.in.native b/tests/issue327.in.native
new file mode 100644
index 0000000..e4888f0
--- /dev/null
+++ b/tests/issue327.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/chinese-gb7714-2005-numeric.csl"]),("references",MetaList [MetaMap (fromList [("ISSN",MetaInlines [Str "1003-1111"]),("URL",MetaInlines [Str "http://kns.cnki.net/kns/detail/detail.aspx?QueryID=4&CurRec=4&recid=&FileName=CHAN201706006&DbName=CJFDLAST2018&DbCode=CJFQ&yx=Y&pr=&URLID=21.1110.S.20171129.1725.006"]),("abstract",MetaInlines [Str "\20026\20102\35299\36797\19996\28286\28023\22495\24213\26646\21160\29289\27425\32423\29983\20135\21147\27700\24179\21644\26102\31354\20998\24067\29305\28857,\26681\25454\&2007\24180\30340\&4\26376\21644\&10\26376\36797\19996\28286\28023\22495\22823\22411\24213\26646\21160\29289\35843\26597\25968\25454,\36816\29992Brey\32463\39564\20844\24335\35745\31639\22823\22411\24213\26646\21160\29289\27425\32423\29983\20135\21147\21644P/B\20540,\24182\32467\21512\28023\27915\29983\29289\25351\25968\26041\27861\23545\36797\19996\28286\28023\22495\36827\34892\29983\22659\36866\23452\24615\35780\20215\12290\20998\26512\32467\26524\34920\26126,\35813\28023\22495\22823\22411\24213\26646\21160\29289\24180\24179\22343\27425\32423\29983\20135\21147\20026\&5.59g/(m~2\183\24180),\24180\24179\22343P/B\20540\20026\&3.16,\36797\19996\28286\22823\22411\24213\26646\21160\29289\27425\32423\29983\20135\21147\31354\38388\20998\24067\21576\29616\20986\33258\27839\23736\21521\20013\37096\36882\22686\30340\36235\21183,P/B\20540\31354\38388\20998\24067\19982\24213\26646\21160\29289\27425\32423\29983\20135\21147\30456\21453,\21576\29616\20986\33258\27839\23736\21521\20013\37096\36882\20943\30340\36235\21183,\32676\33853\32452\25104\20013\20197\20010\20307\23567\12289\29983\27963\21490\30701\12289\20195\35874\24555\30340\24213\26646\21160\29289\20026\20027\12290"]),("accessed",MetaList [MetaMap (fromList [("day",MetaInlines [Str "27"]),("month",MetaInlines [Str "3"]),("year",MetaInlines [Str "2018"])])]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "\26446"]),("given",MetaInlines [Str "\36726\24179"])]),MetaMap (fromList [("family",MetaInlines [Str "\20110"]),("given",MetaInlines [Str "\26093\20809"])]),MetaMap (fromList [("family",MetaInlines [Str "\23385"]),("given",MetaInlines [Str "\26126"])]),MetaMap (fromList [("family",MetaInlines [Str "\37101"]),("given",MetaInlines [Str "\26635"])]),MetaMap (fromList [("family",MetaInlines [Str "\27573"]),("given",MetaInlines [Str "\22925"])]),MetaMap (fromList [("family",MetaInlines [Str "\33891"]),("given",MetaInlines [Str "\23143"])])]),("container-title",MetaInlines [Str "\27700\20135\31185\23398"]),("id",MetaInlines [Str "LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017"]),("issue",MetaInlines [Str "06"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2017"])])]),("keyword",MetaInlines [Str "\27425\32423\29983\20135\21147,\22823\22411\24213\26646\21160\29289,\28023\27915\29983\29289\25351\25968\26041\27861,AMBI,macrozoobenthos,P/B",Space,Str "value,P/B\20540,secondary",Space,Str "productivity"]),("language",MetaInlines [Str "\20013\25991;"]),("page",MetaInlines [Str "728-734"]),("title",MetaInlines [Str "\36797\19996\28286\28023\22495\24213\26646\21160\29289\27425\32423\29983\20135\21147\30740\31350\21450\29983\22659\36866\23452\24615\35780\20215"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Str "I",Space,Str "referenced",Space,Str "something",Space,Str "here",Space,Cite [Citation {citationId = "LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@LiLiaoDongWanHaiYuDiQiDongWuCiJiShengChanLiYanJiuJiShengJingGuaYiXingPingJie2017]"]]]
diff --git a/tests/issue338.expected.native b/tests/issue338.expected.native
new file mode 100644
index 0000000..e47e82d
--- /dev/null
+++ b/tests/issue338.expected.native
@@ -0,0 +1,4 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/din-1505-2.csl"]),("lang",MetaInlines [Str "de"]),("nocite",MetaInlines [Cite [Citation {citationId = "*", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@*"]]),("pagetitle",MetaInlines [Str "Citation"]),("references",MetaList [MetaMap (fromList [("ISBN",MetaInlines [Str "978-3-642-32078-1"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Wolfinger"]),("given",MetaInlines [Str "Christine"])])]),("edition",MetaInlines [Str "11.,",Space,Str "vollst.",Space,Str "\252berarb.",Space,Str "Aufl."]),("id",MetaInlines [Str "item-1"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2013"])])]),("keyword",MetaInlines [Str "UNIX;",Space,Str "LINUX"]),("number-of-pages",MetaInlines [Str "XVIII,",Space,Str "529",Space,Str "S.",Space,Str ":",Space,Str "Ill.,",Space,Str "graph.",Space,Str "Darst."]),("publisher",MetaInlines [Str "Springer",Space,Str "Vieweg"]),("publisher-place",MetaInlines [Str "Berlin",Space,Str "[u.a.]"]),("title",MetaInlines [Str "Keine",Space,Str "Angst",Space,Str "vor",Space,Str "Linux,",Space,Str "Unix:",Space,Str "ein",Space,Str "Lehrbuch",Space,Str "f\252r",Space,Str "Linux-",Space,Str "und",Space,Str "Unix-Anwender"]),("type",MetaInlines [Str "book"])])])]})
+[Div ("refs",["references"],[])
+ [Div ("ref-item-1",[],[])
+ [Para [SmallCaps [Str "Wolfinger,",Space,Str "Christine"],Str ":",Space,Emph [Str "Keine",Space,Str "Angst",Space,Str "vor",Space,Str "Linux,",Space,Str "Unix:",Space,Str "ein",Space,Str "Lehrbuch",Space,Str "f\252r",Space,Str "Linux-",Space,Str "und",Space,Str "Unix-Anwender"],Str ".",Space,Str "11.,",Space,Str "vollst.",Space,Str "\252berarb.",Space,Str "Aufl.",Space,Str "Aufl.",Space,Str "Berlin",Space,Str "[u.a.]\160:",Space,Str "Springer",Space,Str "Vieweg,",Space,Str "2013",Space,Str "\8212\160ISBN\160",Link ("",[],[]) [Str "978-3-642-32078-1"] ("https://worldcat.org/isbn/978-3-642-32078-1","")]]]]
diff --git a/tests/issue338.in.native b/tests/issue338.in.native
new file mode 100644
index 0000000..cbd8f84
--- /dev/null
+++ b/tests/issue338.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/din-1505-2.csl"]),("lang",MetaInlines [Str "de"]),("nocite",MetaInlines [Cite [Citation {citationId = "*", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@*"]]),("pagetitle",MetaInlines [Str "Citation"]),("references",MetaList [MetaMap (fromList [("ISBN",MetaInlines [Str "978-3-642-32078-1"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Wolfinger"]),("given",MetaInlines [Str "Christine"])])]),("edition",MetaInlines [Str "11.,",Space,Str "vollst.",Space,Str "\252berarb.",Space,Str "Aufl."]),("id",MetaInlines [Str "item-1"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "2013"])])]),("keyword",MetaInlines [Str "UNIX;",Space,Str "LINUX"]),("number-of-pages",MetaInlines [Str "XVIII,",Space,Str "529",Space,Str "S.",Space,Str ":",Space,Str "Ill.,",Space,Str "graph.",Space,Str "Darst."]),("publisher",MetaInlines [Str "Springer",Space,Str "Vieweg"]),("publisher-place",MetaInlines [Str "Berlin",Space,Str "[u.a.]"]),("title",MetaInlines [Str "Keine",Space,Str "Angst",Space,Str "vor",Space,Str "Linux,",Space,Str "Unix:",Space,Str "ein",Space,Str "Lehrbuch",Space,Str "f\252r",Space,Str "Linux-",Space,Str "und",Space,Str "Unix-Anwender"]),("type",MetaInlines [Str "book"])])])]})
+[]
diff --git a/tests/issue351.expected.native b/tests/issue351.expected.native
new file mode 100644
index 0000000..879691f
--- /dev/null
+++ b/tests/issue351.expected.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/zeitschrift-fur-kunstgeschichte.csl"]),("references",MetaList [MetaMap (fromList [("editor",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Nietzsche"]),("given",MetaInlines [Str "Friedrich"])])]),("id",MetaInlines [Str "Nie72"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "1872"])])]),("title",MetaInlines [Str "Die",Space,Str "geburt"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Cite [Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Friedrich",Space,Str "Nietzsche",Space,Str "(ed.)",Note [Para [Emph [Str "Die",Space,Str "geburt"],Str ",",Space,Str "1872."]]]]
+,Div ("refs",["references"],[])
+ [Div ("ref-Nie72",[],[])
+ [Para [Str "Nietzsche,",Space,Str "Friedrich",Space,Str "(ed.),",Space,Emph [Str "Die",Space,Str "geburt"],Str ",",Space,Str "1872."]]]]
diff --git a/tests/issue351.in.native b/tests/issue351.in.native
new file mode 100644
index 0000000..9ce14ec
--- /dev/null
+++ b/tests/issue351.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/zeitschrift-fur-kunstgeschichte.csl"]),("references",MetaList [MetaMap (fromList [("editor",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Nietzsche"]),("given",MetaInlines [Str "Friedrich"])])]),("id",MetaInlines [Str "Nie72"]),("issued",MetaList [MetaMap (fromList [("year",MetaInlines [Str "1872"])])]),("title",MetaInlines [Str "Die",Space,Str "geburt"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Cite [Citation {citationId = "Nie72", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@Nie72"]]]
diff --git a/tests/jats.csl b/tests/jats.csl
new file mode 100644
index 0000000..6487286
--- /dev/null
+++ b/tests/jats.csl
@@ -0,0 +1,208 @@
+<?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/zeitschrift-fur-kunstgeschichte.csl b/tests/zeitschrift-fur-kunstgeschichte.csl
new file mode 100644
index 0000000..14f30ae
--- /dev/null
+++ b/tests/zeitschrift-fur-kunstgeschichte.csl
@@ -0,0 +1,346 @@
+<?xml version="1.0" encoding="utf-8"?>
+<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0" demote-non-dropping-particle="sort-only">
+ <info>
+ <title>Zeitschrift für Kunstgeschichte</title>
+ <title-short>ZfK</title-short>
+ <id>http://www.zotero.org/styles/zeitschrift-fur-kunstgeschichte</id>
+ <link href="http://www.zotero.org/styles/zeitschrift-fur-kunstgeschichte" rel="self"/>
+ <link href="http://www.zotero.org/styles/kritische-ausgabe" rel="template"/>
+ <link href="http://www.uni-bielefeld.de/geschichte/abteilung/arbeitsbereiche/bildwissenschaft/zfk/documents/Sylesheet-(ger)-Zeitschrift-fur-Kunstgeschichte.pdf" rel="documentation"/>
+ <link href="https://github.com/citation-style-language/styles/pull/1861" rel="documentation"/>
+ <author>
+ <name>Philipp Zumstein</name>
+ <uri>https://github.com/zuphilip/</uri>
+ </author>
+ <contributor>
+ <name>Anna Simon</name>
+ <email>simonanna@gmx.net</email>
+ </contributor>
+ <category citation-format="note"/>
+ <category field="humanities"/>
+ <category field="history"/>
+ <issn>0044-2992</issn>
+ <summary>From the editors: "Die Herausgeber werden im Falle von Editionen, Lexika und Ausstellungskatalogen dem Titel nachgestellt [use encyclopedia articles with or without container-title for that]. Bei gewöhnlichen Sammelbänden werden die Herausgeber dem Titel vorangestellt [use book for that]." Multilingual style; the information for exhibition catalogues should be entered in the field collection-title; locators may use the word "here" or "hier" in front of the page refering to which must be entered individually (the style outputs the locator as it is entered w/o any label or additional text).</summary>
+ <updated>2016-02-03T17:41:02+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="de">
+ <terms>
+ <term name="note">wie Anm.</term>
+ <term name="et-al">et al.</term>
+ <term name="editor" form="short">Hg.</term>
+ <term name="editortranslator" form="verb-short">hg. und übers. von</term>
+ <term name="accessed">letzter Zugriff am</term>
+ </terms>
+ </locale>
+ <locale xml:lang="en">
+ <terms>
+ <term name="note">as note</term>
+ <term name="editortranslator" form="verb-short">ed. and trans. by</term>
+ </terms>
+ </locale>
+ <macro name="author-short">
+ <names variable="author">
+ <name form="short" delimiter="/" and="text" delimiter-precedes-et-al="never"/>
+ <substitute>
+ <choose>
+ <if type="entry-encyclopedia" match="none">
+ <names variable="editor"/>
+ </if>
+ </choose>
+ <text variable="title" form="short"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="author">
+ <names variable="author" delimiter=", ">
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ <substitute>
+ <choose>
+ <if type="entry-encyclopedia" match="none">
+ <names variable="editor"/>
+ </if>
+ </choose>
+ <text variable="title"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="author-bibliography">
+ <names variable="author" delimiter=", ">
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never" name-as-sort-order="first"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ <substitute>
+ <choose>
+ <if type="entry-encyclopedia" match="none">
+ <names variable="editor"/>
+ </if>
+ </choose>
+ <text variable="title"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="editor">
+ <names variable="editor translator" delimiter=", ">
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </macro>
+ <macro name="editor-encyclopedia">
+ <names variable="editor translator" delimiter=", ">
+ <label form="verb-short" suffix=" "/>
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ </names>
+ </macro>
+ <macro name="volume">
+ <choose>
+ <if type="article-journal">
+ <text variable="volume" prefix=" "/>
+ <text variable="issue" prefix="/"/>
+ </if>
+ <else>
+ <choose>
+ <if variable="volume">
+ <group delimiter=" ">
+ <number variable="volume" form="long-ordinal" text-case="capitalize-first"/>
+ <text term="volume" form="short" text-case="capitalize-first"/>
+ </group>
+ </if>
+ <else>
+ <group>
+ <number variable="number-of-volumes" form="numeric"/>
+ <text term="volume" form="short" prefix=" " plural="true"/>
+ </group>
+ </else>
+ </choose>
+ </else>
+ </choose>
+ </macro>
+ <macro name="year-date">
+ <date variable="issued" date-parts="year" form="numeric"/>
+ </macro>
+ <macro name="collection-with-number">
+ <group delimiter=", " prefix="(" suffix=")">
+ <text variable="collection-title"/>
+ <text variable="collection-number"/>
+ </group>
+ </macro>
+ <macro name="translator">
+ <names variable="editor translator" delimiter=", ">
+ <label form="verb-short"/>
+ <name prefix=" " and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ </names>
+ </macro>
+ <citation et-al-min="3" et-al-use-first="1" disambiguate-add-names="true">
+ <layout delimiter="; " suffix=".">
+ <choose>
+ <if position="ibid-with-locator">
+ <group delimiter=", ">
+ <text term="ibid"/>
+ <text variable="locator" prefix=" "/>
+ </group>
+ </if>
+ <else-if position="ibid">
+ <text term="ibid"/>
+ </else-if>
+ <else-if position="subsequent">
+ <group delimiter=", ">
+ <group delimiter=" ">
+ <text macro="author-short"/>
+ <text macro="year-date"/>
+ <group delimiter=" " prefix="(" suffix=")">
+ <text term="note"/>
+ <text variable="first-reference-note-number"/>
+ </group>
+ </group>
+ <text variable="locator"/>
+ </group>
+ </else-if>
+ <else>
+ <group delimiter=", ">
+ <text macro="author"/>
+ <choose>
+ <if match="any" variable="container-title">
+ <text variable="title"/>
+ <group delimiter=" ">
+ <text term="in" suffix=": "/>
+ <choose>
+ <if type="entry-encyclopedia" match="any">
+ <group delimiter=", ">
+ <group delimiter=" ">
+ <text variable="container-title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ <text macro="volume"/>
+ </group>
+ <text macro="editor-encyclopedia"/>
+ </group>
+ </if>
+ <else>
+ <text macro="editor" suffix=","/>
+ <text variable="container-title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ <text macro="volume"/>
+ </else>
+ </choose>
+ </group>
+ </if>
+ <else>
+ <choose>
+ <if type="entry-encyclopedia" match="any">
+ <group delimiter=" ">
+ <text variable="title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ </group>
+ <text macro="editor-encyclopedia"/>
+ </if>
+ <else-if match="any" variable="translator">
+ <choose>
+ <if match="none" variable="author">
+ <names variable="editor">
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </if>
+ </choose>
+ <group delimiter=" ">
+ <text variable="title" font-style="italic" suffix=","/>
+ <text macro="collection-with-number"/>
+ </group>
+ </else-if>
+ <else>
+ <choose>
+ <if match="none" variable="author">
+ <names variable="editor">
+ <name and="text" delimiter-precedes-et-al="never" delimiter-precedes-last="never"/>
+ <label form="short" prefix=" (" suffix=")"/>
+ </names>
+ </if>
+ </choose>
+ <group delimiter=" ">
+ <group delimiter=", ">
+ <text variable="title" font-style="italic"/>
+ <text macro="translator"/>
+ </group>
+ <text macro="collection-with-number"/>
+ </group>
+ </else>
+ </choose>
+ </else>
+ </choose>
+ <choose>
+ <if type="thesis">
+ <text variable="publisher" prefix="Diss., "/>
+ </if>
+ </choose>
+ <group delimiter=" ">
+ <text variable="publisher-place"/>
+ <group>
+ <text variable="edition" vertical-align="sup"/>
+ <text macro="year-date"/>
+ </group>
+ </group>
+ <text variable="page" prefix=" "/>
+ <text variable="locator" prefix=" "/>
+ </group>
+ </else>
+ </choose>
+ <choose>
+ <if variable="URL" match="any">
+ <group>
+ <text variable="URL" prefix=", "/>
+ <text term="accessed" prefix=" ("/>
+ <date variable="accessed" prefix=" " delimiter="." suffix=")">
+ <date-part name="day"/>
+ <date-part name="month" form="numeric"/>
+ <date-part name="year"/>
+ </date>
+ </group>
+ </if>
+ </choose>
+ </layout>
+ </citation>
+ <bibliography et-al-min="3" et-al-use-first="1" subsequent-author-substitute="&#8212;&#8212;&#8212;" entry-spacing="0" hanging-indent="true">
+ <sort>
+ <key macro="author-bibliography"/>
+ <key macro="year-date"/>
+ <key variable="title"/>
+ </sort>
+ <layout suffix=".">
+ <group delimiter=", ">
+ <text macro="author-bibliography"/>
+ <choose>
+ <if match="any" variable="container-title">
+ <text variable="title"/>
+ <group delimiter=" ">
+ <text term="in" suffix=": "/>
+ <choose>
+ <if type="entry-encyclopedia" match="any">
+ <group delimiter=", ">
+ <group delimiter=" ">
+ <text variable="container-title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ <text macro="volume"/>
+ </group>
+ <text macro="editor-encyclopedia"/>
+ </group>
+ </if>
+ <else>
+ <text macro="editor" suffix=","/>
+ <text variable="container-title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ <text macro="volume"/>
+ </else>
+ </choose>
+ </group>
+ </if>
+ <else>
+ <choose>
+ <if type="entry-encyclopedia" match="any">
+ <group delimiter=" ">
+ <text variable="title" font-style="italic"/>
+ <text macro="collection-with-number"/>
+ </group>
+ <text macro="editor-encyclopedia"/>
+ </if>
+ <else>
+ <group delimiter=" ">
+ <group delimiter=", ">
+ <text variable="title" font-style="italic"/>
+ <text macro="editor"/>
+ </group>
+ <text macro="collection-with-number"/>
+ </group>
+ </else>
+ </choose>
+ </else>
+ </choose>
+ <choose>
+ <if type="thesis">
+ <text variable="publisher" prefix="Diss., "/>
+ </if>
+ </choose>
+ <group delimiter=" ">
+ <text variable="publisher-place"/>
+ <group>
+ <text variable="edition" vertical-align="sup"/>
+ <text macro="year-date"/>
+ </group>
+ </group>
+ <text variable="page" prefix=" "/>
+ </group>
+ <choose>
+ <if variable="URL" match="any">
+ <group>
+ <text variable="URL" prefix=", "/>
+ <text term="accessed" prefix=" ("/>
+ <date variable="accessed" prefix=" " delimiter="." suffix=")">
+ <date-part name="day"/>
+ <date-part name="month" form="numeric"/>
+ <date-part name="year"/>
+ </date>
+ </group>
+ </if>
+ </choose>
+ </layout>
+ </bibliography>
+</style>