summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2017-12-25 06:58:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2017-12-25 06:58:00 (GMT)
commitf4f15e2c89f8b5072e0dc566ab8cdf75fce7ce18 (patch)
treeff7d23bc82da3bc680cb31958d91e9938008e0bf
parent47a9d0936afa44f2cb095d888499e96ef15d5887 (diff)
version 0.12.20.12.2
-rw-r--r--changelog65
-rw-r--r--compat/Text/CSL/Compat/Pandoc.hs3
-rw-r--r--pandoc-citeproc.cabal9
-rw-r--r--src/Text/CSL/Eval.hs7
-rw-r--r--src/Text/CSL/Eval/Date.hs37
-rw-r--r--src/Text/CSL/Eval/Output.hs1
-rw-r--r--src/Text/CSL/Proc/Disamb.hs56
-rw-r--r--src/Text/CSL/Reference.hs128
-rw-r--r--src/Text/CSL/Style.hs21
-rw-r--r--stack.yaml16
-rw-r--r--tests/biblatex-examples.bib1674
-rw-r--r--tests/issue119.expected.native10
-rw-r--r--tests/issue119.in.native3
-rw-r--r--tests/issue38.expected.native5
-rw-r--r--tests/issue38.in.native2
-rw-r--r--tests/issue47.expected.native19
-rw-r--r--tests/issue47.in.native10
-rw-r--r--tests/issue87.expected.native21
-rw-r--r--tests/issue87.in.native8
-rw-r--r--tests/jats.csl208
-rw-r--r--tests/modern-language-association-7th-edition.csl460
-rw-r--r--tests/test-citeproc.hs12
22 files changed, 2219 insertions, 556 deletions
diff --git a/changelog b/changelog
index 050a4b0..c9239dd 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,68 @@
+pandoc-citeproc (0.12.2)
+
+ * Improved parsing of raw dates. First we attempt to parse them
+ as ISO dates or date ranges (allowing `~` at the end to indicate
+ "circa").
+
+ * Prefer 'raw' even if it occurs with 'date-parts'. (In this case
+ 'date-parts' is ignored.)
+
+ * Parse 'cheater' variables embedded in 'note' in CSL JSON (#192).
+ Both braced and newline forms are supported.
+
+ * Don't make title-case sensitive to locale for labels (#119).
+
+ * API change: export `rmTitleCase'` from Text.CSL.Style.
+
+ * Improved raw date parsing (#103).
+
+ + We now only parse 'raw' if `date-parts` is empty or missing.
+ + Code for parsing raw dates moved from Text.CSL.Eval.Date to
+ Text.CSL.Reference.
+ + Use `literal` field if we can't parse data.
+
+ * Support `all-names-with-initials` disambiguation.
+
+ * Remove double quotes in parsing CSL family names.
+ CSL uses double quotes simply to protect the case in names.
+
+ * Text.CSL.Proc.Disamb: exclude year, year suffix, label
+ in detecting collisions, unless year-suffix set.
+ This causes us to pass several more citeproc tests.
+
+ * Parse 'raw' field in ref dates in CSL JSON.
+
+ * Accept numerical versions of boolean parse-names in CSL JSON input.
+ This is mainly useful for avoiding errors in test-citeproc.
+
+ * Support 'film' as synonym of 'motion_picture'.
+ I don't see this documented, but a test case in the citeproc
+ test suite depends on it.
+
+ * Support citations-rtf mode in test-citeproc.
+
+ * Preserve soft breaks in HTML output. This allows us to pass more
+ citeproc test cases.
+
+ * Parse 'season' properly in CSL YAML or JSON dates (#309).
+
+ * Fix "primary-name" name disambiguation (#38). This also sets the
+ default to "by-cite", since that is now the CSL default. However,
+ more adjustments are needed, as we now fail some citeproc tests we
+ passed before.
+
+ * test-citeproc improvements:
+
+ + , use new citeproc (git) test suite, not the old hg one.
+ + Build test-citeproc too in default Makefile target.
+ + Handle boolean values for 'citations' in test data.
+
+ * Add tests for issue #87.
+
+ * Added `-threaded` to `ghc-options` (#311).
+
+ * Added biblatex-examples.bib to data files.
+
pandoc-citeproc (0.12.1.1)
* Avoid double punctuation when citation ends with 'et al.' (#262).
diff --git a/compat/Text/CSL/Compat/Pandoc.hs b/compat/Text/CSL/Compat/Pandoc.hs
index 1dee8ce..99eb6e6 100644
--- a/compat/Text/CSL/Compat/Pandoc.hs
+++ b/compat/Text/CSL/Compat/Pandoc.hs
@@ -71,7 +71,8 @@ writeNative = either mempty T.unpack . runPure . Pandoc.writeNative def{ writerT
writeHtmlString = either mempty T.unpack . runPure . Pandoc.writeHtml4String
def{ writerExtensions = extensionsFromList
- [Ext_native_divs, Ext_native_spans, Ext_raw_html] }
+ [Ext_native_divs, Ext_native_spans, Ext_raw_html],
+ writerWrapText = WrapPreserve }
#else
readHtml = either mempty id . Pandoc.readHtml
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index 8fb7b5a..086f0bd 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.12.1.1
+version: 0.12.2
cabal-version: >= 1.12
synopsis: Supports using pandoc with citeproc
@@ -43,6 +43,7 @@ extra-source-files: stack.yaml
tests/*.expected.native
tests/*.csl
tests/biblio.bib
+ tests/biblatex-examples.bib
tests/biblio2yaml/*.bibtex
tests/biblio2yaml/*.biblatex
tests/biblio2yaml/pandoc-2/*.biblatex
@@ -162,7 +163,7 @@ executable pandoc-citeproc
other-modules: Paths_pandoc_citeproc
Prelude
default-language: Haskell2010
- ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind
+ ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -threaded
if flag(static)
ld-options: -static
if flag(bibutils)
@@ -184,7 +185,7 @@ executable test-citeproc
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
+ ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -threaded
default-language: Haskell2010
other-modules: Text.CSL.Compat.Pandoc
@@ -199,6 +200,6 @@ test-suite test-pandoc-citeproc
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
+ ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -threaded
default-language: Haskell2010
other-modules: Text.CSL.Compat.Pandoc
diff --git a/src/Text/CSL/Eval.hs b/src/Text/CSL/Eval.hs
index 48f640f..a44e393 100644
--- a/src/Text/CSL/Eval.hs
+++ b/src/Text/CSL/Eval.hs
@@ -72,14 +72,17 @@ evalLayout (Layout _ _ es) em b l m o a mbr
(_, Just "en") -> id
(_, Nothing) -> id
("en", Just "") -> id
- _ -> proc' rmTitleCase
+ _ -> proc' rmTitleCase'
evalSorting :: EvalMode -> [Locale] -> [MacroMap] -> [Option] ->
[Sort] -> Abbreviations -> Maybe Reference -> [Sorting]
evalSorting m l ms opts ss as mbr
= map (format . sorting) ss
where
- render = renderPlain . formatOutputList
+ render = renderPlain . formatOutputList . proc removeDelimAndLabel
+ removeDelimAndLabel (OLabel{}) = ONull
+ removeDelimAndLabel (ODel{}) = ONull
+ removeDelimAndLabel x = x
format (s,e) = applaySort s . render $ uncurry eval e
eval o e = evalLayout (Layout emptyFormatting [] [e]) m False l ms o as mbr
applaySort c s
diff --git a/src/Text/CSL/Eval/Date.hs b/src/Text/CSL/Eval/Date.hs
index 9e8c52b..f8abc58 100644
--- a/src/Text/CSL/Eval/Date.hs
+++ b/src/Text/CSL/Eval/Date.hs
@@ -18,10 +18,8 @@ module Text.CSL.Eval.Date where
import Control.Monad.State
import qualified Control.Exception as E
-import Data.Char
import Data.List
import Data.List.Split
-import Data.Maybe
import Text.CSL.Exception
import Text.CSL.Eval.Common
@@ -51,10 +49,10 @@ evalDate (Date s f fm dl dp dp') = do
updateS a b = if b /= a && b /= [] then b else a
case f of
NoFormDate -> mapM getDateVar s >>= return . outputList fm dl .
- concatMap (formatDate em k tm dp . concatMap parseRefDate)
+ concatMap (formatDate em k tm dp)
_ -> do Date _ _ lfm ldl ldp _ <- getDate f
let go dps = return . outputList (updateFM fm lfm) (if ldl /= [] then ldl else dl) .
- concatMap (formatDate em k tm dps . concatMap parseRefDate)
+ concatMap (formatDate em k tm dps)
update l x@(DatePart a b c d) =
case filter ((==) a . dpName) l of
(DatePart _ b' c' d':_) -> DatePart a (updateS b b')
@@ -219,34 +217,3 @@ getOrdinal v s ts
then maybe Neuter termGender $ findTerm v Long ts
else Neuter
-parseRefDate :: RefDate -> [RefDate]
-parseRefDate r@(RefDate _ _ _ _ (Literal o) c)
- = if null o then return r
- else let (a,b) = break (== '-') o
- in if null b then return (parseRaw o) else [parseRaw a, parseRaw b]
- where
- parseRaw str =
- case words $ check str of
- [y'] | and (map isDigit y') -> RefDate (Literal y') mempty mempty mempty (Literal o) c
- [s',y'] | and (map isDigit y')
- , and (map isDigit s') -> RefDate (Literal y') (Literal s') mempty mempty (Literal o) c
- [s',y'] | s' `elem'` seasons -> RefDate (Literal y') mempty (Literal $ select s' seasons) mempty (Literal o) False
- [s',y'] | s' `elem'` months -> RefDate (Literal y') (Literal $ select s' months) mempty mempty (Literal o) c
- [s',d',y'] | and (map isDigit s')
- , and (map isDigit y')
- , and (map isDigit d') -> RefDate (Literal y') (Literal s') mempty (Literal d') (Literal o) c
- [s',d',y'] | s' `elem'` months
- , and (map isDigit y')
- , and (map isDigit d') -> RefDate (Literal y') (Literal $ select s' months) mempty (Literal d') (Literal o) c
- [s',d',y'] | s' `elem'` months
- , and (map isDigit y')
- , and (map isDigit d') -> RefDate (Literal y') (Literal $ select s' months) mempty (Literal d') (Literal o) c
- _ -> r
- check [] = []
- check (x:xs) = if x `elem` ",/-" then ' ' : check xs else x : check xs
- select x = show . (+ 1) . fromJust . elemIndex' x
- elem' x = elem (map toLower $ take 3 x)
- elemIndex' x = elemIndex (map toLower $ take 3 x)
-
- months = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]
- seasons = ["spr","sum","fal","win"]
diff --git a/src/Text/CSL/Eval/Output.hs b/src/Text/CSL/Eval/Output.hs
index 39d4e26..72df97f 100644
--- a/src/Text/CSL/Eval/Output.hs
+++ b/src/Text/CSL/Eval/Output.hs
@@ -130,6 +130,7 @@ formatOutput o =
OPan i -> Formatted i
ODel [] -> Formatted []
ODel " " -> Formatted [Space]
+ ODel "\n" -> Formatted [SoftBreak]
ODel s -> formatString s
OStr [] _ -> Formatted []
OStr s f -> addFormatting f $ formatString s
diff --git a/src/Text/CSL/Proc/Disamb.hs b/src/Text/CSL/Proc/Disamb.hs
index dce2488..f0c2d97 100644
--- a/src/Text/CSL/Proc/Disamb.hs
+++ b/src/Text/CSL/Proc/Disamb.hs
@@ -50,19 +50,21 @@ disambCitations s bibs cs groups
-- name data of name duplicates
nameDupls = getDuplNameData groups
-- citation data of ambiguous cites
- duplics = getDuplCiteData hasNamesOpt hasYSuffOpt groups
+ duplics = getDuplCiteData giveNameDisamb hasNamesOpt hasYSuffOpt groups
-- check the options set in the style
- isByCite = let gno = getOptionVal "givenname-disambiguation-rule" (citOptions $ citation s)
- in gno == "by-cite" || gno == []
disOpts = getCitDisambOptions s
hasNamesOpt = "disambiguate-add-names" `elem` disOpts
hasGNameOpt = "disambiguate-add-givenname" `elem` disOpts
hasYSuffOpt = "disambiguate-add-year-suffix" `elem` disOpts
- givenNames = if hasGNameOpt
- then if isByCite then ByCite else AllNames
- else NoGiven
-
+ giveNameDisamb = case getOptionVal "givenname-disambiguation-rule"
+ (citOptions (citation s)) of
+ "by-cite" -> ByCite
+ "all-names" -> AllNames
+ "all-names-with-initials" -> AllNames
+ "primary-name" -> PrimaryName
+ "primary-name-with-initials" -> PrimaryName
+ _ -> ByCite -- default as of CSL 1.0
clean = if hasGNameOpt then id else proc rmHashAndGivenNames
withNames = flip map duplics $ same . clean .
map (if hasNamesOpt then disambData else return . disambYS)
@@ -71,8 +73,8 @@ disambCitations s bibs cs groups
needYSuff = filter_ snd $ zip duplics withNames
newNames :: [CiteData]
- newNames = when_ (hasNamesOpt || hasGNameOpt) $ disambAddNames givenNames $ needNames ++
- if hasYSuffOpt && givenNames == NoGiven then [] else needYSuff
+ newNames = when_ (hasNamesOpt || hasGNameOpt) $ disambAddNames giveNameDisamb $ needNames ++
+ if hasYSuffOpt && giveNameDisamb == NoGiven then [] else needYSuff
newGName :: [NameData]
newGName = when_ hasGNameOpt $ concatMap disambAddGivenNames nameDupls
@@ -92,7 +94,7 @@ disambCitations s bibs cs groups
yearSuffs = when_ hasYSuffOpt . generateYearSuffix bibs . concatMap getYearSuffixes $ withYearS
- addNames = proc (updateContrib givenNames newNames newGName)
+ addNames = proc (updateContrib giveNameDisamb newNames newGName)
processed = if hasYSuffOpt
then proc (updateYearSuffixes yearSuffs) $ withYearS
else withYearS
@@ -106,9 +108,10 @@ mapCitationGroup :: ([Output] -> [Output]) -> CitationGroup -> CitationGroup
mapCitationGroup f (CG cs fm d os) = CG cs fm d (zip (map fst os) . f $ map snd os)
data GiveNameDisambiguation
- = NoGiven
+ = NoGiven -- TODO this is no longer used?
| ByCite
| AllNames
+ | PrimaryName
deriving (Show, Eq)
disambAddNames :: GiveNameDisambiguation -> [CiteData] -> [CiteData]
@@ -189,29 +192,34 @@ getCitDisambOptions
-- disambiguation. The second 'Bool' is 'True' when comparing both
-- year and contributors' names for finding duplicates (when the
-- year-suffix option is set).
-getDuplCiteData :: Bool -> Bool -> [CitationGroup] -> [[CiteData]]
-getDuplCiteData b1 b2 g
+getDuplCiteData :: GiveNameDisambiguation -> Bool -> Bool -> [CitationGroup] -> [[CiteData]]
+getDuplCiteData giveNameDisamb b1 b2 g
= groupBy (\x y -> collide x == collide y) . sortBy (comparing collide)
$ duplicates
where
whatToGet = if b1 then collision else disambYS
- collide = proc rmExtras . proc rmHashAndGivenNames . whatToGet
+ collide = proc (rmExtras giveNameDisamb) . proc rmHashAndGivenNames . whatToGet
citeData = nubBy (\a b -> collide a == collide b && key a == key b) $
concatMap (mapGroupOutput $ getCiteData) g
duplicates = [c | c <- citeData , d <- citeData , collides c d]
collides x y = x /= y && (collide x == collide y)
&& (not b2 || citYear x == citYear y)
-rmExtras :: [Output] -> [Output]
-rmExtras os
- | Output x _ : xs <- os = case rmExtras x of
- [] -> rmExtras xs
- ys -> ys ++ rmExtras xs
- | OContrib _ _ x _ _ : xs <- os = OContrib [] [] x [] [] : rmExtras xs
- | OYear y _ f : xs <- os = OYear y [] f : rmExtras xs
- | ODel _ : xs <- os = rmExtras xs
- | OLoc _ _ : xs <- os = rmExtras xs
- | x : xs <- os = x : rmExtras xs
+rmExtras :: GiveNameDisambiguation -> [Output] -> [Output]
+rmExtras g os
+ | Output x _ : xs <- os = case rmExtras g x of
+ [] -> rmExtras g xs
+ ys -> ys ++ rmExtras g xs
+ | OContrib _ _ (y:ys) _ _ : xs <- os
+ = if g == PrimaryName
+ then OContrib [] [] [y] [] [] : rmExtras g xs
+ else OContrib [] [] (y:ys) [] [] : rmExtras g xs
+ | OYear{} : xs <- os = rmExtras g xs
+ | OYearSuf{} : xs <- os = rmExtras g xs
+ | OLabel{} : xs <- os = rmExtras g xs
+ | ODel _ : xs <- os = rmExtras g xs
+ | OLoc _ _ : xs <- os = rmExtras g xs
+ | x : xs <- os = x : rmExtras g xs
| otherwise = []
-- | For an evaluated citation get its 'CiteData'. The disambiguated
diff --git a/src/Text/CSL/Reference.hs b/src/Text/CSL/Reference.hs
index 4cbac98..c21d045 100644
--- a/src/Text/CSL/Reference.hs
+++ b/src/Text/CSL/Reference.hs
@@ -47,9 +47,10 @@ module Text.CSL.Reference ( Literal(..)
)
where
+import Control.Monad ( guard )
import Data.List ( elemIndex, intercalate )
import Data.List.Split ( splitWhen )
-import Data.Maybe ( fromMaybe )
+import Data.Maybe ( fromMaybe, isJust, isNothing )
import Data.Generics hiding (Generic)
import GHC.Generics (Generic)
import Data.Aeson hiding (Value)
@@ -57,6 +58,7 @@ import qualified Data.Aeson as Aeson
import Data.Aeson.Types (Parser)
import qualified Data.Yaml.Builder as Y
import Data.Yaml.Builder (ToYaml(..))
+import Data.Either (lefts, rights)
import Control.Applicative ((<|>))
import qualified Data.Text as T
import Data.Text (Text)
@@ -173,13 +175,19 @@ instance OVERLAPS
FromJSON [RefDate] where
parseJSON (Array xs) = mapM parseJSON $ V.toList xs
parseJSON (Object v) = do
+ raw' <- v .:? "raw"
dateParts <- v .:? "date-parts"
circa' <- (v .: "circa" >>= parseBool) <|> pure False
+ season' <- (v .: "season") <|> pure mempty
case dateParts of
- Just (Array xs) -> mapM (fmap (setCirca circa') . parseJSON)
- $ V.toList xs
- _ -> handleLiteral <$> parseJSON (Object v)
- parseJSON x = parseJSON x >>= mkRefDate
+ Just (Array xs) | not (isJust raw') && not (V.null xs)
+ -> mapM (fmap (setCirca circa' .
+ setSeason season') . parseJSON)
+ $ V.toList xs
+ _ -> case raw' of
+ Nothing -> handleLiteral <$> parseJSON (Object v)
+ Just r -> return $ parseRawDate r
+ parseJSON x = parseRawDate <$> parseJSON x
-- Zotero doesn't properly support date ranges, so a common
-- workaround is 2005_2007 or 2005_; support this as date range:
@@ -218,6 +226,9 @@ instance OVERLAPS
setCirca :: Bool -> RefDate -> RefDate
setCirca circa' rd = rd{ circa = circa' }
+setSeason :: Literal -> RefDate -> RefDate
+setSeason season' rd = rd{ season = season' }
+
mkRefDate :: Literal -> Parser [RefDate]
mkRefDate z@(Literal xs)
| all isDigit xs = return [RefDate z mempty mempty mempty mempty False]
@@ -266,6 +277,8 @@ instance Show RefType where
show x = map toLower . uncamelize . showConstr . toConstr $ x
instance FromJSON RefType where
+ -- found in one of the test cases:
+ parseJSON (String "film") = return MotionPicture
parseJSON (String t) =
(safeRead (capitalize . camelize . T.unpack $ t)) <|>
fail ("'" ++ T.unpack t ++ "' is not a valid reference type")
@@ -491,6 +504,8 @@ instance FromJSON Reference where
-- Syntax for adding supplementary fields in note variable
-- {:authority:Superior Court of California}{:section:A}{:original-date:1777}
+-- or
+-- Foo\nissued: 2016-03-20/2016-07-31\nbar
-- see http://gsl-nagoya-u.net/http/pub/citeproc-doc.html#supplementary-fields
parseSuppFields :: Aeson.Object -> Parser Aeson.Object
parseSuppFields o = do
@@ -501,20 +516,31 @@ parseSuppFields o = do
noteFields :: P.Parser [(Text, Aeson.Value)]
noteFields = do
- fs <- P.many noteField
+ fs <- P.many (Right <$> (noteField <|> lineNoteField) <|> Left <$> regText)
P.spaces
- rest <- P.getInput
- return (("note", Aeson.String (T.pack rest)) : fs)
+ let rest = T.unwords (lefts fs)
+ return (("note", Aeson.String rest) : rights fs)
noteField :: P.Parser (Text, Aeson.Value)
noteField = P.try $ do
- P.spaces
_ <- P.char '{'
_ <- P.char ':'
k <- P.manyTill (P.letter <|> P.char '-') (P.char ':')
+ _ <- P.skipMany (P.char ' ')
v <- P.manyTill P.anyChar (P.char '}')
return (T.pack k, Aeson.String (T.pack v))
+lineNoteField :: P.Parser (Text, Aeson.Value)
+lineNoteField = P.try $ do
+ _ <- P.char '\n'
+ k <- P.manyTill (P.letter <|> P.char '-') (P.char ':')
+ _ <- P.skipMany (P.char ' ')
+ v <- P.manyTill P.anyChar (P.char '\n' <|> '\n' <$ P.eof)
+ return (T.pack k, Aeson.String (T.pack v))
+
+regText :: P.Parser Text
+regText = (T.pack <$> P.many1 (P.noneOf "\n{")) <|> (T.singleton <$> P.anyChar)
+
instance ToJSON Reference where
toJSON ref = object' [
"id" .= refId ref
@@ -834,3 +860,87 @@ setNearNote s cs
citeNoteNumber x /= "0" &&
readNum (citeNoteNumber c) - readNum (citeNoteNumber x) <= near_note
_ -> False
+
+parseRawDate :: String -> [RefDate]
+parseRawDate o =
+ case P.parse rawDate "raw date" o of
+ Left _ -> [RefDate mempty mempty mempty mempty (Literal o) False]
+ Right ds -> ds
+
+rawDate :: P.Parser [RefDate]
+rawDate = rawDateISO <|> rawDateOld
+
+rawDateISO :: P.Parser [RefDate]
+rawDateISO = do
+ d1 <- isoDate
+ P.option [d1] (P.char '/' >> (\x -> [d1, x]) <$> isoDate)
+
+isoDate :: P.Parser RefDate
+isoDate = P.try $ do
+ y <- P.many1 P.digit
+ m' <- P.option Nothing $ Just <$> P.try (P.char '-' >> P.many1 P.digit)
+ (m,s) <- case m' >>= safeRead of
+ Just (n::Int)
+ | n >= 1 && n <= 12 -> return (show n, "")
+ | n >= 13 && n <= 16 -> return ("", show (n - 12))
+ | n >= 21 && n <= 24 -> return ("", show (n - 20))
+ Nothing | isNothing m' -> return ("", "")
+ _ -> fail "Improper month"
+ d <- P.option Nothing $ Just <$> P.try (P.char '-' >> P.many1 P.digit)
+ guard $ isNothing d || case d >>= safeRead of
+ Just (n::Int) | n >= 1 && n <= 31 -> True
+ _ -> False
+ c <- P.option False (True <$ P.char '~')
+ return RefDate{ year = Literal y, month = Literal m,
+ season = Literal s, day = maybe mempty Literal d,
+ other = mempty, circa = c }
+
+rawDateOld :: P.Parser [RefDate]
+rawDateOld = do
+ let months = ["jan","feb","mar","apr","may","jun","jul","aug",
+ "sep","oct","nov","dec"]
+ let seasons = ["spr","sum","fal","win"]
+ let pmonth = P.try $ do
+ xs <- P.many1 P.letter <|> P.many1 P.digit
+ if all isDigit xs
+ then case safeRead xs of
+ Just (n::Int) | n >= 1 && n <= 12 -> return (show n)
+ _ -> fail "Improper month"
+ else case elemIndex (map toLower $ take 3 xs) months of
+ Nothing -> fail "Improper month"
+ Just n -> return (show (n+1))
+ let pseason = P.try $ do
+ xs <- P.many1 P.letter
+ case elemIndex (map toLower $ take 3 xs) seasons of
+ Nothing -> fail "Improper season"
+ Just n -> return (show (n+1))
+ let pday = P.try $ do
+ xs <- P.many1 P.digit
+ case safeRead xs of
+ Just (n::Int) | n >= 1 && n <= 31 -> return (show n)
+ _ -> fail "Improper day"
+ let pyear = P.many1 P.digit
+ let sep = P.oneOf ['-',' ','/',','] >> P.spaces
+ let rangesep = P.try $ P.spaces >> P.char '-' >> P.spaces
+ let refDate = RefDate mempty mempty mempty mempty mempty False
+ let date = P.choice $ map P.try [
+ (do s <- pseason
+ sep
+ y <- pyear
+ return refDate{ year = Literal y, season = Literal s })
+ , (do m <- pmonth
+ sep
+ d <- pday
+ sep
+ y <- pyear
+ return refDate{ year = Literal y, month = Literal m,
+ day = Literal d })
+ , (do m <- pmonth
+ sep
+ y <- pyear
+ return refDate{ year = Literal y, month = Literal m })
+ , (do y <- pyear
+ return refDate{ year = Literal y })
+ ]
+ d1 <- date
+ P.option [d1] ((\x -> [d1,x]) <$> (rangesep >> date))
diff --git a/src/Text/CSL/Style.hs b/src/Text/CSL/Style.hs
index c4ff383..5790bb2 100644
--- a/src/Text/CSL/Style.hs
+++ b/src/Text/CSL/Style.hs
@@ -64,6 +64,7 @@ module Text.CSL.Style ( readCSLString
, Formatting(..)
, emptyFormatting
, rmTitleCase
+ , rmTitleCase'
, Quote(..)
, mergeFM
, CSInfo(..)
@@ -590,6 +591,13 @@ instance Show Formatting where
rmTitleCase :: Formatting -> Formatting
rmTitleCase f = f{ textCase = if textCase f == "title" then "" else textCase f }
+rmTitleCase' :: Output -> Output
+rmTitleCase' o =
+ case o of
+ OStr s f -> OStr s (rmTitleCase f)
+ Output os f -> Output os (rmTitleCase f)
+ _ -> o
+
data Quote
= NativeQuote
| ParsedQuote
@@ -777,16 +785,23 @@ data Agent
emptyAgent :: Agent
emptyAgent = Agent [] mempty mempty mempty mempty mempty False False
+-- CSL JSON uses quotes to protect capitalization
+removeQuoted :: Formatted -> Formatted
+removeQuoted (Formatted ils) = Formatted (go ils)
+ where go [] = []
+ go (Quoted DoubleQuote ils' : xs) = ils' ++ go xs
+ go (x:xs) = x : go xs
+
instance FromJSON Agent where
parseJSON (Object v) = nameTransform <$> (Agent <$>
(v .: "given" <|> ((map Formatted . wordsBy isSpace . unFormatted) <$> v .: "given") <|> pure []) <*>
v .:? "dropping-particle" .!= mempty <*>
v .:? "non-dropping-particle" .!= mempty <*>
- v .:? "family" .!= mempty <*>
+ (removeQuoted <$> (v .:? "family" .!= mempty)) <*>
v .:? "suffix" .!= mempty <*>
v .:? "literal" .!= mempty <*>
- v .:? "comma-suffix" .!= False <*>
- v .:? "parse-names" .!= False)
+ (v .:? "comma-suffix" >>= mb parseBool) .!= False <*>
+ (v .:? "parse-names" >>= mb parseBool) .!= False)
parseJSON _ = fail "Could not parse Agent"
instance ToYaml Agent where
diff --git a/stack.yaml b/stack.yaml
index 74c264f..72febbc 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -9,19 +9,5 @@ flags:
packages:
- '.'
extra-deps:
-- pandoc-2.0.5
-- texmath-0.10
-- hslua-0.9.3
-- hslua-module-text-0.1.2.1
-- skylighting-0.5
-- cmark-gfm-0.1.1
-- QuickCheck-2.10.0.1
-- tasty-quickcheck-0.9.1
-- tagsoup-0.14.2
-- doctemplates-0.2.1
-- haddock-library-1.4.3
-- pandoc-types-1.17.3
-# needed for now:
-- hs-bibutils-6.2.0.1
- rfc5051-0.1.0.3
-resolver: lts-9.14
+resolver: lts-10.0
diff --git a/tests/biblatex-examples.bib b/tests/biblatex-examples.bib
new file mode 100644
index 0000000..36ac849
--- /dev/null
+++ b/tests/biblatex-examples.bib
@@ -0,0 +1,1674 @@
+@string{anch-ie = {Angew.~Chem. Int.~Ed.}}
+@string{cup = {Cambridge University Press}}
+@string{dtv = {Deutscher Taschenbuch-Verlag}}
+@string{hup = {Harvard University Press}}
+@string{jams = {J.~Amer. Math. Soc.}}
+@string{jchph = {J.~Chem. Phys.}}
+@string{jomch = {J.~Organomet. Chem.}}
+@string{pup = {Princeton University Press}}
+
+@incollection{westfahl:space,
+ author = {Westfahl, Gary},
+ title = {The True Frontier},
+ subtitle = {Confronting and Avoiding the Realities of Space in {American}
+ Science Fiction Films},
+ pages = {55-65},
+ crossref = {westfahl:frontier},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {True Frontier, The},
+ annotation = {A cross-referenced article from a \texttt{collection}. This is
+ an \texttt{incollection} entry with a \texttt{crossref}
+ field. Note the \texttt{subtitle} and \texttt{indextitle}
+ fields},
+}
+
+@set{set,
+ entryset = {herrmann,aksin,yoon},
+ annotation = {A \texttt{set} with three members. The \texttt{crossref} field
+ in the \texttt{@set} entry and the \texttt{entryset} field in
+ each set member entry is needed only when using BibTeX as the
+ backend},
+}
+
+@set{stdmodel,
+ entryset = {glashow,weinberg,salam},
+ annotation = {A \texttt{set} with three members discussing the standard
+ model of particle physics. The \texttt{crossref} field
+ in the \texttt{@set} entry and the \texttt{entryset} field in
+ each set member entry is needed only when using BibTeX as the
+ backend},
+}
+
+@article{aksin,
+ author = {Aks{\i}n, {\"O}zge and T{\"u}rkmen, Hayati and Artok, Levent
+ and {\c{C}}etinkaya, Bekir and Ni, Chaoying and
+ B{\"u}y{\"u}kg{\"u}ng{\"o}r, Orhan and {\"O}zkal, Erhan},
+ title = {Effect of immobilization on catalytic characteristics of
+ saturated {Pd-N}-heterocyclic carbenes in {Mizoroki-Heck}
+ reactions},
+ journaltitle = jomch,
+ date = 2006,
+ volume = 691,
+ number = 13,
+ pages = {3027-3036},
+ indextitle = {Effect of immobilization on catalytic characteristics},
+}
+
+@article{angenendt,
+ author = {Angenendt, Arnold},
+ title = {In Honore Salvatoris~-- Vom Sinn und Unsinn der
+ Patrozinienkunde},
+ journaltitle = {Revue d'Histoire Eccl{\'e}siastique},
+ date = 2002,
+ volume = 97,
+ pages = {431--456, 791--823},
+ langid = {german},
+ indextitle = {In Honore Salvatoris},
+ shorttitle = {In Honore Salvatoris},
+ annotation = {A German article in a French journal. Apart from that, a
+ typical \texttt{article} entry. Note the \texttt{indextitle}
+ field},
+}
+
+@article{baez/article,
+ author = {Baez, John C. and Lauda, Aaron D.},
+ title = {Higher-Dimensional Algebra {V}: 2-Groups},
+ journaltitle = {Theory and Applications of Categories},
+ date = 2004,
+ volume = 12,
+ pages = {423-491},
+ version = 3,
+ eprint = {math/0307200v3},
+ eprinttype = {arxiv},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {An \texttt{article} with \texttt{eprint} and
+ \texttt{eprinttype} fields. Note that the arXiv reference is
+ transformed into a clickable link if \texttt{hyperref} support
+ has been enabled. Compare \texttt{baez\slash online}, which
+ is the same item given as an \texttt{online} entry},
+}
+
+@article{bertram,
+ author = {Bertram, Aaron and Wentworth, Richard},
+ title = {Gromov invariants for holomorphic maps on {Riemann} surfaces},
+ journaltitle = jams,
+ date = 1996,
+ volume = 9,
+ number = 2,
+ pages = {529-571},
+ langid = {english},
+ langidopts = {variant=american},
+ shorttitle = {Gromov invariants},
+ annotation = {An \texttt{article} entry with a \texttt{volume} and a
+ \texttt{number} field},
+}
+
+@article{doody,
+ author = {Doody, Terrence},
+ title = {Hemingway's Style and {Jake's} Narration},
+ year = 1974,
+ volume = 4,
+ number = 3,
+ pages = {212-225},
+ langid = {english},
+ langidopts = {variant=american},
+ related = {matuz:doody},
+ relatedstring= {\autocap{e}xcerpt in},
+ journal = {The Journal of Narrative Technique},
+ annotation = {An \texttt{article} entry cited as an excerpt from a
+ \texttt{collection} entry. Note the format of the
+ \texttt{related} and \texttt{relatedstring} fields},
+}
+
+@collection{matuz:doody,
+ editor = {Matuz, Roger},
+ title = {Contemporary Literary Criticism},
+ year = 1990,
+ volume = 61,
+ publisher = {Gale},
+ location = {Detroit},
+ pages = {204-208},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {A \texttt{collection} entry providing the excerpt information
+ for the \texttt{doody} entry. Note the format of the
+ \texttt{pages} field},
+}
+
+@article{gillies,
+ author = {Gillies, Alexander},
+ title = {Herder and the Preparation of {Goethe's} Idea of World
+ Literature},
+ journaltitle = {Publications of the English Goethe Society},
+ date = 1933,
+ series = {newseries},
+ volume = 9,
+ pages = {46-67},
+ langid = {english},
+ langidopts = {variant=british},
+ annotation = {An \texttt{article} entry with a \texttt{series} and a
+ \texttt{volume} field. Note that format of the \texttt{series}
+ field in the database file},
+}
+
+@article{glashow,
+ author = {Glashow, Sheldon},
+ title = {Partial Symmetries of Weak Interactions},
+ journaltitle = {Nucl.~Phys.},
+ date = 1961,
+ volume = 22,
+ pages = {579-588},
+}
+
+@article{herrmann,
+ author = {Herrmann, Wolfgang A. and {\"O}fele, Karl and Schneider,
+ Sabine K. and Herdtweck, Eberhardt and Hoffmann, Stephan D.},
+ title = {A carbocyclic carbene as an efficient catalyst ligand for {C--C}
+ coupling reactions},
+ journaltitle = anch-ie,
+ date = 2006,
+ volume = 45,
+ number = 23,
+ pages = {3859-3862},
+ indextitle = {Carbocyclic carbene as an efficient catalyst, A},
+}
+
+@article{kastenholz,
+ author = {Kastenholz, M. A. and H{\"u}nenberger, Philippe H.},
+ title = {Computation of methodology\hyphen independent ionic solvation
+ free energies from molecular simulations},
+ journaltitle = jchph,
+ date = 2006,
+ subtitle = {{I}. {The} electrostatic potential in molecular liquids},
+ volume = 124,
+ eid = 124106,
+ doi = {10.1063/1.2172593},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Computation of ionic solvation free energies},
+ annotation = {An \texttt{article} entry with an \texttt{eid} and a
+ \texttt{doi} field. Note that the \textsc{doi} is transformed
+ into a clickable link if \texttt{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 more than 15 years. The
+ reason is that the charging free energies evaluated from such
+ simulations are affected by very large errors. One of these is
+ related to the choice of a specific convention for summing up
+ the contributions of solvent charges to the electrostatic
+ potential in the ionic cavity, namely, on the basis of point
+ charges within entire solvent molecules (M scheme) or on the
+ basis of individual point charges (P scheme). The use of an
+ inappropriate convention may lead to a charge-independent
+ offset in the calculated potential, which depends on the
+ details of the summation scheme, on the quadrupole-moment
+ trace of the solvent molecule, and on the approximate form
+ used to represent electrostatic interactions in the
+ system. However, whether the M or P scheme (if any) represents
+ the appropriate convention is still a matter of on-going
+ debate. The goal of the present article is to settle this
+ long-standing controversy by carefully analyzing (both
+ analytically and numerically) the properties of the
+ electrostatic potential in molecular liquids (and inside
+ cavities within them).},
+}
+
+@article{murray,
+ author = {Hostetler, Michael J. and Wingate, Julia E. and Zhong,
+ Chuan-Jian and Harris, Jay E. and Vachet, Richard W. and
+ Clark, Michael R. and Londono, J. David and Green, Stephen
+ J. and Stokes, Jennifer J. and Wignall, George D. and Glish,
+ Gary L. and Porter, Marc D. and Evans, Neal D. and Murray,
+ Royce W.},
+ title = {Alkanethiolate gold cluster molecules with core diameters from
+ 1.5 to 5.2~{nm}},
+ journaltitle = {Langmuir},
+ date = 1998,
+ subtitle = {Core and monolayer properties as a function of core size},
+ volume = 14,
+ number = 1,
+ pages = {17-30},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Alkanethiolate gold cluster molecules},
+ shorttitle = {Alkanethiolate gold cluster molecules},
+ annotation = {An \texttt{article} entry with \arabic{author} authors. By
+ default, long author and editor lists are automatically
+ truncated. This is configurable},
+}
+
+@article{reese,
+ author = {Reese, Trevor R.},
+ title = {Georgia in {Anglo-Spanish} Diplomacy, 1736--1739},
+ journaltitle = {William and Mary Quarterly},
+ date = 1958,
+ series = 3,
+ volume = 15,
+ pages = {168-190},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {An \texttt{article} entry with a \texttt{series} and a
+ \texttt{volume} field. Note the format of the series. If the
+ value of the \texttt{series} field is an integer, this number
+ is printed as an ordinal and the string \enquote*{series} is
+ appended automatically},
+}
+
+@article{sarfraz,
+ author = {M. Sarfraz and M. F. A. Razzak},
+ title = {Technical section: {An} algorithm for automatic capturing of
+ the font outlines},
+ year = 2002,
+ volume = 26,
+ number = 5,
+ pages = {795-804},
+ issn = {0097-8493},
+ journal = {Computers and Graphics},
+ annotation = {An \texttt{article} entry with an \texttt{issn} field},
+}
+
+@article{shore,
+ author = {Shore, Bradd},
+ title = {Twice-Born, Once Conceived},
+ journaltitle = {American Anthropologist},
+ date = {1991-03},
+ subtitle = {Meaning Construction and Cultural Cognition},
+ series = {newseries},
+ volume = 93,
+ number = 1,
+ pages = {9-27},
+ annotation = {An \texttt{article} entry with \texttt{series},
+ \texttt{volume}, and \texttt{number} fields. Note the format
+ of the \texttt{series} which is a localization key},
+}
+
+@article{sigfridsson,
+ author = {Sigfridsson, Emma and Ryde, Ulf},
+ title = {Comparison of methods for deriving atomic charges from the
+ electrostatic potential and moments},
+ journaltitle = {Journal of Computational Chemistry},
+ date = 1998,
+ volume = 19,
+ number = 4,
+ pages = {377-395},
+ doi = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Methods for deriving atomic charges},
+ annotation = {An \texttt{article} entry with \texttt{volume},
+ \texttt{number}, and \texttt{doi} fields. Note that the
+ \textsc{doi} is transformed into a clickable link if
+ \texttt{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
+ where the potential points are selected. Two alternative
+ methods are suggested to avoid the arbitrariness in the
+ point-selection schemes and van der Waals exclusion radii:
+ CHELP-BOW, which also estimates the charges from the
+ electrostatic potential, but with potential points that are
+ Boltzmann-weighted after their occurrence in actual
+ simulations using the energy function of the program in which
+ the charges will be used, and CHELMO, which estimates the
+ charges directly from the electrostatic multipole
+ moments. Different criteria for the quality of the charges are
+ discussed.},
+}
+
+@article{spiegelberg,
+ author = {Spiegelberg, Herbert},
+ title = {\mkbibquote{Intention} und \mkbibquote{Intentionalit{\"a}t} in
+ der Scholastik, bei Brentano und Husserl},
+ journaltitle = {Studia Philosophica},
+ date = 1969,
+ volume = 29,
+ pages = {189-216},
+ langid = {german},
+ sorttitle = {Intention und Intentionalitat in der Scholastik, bei Brentano
+ und Husserl},
+ indexsorttitle= {Intention und Intentionalitat in der Scholastik, bei Brentano
+ und Husserl},
+ shorttitle = {Intention und Intentionalit{\"a}t},
+ annotation = {An \texttt{article} entry. Note the \texttt{sorttitle} and
+ \texttt{indexsorttitle} fields and the markup of the quotes in
+ the database file},
+}
+
+@article{springer,
+ author = {Springer, Otto},
+ title = {Mediaeval Pilgrim Routes from {Scandinavia} to {Rome}},
+ journaltitle = {Mediaeval Studies},
+ date = 1950,
+ volume = 12,
+ pages = {92-122},
+ langid = {english},
+ langidopts = {variant=british},
+ shorttitle = {Mediaeval Pilgrim Routes},
+ annotation = {A plain \texttt{article} entry},
+}
+
+@article{weinberg,
+ author = {Weinberg, Steven},
+ title = {A Model of Leptons},
+ journaltitle = {Phys.~Rev.~Lett.},
+ date = 1967,
+ volume = 19,
+ pages = {1264-1266},
+}
+
+@article{yoon,
+ author = {Yoon, Myeong S. and Ryu, Dowook and Kim, Jeongryul and Ahn,
+ Kyo Han},
+ title = {Palladium pincer complexes with reduced bond angle strain:
+ efficient catalysts for the {Heck} reaction},
+ journaltitle = {Organometallics},
+ date = 2006,
+ volume = 25,
+ number = 10,
+ pages = {2409-2411},
+ indextitle = {Palladium pincer complexes},
+}
+
+@book{aristotle:anima,
+ author = {Aristotle},
+ title = {De Anima},
+ date = 1907,
+ editor = {Hicks, Robert Drew},
+ publisher = cup,
+ location = {Cambridge},
+ keywords = {primary},
+ langid = {english},
+ langidopts = {variant=british},
+ annotation = {A \texttt{book} entry with an \texttt{author} and an
+ \texttt{editor}},
+}
+
+@book{aristotle:physics,
+ author = {Aristotle},
+ title = {Physics},
+ date = 1929,
+ translator = {Wicksteed, P. H. and Cornford, F. M.},
+ publisher = {G. P. Putnam},
+ location = {New York},
+ keywords = {primary},
+ langid = {english},
+ langidopts = {variant=american},
+ shorttitle = {Physics},
+ annotation = {A \texttt{book} entry with a \texttt{translator} field},
+}
+
+@book{aristotle:poetics,
+ author = {Aristotle},
+ title = {Poetics},
+ date = 1968,
+ editor = {Lucas, D. W.},
+ series = {Clarendon {Aristotle}},
+ publisher = {Clarendon Press},
+ location = {Oxford},
+ keywords = {primary},
+ langid = {english},
+ langidopts = {variant=british},
+ shorttitle = {Poetics},
+ annotation = {A \texttt{book} entry with an \texttt{author} and an
+ \texttt{editor} as well as a \texttt{series} field},
+}
+
+@book{aristotle:rhetoric,
+ author = {Aristotle},
+ title = {The Rhetoric of {Aristotle} with a commentary by the late {Edward
+ Meredith Cope}},
+ date = 1877,
+ editor = {Cope, Edward Meredith},
+ commentator = {Cope, Edward Meredith},
+ volumes = 3,
+ publisher = cup,
+ keywords = {primary},
+ langid = {english},
+ langidopts = {variant=british},
+ sorttitle = {Rhetoric of Aristotle},
+ indextitle = {Rhetoric of {Aristotle}, The},
+ shorttitle = {Rhetoric},
+ annotation = {A commented edition. Note the concatenation of the
+ \texttt{editor} and \texttt{commentator} fields as well as the
+ \texttt{volumes}, \texttt{sorttitle}, and \texttt{indextitle}
+ fields},
+}
+
+@book{augustine,
+ author = {Augustine, Robert L.},
+ title = {Heterogeneous catalysis for the synthetic chemist},
+ date = 1995,
+ publisher = {Marcel Dekker},
+ location = {New York},
+ langid = {english},
+ langidopts = {variant=american},
+ shorttitle = {Heterogeneous catalysis},
+ annotation = {A plain \texttt{book} entry},
+}
+
+@book{averroes/bland,
+ author = {Averroes},
+ title = {The Epistle on the Possibility of Conjunction with the Active
+ Intellect by {Ibn Rushd} with the Commentary of {Moses Narboni}},
+ date = 1982,
+ editor = {Bland, Kalman P.},
+ translator = {Bland, Kalman P.},
+ series = {Moreshet: Studies in {Jewish} History, Literature and Thought},
+ number = 7,
+ publisher = {Jewish Theological Seminary of America},
+ location = {New York},
+ keywords = {primary},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Epistle on the Possibility of Conjunction, The},
+ shorttitle = {Possibility of Conjunction},
+ annotation = {A \texttt{book} entry with a \texttt{series} and a
+ \texttt{number}. Note the concatenation of the \texttt{editor}
+ and \texttt{translator} fields as well as the
+ \texttt{indextitle} field},
+}
+
+@book{averroes/hannes,
+ author = {Averroes},
+ title = {Des Averro{\"e}s Abhandlung: \mkbibquote{{\"U}ber die
+ M{\"o}glichkeit der Conjunktion} oder \mkbibquote{{\"U}ber den
+ materiellen Intellekt}},
+ date = 1892,
+ editor = {Hannes, Ludwig},
+ translator = {Hannes, Ludwig},
+ annotator = {Hannes, Ludwig},
+ publisher = {C.~A. Kaemmerer},
+ location = {Halle an der Saale},
+ keywords = {primary},
+ langid = {german},
+ sorttitle = {Uber die Moglichkeit der Conjunktion},
+ indexsorttitle= {Uber die Moglichkeit der Conjunktion},
+ indextitle = {{\"U}ber die M{\"o}glichkeit der Conjunktion},
+ shorttitle = {{\"U}ber die M{\"o}glichkeit der Conjunktion},
+ annotation = {An annotated edition. Note the concatenation of the
+ \texttt{editor}, \texttt{translator}, and \texttt{annotator}
+ fields. Also note the \texttt{shorttitle},
+ \texttt{indextitle}, \texttt{sorttitle}, and
+ \texttt{indexsorttitle} fields},
+}
+
+@book{averroes/hercz,
+ author = {Averroes},
+ title = {Drei Abhandlungen {\"u}ber die Conjunction des separaten
+ Intellects mit dem Menschen},
+ date = 1869,
+ editor = {Hercz, J.},
+ translator = {Hercz, J.},
+ publisher = {S.~Hermann},
+ location = {Berlin},
+ keywords = {primary},
+ langid = {german},
+ indexsorttitle= {Drei Abhandlungen uber die Conjunction},
+ indextitle = {Drei Abhandlungen {\"u}ber die Conjunction},
+ subtitle = {Von Averroes (Vater und Sohn), aus dem Arabischen
+ {\"u}bersetzt von Samuel Ibn Tibbon},
+ shorttitle = {Drei Abhandlungen},
+ annotation = {A \texttt{book} entry. Note the concatenation of the
+ \texttt{editor} and \texttt{translator} fields as well as the
+ \texttt{indextitle} and \texttt{indexsorttitle} fields},
+}
+
+@book{cicero,
+ author = {Cicero, Marcus Tullius},
+ title = {De natura deorum. {\"U}ber das Wesen der G{\"o}tter},
+ date = 1995,
+ editor = {Blank-Sangmeister, Ursula},
+ translator = {Blank-Sangmeister, Ursula},
+ afterword = {Thraede, Klaus},
+ language = {langlatin and langgerman},
+ publisher = {Reclam},
+ location = {Stuttgart},
+ langid = {german},
+ indextitle = {De natura deorum},
+ shorttitle = {De natura deorum},
+ annotation = {A bilingual edition of Cicero's \emph{De natura deorum}, with
+ a German translation. Note the format of the \texttt{language}
+ field in the database file, the concatenation of the
+ \texttt{editor} and \texttt{translator} fields, and the
+ \texttt{afterword} field},
+}
+
+@book{coleridge,
+ author = {Coleridge, Samuel Taylor},
+ title = {Biographia literaria, or {Biographical} sketches of my literary
+ life and opinions},
+ date = 1983,
+ editor = {Coburn, Kathleen and Engell, James and Bate, W. Jackson},
+ maintitle = {The collected works of {Samuel Taylor Coleridge}},
+ volume = 7,
+ part = 2,
+ series = {Bollingen Series},
+ number = 75,
+ publisher = {Routledge {and} Kegan Paul},
+ location = {London},
+ langid = {english},
+ langidopts = {variant=british},
+ indextitle = {Biographia literaria},
+ shorttitle = {Biographia literaria},
+ annotation = {One (partial) volume of a multivolume book. This is a
+ \texttt{book} entry with a \texttt{volume} and a \texttt{part}
+ field which explicitly refers to the second (physical) part of
+ the seventh (logical) volume. Also note the \texttt{series}
+ and \texttt{number} fields},
+}
+
+@book{companion,
+ author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
+ title = {The {LaTeX} Companion},
+ date = 1994,
+ edition = 1,
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ pagetotal = 528,
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {LaTeX Companion},
+ indextitle = {LaTeX Companion, The},
+ shorttitle = {LaTeX Companion},
+ annotation = {A book with three authors. Note the formatting of the author
+ list. By default, only the first name is reversed in the
+ bibliography},
+}
+
+@book{cotton,
+ author = {Cotton, Frank Albert and Wilkinson, Geoffrey and Murillio,
+ Carlos A. and Bochmann, Manfred},
+ title = {Advanced inorganic chemistry},
+ date = 1999,
+ edition = 6,
+ publisher = {Wiley},
+ location = {Chichester},
+ langid = {english},
+ langidopts = {variant=british},
+ annotation = {A \texttt{book} entry with \arabic{author} authors and an
+ \texttt{edition} field. By default, long \texttt{author} and
+ \texttt{editor} lists are automatically truncated. This is
+ configurable},
+}
+
+@book{gerhardt,
+ author = {Gerhardt, Michael J.},
+ title = {The Federal Appointments Process},
+ date = 2000,
+ publisher = {Duke University Press},
+ location = {Durham and London},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Federal Appointments Process},
+ indextitle = {Federal Appointments Process, The},
+ subtitle = {A Constitutional and Historical Analysis},
+ shorttitle = {Federal Appointments Process},
+ annotation = {This is a \texttt{book} entry. Note the format of the
+ \texttt{location} field as well as the \texttt{sorttitle} and
+ \texttt{indextitle} fields},
+}
+
+@book{gonzalez,
+ author = {Gonzalez, Ray},
+ title = {The Ghost of {John Wayne} and Other Stories},
+ date = 2001,
+ publisher = {The University of Arizona Press},
+ location = {Tucson},
+ isbn = {0-816-52066-6},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Ghost of John Wayne and Other Stories},
+ indextitle = {Ghost of {John Wayne} and Other Stories, The},
+ shorttitle = {Ghost of {John Wayne}},
+ annotation = {A collection of short stories. This is a \texttt{book} entry.
+ Note the \texttt{sorttitle} and \texttt{indextitle} fields in
+ the database file. There's also an \texttt{isbn} field},
+}
+
+@book{hammond,
+ author = {Hammond, Christopher},
+ title = {The basics of crystallography and diffraction},
+ date = 1997,
+ publisher = {International Union of Crystallography and Oxford University
+ Press},
+ location = {Oxford},
+ langid = {english},
+ langidopts = {variant=british},
+ sorttitle = {Basics of crystallography and diffraction},
+ indextitle = {Basics of crystallography and diffraction, The},
+ shorttitle = {Crystallography and diffraction},
+ annotation = {A \texttt{book} entry. Note the \texttt{sorttitle} and
+ \texttt{indextitle} fields as well as the format of the
+ \texttt{publisher} field},
+}
+
+@book{iliad,
+ author = {Homer},
+ title = {Die Ilias},
+ date = 2004,
+ translator = {Schadewaldt, Wolfgang},
+ introduction = {Latacz, Joachim},
+ edition = 3,
+ publisher = {Artemis \& Winkler},
+ location = {D{\"u}sseldorf and Z{\"u}rich},
+ langid = {german},
+ sorttitle = {Ilias},
+ indextitle = {Ilias, Die},
+ shorttitle = {Ilias},
+ annotation = {A German translation of the \emph{Iliad}. Note the
+ \texttt{translator} and \texttt{introduction} fields and the
+ format of the \texttt{location} field in the database
+ file. Also note the \texttt{sorttitle} and \texttt{indextitle}
+ fields},
+}
+
+@book{knuth:ct,
+ author = {Knuth, Donald E.},
+ title = {Computers \& Typesetting},
+ date = {1984/1986},
+ volumes = 5,
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1984-0},
+ sorttitle = {Computers & Typesetting},
+ indexsorttitle= {Computers & Typesetting},
+ annotation = {A five-volume book cited as a whole. This is a \texttt{book}
+ entry, note the \texttt{volumes} field},
+}
+
+@book{knuth:ct:a,
+ author = {Knuth, Donald E.},
+ title = {The {\TeX} book},
+ date = 1984,
+ maintitle = {Computers \& Typesetting},
+ volume = {A},
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1984-1},
+ sorttitle = {Computers & Typesetting A},
+ indexsorttitle= {The TeXbook},
+ indextitle = {\protect\TeX book, The},
+ shorttitle = {\TeX book},
+ annotation = {The first volume of a five-volume book. Note the
+ \texttt{sorttitle} and \texttt{sortyear} fields. We want this
+ volume to be listed after the entry referring to the entire
+ five-volume set. Also note the \texttt{indextitle} and
+ \texttt{indexsorttitle} fields. Indexing packages that don't
+ generate robust index entries require some control sequences
+ to be protected from expansion},
+}
+
+@book{knuth:ct:b,
+ author = {Knuth, Donald E.},
+ title = {\TeX: The Program},
+ date = 1986,
+ maintitle = {Computers \& Typesetting},
+ volume = {B},
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1986-1},
+ sorttitle = {Computers & Typesetting B},
+ indexsorttitle= {TeX: The Program},
+ shorttitle = {\TeX},
+ annotation = {The second volume of a five-volume book. Note the
+ \texttt{sorttitle} and \texttt{sortyear} fields. Also note the
+ \texttt{indexsorttitle} field},
+}
+
+@book{knuth:ct:c,
+ author = {Knuth, Donald E.},
+ title = {The {METAFONTbook}},
+ date = 1986,
+ maintitle = {Computers \& Typesetting},
+ volume = {C},
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1986-2},
+ sorttitle = {Computers & Typesetting C},
+ indextitle = {METAFONTbook, The},
+ shorttitle = {METAFONTbook},
+ annotation = {The third volume of a five-volume book. Note the
+ \texttt{sorttitle} and \texttt{sortyear} fields as well as the
+ \texttt{indextitle} field},
+}
+
+@book{knuth:ct:d,
+ author = {Knuth, Donald E.},
+ title = {METAFONT: The Program},
+ date = 1986,
+ maintitle = {Computers \& Typesetting},
+ volume = {D},
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1986-3},
+ sorttitle = {Computers & Typesetting D},
+ shorttitle = {METAFONT},
+ annotation = {The fourth volume of a five-volume book. Note the
+ \texttt{sorttitle} and \texttt{sortyear} fields},
+}
+
+@book{knuth:ct:e,
+ author = {Knuth, Donald E.},
+ title = {{Computer Modern} Typefaces},
+ date = 1986,
+ maintitle = {Computers \& Typesetting},
+ volume = {E},
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1986-4},
+ sorttitle = {Computers & Typesetting E},
+ annotation = {The fifth volume of a five-volume book. Note the
+ \texttt{sorttitle} and \texttt{sortyear} fields},
+}
+
+@book{knuth:ct:related,
+ author = {Knuth, Donald E.},
+ title = {Computers \& Typesetting},
+ date = {1984/1986},
+ volumes = 5,
+ publisher = {Addison-Wesley},
+ location = {Reading, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sortyear = {1984-0},
+ sorttitle = {Computers & Typesetting},
+ indexsorttitle= {Computers & Typesetting},
+ related = {knuth:ct:a,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e},
+ relatedtype = {multivolume},
+ annotation = {A five-volume book cited as a whole and related to its
+ individual volumes. Note the \texttt{related} and
+ \texttt{relatedtype} fields},
+}
+
+@book{kullback,
+ author = {Kullback, Solomon},
+ title = {Information Theory and Statistics},
+ year = 1959,
+ publisher = {John Wiley \& Sons},
+ location = {New York},
+ langid = {english},
+ langidopts = {variant=american},
+}
+
+@book{kullback:reprint,
+ author = {Kullback, Solomon},
+ title = {Information Theory and Statistics},
+ year = 1997,
+ publisher = {Dover Publications},
+ location = {New York},
+ origyear = 1959,
+ origpublisher= {John Wiley \& Sons},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {A reprint of the \texttt{kullback} entry. Note the format of
+ \texttt{origyear} and \texttt{origpublisher}. These fields are
+ not used by the standard bibliography styles},
+}
+
+@book{kullback:related,
+ author = {Kullback, Solomon},
+ title = {Information Theory and Statistics},
+ year = 1997,
+ publisher = {Dover Publications},
+ location = {New York},
+ langid = {english},
+ langidopts = {variant=american},
+ related = {kullback},
+ relatedtype = {origpubin},
+ annotation = {A reprint of the \texttt{kullback} entry. Note the format of
+ the \texttt{related} and \texttt{relatedtype} fields},
+}
+
+@book{malinowski,
+ author = {Malinowski, Bronis{\l}aw},
+ title = {Argonauts of the {Western Pacific}},
+ date = 1972,
+ edition = 8,
+ publisher = {Routledge {and} Kegan Paul},
+ location = {London},
+ langid = {english},
+ langidopts = {variant=british},
+ subtitle = {An account of native enterprise and adventure in the
+ Archipelagoes of {Melanesian New Guinea}},
+ shorttitle = {Argonauts},
+ annotation = {This is a \texttt{book} entry. Note the format of the
+ \texttt{publisher} and \texttt{edition} fields as well as the
+ \texttt{subtitle} field},
+}
+
+@book{maron,
+ author = {Maron, Monika},
+ title = {Animal Triste},
+ date = 2000,
+ translator = {Brigitte Goldstein},
+ origlanguage = {german},
+ publisher = {University of Nebraska Press},
+ location = {Lincoln},
+ langid = {english},
+ langidopts = {variant=american},
+ shorttitle = {Animal Triste},
+ annotation = {An English translation of a German novel with a French title.
+ In other words: a \texttt{book} entry with a
+ \texttt{translator} field. Note the \texttt{origlanguage}
+ field which is concatenated with the \texttt{translator}},
+}
+
+@book{massa,
+ author = {Werner Massa},
+ title = {Crystal structure determination},
+ date = 2004,
+ edition = 2,
+ publisher = {Spinger},
+ location = {Berlin},
+ langid = {english},
+ langidopts = {variant=british},
+ annotation = {A \texttt{book} entry with an \texttt{edition} field},
+}
+
+@article{moore,
+ author = {Moore, Gordon E.},
+ title = {Cramming more components onto integrated circuits},
+ journaltitle = {Electronics},
+ year = 1965,
+ volume = 38,
+ number = 8,
+ pages = {114-117},
+ langid = {english},
+ langidopts = {variant=american},
+}
+
+@article{moore:related,
+ author = {Moore, Gordon E.},
+ title = {Cramming more components onto integrated circuits},
+ journaltitle = {Proceedings of the {IEEE}},
+ year = 1998,
+ volume = 86,
+ number = 1,
+ pages = {82-85},
+ langid = {english},
+ langidopts = {variant=american},
+ related = {moore},
+ relatedtype = {reprintfrom},
+ annotation = {A reprint of Moore's law. Note the \texttt{related} and
+ \texttt{relatedtype} fields},
+}
+
+@book{nietzsche:ksa,
+ author = {Nietzsche, Friedrich},
+ title = {S{\"a}mtliche Werke},
+ date = 1988,
+ editor = {Colli, Giorgio and Montinari, Mazzino},
+ edition = 2,
+ volumes = 15,
+ publisher = dtv # { and Walter de Gruyter},
+ location = {M{\"u}nchen and Berlin and New York},
+ langid = {german},
+ sortyear = {1988-0},
+ sorttitle = {Werke-00-000},
+ indexsorttitle= {Samtliche Werke},
+ subtitle = {Kritische Studienausgabe},
+ annotation = {The critical edition of Nietzsche's works. This is a
+ \texttt{book} entry referring to a 15-volume work as a
+ whole. Note the \texttt{volumes} field and the format of the
+ \texttt{publisher} and \texttt{location} fields in the
+ database file. Also note the \texttt{sorttitle} and
+ \texttt{sortyear} fields which are used to fine-tune the
+ sorting order of the bibliography. We want this item listed
+ first in the bibliography},
+}
+
+@book{nietzsche:ksa1,
+ author = {Nietzsche, Friedrich},
+ title = {Die Geburt der Trag{\"o}die. Unzeitgem{\"a}{\ss}e
+ Betrachtungen I--IV. Nachgelassene Schriften 1870--1973},
+ date = 1988,
+ editor = {Colli, Giorgio and Montinari, Mazzino},
+ maintitle = {S{\"a}mtliche Werke},
+ mainsubtitle = {Kritische Studienausgabe},
+ volume = 1,
+ edition = 2,
+ publisher = dtv # { and Walter de Gruyter},
+ location = {M{\"u}nchen and Berlin and New York},
+ langid = {german},
+ sortyear = {1988-1},
+ sorttitle = {Werke-01-000},
+ indexsorttitle= {Samtliche Werke I},
+ bookauthor = {Nietzsche, Friedrich},
+ indextitle = {S{\"a}mtliche Werke I},
+ shorttitle = {S{\"a}mtliche Werke I},
+ annotation = {A single volume from the critical edition of Nietzsche's
+ works. This \texttt{book} entry explicitly refers to the first
+ volume only. Note the \texttt{title} and \texttt{maintitle}
+ fields. Also note the \texttt{sorttitle} and \texttt{sortyear}
+ fields. We want this entry to be listed after the entry
+ referring to the entire edition},
+}
+
+@book{nussbaum,
+ author = {Nussbaum, Martha},
+ title = {Aristotle's \mkbibquote{De Motu Animalium}},
+ date = 1978,
+ publisher = pup,
+ location = {Princeton},
+ keywords = {secondary},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Aristotle's De Motu Animalium},
+ indexsorttitle= {Aristotle's De Motu Animalium},
+ annotation = {A \texttt{book} entry. Note the \texttt{sorttitle} and
+ \texttt{indexsorttitle} fields and the markup of the quotes in
+ the database file},
+}
+
+@book{piccato,
+ author = {Piccato, Pablo},
+ title = {City of Suspects},
+ date = 2001,
+ publisher = {Duke University Press},
+ location = {Durham and London},
+ langid = {english},
+ langidopts = {variant=american},
+ subtitle = {Crime in {Mexico City}, 1900--1931},
+ shorttitle = {City of Suspects},
+ annotation = {This is a \texttt{book} entry. Note the format of the
+ \texttt{location} field in the database file},
+}
+
+@book{vangennep,
+ author = {van Gennep, Arnold},
+ title = {Les rites de passage},
+ date = 1909,
+ publisher = {Nourry},
+ location = {Paris},
+ options = {useprefix},
+ langid = {french},
+ sorttitle = {Rites de passage},
+ indextitle = {Rites de passage, Les},
+ shorttitle = {Rites de passage},
+ annotation = {A \texttt{book} entry. Note the format of the printed name and
+ compare the \texttt{useprefix} option in the \texttt{options}
+ field as well as \texttt{brandt} and \texttt{geer}},
+}
+
+@book{vangennep:trans,
+ author = {van Gennep, Arnold},
+ title = {The Rites of Passage},
+ year = 1960,
+ translator = {Vizedom, Monika B. and Caffee, Gabrielle L.},
+ language = {english},
+ origlanguage = {french},
+ publisher = {University of Chicago Press},
+ options = {useprefix},
+ indextitle = {Rites of Passage, The},
+ sorttitle = {Rites of Passage},
+ shorttitle = {Rites of Passage},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {A translation of the \texttt{vangennep} entry. Note the
+ \texttt{translator} and \texttt{origlanguage} fields. Compare
+ with the \texttt{vangennep:related} entry.},
+}
+
+@book{vangennep:related,
+ author = {van Gennep, Arnold},
+ title = {Les rites de passage},
+ date = 1909,
+ publisher = {Nourry},
+ location = {Paris},
+ options = {useprefix},
+ langid = {french},
+ related = {vizedom:related},
+ relatedtype = {bytranslator},
+ sorttitle = {Rites de passage},
+ indextitle = {Rites de passage, Les},
+ shorttitle = {Rites de passage},
+ annotation = {A variant of the \texttt{vangennep} entry related to its
+ translation. Note the format of the \texttt{related} and
+ \texttt{relatedtype} fields},
+}
+
+@book{vizedom:related,
+ title = {The Rites of Passage},
+ year = 1960,
+ translator = {Vizedom, Monika B. and Caffee, Gabrielle L.},
+ language = {english},
+ publisher = {University of Chicago Press},
+ langid = {english},
+ langidopts = {variant=american},
+ options = {usetranslator},
+ related = {vangennep},
+ relatedtype = {translationof},
+ indextitle = {Rites of Passage, The},
+ sorttitle = {Rites of Passage},
+ shorttitle = {Rites of Passage},
+ annotation = {A translated work from \texttt{vangennep}. Note the format of
+ the \texttt{related} and \texttt{relatedtype} fields},
+}
+
+@book{vazques-de-parga,
+ author = {V{\'a}zques{ de }Parga, Luis and Lacarra, Jos{\'e} Mar{\'i}a
+ and Ur{\'i}a R{\'i}u, Juan},
+ title = {Las Peregrinaciones a Santiago de Compostela},
+ date = 1993,
+ volumes = 3,
+ note = {Ed. facs. de la realizada en 1948--49},
+ publisher = {Iberdrola},
+ location = {Pamplona},
+ langid = {spanish},
+ sorttitle = {Peregrinaciones a Santiago de Compostela},
+ indextitle = {Peregrinaciones a Santiago de Compostela, Las},
+ shorttitle = {Peregrinaciones},
+ annotation = {A multivolume book cited as a whole. This is a \texttt{book}
+ entry with \texttt{volumes}, \texttt{note},
+ \texttt{sorttitle}, and \texttt{indextitle} fields},
+}
+
+@book{wilde,
+ author = {Wilde, Oscar},
+ title = {The Importance of Being Earnest: A Trivial Comedy for Serious
+ People},
+ year = 1899,
+ series = {English and {American} drama of the Nineteenth Century},
+ publisher = {Leonard Smithers {and} Company},
+ eprint = {4HIWAAAAYAAJ},
+ eprinttype = {googlebooks},
+ annotation = {A \texttt{book} with \texttt{eprint} and \texttt{eprinttype}
+ fields.},
+}
+
+@book{worman,
+ author = {Worman, Nancy},
+ title = {The Cast of Character},
+ date = 2002,
+ publisher = {University of Texas Press},
+ location = {Austin},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Cast of Character},
+ indextitle = {Cast of Character, The},
+ subtitle = {Style in {Greek} Literature},
+ shorttitle = {Cast of Character},
+ annotation = {A \texttt{book} entry. Note the \texttt{sorttitle} and
+ \texttt{indextitle} fields},
+}
+
+@collection{britannica,
+ editor = {Preece, Warren E.},
+ title = {The {New Encyclop{\ae}dia Britannica}},
+ date = 2003,
+ edition = 15,
+ volumes = 32,
+ publisher = {Encyclop{\ae}dia Britannica},
+ location = {Chicago, Ill.},
+ options = {useeditor=false},
+ label = {EB},
+ langid = {english},
+ langidopts = {variant=british},
+ sorttitle = {Encyclop{\ae}dia Britannica},
+ indextitle = {{Encyclop{\ae}dia Britannica}, The {New}},
+ shorttitle = {{Encyclop{\ae}dia Britannica}},
+ annotation = {This is a \texttt{collection} entry for an encyclopedia. Note
+ the \texttt{useeditor} option in the \texttt{options} field as
+ well as the \texttt{sorttitle} field. We want this entry to be
+ cited and alphabetized by title even though there is an
+ editor. In addition to that, we want the title to be
+ alphabetized under \enquote*{E} rather than \enquote*{T}. Also
+ note the \texttt{label} field which is provided for
+ author-year citation styles},
+}
+
+@collection{gaonkar,
+ editor = {Gaonkar, Dilip Parameshwar},
+ title = {Alternative Modernities},
+ date = 2001,
+ publisher = {Duke University Press},
+ location = {Durham and London},
+ isbn = {0-822-32714-7},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {This is a \texttt{collection} entry. Note the format of the
+ \texttt{location} field in the database file as well as the
+ \texttt{isbn} field},
+}
+
+@InCollection{gaonkar:in,
+ author = {Gaonkar, Dilip Parameshwar},
+ editor = {Gaonkar, Dilip Parameshwar},
+ title = {On Alternative Modernities},
+ date = 2001,
+ booktitle = {Alternative Modernities},
+ publisher = {Duke University Press},
+ location = {Durham and London},
+ isbn = {0-822-32714-7},
+ pages = {1-23},
+}
+
+@collection{jaffe,
+ editor = {Jaff{\'e}, Philipp},
+ title = {Regesta Pontificum Romanorum ab condita ecclesia ad annum post
+ Christum natum \textsc{mcxcviii}},
+ date = {1885/1888},
+ editora = {Loewenfeld, Samuel and Kaltenbrunner, Ferdinand and Ewald,
+ Paul},
+ edition = 2,
+ volumes = 2,
+ location = {Leipzig},
+ langid = {latin},
+ editoratype = {redactor},
+ indextitle = {Regesta Pontificum Romanorum},
+ shorttitle = {Regesta Pontificum Romanorum},
+ annotation = {A \texttt{collection} entry with \texttt{edition} and
+ \texttt{volumes} fields. Note the \texttt{editora} and
+ \texttt{editoratype} fields},
+}
+
+@collection{westfahl:frontier,
+ editor = {Westfahl, Gary},
+ title = {Space and Beyond},
+ date = 2000,
+ subtitle = {The Frontier Theme in Science Fiction},
+ publisher = {Greenwood},
+ location = {Westport, Conn. and London},
+ langid = {english},
+ langidopts = {variant=american},
+ booktitle = {Space and Beyond},
+ booksubtitle = {The Frontier Theme in Science Fiction},
+ annotation = {This is a \texttt{collection} entry. Note the format of the
+ \texttt{location} field as well as the \texttt{subtitle} and
+ \texttt{booksubtitle} fields},
+}
+
+@inbook{kant:kpv,
+ title = {Kritik der praktischen Vernunft},
+ date = 1968,
+ author = {Kant, Immanuel},
+ booktitle = {Kritik der praktischen Vernunft. Kritik der Urtheilskraft},
+ bookauthor = {Kant, Immanuel},
+ maintitle = {Kants Werke. Akademie Textausgabe},
+ volume = 5,
+ publisher = {Walter de Gruyter},
+ location = {Berlin},
+ pages = {1-163},
+ shorthand = {KpV},
+ langid = {german},
+ shorttitle = {Kritik der praktischen Vernunft},
+ annotation = {An edition of Kant's \emph{Collected Works}, volume five. This
+ is an \texttt{inbook} entry which explicitly refers to the
+ \emph{Critique of Practical Reason} only, not to the entire
+ fifth volume. Note the \texttt{author} and \texttt{bookauthor}
+ fields in the database file. By default, the
+ \texttt{bookauthor} is omitted if the values of the
+ \texttt{author} and \texttt{bookauthor} fields are identical},
+}
+
+@inbook{kant:ku,
+ title = {Kritik der Urtheilskraft},
+ date = 1968,
+ author = {Kant, Immanuel},
+ booktitle = {Kritik der praktischen Vernunft. Kritik der Urtheilskraft},
+ bookauthor = {Kant, Immanuel},
+ maintitle = {Kants Werke. Akademie Textausgabe},
+ volume = 5,
+ publisher = {Walter de Gruyter},
+ location = {Berlin},
+ pages = {165-485},
+ shorthand = {KU},
+ langid = {german},
+ annotation = {An edition of Kant's \emph{Collected Works}, volume five. This
+ is an \texttt{inbook} entry which explicitly refers to the
+ \emph{Critique of Judgment} only, not to the entire fifth
+ volume},
+}
+
+@inbook{nietzsche:historie,
+ title = {Unzeitgem{\"a}sse Betrachtungen. Zweites St{\"u}ck},
+ date = 1988,
+ author = {Nietzsche, Friedrich},
+ booktitle = {Die Geburt der Trag{\"o}die. Unzeitgem{\"a}{\ss}e
+ Betrachtungen I--IV. Nachgelassene Schriften 1870--1973},
+ bookauthor = {Nietzsche, Friedrich},
+ editor = {Colli, Giorgio and Montinari, Mazzino},
+ subtitle = {Vom Nutzen und Nachtheil der Historie f{\"u}r das Leben},
+ maintitle = {S{\"a}mtliche Werke},
+ mainsubtitle = {Kritische Studienausgabe},
+ volume = 1,
+ publisher = dtv # { and Walter de Gruyter},
+ location = {M{\"u}nchen and Berlin and New York},
+ pages = {243-334},
+ langid = {german},
+ sortyear = {1988-2},
+ sorttitle = {Werke-01-243},
+ indexsorttitle= {Vom Nutzen und Nachtheil der Historie fur das Leben},
+ indextitle = {Vom Nutzen und Nachtheil der Historie f{\"u}r das Leben},
+ shorttitle = {Vom Nutzen und Nachtheil der Historie},
+ annotation = {A single essay from the critical edition of Nietzsche's works.
+ This \texttt{inbook} entry explicitly refers to an essay found
+ in the first volume. Note the \texttt{title},
+ \texttt{booktitle}, and \texttt{maintitle} fields. Also note
+ the \texttt{sorttitle} and \texttt{sortyear} fields. We want
+ this entry to be listed after the entry referring to the
+ entire first volume},
+}
+
+@incollection{brandt,
+ author = {von Brandt, Ahasver and Erich Hoffmann},
+ editor = {Ferdinand Seibt},
+ title = {Die nordischen L{\"a}nder von der Mitte des 11.~Jahrhunderts
+ bis 1448},
+ date = 1987,
+ booktitle = {Europa im Hoch- und Sp{\"a}tmittelalter},
+ series = {Handbuch der europ{\"a}ischen Geschichte},
+ number = 2,
+ publisher = {Klett-Cotta},
+ location = {Stuttgart},
+ pages = {884-917},
+ options = {useprefix=false},
+ langid = {german},
+ indexsorttitle= {Nordischen Lander von der Mitte des 11. Jahrhunderts bis
+ 1448},
+ indextitle = {Nordischen L{\"a}nder von der Mitte des 11.~Jahrhunderts bis
+ 1448, Die},
+ shorttitle = {Die nordischen L{\"a}nder},
+ annotation = {An \texttt{incollection} entry with a \texttt{series} and a
+ \texttt{number}. Note the format of the printed name and
+ compare the \texttt{useprefix} option in the \texttt{options}
+ field as well as \texttt{vangennep}. Also note the
+ \texttt{indextitle, and \texttt{indexsorttitle} fields}},
+}
+
+@incollection{hyman,
+ author = {Arthur Hyman},
+ editor = {O'Meara, Dominic J.},
+ title = {Aristotle's Theory of the Intellect and its Interpretation by
+ {Averroes}},
+ date = 1981,
+ booktitle = {Studies in {Aristotle}},
+ series = {Studies in Philosophy and the History of Philosophy},
+ number = 9,
+ publisher = {The Catholic University of America Press},
+ location = {Washington, D.C.},
+ pages = {161-191},
+ keywords = {secondary},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Aristotle's Theory of the Intellect},
+ shorttitle = {Aristotle's Theory of the Intellect},
+ annotation = {An \texttt{incollection} entry with a \texttt{series} and
+ \texttt{number} field},
+}
+
+@incollection{pines,
+ author = {Pines, Shlomo},
+ editor = {Twersky, Isadore},
+ title = {The Limitations of Human Knowledge According to {Al-Farabi}, {ibn
+ Bajja}, and {Maimonides}},
+ date = 1979,
+ booktitle = {Studies in Medieval {Jewish} History and Literature},
+ publisher = hup,
+ location = {Cambridge, Mass.},
+ pages = {82-109},
+ keywords = {secondary},
+ langid = {english},
+ langidopts = {variant=american},
+ indextitle = {Limitations of Human Knowledge According to {Al-Farabi}, {ibn
+ Bajja}, and {Maimonides}, The},
+ shorttitle = {Limitations of Human Knowledge},
+ annotation = {A typical \texttt{incollection} entry. Note the
+ \texttt{indextitle} field},
+}
+
+@inproceedings{moraux,
+ author = {Moraux, Paul},
+ editor = {Lloyd, G. E. R. and Owen, G. E. L.},
+ title = {Le \emph{De Anima} dans la tradition gr{\`e}cque},
+ date = 1979,
+ booktitle = {Aristotle on Mind and the Senses},
+ subtitle = {Quelques aspects de l'interpretation du trait{\'e}, de
+ Theophraste {\`a} Themistius},
+ booktitleaddon= {Proceedings of the Seventh Symposium Aristotelicum},
+ eventdate = 1975,
+ publisher = cup,
+ location = {Cambridge},
+ pages = {281-324},
+ keywords = {secondary},
+ langid = {french},
+ indexsorttitle= {De Anima dans la tradition grecque},
+ indextitle = {\emph{De Anima} dans la tradition gr{\`e}cque, Le},
+ shorttitle = {\emph{De Anima} dans la tradition gr{\`e}cque},
+ annotation = {This is a typical \texttt{inproceedings} entry. Note the
+ \texttt{booksubtitle}, \texttt{shorttitle},
+ \texttt{indextitle}, and \texttt{indexsorttitle} fields. Also
+ note the \texttt{eventdate} field.},
+}
+
+@inproceedings{salam,
+ author = {Salam, Abdus},
+ editor = {Svartholm, Nils},
+ title = {Weak and Electromagnetic Interactions},
+ date = 1968,
+ booktitle = {Elementary particle theory},
+ booksubtitle = {Relativistic groups and analyticity},
+ booktitleaddon= {Proceedings of the {Eighth Nobel Symposium}},
+ eventdate = {1968-05-19/1968-05-25},
+ venue = {Aspen{\"a}sgarden, Lerum},
+ publisher = {Almquist \& Wiksell},
+ location = {Stockholm},
+ pages = {367-377},
+}
+
+@manual{cms,
+ title = {The {Chicago} Manual of Style},
+ date = 2003,
+ subtitle = {The Essential Guide for Writers, Editors, and Publishers},
+ edition = 15,
+ publisher = {University of Chicago Press},
+ location = {Chicago, Ill.},
+ isbn = {0-226-10403-6},
+ label = {CMS},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Chicago Manual of Style},
+ indextitle = {Chicago Manual of Style, The},
+ shorttitle = {Chicago Manual of Style},
+ annotation = {This is a \texttt{manual} entry without an \texttt{author} or
+ \texttt{editor}. Note the \texttt{label} field in the database
+ file which is provided for author-year citation styles. Also
+ note the \texttt{sorttitle} and \texttt{indextitle} fields. By
+ default, all entries without an \texttt{author} or
+ \texttt{editor} are alphabetized by \texttt{title} but we want
+ this entry to be alphabetized under \enquote*{C} rather than
+ \enquote*{T}. There's also an \texttt{isbn} field},
+}
+
+@online{baez/online,
+ author = {Baez, John C. and Lauda, Aaron D.},
+ title = {Higher-Dimensional Algebra {V}: 2-Groups},
+ date = {2004-10-27},
+ version = 3,
+ langid = {english},
+ langidopts = {variant=american},
+ eprinttype = {arxiv},
+ eprint = {math/0307200v3},
+ annotation = {An \texttt{online} reference from arXiv. Note the
+ \texttt{eprint} and \texttt{eprinttype} fields. Compare
+ \texttt{baez\slash article} which is the same item given as an
+ \texttt{article} entry with eprint information},
+}
+
+@online{ctan,
+ title = {CTAN},
+ date = 2006,
+ url = {http://www.ctan.org},
+ subtitle = {The {Comprehensive TeX Archive Network}},
+ urldate = {2006-10-01},
+ label = {CTAN},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {This is an \texttt{online} entry. The \textsc{url}, which is
+ given in the \texttt{url} field, is transformed into a
+ clickable link if \texttt{hyperref} support has been
+ enabled. Note the format of the \texttt{urldate} field
+ (\texttt{yyyy-mm-dd}) in the database file. Also note the
+ \texttt{label} field which may be used as a fallback by
+ citation styles which need an \texttt{author} and\slash or a
+ \texttt{year}},
+}
+
+@online{itzhaki,
+ author = {Itzhaki, Nissan},
+ title = {Some remarks on {'t Hooft's} {S}-matrix for black holes},
+ date = {1996-03-11},
+ version = 1,
+ langid = {english},
+ langidopts = {variant=american},
+ eprinttype = {arxiv},
+ eprint = {hep-th/9603067},
+ annotation = {An \texttt{online} reference from arXiv. Note the
+ \texttt{eprint} and \texttt{eprinttype} fields. Also note that
+ the arXiv reference is transformed into a clickable link if
+ \texttt{hyperref} support has been enabled},
+ abstract = {We discuss the limitations of 't Hooft's proposal for the
+ black hole S-matrix. We find that the validity of the S-matrix
+ implies violation of the semi-classical approximation at
+ scales large compared to the Planck scale. We also show that
+ the effect of the centrifugal barrier on the S-matrix is
+ crucial even for large transverse distances.},
+}
+
+@online{markey,
+ author = {Markey, Nicolas},
+ title = {Tame the {BeaST}},
+ date = {2005-10-16},
+ url = {http://mirror.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf},
+ subtitle = {The {B} to {X} of {BibTeX}},
+ version = {1.3},
+ urldate = {2006-10-01},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Tame the Beast},
+ annotation = {An \texttt{online} entry for a tutorial. Note the format of
+ the \texttt{date} field (\texttt{yyyy-mm-dd}) in the database
+ file.},
+}
+
+@online{wassenberg,
+ author = {Wassenberg, Jan and Sanders, Peter},
+ title = {Faster Radix Sort via Virtual Memory and Write-Combining},
+ date = {2010-08-17},
+ version = 1,
+ langid = {english},
+ langidopts = {variant=american},
+ eprinttype = {arxiv},
+ eprintclass = {cs.DS},
+ eprint = {1008.2849v1},
+ annotation = {A recent \texttt{online} reference from arXiv using the new
+ (April 2007 onward) identifier format. Note the
+ \texttt{eprint}, \texttt{eprinttype}, and \texttt{eprintclass}
+ fields. Also note that the arXiv reference is transformed into
+ a clickable link if \texttt{hyperref} support has been
+ enabled},
+ abstract = {Sorting algorithms are the deciding factor for the performance
+ of common operations such as removal of duplicates or database
+ sort-merge joins. This work focuses on 32-bit integer keys,
+ optionally paired with a 32-bit value. We present a fast radix
+ sorting algorithm that builds upon a microarchitecture-aware
+ variant of counting sort},
+}
+
+@patent{almendro,
+ author = {Almendro, Jos{\'e} L. and Mart{\'i}n, Jacinto and S{\'a}nchez,
+ Alberto and Nozal, Fernando},
+ title = {Elektromagnetisches Signalhorn},
+ number = {EU-29702195U},
+ date = 1998,
+ location = {countryfr and countryuk and countryde},
+ langid = {german},
+ annotation = {This is a \texttt{patent} entry with a \texttt{location}
+ field. The number is given in the \texttt{number} field. Note
+ the format of the \texttt{location} field in the database
+ file. Compare \texttt{laufenberg}, \texttt{sorace}, and
+ \texttt{kowalik}},
+}
+
+@patent{kowalik,
+ author = {Kowalik, F. and Isard, M.},
+ title = {Estimateur d'un d{\'e}faut de fonctionnement d'un modulateur
+ en quadrature et {\'e}tage de modulation l'utilisant},
+ number = 9500261,
+ date = {1995-01-11},
+ type = {patreqfr},
+ langid = {french},
+ indextitle = {Estimateur d'un d{\'e}faut de fonctionnement},
+ annotation = {This is a \texttt{patent} entry for a French patent request
+ with a full date. The number is given in the \texttt{number}
+ field. Note the format of the \texttt{type} and \texttt{date}
+ fields in the database file. Compare \texttt{almendro},
+ \texttt{laufenberg}, and \texttt{sorace}},
+}
+
+@patent{laufenberg,
+ author = {Laufenberg, Xaver and Eynius, Dominique and Suelzle, Helmut
+ and Usbeck, Stephan and Spaeth, Matthias and Neuser-Hoffmann,
+ Miriam and Myrzik, Christian and Schmid, Manfred and Nietfeld,
+ Franz and Thiel, Alexander and Braun, Harald and Ebner,
+ Norbert},
+ title = {Elektrische Einrichtung und Betriebsverfahren},
+ number = 1700367,
+ date = {2006-09-13},
+ holder = {{Robert Bosch GmbH} and {Daimler Chrysler AG} and {Bayerische
+ Motoren Werke AG}},
+ type = {patenteu},
+ langid = {german},
+ annotation = {This is a \texttt{patent} entry with a \texttt{holder} field.
+ Note the format of the \texttt{type} and \texttt{location}
+ fields in the database file. Compare \texttt{almendro},
+ \texttt{sorace}, and \texttt{kowalik}},
+ abstract = {The invention relates to an electric device comprising a
+ generator, in particular for use in the vehicle electric
+ system of a motor vehicle and a controller for controlling the
+ generator voltage. The device is equipped with a control zone,
+ in which the voltage is controlled and zones, in which the
+ torque is controlled. The invention also relates to methods
+ for operating a device of this type.},
+ file = {http://v3.espacenet.com/textdoc?IDX=EP1700367},
+}
+
+@patent{sorace,
+ author = {Sorace, Ronald E. and Reinhardt, Victor S. and Vaughn, Steven
+ A.},
+ title = {High-Speed Digital-to-{RF} Converter},
+ number = 5668842,
+ date = {1997-09-16},
+ holder = {{Hughes Aircraft Company}},
+ type = {patentus},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {This is a \texttt{patent} entry with a \texttt{holder} field.
+ Note the format of the \texttt{type} and \texttt{date} fields
+ in the database file. Compare \texttt{almendro},
+ \texttt{laufenberg}, and \texttt{kowalik}},
+}
+
+@periodical{jcg,
+ title = {Computers and Graphics},
+ year = 2011,
+ issuetitle = {Semantic {3D} Media and Content},
+ volume = 35,
+ number = 4,
+ issn = {0097-8493},
+ annotation = {This is a \texttt{periodical} entry with an \texttt{issn}
+ field.},
+}
+
+@report{chiu,
+ author = {Chiu, Willy W. and Chow, We Min},
+ title = {A Hybrid Hierarchical Model of a {Multiple Virtual Storage}
+ ({MVS}) Operating System},
+ type = {resreport},
+ institution = {IBM},
+ date = 1978,
+ number = {RC-6947},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {Hybrid Hierarchical Model of a Multiple Virtual Storage (MVS)
+ Operating System},
+ indextitle = {Hybrid Hierarchical Model, A},
+ annotation = {This is a \texttt{report} entry for a research report. Note
+ the format of the \texttt{type} field in the database file
+ which uses a localization key. The number of the report is
+ given in the \texttt{number} field. Also note the
+ \texttt{sorttitle} and \texttt{indextitle} fields},
+}
+
+@report{padhye,
+ author = {Padhye, Jitendra and Firoiu, Victor and Towsley, Don},
+ title = {A Stochastic Model of {TCP Reno} Congestion Avoidance and
+ Control},
+ type = {techreport},
+ institution = {University of Massachusetts},
+ date = 1999,
+ number = {99-02},
+ location = {Amherst, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ sorttitle = {A Stochastic Model of TCP Reno Congestion Avoidance and
+ Control},
+ indextitle = {Stochastic Model of {TCP Reno} Congestion Avoidance and Control,
+ A},
+ annotation = {This is a \texttt{report} entry for a technical report. Note
+ the format of the \texttt{type} field in the database file
+ which uses a localization key. The number of the report is
+ given in the \texttt{number} field. Also note the
+ \texttt{sorttitle} and \texttt{indextitle} fields},
+ abstract = {The steady state performance of a bulk transfer TCP flow
+ (i.e. a flow with a large amount of data to send, such as FTP
+ transfers) may be characterized by three quantities. The first
+ is the send rate, which is the amount of data sent by the
+ sender in unit time. The second is the throughput, which is
+ the amount of data received by the receiver in unit time. Note
+ that the throughput will always be less than or equal to the
+ send rate due to losses. Finally, the number of non-duplicate
+ packets received by the receiver in unit time gives us the
+ goodput of the connection. The goodput is always less than or
+ equal to the throughput, since the receiver may receive two
+ copies of the same packet due to retransmissions by the
+ sender. In a previous paper, we presented a simple model for
+ predicting the steady state send rate of a bulk transfer TCP
+ flow as a function of loss rate and round trip time. In this
+ paper, we extend that work in two ways. First, we analyze the
+ performance of bulk transfer TCP flows using more precise,
+ stochastic analysis. Second, we build upon the previous
+ analysis to provide both an approximate formula as well as a
+ more accurate stochastic model for the steady state throughput
+ of a bulk transfer TCP flow.},
+ file = {ftp://gaia.cs.umass.edu/pub/Padhey99-markov.ps},
+}
+
+@thesis{geer,
+ author = {de Geer, Ingrid},
+ title = {Earl, Saint, Bishop, Skald~-- and Music},
+ type = {phdthesis},
+ institution = {Uppsala Universitet},
+ date = 1985,
+ subtitle = {The {Orkney Earldom} of the Twelfth Century. {A} Musicological
+ Study},
+ location = {Uppsala},
+ options = {useprefix=false},
+ langid = {english},
+ langidopts = {variant=british},
+ annotation = {This is a typical \texttt{thesis} entry for a PhD thesis. Note
+ the \texttt{type} field in the database file which uses a
+ localization key. Also note the format of the printed name and
+ compare the \texttt{useprefix} option in the \texttt{options}
+ field as well as \texttt{vangennep}},
+}
+
+@thesis{loh,
+ author = {Loh, Nin C.},
+ title = {High-Resolution Micromachined Interferometric Accelerometer},
+ type = {mathesis},
+ institution = {Massachusetts Institute of Technology},
+ date = 1992,
+ location = {Cambridge, Mass.},
+ langid = {english},
+ langidopts = {variant=american},
+ annotation = {This is a typical \texttt{thesis} entry for an MA thesis. Note
+ the \texttt{type} field in the database file which uses a
+ localization key},
+}
diff --git a/tests/issue119.expected.native b/tests/issue119.expected.native
new file mode 100644
index 0000000..ba4a2b0
--- /dev/null
+++ b/tests/issue119.expected.native
@@ -0,0 +1,10 @@
+Pandoc (Meta {unMeta = fromList [("bibliography",MetaInlines [Str "tests/biblatex-examples.bib"]),("csl",MetaInlines [Str "tests/apa.csl"])]})
+[Para [Cite [Citation {citationId = "averroes/bland", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Averroes",Space,Str "(1982)"],Str ";",Space,Cite [Citation {citationId = "averroes/hannes", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "Averroes",Space,Str "(1892)"],Str ";",Space,Cite [Citation {citationId = "averroes/hercz", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 3}] [Str "Averroes",Space,Str "(1869)"]]
+,Header 1 ("references",["unnumbered"],[]) [Str "References"]
+,Div ("refs",["references"],[])
+ [Div ("ref-averroes/hercz",[],[])
+ [Para [Str "Averroes.",Space,Str "(1869).",Space,Emph [Str "Drei",Space,Str "Abhandlungen",Space,Str "\252ber",Space,Str "die",Space,Str "Conjunction",Space,Str "des",Space,Str "separaten",Space,Str "Intellects",Space,Str "mit",Space,Str "dem",Space,Str "Menschen:",Space,Str "Von",Space,Str "Averroes",Space,Str "(Vater",Space,Str "und",Space,Str "Sohn),",Space,Str "aus",Space,Str "dem",Space,Str "Arabischen",Space,Str "\252bersetzt",Space,Str "von",Space,Str "Samuel",Space,Str "Ibn",Space,Str "Tibbon"],Str ".",Space,Str "(J.",Space,Str "Hercz,",Space,Str "Trans.,",Space,Str "J.",Space,Str "Hercz,",Space,Str "Ed.).",Space,Str "Berlin:",Space,Str "S.\160Hermann."]]
+ ,Div ("ref-averroes/hannes",[],[])
+ [Para [Str "Averroes.",Space,Str "(1892).",Space,Emph [Str "Des",Space,Str "Averro\235s",Space,Str "Abhandlung:",Space,Str "\8220\220ber",Space,Str "die",Space,Str "M\246glichkeit",Space,Str "der",Space,Str "Conjunktion\8221",Space,Str "oder",Space,Str "\8220\220ber",Space,Str "den",Space,Str "materiellen",Space,Str "Intellekt\8221"],Str ".",Space,Str "(L.",Space,Str "Hannes,",Space,Str "Trans.,",Space,Str "L.",Space,Str "Hannes,",Space,Str "Ed.).",Space,Str "Halle",Space,Str "an",Space,Str "der",Space,Str "Saale:",Space,Str "C.\160A.",Space,Str "Kaemmerer."]]
+ ,Div ("ref-averroes/bland",[],[])
+ [Para [Str "Averroes.",Space,Str "(1982).",Space,Emph [Str "The",Space,Str "epistle",Space,Str "on",Space,Str "the",Space,Str "possibility",Space,Str "of",Space,Str "conjunction",Space,Str "with",Space,Str "the",Space,Str "active",Space,Str "intellect",Space,Str "by",Space,Str "Ibn",Space,Str "Rushd",Space,Str "with",Space,Str "the",Space,Str "commentary",Space,Str "of",Space,Str "Moses",Space,Str "Narboni"],Str ".",Space,Str "(K.",Space,Str "P.",Space,Str "Bland,",Space,Str "Trans.,",Space,Str "K.",Space,Str "P.",Space,Str "Bland,",Space,Str "Ed.).",Space,Str "New",Space,Str "York:",Space,Str "Jewish",Space,Str "Theological",Space,Str "Seminary",Space,Str "of",Space,Str "America."]]]]
diff --git a/tests/issue119.in.native b/tests/issue119.in.native
new file mode 100644
index 0000000..96e39a0
--- /dev/null
+++ b/tests/issue119.in.native
@@ -0,0 +1,3 @@
+Pandoc (Meta {unMeta = fromList [("bibliography",MetaInlines [Str "tests/biblatex-examples.bib"]),("csl",MetaInlines [Str "tests/apa.csl"])]})
+[Para [Cite [Citation {citationId = "averroes/bland", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@averroes/bland"],Str ";",Space,Cite [Citation {citationId = "averroes/hannes", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@averroes/hannes"],Str ";",Space,Cite [Citation {citationId = "averroes/hercz", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@averroes/hercz"]]
+,Header 1 ("references",["unnumbered"],[]) [Str "References"]]
diff --git a/tests/issue38.expected.native b/tests/issue38.expected.native
new file mode 100644
index 0000000..ffe817f
--- /dev/null
+++ b/tests/issue38.expected.native
@@ -0,0 +1,5 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Ann"])]),MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Ben"])]),MetaMap (fromList [("family",MetaInlines [Str "Roe"]),("given",MetaInlines [Str "Ron"])])]),("id",MetaInlines [Str "a"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2007"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Cite [Citation {citationId = "a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Doe,",Space,Str "Doe,",Space,Str "and",Space,Str "Roe",Space,Str "(2007)"]]
+,Div ("refs",["references"],[])
+ [Div ("ref-a",[],[])
+ [Para [Str "Doe,",Space,Str "Ann,",Space,Str "Ben",Space,Str "Doe,",Space,Str "and",Space,Str "Ron",Space,Str "Roe.",Space,Str "2007.",Space,Str "\8220Title.\8221"]]]]
diff --git a/tests/issue38.in.native b/tests/issue38.in.native
new file mode 100644
index 0000000..3d8250f
--- /dev/null
+++ b/tests/issue38.in.native
@@ -0,0 +1,2 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Ann"])]),MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Ben"])]),MetaMap (fromList [("family",MetaInlines [Str "Roe"]),("given",MetaInlines [Str "Ron"])])]),("id",MetaInlines [Str "a"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2007"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-journal"])])])]})
+[Para [Cite [Citation {citationId = "a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@a"]]]
diff --git a/tests/issue47.expected.native b/tests/issue47.expected.native
new file mode 100644
index 0000000..2d724d4
--- /dev/null
+++ b/tests/issue47.expected.native
@@ -0,0 +1,19 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Poe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doepoe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("editor",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doe-ed"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Loe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Toe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doeloetoe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Str "Foo",Space,Cite [Citation {citationId = "doe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1}] [Str "(Doe",Space,Str "2000a)"],Str ".",Space,Str "Bar",Space,Cite [Citation {citationId = "doepoe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 2}] [Str "(Doe",Space,Str "and",Space,Str "Poe",Space,Str "2000)"],Str ".",SoftBreak,Str "Foo",Space,Cite [Citation {citationId = "doe-ed", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 3}] [Str "(Doe",Space,Str "2000b)"],Str ".",Space,Str "Bar",Space,Cite [Citation {citationId = "doeloetoe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 4}] [Str "(Doe,",Space,Str "Loe,",Space,Str "and",Space,Str "Toe",Space,Str "2000)"],Str "."]
+,Para [Str "Expected",Space,Str "output:"]
+,BlockQuote
+ [Para [Str "Doe,",Space,Str "A.",Space,Str "2000a.",Space,Str "Title."]
+ ,Para [Str "\8212\8212\8212,",Space,Str "ed.",Space,Str "2000b.",Space,Str "Title."]
+ ,Para [Str "Doe,",Space,Str "A.,",Space,Str "A.",Space,Str "Loe,",Space,Str "and",Space,Str "A.",Space,Str "Toe.",Space,Str "2000.",Space,Str "Title."]
+ ,Para [Str "Doe,",Space,Str "A.,",Space,Str "and",Space,Str "A.",Space,Str "Poe.",Space,Str "2000.",Space,Str "Title."]]
+,Para [Str "(See",Space,Str "CMoS,",Space,Str "16e,",Space,Str "15.16,",Space,Quoted DoubleQuote [Str "Single",Space,Str "author",Space,Str "versus",Space,Str "several",Space,Str "authors\8212reference",Space,Str "list",Space,Str "order"],Str ":",Space,Quoted DoubleQuote [Str "Successive",Space,Str "entries",Space,Str "by",Space,Str "two",Space,Str "or",Space,Str "more",Space,Str "authors",Space,Str "in",Space,Str "which",Space,Str "only",Space,Str "the",Space,Str "first",Space,Str "author\8217s",Space,Str "name",Space,Str "is",Space,Str "the",Space,Str "same",Space,Str "are",Space,Str "alphabetized",Space,Str "according",Space,Str "to",Space,Str "the",Space,Str "coauthors\8217",Space,Str "last",Space,Str "names",Space,Str "(regardless",Space,Str "of",Space,Str "how",Space,Str "many",Space,Str "coauthors",Space,Str "there",Space,Str "are)."],Space,Str "and",Space,Str "15.18,",Space,Quoted DoubleQuote [Str "The",Space,Str "3-em",Space,Str "dash",Space,Str "with",Space,Str "edited,",Space,Str "translated,",Space,Str "or",Space,Str "compiled",Space,Str "works"],Str ":",Space,Quoted DoubleQuote [Str "The",Space,Str "chronological",Space,Str "order",Space,Str "is",Space,Str "maintained,",Space,Str "regardless",Space,Str "of",Space,Str "the",Space,Str "added",Space,Str "abbreviation.",Space,Str "[ed.,",Space,Str "trans.,",Space,Str "comp.,",Space,Str "or",Space,Str "whatever]"]]
+,Header 1 ("references",["unnumbered"],[]) [Str "References"]
+,Div ("refs",["references"],[])
+ [Div ("ref-doe",[],[])
+ [Para [Str "Doe,",Space,Str "A.",Space,Str "2000a.",Space,Emph [Str "Title"],Str "."]]
+ ,Div ("ref-doe-ed",[],[])
+ [Para [Str "\8212\8212\8212,",Space,Str "ed.",Space,Str "2000b.",Space,Emph [Str "Title"],Str "."]]
+ ,Div ("ref-doeloetoe",[],[])
+ [Para [Str "Doe,",Space,Str "A.,",Space,Str "A.",Space,Str "Loe,",Space,Str "and",Space,Str "A.",Space,Str "Toe.",Space,Str "2000.",Space,Emph [Str "Title"],Str "."]]
+ ,Div ("ref-doepoe",[],[])
+ [Para [Str "Doe,",Space,Str "A.,",Space,Str "and",Space,Str "A.",Space,Str "Poe.",Space,Str "2000.",Space,Emph [Str "Title"],Str "."]]]]
diff --git a/tests/issue47.in.native b/tests/issue47.in.native
new file mode 100644
index 0000000..c0f5444
--- /dev/null
+++ b/tests/issue47.in.native
@@ -0,0 +1,10 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Poe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doepoe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("editor",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doe-ed"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])]),MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Loe"]),("given",MetaInlines [Str "A."])]),MetaMap (fromList [("family",MetaInlines [Str "Toe"]),("given",MetaInlines [Str "A."])])]),("id",MetaInlines [Str "doeloetoe"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2000"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "book"])])])]})
+[Para [Str "Foo",Space,Cite [Citation {citationId = "doe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@doe]"],Str ".",Space,Str "Bar",Space,Cite [Citation {citationId = "doepoe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@doepoe]"],Str ".",SoftBreak,Str "Foo",Space,Cite [Citation {citationId = "doe-ed", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@doe-ed]"],Str ".",Space,Str "Bar",Space,Cite [Citation {citationId = "doeloetoe", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@doeloetoe]"],Str "."]
+,Para [Str "Expected",Space,Str "output:"]
+,BlockQuote
+ [Para [Str "Doe,",Space,Str "A.",Space,Str "2000a.",Space,Str "Title."]
+ ,Para [Str "\8212\8212\8212,",Space,Str "ed.",Space,Str "2000b.",Space,Str "Title."]
+ ,Para [Str "Doe,",Space,Str "A.,",Space,Str "A.",Space,Str "Loe,",Space,Str "and",Space,Str "A.",Space,Str "Toe.",Space,Str "2000.",Space,Str "Title."]
+ ,Para [Str "Doe,",Space,Str "A.,",Space,Str "and",Space,Str "A.",Space,Str "Poe.",Space,Str "2000.",Space,Str "Title."]]
+,Para [Str "(See",Space,Str "CMoS,",Space,Str "16e,",Space,Str "15.16,",Space,Quoted DoubleQuote [Str "Single",Space,Str "author",Space,Str "versus",Space,Str "several",Space,Str "authors\8212reference",Space,Str "list",Space,Str "order"],Str ":",Space,Quoted DoubleQuote [Str "Successive",Space,Str "entries",Space,Str "by",Space,Str "two",Space,Str "or",Space,Str "more",Space,Str "authors",Space,Str "in",Space,Str "which",Space,Str "only",Space,Str "the",Space,Str "first",Space,Str "author\8217s",Space,Str "name",Space,Str "is",Space,Str "the",Space,Str "same",Space,Str "are",Space,Str "alphabetized",Space,Str "according",Space,Str "to",Space,Str "the",Space,Str "coauthors\8217",Space,Str "last",Space,Str "names",Space,Str "(regardless",Space,Str "of",Space,Str "how",Space,Str "many",Space,Str "coauthors",Space,Str "there",Space,Str "are)."],Space,Str "and",Space,Str "15.18,",Space,Quoted DoubleQuote [Str "The",Space,Str "3-em",Space,Str "dash",Space,Str "with",Space,Str "edited,",Space,Str "translated,",Space,Str "or",Space,Str "compiled",Space,Str "works"],Str ":",Space,Quoted DoubleQuote [Str "The",Space,Str "chronological",Space,Str "order",Space,Str "is",Space,Str "maintained,",Space,Str "regardless",Space,Str "of",Space,Str "the",Space,Str "added",Space,Str "abbreviation.",Space,Str "[ed.,",Space,Str "trans.,",Space,Str "comp.,",Space,Str "or",Space,Str "whatever]"]]
+,Header 1 ("references",["unnumbered"],[]) [Str "References"]]
diff --git a/tests/issue87.expected.native b/tests/issue87.expected.native
new file mode 100644
index 0000000..b2dcd6a
--- /dev/null
+++ b/tests/issue87.expected.native
@@ -0,0 +1,21 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"],MetaList [MetaString "2006",MetaString "11",MetaString "27"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2a"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10"],MetaList [MetaString "2006",MetaString "11"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2b"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "12",MetaString "31"],MetaList [MetaString "2007",MetaString "1",MetaString "1"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Newspaper"]),("id",MetaInlines [Str "item3"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"],MetaList [MetaString "2006",MetaString "11",MetaString "27"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-newspaper"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Newspaper"]),("id",MetaInlines [Str "item3b"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10"],MetaList [MetaString "2006",MetaString "11"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-newspaper"])])])]})
+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "Doe",Space,Str "(2006c)"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date"]
+,Para [Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 2}] [Str "Doe",Space,Str "(2006d)"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range"]
+,Para [Cite [Citation {citationId = "item2a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 3}] [Str "Doe",Space,Str "(2006a)"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range",Space,Str "YM"]
+,Para [Cite [Citation {citationId = "item2b", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 4}] [Str "Doe",Space,Str "(2006\8211\&2007)"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range",Space,Str "across",Space,Str "years"]
+,Para [Cite [Citation {citationId = "item3", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 5}] [Str "Doe",Space,Str "(2006e)"],Space,Str "\8211",Space,Str "article-newspaper"]
+,Para [Cite [Citation {citationId = "item3b", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 6}] [Str "Doe",Space,Str "(2006b)"],Space,Str "\8211",Space,Str "article-newspaper",Space,Str "YM"]
+,Header 1 ("references",["unnumbered"],[]) [Str "References"]
+,Div ("refs",["references"],[])
+ [Div ("ref-item2a",[],[])
+ [Para [Str "Doe,",Space,Str "John.",Space,Str "2006a.",Space,Str "\8220Title.\8221",Space,Str "The",Space,Str "Web",Space,Str "Site.",Space,Str "October\8211November",Space,Str "2006.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]
+ ,Div ("ref-item3b",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006b.",Space,Str "\8220Title.\8221",Space,Emph [Str "The",Space,Str "Newspaper"],Str ",",Space,Str "October\8211November",Space,Str "2006.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]
+ ,Div ("ref-item1",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006c.",Space,Str "\8220Title.\8221",Space,Str "The",Space,Str "Web",Space,Str "Site.",Space,Str "October",Space,Str "26,",Space,Str "2006.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]
+ ,Div ("ref-item2",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006d.",Space,Str "\8220Title.\8221",Space,Str "The",Space,Str "Web",Space,Str "Site.",Space,Str "October",Space,Str "26\8211November",Space,Str "27,",Space,Str "2006.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]
+ ,Div ("ref-item3",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006e.",Space,Str "\8220Title.\8221",Space,Emph [Str "The",Space,Str "Newspaper"],Str ",",Space,Str "October",Space,Str "26\8211November",Space,Str "27,",Space,Str "2006.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]
+ ,Div ("ref-item2b",[],[])
+ [Para [Str "\8212\8212\8212.",Space,Str "2006\8211\&2007.",Space,Str "\8220Title.\8221",Space,Str "The",Space,Str "Web",Space,Str "Site.",Space,Str "December",Space,Str "31,",Space,Str "2006\8211January",Space,Str "1,",Space,Str "2007.",Space,Link ("",[],[]) [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]]]]
diff --git a/tests/issue87.in.native b/tests/issue87.in.native
new file mode 100644
index 0000000..e89a856
--- /dev/null
+++ b/tests/issue87.in.native
@@ -0,0 +1,8 @@
+Pandoc (Meta {unMeta = fromList [("references",MetaList [MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"],MetaList [MetaString "2006",MetaString "11",MetaString "27"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2a"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10"],MetaList [MetaString "2006",MetaString "11"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Web",Space,Str "Site"]),("id",MetaInlines [Str "item2b"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "12",MetaString "31"],MetaList [MetaString "2007",MetaString "1",MetaString "1"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "webpage"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Newspaper"]),("id",MetaInlines [Str "item3"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10",MetaString "26"],MetaList [MetaString "2006",MetaString "11",MetaString "27"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-newspaper"])]),MetaMap (fromList [("URL",MetaInlines [Str "http://www.example.com"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "John"])])]),("container-title",MetaInlines [Str "The",Space,Str "Newspaper"]),("id",MetaInlines [Str "item3b"]),("issued",MetaMap (fromList [("date-parts",MetaList [MetaList [MetaString "2006",MetaString "10"],MetaList [MetaString "2006",MetaString "11"]])])),("title",MetaInlines [Str "Title"]),("type",MetaInlines [Str "article-newspaper"])])])]})
+[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item1"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date"]
+,Para [Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item2"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range"]
+,Para [Cite [Citation {citationId = "item2a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item2a"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range",Space,Str "YM"]
+,Para [Cite [Citation {citationId = "item2b", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item2b"],Space,Str "\8211",Space,Str "webpage,",Space,Str "date",Space,Str "range",Space,Str "across",Space,Str "years"]
+,Para [Cite [Citation {citationId = "item3", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item3"],Space,Str "\8211",Space,Str "article-newspaper"]
+,Para [Cite [Citation {citationId = "item3b", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@item3b"],Space,Str "\8211",Space,Str "article-newspaper",Space,Str "YM"]
+,Header 1 ("references",[],[]) [Str "References"]]
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/modern-language-association-7th-edition.csl b/tests/modern-language-association-7th-edition.csl
deleted file mode 100644
index c2fc292..0000000
--- a/tests/modern-language-association-7th-edition.csl
+++ /dev/null
@@ -1,460 +0,0 @@
-<?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="never">
- <info>
- <title>Modern Language Association 7th edition</title>
- <title-short>MLA</title-short>
- <id>http://www.zotero.org/styles/modern-language-association-7th-edition</id>
- <link href="http://www.zotero.org/styles/modern-language-association-7th-edition" rel="self"/>
- <link href="http://owl.english.purdue.edu/owl/section/2/11/" rel="documentation"/>
- <author>
- <name>Ilouise S. Bradford</name>
- <email>isbradford@gmail.com</email>
- </author>
- <contributor>
- <name>Sarah Ficke</name>
- <email>sficke@email.unc.edu</email>
- </contributor>
- <contributor>
- <name>Sebastian Karcher</name>
- <email>karcher@u.northwestern.edu</email>
- </contributor>
- <contributor>
- <name>Christian Werthschulte</name>
- <email>Christian.Werthschulte@rub.de</email>
- </contributor>
- <contributor>
- <name>Simon Kornblith</name>
- <email>simon@simonster.com</email>
- </contributor>
- <contributor>
- <name>James Johnston</name>
- <email>thejamesjohnston@gmail.com</email>
- </contributor>
- <category citation-format="author"/>
- <category field="generic-base"/>
- <summary>This style adheres to the MLA 7th edition handbook and contains modifications to these types of sources: e-mail, forum posts, interviews, manuscripts, maps, presentations, TV broadcasts, and web pages.</summary>
- <updated>2017-04-27T18:03:35+00:00</updated>
- <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
- </info>
- <locale xml:lang="en">
- <terms>
- <term name="month-01" form="short">Jan.</term>
- <term name="month-02" form="short">Feb.</term>
- <term name="month-03" form="short">Mar.</term>
- <term name="month-04" form="short">Apr.</term>
- <term name="month-05" form="short">May</term>
- <term name="month-06" form="short">June</term>
- <term name="month-07" form="short">July</term>
- <term name="month-08" form="short">Aug.</term>
- <term name="month-09" form="short">Sept.</term>
- <term name="month-10" form="short">Oct.</term>
- <term name="month-11" form="short">Nov.</term>
- <term name="month-12" form="short">Dec.</term>
- <term name="volume" form="short">
- <single>Vol.</single>
- <multiple>vols</multiple>
- </term>
- <term name="edition" form="short">ed</term>
- <term name="editor" form="verb-short">ed.</term>
- <term name="translator" form="verb-short">trans.</term>
- <term name="translator" form="short">trans.</term>
- </terms>
- </locale>
- <macro name="editor-translator">
- <names variable="editor translator" delimiter=". ">
- <label form="verb-short" text-case="capitalize-first" suffix=" "/>
- <name and="text" delimiter=", "/>
- </names>
- </macro>
- <macro name="author">
- <names variable="author">
- <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
- <label form="short" prefix=", "/>
- <substitute>
- <names variable="editor"/>
- <names variable="translator"/>
- <text macro="title"/>
- </substitute>
- </names>
- </macro>
- <macro name="author-short">
- <names variable="author">
- <name form="short" and="text" delimiter=", " initialize-with=". "/>
- <substitute>
- <names variable="editor"/>
- <names variable="translator"/>
- <text macro="title-short"/>
- </substitute>
- </names>
- </macro>
- <macro name="access">
- <group delimiter=" ">
- <date variable="accessed">
- <date-part name="day" suffix=" "/>
- <date-part name="month" form="short" suffix=" "/>
- <date-part name="year"/>
- </date>
- </group>
- </macro>
- <macro name="issued-full-date">
- <choose>
- <if variable="issued">
- <date variable="issued">
- <date-part name="day" suffix=" "/>
- <date-part name="month" form="short" suffix=" " strip-periods="false"/>
- <date-part name="year"/>
- </date>
- </if>
- <else>
- <text term="no date" form="short"/>
- </else>
- </choose>
- </macro>
- <macro name="medium">
- <choose>
- <if type="motion_picture">
- <choose>
- <if variable="medium">
- <text variable="medium" prefix=" "/>
- </if>
- <else>
- <text value="Film" prefix=" "/>
- </else>
- </choose>
- </if>
- <else-if type="broadcast">
- <choose>
- <if variable="medium">
- <text variable="medium" prefix=" "/>
- </if>
- <else>
- <text value="Television" prefix=" "/>
- </else>
- </choose>
- </else-if>
- <else-if type="manuscript">
- <text value=""/>
- </else-if>
- <else-if type="personal_communication" match="any">
- <text value="" prefix=" "/>
- </else-if>
- <else-if type="speech" match="any">
- <text value=""/>
- </else-if>
- <else-if type="interview">
- <text variable="medium" prefix=" "/>
- </else-if>
- <else-if type="song">
- <choose>
- <if variable="medium">
- <text variable="medium" prefix=" "/>
- </if>
- <else>
- <text value="Audio Recording" prefix=" "/>
- </else>
- </choose>
- </else-if>
- <else-if type="graphic" variable="medium" match="all">
- <text variable="medium" prefix=" "/>
- </else-if>
- <else>
- <choose>
- <if variable="URL DOI" match="any">
- <text variable="source" prefix=" " suffix="." font-style="italic"/>
- <group>
- <text value="Web." prefix=" "/>
- </group>
- <text prefix=" " suffix="." macro="access"/>
- </if>
- <else>
- <text value="Print" prefix=" "/>
- </else>
- </choose>
- </else>
- </choose>
- </macro>
- <macro name="title">
- <choose>
- <if type="bill book graphic legal_case legislation manuscript motion_picture report song" match="any">
- <text variable="title" font-style="italic" text-case="title"/>
- </if>
- <else-if type="interview personal_communication" match="any">
- <text variable="title" text-case="title" quotes="false"/>
- </else-if>
- <else>
- <text variable="title" text-case="title" quotes="true"/>
- </else>
- </choose>
- </macro>
- <macro name="title-short">
- <choose>
- <if type="bill book graphic legal_case legislation manuscript motion_picture report song" match="any">
- <text variable="title" text-case="title" form="short" font-style="italic"/>
- </if>
- <else>
- <text variable="title" text-case="title" form="short" quotes="true"/>
- </else>
- </choose>
- </macro>
- <macro name="pages">
- <choose>
- <if variable="page">
- <text variable="page"/>
- </if>
- <else-if type="personal_communication interview" match="any">
- <text value=""/>
- </else-if>
- <else>
- <text value="n. pag"/>
- </else>
- </choose>
- </macro>
- <macro name="edition">
- <choose>
- <if is-numeric="edition">
- <group delimiter=" ">
- <number variable="edition" form="ordinal"/>
- <text term="edition" form="short"/>
- </group>
- </if>
- <else>
- <text variable="edition"/>
- </else>
- </choose>
- </macro>
- <macro name="volume">
- <choose>
- <if is-numeric="volume">
- <group delimiter=" ">
- <text term="volume" form="short" strip-periods="false"/>
- <number variable="volume"/>
- </group>
- </if>
- <else>
- <text variable="volume"/>
- </else>
- </choose>
- </macro>
- <macro name="number-of-volumes-only">
- <choose>
- <if variable="volume" match="none">
- <choose>
- <if is-numeric="number-of-volumes">
- <group delimiter=" ">
- <number variable="number-of-volumes"/>
- <text term="volume" form="short" plural="true" strip-periods="true"/>
- </group>
- </if>
- <else>
- <text variable="number-of-volumes"/>
- </else>
- </choose>
- </if>
- </choose>
- </macro>
- <macro name="number-of-volumes-optional">
- <choose>
- <if variable="volume">
- <choose>
- <if is-numeric="number-of-volumes">
- <group delimiter=" ">
- <number variable="number-of-volumes"/>
- <text term="volume" form="short" plural="true" strip-periods="true"/>
- </group>
- </if>
- <else>
- <text variable="number-of-volumes"/>
- </else>
- </choose>
- </if>
- </choose>
- </macro>
- <macro name="collection-title">
- <text variable="collection-title" text-case="title" prefix=" "/>
- </macro>
- <macro name="collection-number">
- <text variable="collection-number" prefix=" " suffix="."/>
- </macro>
- <macro name="publisher">
- <choose>
- <if variable="publisher">
- <text variable="publisher"/>
- </if>
- <else>
- <text value="N.p."/>
- </else>
- </choose>
- </macro>
- <macro name="publisher-year">
- <group delimiter=", ">
- <group delimiter=": ">
- <text variable="publisher-place"/>
- <text macro="publisher"/>
- </group>
- <date variable="issued">
- <date-part name="year"/>
- </date>
- </group>
- </macro>
- <citation et-al-min="2" et-al-use-first="1" disambiguate-add-names="true" disambiguate-add-givenname="true">
- <layout prefix="(" suffix=")" delimiter="; ">
- <group delimiter=" ">
- <choose>
- <if variable="author editor translator" match="any">
- <group delimiter=", ">
- <text macro="author-short"/>
- <choose>
- <if disambiguate="true">
- <text macro="title-short"/>
- </if>
- </choose>
- </group>
- </if>
- <else>
- <text macro="title-short"/>
- </else>
- </choose>
- <text variable="locator"/>
- </group>
- </layout>
- </citation>
- <bibliography hanging-indent="true" et-al-min="4" et-al-use-first="1" line-spacing="2" entry-spacing="0" subsequent-author-substitute="---">
- <sort>
- <key macro="author"/>
- <key variable="title"/>
- </sort>
- <layout suffix=".">
- <text macro="author" suffix="."/>
- <text macro="title" prefix=" " suffix="."/>
- <choose>
- <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
- <text macro="editor-translator" prefix=" " suffix="."/>
- <text macro="edition" prefix=" " suffix="."/>
- <text macro="volume" prefix=" " suffix="."/>
- <text macro="number-of-volumes-only" prefix=" " suffix="."/>
- <text macro="publisher-year" prefix=" " suffix="."/>
- </if>
- <else-if type="chapter paper-conference" match="any">
- <group>
- <text variable="container-title" text-case="title" font-style="italic" prefix=" " suffix="."/>
- <text macro="editor-translator" prefix=" " suffix="."/>
- <text macro="edition" prefix=" " suffix="."/>
- <text macro="volume" prefix=" " suffix="."/>
- <text macro="number-of-volumes-only" prefix=" " suffix="."/>
- <text macro="publisher-year" prefix=" " suffix="."/>
- </group>
- <text variable="page" prefix=" " suffix="."/>
- </else-if>
- <else-if type="thesis">
- <text variable="genre" prefix=" " suffix="."/>
- <group delimiter=", ">
- <text macro="publisher" prefix=" "/>
- <date variable="issued" prefix=" " suffix=".">
- <date-part name="year"/>
- </date>
- </group>
- <text variable="archive_location" prefix=" " suffix="."/>
- </else-if>
- <else-if type="manuscript">
- <date variable="issued" prefix=" " suffix=".">
- <date-part name="year"/>
- </date>
- <text variable="genre" prefix=" " suffix="."/>
- <text variable="archive_location" prefix=" " suffix="."/>
- <text variable="publisher-place" prefix=" "/>
- </else-if>
- <else-if type="personal_communication">
- <date variable="issued" prefix=" " suffix=".">
- <date-part name="day" suffix=" "/>
- <date-part name="month" form="short" suffix=" "/>
- <date-part name="year"/>
- </date>
- <choose>
- <if variable="genre">
- <text prefix=" " suffix="." variable="genre"/>
- </if>
- <else>
- <text prefix=" " suffix="." value="E-mail"/>
- </else>
- </choose>
- </else-if>
- <else-if type="map">
- <text variable="genre" prefix=" " suffix="."/>
- <text variable="publisher-place" prefix=" " suffix=":"/>
- <text macro="publisher" prefix=" "/>
- <date variable="issued" prefix=" " suffix=",">
- <date-part name="year"/>
- </date>
- </else-if>
- <else-if type="speech">
- <text variable="event" prefix=" " suffix="."/>
- <text variable="publisher-place" prefix=" " suffix="."/>
- <date variable="issued" prefix=" " suffix=".">
- <date-part name="year"/>
- </date>
- <text variable="genre" prefix=" " suffix="."/>
- </else-if>
- <else-if type="webpage post-weblog" match="any">
- <text variable="genre" prefix=" " suffix="."/>
- <text variable="container-title" font-style="italic" prefix=" " suffix="."/>
- <group delimiter=", " prefix=" ">
- <text macro="publisher"/>
- <text macro="issued-full-date" suffix="."/>
- </group>
- </else-if>
- <else-if type="broadcast">
- <text variable="container-title" font-style="italic" prefix=" " suffix="."/>
- <text macro="publisher" prefix=" " suffix=","/>
- <date variable="issued" prefix=" " suffix=".">
- <date-part name="day" suffix=" "/>
- <date-part name="month" form="short" suffix=" " strip-periods="false"/>
- <date-part name="year"/>
- </date>
- </else-if>
- <else>
- <group prefix=" " suffix="." delimiter=": ">
- <group delimiter=" ">
- <text macro="editor-translator" suffix="."/>
- <text variable="container-title" font-style="italic"/>
- <choose>
- <if type="article-journal">
- <group delimiter=" ">
- <group delimiter=".">
- <text variable="volume"/>
- <text variable="issue"/>
- </group>
- <date variable="issued" prefix="(" suffix="):">
- <date-part name="year"/>
- </date>
- </group>
- <text macro="pages" prefix=" "/>
- </if>
- <else>
- <group>
- <date variable="issued">
- <date-part name="day" suffix=" "/>
- <date-part name="month" form="short" suffix=" " strip-periods="false"/>
- <date-part name="year"/>
- </date>
- <choose>
- <if variable="URL DOI" match="any">
- <text variable="page" prefix=": "/>
- </if>
- <else>
- <text macro="pages" prefix=": "/>
- </else>
- </choose>
- </group>
- </else>
- </choose>
- </group>
- </group>
- </else>
- </choose>
- <text macro="medium" suffix="."/>
- <text macro="number-of-volumes-optional" suffix="." prefix=" "/>
- <text macro="collection-title"/>
- <text macro="collection-number"/>
- </layout>
- </bibliography>
-</style>
diff --git a/tests/test-citeproc.hs b/tests/test-citeproc.hs
index a6c6433..323cf4e 100644
--- a/tests/test-citeproc.hs
+++ b/tests/test-citeproc.hs
@@ -13,6 +13,7 @@ import System.Process
import System.IO.Temp (withSystemTempDirectory)
import qualified Text.Pandoc.UTF8 as UTF8
import Data.Aeson
+import Data.Aeson.Types (Parser)
import System.FilePath
import System.Directory
import Data.List (sort, isInfixOf)
@@ -35,6 +36,7 @@ data TestCase = TestCase{
} deriving (Show)
data Mode = CitationMode
+ | CitationRTFMode
| BibliographyMode
| BibliographyHeaderMode
| BibliographyNoSortMode
@@ -42,6 +44,7 @@ data Mode = CitationMode
instance FromJSON Mode where
parseJSON (String "citation") = return CitationMode
+ parseJSON (String "citation-rtf") = return CitationRTFMode
parseJSON (String "bibliography") = return BibliographyMode
parseJSON (String "bibliography-header") = return BibliographyHeaderMode
parseJSON (String "bibliography-nosort") = return BibliographyNoSortMode
@@ -51,12 +54,15 @@ instance FromJSON TestCase where
parseJSON (Object v) = TestCase <$>
v .: "mode" <*>
v .:? "bibsection" .!= Select [] [] <*>
- v .:? "citations" .!= [] <*>
+ ((v .: "citations") >>= parseCitations) <*>
v .:? "citation_items" .!= [] <*>
- (parseCSL <$> (v .: "csl")) <*>
+ (parseCSL <$> (v .: "csl")) <*>
v .:? "abbreviations" .!= (Abbreviations M.empty) <*>
v .: "input" <*>
v .: "result"
+ where parseCitations :: Data.Aeson.Value -> Parser [CiteObject]
+ parseCitations x@(Array{}) = parseJSON x
+ parseCitations _ = return []
parseJSON _ = fail "Could not parse test case"
newtype CiteObject =
@@ -210,7 +216,7 @@ main = do
exists <- doesDirectoryExist testDir
unless exists $ do
putStrLn "Downloading test suite"
- rawSystem "hg" ["clone", "https://bitbucket.org/bdarcus/citeproc-test"]
+ _ <- rawSystem "git" ["clone", "https://github.com/citation-style-language/test-suite.git", "citeproc-test"]
withDirectory "citeproc-test" $
void $ rawSystem "python" ["processor.py", "--grind"]