summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2017-09-18 03:28:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-09-18 03:28:00 (GMT)
commite606259adfd246543390f9e8968f73971fa01460 (patch)
tree737da26ca09a585b6bc66c8f69aa740bff5f78e4
parentd833b4daba0e11679379c5fd079c79eaf333a611 (diff)
version 0.11.1.10.11.1.1
-rw-r--r--changelog14
-rw-r--r--compat/Text/CSL/Compat/Pandoc.hs19
-rw-r--r--pandoc-citeproc.cabal15
-rw-r--r--src/Text/CSL/Input/Bibtex.hs4
-rw-r--r--src/Text/CSL/Util.hs36
-rw-r--r--stack.yaml11
-rw-r--r--tests/biblio2yaml/book-averroes.biblatex3
-rw-r--r--tests/biblio2yaml/incollection.biblatex4
-rw-r--r--tests/biblio2yaml/itzhaki.biblatex3
-rw-r--r--tests/biblio2yaml/malinowski.biblatex2
-rw-r--r--tests/biblio2yaml/murray.biblatex3
-rw-r--r--tests/biblio2yaml/pandoc-2/ctan.biblatex10
-rw-r--r--tests/biblio2yaml/pandoc-2/formatting.biblatex2
-rw-r--r--tests/biblio2yaml/pandoc-2/jaffe.biblatex2
-rw-r--r--tests/biblio2yaml/pandoc-2/kastenholz.biblatex2
-rw-r--r--tests/biblio2yaml/pandoc-2/online.biblatex10
-rw-r--r--tests/biblio2yaml/pandoc-2/sigfridsson.biblatex5
-rw-r--r--tests/biblio2yaml/pines.biblatex4
-rw-r--r--tests/biblio2yaml/test-case-conversion.biblatex6
-rw-r--r--tests/biblio2yaml/textnormal.biblatex2
-rw-r--r--tests/issue301.expected.native7
-rw-r--r--tests/issue301.in.native2
-rw-r--r--tests/jats.csl208
23 files changed, 319 insertions, 55 deletions
diff --git a/changelog b/changelog
index 74f9071..48fd3ed 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,17 @@
+pandoc-citeproc (0.11.1.1)
+
+ * Added containers to build deps for test-pandoc-citeproc.
+ * Fix titlecase when a colon is inside an emph (#301).
+ * Titlecasing: never lowercase anything except stop words (#301).
+ * Text.CSL.Compat.Pandoc: disable `bracketed_spans` extension.
+ We want to stay compatible with CSL standards, which understand a span
+ tag but not the brackets.
+ * Titlecase transform: start new sentence after ".". "Foo bar. An essay."
+ * Use set for short words lookup (performance).
+ * Case transform: recognize mixed upper+punct as all uppercase (#301).
+ This helps with things like "N.R. Kerr".
+ * Add 'static' Cabal flag.
+
pandoc-citeproc (0.11.1)
* Don't produce ??? with empty suppress-author citation (#156).
diff --git a/compat/Text/CSL/Compat/Pandoc.hs b/compat/Text/CSL/Compat/Pandoc.hs
index 6d8c395..5a6ddac 100644
--- a/compat/Text/CSL/Compat/Pandoc.hs
+++ b/compat/Text/CSL/Compat/Pandoc.hs
@@ -19,6 +19,9 @@ import Data.ByteString.Lazy as BL
import Data.ByteString as B
import Text.Pandoc (Pandoc, ReaderOptions(..), def, WrapOption(..),
WriterOptions(..))
+#if MIN_VERSION_pandoc(1,19,0)
+import Text.Pandoc (Extension(..), pandocExtensions)
+#endif
import qualified Text.Pandoc as Pandoc
import qualified Text.Pandoc.Process
#if MIN_VERSION_pandoc(2,0,0)
@@ -28,9 +31,9 @@ import Text.Pandoc.Error (PandocError)
import Text.Pandoc.Class (runPure, runIO)
import qualified Text.Pandoc.Class (fetchItem)
import Control.Monad.Except (runExceptT, lift)
-import Text.Pandoc.Extensions (extensionsFromList, Extension(..),
- pandocExtensions, disableExtension)
+import Text.Pandoc.Extensions (extensionsFromList, disableExtension)
#else
+import Data.Set as Set
import System.IO (stderr)
import qualified Text.Pandoc.Shared (fetchItem)
@@ -57,7 +60,9 @@ readLaTeX = either mempty id . runPure . Pandoc.readLaTeX
readNative = either mempty id . runPure . Pandoc.readNative def . T.pack
writeMarkdown = either mempty T.unpack . runPure . Pandoc.writeMarkdown
- def{ writerExtensions = disableExtension Ext_smart pandocExtensions,
+ def{ writerExtensions = disableExtension Ext_smart $
+ disableExtension Ext_bracketed_spans $
+ pandocExtensions,
writerWrapText = WrapNone }
writePlain = either mempty T.unpack . runPure . Pandoc.writePlain def
@@ -80,7 +85,13 @@ readLaTeX = either mempty id . Pandoc.readLaTeX
readNative = either mempty id . Pandoc.readNative
-writeMarkdown = Pandoc.writeMarkdown def{ writerWrapText = WrapNone }
+writeMarkdown = Pandoc.writeMarkdown def{
+ writerWrapText = WrapNone
+ , writerColumns = 72
+#if MIN_VERSION_pandoc(1,19,0)
+ , writerExtensions = Set.delete Ext_bracketed_spans pandocExtensions
+#endif
+ }
writePlain = Pandoc.writePlain def
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index 5147e10..071d1bc 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.11.1
+version: 0.11.1.1
cabal-version: >= 1.12
synopsis: Supports using pandoc with citeproc
@@ -71,6 +71,10 @@ flag debug
description: Turn on debug tracing.
default: False
+flag static
+ description: Use static linking.
+ default: False
+
library
hs-source-dirs: src, prelude, compat
exposed-modules: Text.CSL.Pandoc
@@ -106,7 +110,7 @@ library
aeson >= 0.7 && < 1.3,
text,
vector,
- xml-conduit >= 1.2 && < 1.6,
+ xml-conduit >= 1.2 && < 1.7,
unordered-containers >= 0.2 && < 0.3,
data-default,
setenv >= 0.1 && < 0.2,
@@ -156,6 +160,9 @@ executable pandoc-citeproc
Prelude
default-language: Haskell2010
ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind
+ if flag(static)
+ ld-options: -static -pthread
+ ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -fPIC
if flag(bibutils)
default-extensions: CPP
cpp-options: -DUSE_BIBUTILS
@@ -172,7 +179,7 @@ executable test-citeproc
build-depends: base >= 4, aeson, directory, text, mtl,
pandoc-types >= 1.16 && < 1.18,
pandoc >= 1.16 && < 2.1,
- filepath,
+ filepath, containers,
bytestring, pandoc-citeproc, process, temporary >= 1.1,
yaml >= 0.8.8.7, containers >= 0.4, vector >= 0.10
ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind
@@ -187,7 +194,7 @@ test-suite test-pandoc-citeproc
Hs-Source-Dirs: tests, prelude, compat
build-depends: base >= 4, aeson, directory, text,
pandoc-types >= 1.16 && < 1.18, mtl,
- pandoc >= 1.16 && < 2.1, filepath,
+ pandoc >= 1.16 && < 2.1, filepath, containers,
bytestring, pandoc-citeproc, process, temporary >= 1.1,
yaml >= 0.8.8.7
ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind
diff --git a/src/Text/CSL/Input/Bibtex.hs b/src/Text/CSL/Input/Bibtex.hs
index 8f205e2..3136cc5 100644
--- a/src/Text/CSL/Input/Bibtex.hs
+++ b/src/Text/CSL/Input/Bibtex.hs
@@ -27,7 +27,7 @@ import Text.CSL.Compat.Pandoc (readLaTeX)
import Text.Pandoc.Definition
import Text.Pandoc.Generic (bottomUp)
import Data.List.Split (splitOn, splitWhen, wordsBy)
-import Data.List (intercalate)
+import Data.List (intercalate, foldl')
import Data.Maybe
import Data.Char (toLower, isUpper, toUpper, isDigit, isAlphaNum)
import Control.Monad
@@ -1223,7 +1223,7 @@ toLocale "latin" = "la"
toLocale x = x
concatWith :: Char -> [Formatted] -> Formatted
-concatWith sep = Formatted . foldl go mempty . map unFormatted
+concatWith sep = Formatted . foldl' go mempty . map unFormatted
where go :: [Inline] -> [Inline] -> [Inline]
go accum [] = accum
go accum s = case reverse accum of
diff --git a/src/Text/CSL/Util.hs b/src/Text/CSL/Util.hs
index 38d1cc3..88603cc 100644
--- a/src/Text/CSL/Util.hs
+++ b/src/Text/CSL/Util.hs
@@ -58,6 +58,7 @@ import Data.List.Split (wordsBy)
import Control.Monad.State
import Data.Generics ( Typeable, Data, everywhere, everywhereM, mkM,
everywhere', everything, mkT, mkQ )
+import qualified Data.Set as Set
import System.FilePath
import System.Directory (doesFileExist)
import qualified Data.Yaml.Builder as Y
@@ -247,32 +248,38 @@ titlecase zs = evalState (caseTransform tc zs) SentenceBoundary
case (x:xs) of
s | not (isAscii x) -> Str s
| isShortWord s -> Str s
- | all isUpper s -> Str s
+ | all isUpperOrPunct s -> Str s
| isMixedCase s -> Str s
- | otherwise -> Str (toUpper x:map toLower xs)
+ | otherwise -> Str (toUpper x:xs)
WordBoundary ->
case (x:xs) of
s | not (isAscii x) -> Str s
- | all isUpper s -> Str s
+ | all isUpperOrPunct s -> Str s
| isShortWord s -> Str (map toLower s)
| isMixedCase s -> Str s
- | otherwise -> Str (toUpper x:map toLower xs)
+ | otherwise -> Str (toUpper x:xs)
SentenceBoundary ->
- if isMixedCase (x:xs) || (all isUpper (x:xs))
+ if isMixedCase (x:xs) || (all isUpperOrPunct (x:xs))
then Str (x:xs)
else Str (toUpper x : xs)
_ -> Str (x:xs)
tc (Span ("",["nocase"],[]) xs) = return $ Span ("",["nocase"],[]) xs
tc x = return x
- isShortWord s = map toLower s `elem`
- ["a","an","and","as","at","but","by","c","ca","d","de"
- ,"down","et","for","from"
- ,"in","into","nor","of","on","onto","or","over","so"
- ,"the","till","to","up","van","von","via","with","yet"]
+ isShortWord s = map toLower s `Set.member` shortWords
+
+shortWords :: Set.Set String
+shortWords = Set.fromList
+ ["a","an","and","as","at","but","by","c","ca","d","de"
+ ,"down","et","for","from"
+ ,"in","into","nor","of","on","onto","or","over","so"
+ ,"the","till","to","up","van","von","via","with","yet"]
isMixedCase :: String -> Bool
isMixedCase xs = any isUpper xs && any isLower xs
+isUpperOrPunct :: Char -> Bool
+isUpperOrPunct c = isUpper c || isPunctuation c
+
data CaseTransformState = WordBoundary
| LastWordBoundary
| SentenceBoundary
@@ -285,16 +292,15 @@ caseTransform xform = fmap reverse . foldM go [] . splitUpStr
modify (\st ->
case st of
SentenceBoundary -> SentenceBoundary
- _ ->
- case acc of
- (Str [x]:_)
- | x `elem` "?!:" -> SentenceBoundary
- _ -> WordBoundary)
+ _ -> WordBoundary)
return $ Space : acc
go acc LineBreak = do
put WordBoundary
return $ Space : acc
go acc (Str [c])
+ | c `elem` ".?!:" = do
+ put SentenceBoundary
+ return $ Str [c] : acc
| c `elem` "-/\x2013\x2014\160" = do
put WordBoundary
return $ Str [c] : acc
diff --git a/stack.yaml b/stack.yaml
index d38438d..468396d 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -9,13 +9,18 @@ packages:
- '.'
- location:
git: https://github.com/jgm/pandoc.git
- commit: ae61d5f57dc8094eb40a9e83427db7fb02afcefb
+ commit: 5849b89e52de64a5bbebbc815772ad6bbc883c1d
extra-dep: true
extra-deps:
+- texmath-0.9.4.2
- hslua-0.8.0
-- skylighting-0.3.3
+- skylighting-0.3.4.1
- cmark-gfm-0.1.1
- QuickCheck-2.10.0.1
- tasty-quickcheck-0.9.1
- haddock-library-1.4.3
-resolver: lts-9.0
+- pandoc-types-1.17.1
+# needed for now:
+- hs-bibutils-5.5
+- rfc5051-0.1.0.3
+resolver: lts-9.1
diff --git a/tests/biblio2yaml/book-averroes.biblatex b/tests/biblio2yaml/book-averroes.biblatex
index b34b2b4..58a1ddc 100644
--- a/tests/biblio2yaml/book-averroes.biblatex
+++ b/tests/biblio2yaml/book-averroes.biblatex
@@ -66,7 +66,8 @@ references:
title: The epistle on the possibility of conjunction with the active intellect by
Ibn Rushd with the commentary of Moses Narboni
title-short: Possibility of conjunction
- collection-title: '[Moreshet: Studies in Jewish History, Literature and Thought]{.nocase}'
+ collection-title: '<span class="nocase">Moreshet: Studies in Jewish History, Literature
+ and Thought</span>'
collection-number: '7'
publisher: Jewish Theological Seminary of America
publisher-place: New York
diff --git a/tests/biblio2yaml/incollection.biblatex b/tests/biblio2yaml/incollection.biblatex
index ab57200..40f4b5f 100644
--- a/tests/biblio2yaml/incollection.biblatex
+++ b/tests/biblio2yaml/incollection.biblatex
@@ -112,8 +112,8 @@ references:
given: Isadore
issued:
- year: '1979'
- title: The limitations of human knowledge according to Al-Farabi, [ibn Bajja]{.nocase},
- and Maimonides
+ title: The limitations of human knowledge according to Al-Farabi, <span class="nocase">ibn
+ Bajja</span>, and Maimonides
title-short: Limitations of human knowledge
container-title: Studies in medieval Jewish history and literature
publisher: Harvard University Press
diff --git a/tests/biblio2yaml/itzhaki.biblatex b/tests/biblio2yaml/itzhaki.biblatex
index c7dfb73..0d5dedd 100644
--- a/tests/biblio2yaml/itzhaki.biblatex
+++ b/tests/biblio2yaml/itzhaki.biblatex
@@ -62,7 +62,8 @@ references:
- year: '1996'
month: '3'
day: '11'
- title: Some remarks on ’[t Hooft’s]{.nocase} S-matrix for black holes
+ title: Some remarks on ’<span class="nocase">t Hooft’s</span> S-matrix for black
+ holes
version: '1'
annote: An online reference from arXiv. Note the eprint and eprinttype fields. Also
note that the arXiv reference is transformed into a clickable link if hyperref
diff --git a/tests/biblio2yaml/malinowski.biblatex b/tests/biblio2yaml/malinowski.biblatex
index 3b69693..1aaff4d 100644
--- a/tests/biblio2yaml/malinowski.biblatex
+++ b/tests/biblio2yaml/malinowski.biblatex
@@ -49,7 +49,7 @@ references:
issued:
- year: '1972'
title: 'Argonauts of the Western Pacific: An account of native enterprise and
- adventure in the [Archipelagoes of Melanesian New Guinea]{.nocase}'
+ adventure in the <span class="nocase">Archipelagoes of Melanesian New Guinea</span>'
title-short: Argonauts
publisher: Routledge and Kegan Paul
publisher-place: London
diff --git a/tests/biblio2yaml/murray.biblatex b/tests/biblio2yaml/murray.biblatex
index 37d0270..e47eb5c 100644
--- a/tests/biblio2yaml/murray.biblatex
+++ b/tests/biblio2yaml/murray.biblatex
@@ -85,7 +85,8 @@ references:
issued:
- year: '1998'
title: 'Alkanethiolate gold cluster molecules with core diameters from 1.5 to
- 5.2 [nm]{.nocase}: Core and monolayer properties as a function of core size'
+ 5.2 <span class="nocase">nm</span>: Core and monolayer properties as a function
+ of core size'
title-short: Alkanethiolate gold cluster molecules
container-title: Langmuir
page: '17-30'
diff --git a/tests/biblio2yaml/pandoc-2/ctan.biblatex b/tests/biblio2yaml/pandoc-2/ctan.biblatex
index 7d8fdaa..a36e44a 100644
--- a/tests/biblio2yaml/pandoc-2/ctan.biblatex
+++ b/tests/biblio2yaml/pandoc-2/ctan.biblatex
@@ -59,11 +59,11 @@ references:
day: '1'
title: 'CTAN: The Comprehensive TeX Archive Network'
title-short: CTAN
- annote: This is an online entry. The [url]{.smallcaps}, which is given in the url
- field, is transformed into a clickable link if hyperref support has been enabled.
- Note the format of the urldate field (yyyy-mm-dd) in the database file. Also note
- the label field which may be used as a fallback by citation styles which need
- an author and/or a year
+ annote: This is an online entry. The <span class="smallcaps">url</span>, which is
+ given in the url field, is transformed into a clickable link if hyperref support
+ has been enabled. Note the format of the urldate field (yyyy-mm-dd) in the database
+ file. Also note the label field which may be used as a fallback by citation styles
+ which need an author and/or a year
URL: http://www.ctan.org
language: en-US
...
diff --git a/tests/biblio2yaml/pandoc-2/formatting.biblatex b/tests/biblio2yaml/pandoc-2/formatting.biblatex
index 4cfe5de..1f2d1c6 100644
--- a/tests/biblio2yaml/pandoc-2/formatting.biblatex
+++ b/tests/biblio2yaml/pandoc-2/formatting.biblatex
@@ -10,6 +10,6 @@
references:
- id: item1
type: article-journal
- title: 'The title: *Italics*, **bold**, ~subscript~, ^superscript^, [small-caps]{.smallcaps}'
+ title: 'The title: *Italics*, **bold**, ~subscript~, ^superscript^, <span class="smallcaps">small-caps</span>'
title-short: The title
...
diff --git a/tests/biblio2yaml/pandoc-2/jaffe.biblatex b/tests/biblio2yaml/pandoc-2/jaffe.biblatex
index 016cbd7..f6fd8dd 100644
--- a/tests/biblio2yaml/pandoc-2/jaffe.biblatex
+++ b/tests/biblio2yaml/pandoc-2/jaffe.biblatex
@@ -66,7 +66,7 @@ references:
- year: '1885'
- year: '1888'
title: Regesta Pontificum Romanorum ab condita ecclesia ad annum post Christum natum
- [mcxcviii]{.smallcaps}
+ <span class="smallcaps">mcxcviii</span>
title-short: Regesta Pontificum Romanorum
publisher-place: Leipzig
number-of-volumes: '2'
diff --git a/tests/biblio2yaml/pandoc-2/kastenholz.biblatex b/tests/biblio2yaml/pandoc-2/kastenholz.biblatex
index 47bb33a..cbbae5d 100644
--- a/tests/biblio2yaml/pandoc-2/kastenholz.biblatex
+++ b/tests/biblio2yaml/pandoc-2/kastenholz.biblatex
@@ -92,7 +92,7 @@ references:
from molecular simulations
container-title: J. Chem. Phys.
volume: '124'
- annote: An article entry with an eid and a doi field. Note that the [doi]{.smallcaps}
+ annote: An article entry with an eid and a doi field. Note that the <span class="smallcaps">doi</span>
is transformed into a clickable link if hyperref support has been enabled
abstract: The computation of ionic solvation free energies from atomistic simulations
is a surprisingly difficult problem that has found no satisfactory solution for
diff --git a/tests/biblio2yaml/pandoc-2/online.biblatex b/tests/biblio2yaml/pandoc-2/online.biblatex
index 7e3226c..2282c61 100644
--- a/tests/biblio2yaml/pandoc-2/online.biblatex
+++ b/tests/biblio2yaml/pandoc-2/online.biblatex
@@ -57,11 +57,11 @@ references:
day: '1'
title: 'CTAN: The Comprehensive TeX Archive Network'
title-short: CTAN
- annote: This is an online entry. The [url]{.smallcaps}, which is given in the url
- field, is transformed into a clickable link if hyperref support has been enabled.
- Note the format of the urldate field (yyyy-mm-dd) in the database file. Also note
- the label field which may be used as a fallback by citation styles which need
- an author and/or a year
+ annote: This is an online entry. The <span class="smallcaps">url</span>, which is
+ given in the url field, is transformed into a clickable link if hyperref support
+ has been enabled. Note the format of the urldate field (yyyy-mm-dd) in the database
+ file. Also note the label field which may be used as a fallback by citation styles
+ which need an author and/or a year
URL: http://www.ctan.org
language: en-US
...
diff --git a/tests/biblio2yaml/pandoc-2/sigfridsson.biblatex b/tests/biblio2yaml/pandoc-2/sigfridsson.biblatex
index 0c96234..3e48cf9 100644
--- a/tests/biblio2yaml/pandoc-2/sigfridsson.biblatex
+++ b/tests/biblio2yaml/pandoc-2/sigfridsson.biblatex
@@ -79,8 +79,9 @@ references:
page: '377-395'
volume: '19'
issue: '4'
- annote: An article entry with volume, number, and doi fields. Note that the [doi]{.smallcaps}
- is transformed into a clickable link if hyperref support has been enabled
+ annote: An article entry with volume, number, and doi fields. Note that the <span
+ class="smallcaps">doi</span> is transformed into a clickable link if hyperref
+ support has been enabled
abstract: 'Four methods for deriving partial atomic charges from the quantum chemical
electrostatic potential (CHELP, CHELPG, Merz-Kollman, and RESP) have been compared
and critically evaluated. It is shown that charges strongly depend on how and
diff --git a/tests/biblio2yaml/pines.biblatex b/tests/biblio2yaml/pines.biblatex
index ce81a1a..f8820eb 100644
--- a/tests/biblio2yaml/pines.biblatex
+++ b/tests/biblio2yaml/pines.biblatex
@@ -58,8 +58,8 @@ references:
given: Isadore
issued:
- year: '1979'
- title: The limitations of human knowledge according to Al-Farabi, [ibn Bajja]{.nocase},
- and Maimonides
+ title: The limitations of human knowledge according to Al-Farabi, <span class="nocase">ibn
+ Bajja</span>, and Maimonides
title-short: Limitations of human knowledge
container-title: Studies in medieval Jewish history and literature
publisher: Harvard University Press
diff --git a/tests/biblio2yaml/test-case-conversion.biblatex b/tests/biblio2yaml/test-case-conversion.biblatex
index d6f43b3..40bdd95 100644
--- a/tests/biblio2yaml/test-case-conversion.biblatex
+++ b/tests/biblio2yaml/test-case-conversion.biblatex
@@ -59,9 +59,9 @@ references:
given: Ann
issued:
- year: '2013'
- title: A title, in English, with a Proper Name and an ACRONYM and a [camelCase]{.nocase}
- word and some units, 400 [nm]{.nocase}, 3 [cm]{.nocase}, and a quote, *Alea [iacta
- est]{.nocase}*
+ title: A title, in English, with a Proper Name and an ACRONYM and a <span class="nocase">camelCase</span>
+ word and some units, 400 <span class="nocase">nm</span>, 3 <span class="nocase">cm</span>,
+ and a quote, *Alea <span class="nocase">iacta est</span>*
container-title: Journal
language: en-US
...
diff --git a/tests/biblio2yaml/textnormal.biblatex b/tests/biblio2yaml/textnormal.biblatex
index 1097aa3..2850608 100644
--- a/tests/biblio2yaml/textnormal.biblatex
+++ b/tests/biblio2yaml/textnormal.biblatex
@@ -6,5 +6,5 @@
references:
- id: item1
type: book
- title: The title [of this book]{.nodecor}
+ title: The title <span class="nodecor">of this book</span>
...
diff --git a/tests/issue301.expected.native b/tests/issue301.expected.native
new file mode 100644
index 0000000..571a510
--- /dev/null
+++ b/tests/issue301.expected.native
@@ -0,0 +1,7 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("id",MetaInlines [Str "test"]),("title",MetaInlines [Str "Essays",Space,Str "presented",Space,Str "to",Space,Str "N.R.",Space,Str "Ker",Space,Str "(On",Space,Str "Art)"])]),MetaMap (fromList [("id",MetaInlines [Str "test2"]),("title",MetaInlines [Emph [Str "Test:"],Space,Str "An",Space,Str "experiment:",Space,Str "An",Space,Str "abridgement"])])])]})
+[Para [Cite [Citation {citationId = "test", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "(",Str "\8220Essays",Space,Str "Presented",Space,Str "to",Space,Str "N.R.",Space,Str "Ker",Space,Str "(on",Space,Str "Art),\8221",Space,Str "n.d.)"],Str ";",Space,Cite [Citation {citationId = "test2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "(",Str "\8220",Emph [Str "Test:"],Space,Str "An",Space,Str "Experiment:",Space,Str "An",Space,Str "Abridgement,\8221",Space,Str "n.d.)"]]
+,Div ("refs",["references"],[])
+ [Div ("ref-test",[],[])
+ [Para [Str "\8220",Str "Essays",Space,Str "Presented",Space,Str "to",Space,Str "N.R.",Space,Str "Ker",Space,Str "(on",Space,Str "Art).\8221",Space,Str "n.d."]]
+ ,Div ("ref-test2",[],[])
+ [Para [Str "\8220",Emph [Str "Test:"],Space,Str "An",Space,Str "Experiment:",Space,Str "An",Space,Str "Abridgement.\8221",Space,Str "n.d."]]]]
diff --git a/tests/issue301.in.native b/tests/issue301.in.native
new file mode 100644
index 0000000..62791da
--- /dev/null
+++ b/tests/issue301.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("id",MetaInlines [Str "test"]),("title",MetaInlines [Str "Essays",Space,Str "presented",Space,Str "to",Space,Str "N.R.",Space,Str "Ker",Space,Str "(On",Space,Str "Art)"])]),MetaMap (fromList [("id",MetaInlines [Str "test2"]),("title",MetaInlines [Emph [Str "Test:"],Space,Str "An",Space,Str "experiment:",Space,Str "An",Space,Str "abridgement"])])])]})
+[Para [Cite [Citation {citationId = "test", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@test"],Str ";",Space,Cite [Citation {citationId = "test2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@test2"]]]
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>
+