packages feed

pandoc-citeproc 0.16.1.1 → 0.16.1.2

raw patch · 9 files changed

+257/−83 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog view
@@ -1,3 +1,10 @@+pandoc-citeproc (0.16.1.2)++  * Fix extraction page-first when page is not fully numeric (#386).+  * For cites in notes in a footnote style, don't add comma right after+    open parentheses.  Partially addresses #389.+  * Ensure that URIs (e.g. in DOIs) are properly escaped (#391).+ pandoc-citeproc (0.16.1.1)    * Bump version bounds for pandoc, network.
man/man1/pandoc-citeproc.1 view
@@ -1,45 +1,48 @@ .\"t-.\" Automatically generated by Pandoc 2.5+.\" Automatically generated by Pandoc 2.7 .\"-.TH "pandoc\-citeproc" "1" "2019-02-06" "pandoc-citeproc 0.16.0.1" ""+.TH "pandoc-citeproc" "1" "2019-03-07" "pandoc-citeproc 0.16.1.2" "" .hy .SH NAME .PP-pandoc\-citeproc \- filter to resolve citations in a pandoc document.+pandoc-citeproc - filter to resolve citations in a pandoc document. .SH SYNOPSIS .PP-pandoc\-citeproc options [file..]+pandoc-citeproc options [file..] .SH DESCRIPTION .PP-The \f[C]pandoc\-citeproc\f[R] executable has two modes, filter mode and+The \f[C]pandoc-citeproc\f[R] executable has two modes, filter mode and convert mode. .SS Filter mode .PP-Run without options, it acts as a filter that takes a JSON\-encoded+Run without options, it acts as a filter that takes a JSON-encoded Pandoc document, formats citations and adds a bibliography, and returns-a JSON\-encoded pandoc document.+a JSON-encoded pandoc document. Citations will be resolved, and, assuming there are bibliography entries, a bibliography will be inserted into a Div element with id \f[C]refs\f[R]. If no such Div exists, one will be created and appended to the end of-the document (unless the \f[C]suppress\-bibliography\f[R] metadata field+the document (unless the \f[C]suppress-bibliography\f[R] metadata field is set to a true value). If you wish the bibliography to have a section header, put the section header at the end of your document.-(See the \f[C]pandoc_markdown\f[R] (5) man page under-\[lq]Citations\[rq] for details on how to encode citations in-pandoc\[cq]s markdown.)+(See the \f[C]pandoc\f[R] (1) man page under \[lq]Citations\[rq] for+details on how to encode citations in pandoc\[cq]s markdown.) .PP-To process citations with pandoc, call pandoc\-citeproc as a filter:+To process citations with pandoc, call pandoc-citeproc as a filter: .IP .nf \f[C]-pandoc \-\-filter pandoc\-citeproc input.md \-s \-o output.html+pandoc --filter pandoc-citeproc input.md -s -o output.html \f[R] .fi .PP-pandoc\-citeproc will look for the following metadata fields in the-input:+pandoc-citeproc will look for the following metadata fields in the+input.+(For details on how to set metadata fields in pandoc\[cq]s markdown, see+the \f[C]pandoc\f[R] (1) man page under \f[C]--metadata\f[R],+\f[C]--metadata-file\f[R], and+\f[C]Extension: yaml_metadata_block\f[R].) .TP .B \f[C]bibliography\f[R] A path, or YAML list of paths, of bibliography files to use.@@ -130,17 +133,17 @@ .IP .nf \f[C]-\- id: doe2006+- id: doe2006   author:     family: Doe     given: [John, F.]   title: Article-  page: 33\-34+  page: 33-34   issued:     year: 2006-  type: article\-journal+  type: article-journal   volume: 6-  container\-title: Journal of Generic Studies+  container-title: Journal of Generic Studies \f[R] .fi .PP@@ -150,26 +153,26 @@ Simple tex math will also be parsed and rendered appropriately. .RE .TP-.B \f[C]csl\f[R] or \f[C]citation\-style\f[R]+.B \f[C]csl\f[R] or \f[C]citation-style\f[R] Path or URL of a CSL style file. If the file is not found relative to the working directory,-pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or+pandoc-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or \f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]csl\f[R] in Windows 7).-If this is left off, pandoc\-citeproc will look for+If this is left off, pandoc-citeproc will look for \f[C]$HOME/.pandoc/default.csl\f[R], and if this is not present, it will-use \f[C]chicago\-author\-date.csl\f[R], looking first in+use \f[C]chicago-author-date.csl\f[R], looking first in \f[C]$HOME/.csl\f[R] and then in its own data files. .TP-.B \f[C]link\-citations\f[R]-If this has a true value, citations in author\-date and numerical styles+.B \f[C]link-citations\f[R]+If this has a true value, citations in author-date and numerical styles will be hyperlinked to their corresponding bibliography entries. The default is not to add hyperlinks. .TP-.B \f[C]citation\-abbreviations\f[R]+.B \f[C]citation-abbreviations\f[R] Path to a CSL abbreviations JSON file. If the file is not found relative to the working directory,-pandoc\-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or+pandoc-citeproc will look in the \f[C]$HOME/.csl\f[R] directory (or \f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]csl\f[R] in Windows 7). The format is described@@ -184,7 +187,7 @@ .nf \f[C] { \[dq]default\[dq]: {-    \[dq]container\-title\[dq]: {+    \[dq]container-title\[dq]: {             \[dq]Lloyd\[aq]s Law Reports\[dq]: \[dq]Lloyd\[aq]s Rep\[dq],             \[dq]Estates Gazette\[dq]: \[dq]EG\[dq],             \[dq]Scots Law Times\[dq]: \[dq]SLT\[dq]@@ -198,27 +201,27 @@ .B \f[C]lang\f[R] Locale to use in formatting citations. If this is not set, the locale is taken from the-\f[C]default\-locale\f[R] attribute of the CSL file.-\f[C]en\-US\f[R] is used if a locale is not specified in either the+\f[C]default-locale\f[R] attribute of the CSL file.+\f[C]en-US\f[R] is used if a locale is not specified in either the metadata or the CSL file. (For backwards compatibility, the field \f[C]locale\f[R] can be used instead of \f[C]lang\f[R], but this \f[C]lang\f[R] should be used going forward.) .TP-.B \f[C]suppress\-bibliography\f[R]+.B \f[C]suppress-bibliography\f[R] If this has a true value, the bibliography will be left off. Otherwise a bibliography will be inserted into each Div element with id \f[C]refs\f[R]. If there is no such Div, one will be created at the end of the document. .TP-.B \f[C]reference\-section\-title\f[R]+.B \f[C]reference-section-title\f[R] If this has a value, a section header with this title will be added before the bibliography.-If \f[C]reference\-section\-title\f[R] is not specified and the document+If \f[C]reference-section-title\f[R] is not specified and the document ends with a section header, this final header will be treated as the bibliography header. .TP-.B \f[C]notes\-after\-punctuation\f[R]+.B \f[C]notes-after-punctuation\f[R] If true (the default), pandoc will put footnote citations after following punctuation. For example, if the source contains \f[C]blah blah [\[at]jones99].\f[R],@@ -229,25 +232,25 @@ .PP The metadata must contain either \f[C]references\f[R] or \f[C]bibliography\f[R] or both as a source of references.-\f[C]csl\f[R] and \f[C]citation\-abbreviations\f[R] are optional.+\f[C]csl\f[R] and \f[C]citation-abbreviations\f[R] are optional. If \f[C]csl\f[R] is not provided, a default stylesheet will be used (either \f[C]\[ti]/.pandoc/default.csl\f[R] or a version of-\f[C]chicago\-author\-date.csl\f[R]).+\f[C]chicago-author-date.csl\f[R]). .SS Convert mode .PP-If the option \f[C]\-\-bib2yaml\f[R] or \f[C]\-\-bib2json\f[R] is used,-\f[C]pandoc\-citeproc\f[R] will not process citations; instead, it will+If the option \f[C]--bib2yaml\f[R] or \f[C]--bib2json\f[R] is used,+\f[C]pandoc-citeproc\f[R] will not process citations; instead, it will treat its input (from stdin or files) as a bibliography and convert it either to a pandoc YAML metadata section, suitable for inclusion in a-pandoc document (\f[C]\-\-bib2yaml\f[R]), or as a CSL JSON bibliography,-suitable for import to zotero (\f[C]\-\-bib2json\f[R]).+pandoc document (\f[C]--bib2yaml\f[R]), or as a CSL JSON bibliography,+suitable for import to zotero (\f[C]--bib2json\f[R]). .PP-The \f[C]\-\-format\f[R] option can be used to specify the bibliography-format, though when files are used, \f[C]pandoc\-citeproc\f[R] can+The \f[C]--format\f[R] option can be used to specify the bibliography+format, though when files are used, \f[C]pandoc-citeproc\f[R] can generally guess this from the extension. .PP This mode supersedes the old \f[C]biblio2yaml\f[R] program.-.SS Raw content (pandoc\-citeproc only)+.SS Raw content (pandoc-citeproc only) .PP To include raw content in a prefix, suffix, delimiter, or term, surround it with these tags indicating the format:@@ -267,35 +270,41 @@ CSL implementations. .SH OPTIONS .TP-.B \f[C]\-y, \-\-bib2yaml\f[R]+.B \f[C]-y, --bib2yaml\f[R] Convert bibliography to YAML suitable for inclusion in pandoc metadata. .TP-.B \f[C]\-j, \-\-bib2json\f[R]+.B \f[C]-j, --bib2json\f[R] Convert bibliography to CSL JSON suitable for import into Zotero. .TP-.B \f[C]\-f\f[R] \f[I]FORMAT\f[R], \f[C]\-\-format=\f[R]\f[I]FORMAT\f[R]+.B \f[C]-f\f[R] \f[I]FORMAT\f[R], \f[C]--format=\f[R]\f[I]FORMAT\f[R] Specify format of bibliography to be converted. Legal values are \f[C]biblatex\f[R], \f[C]bibtex\f[R], \f[C]ris\f[R], \f[C]endnote\f[R], \f[C]endnotexml\f[R], \f[C]isi\f[R], \f[C]medline\f[R], \f[C]copac\f[R], \f[C]mods\f[R], \f[C]nbib\f[R], and \f[C]json\f[R]. .TP-.B \f[C]\-h, \-\-help\f[R]+.B \f[C]-c\f[R] \f[I]NUMBER\f[R], \f[C]--columns=\f[R]\f[I]NUMBER\f[R]+Specify column to which to wrap YAML output produced using+\f[C]--bib2yaml\f[R].+Default is 80.+To disable wrapping, set 0.+.TP+.B \f[C]-h, --help\f[R] Print usage information. .TP-.B \f[C]\-\-man\f[R]+.B \f[C]--man\f[R] Print the man page in groff man format. To get a plain text version,-\f[C]pandoc\-citeproc \-\-man | groff \-mman \-Tutf8\f[R].-To \f[C]pandoc\-citeproc \-\-man | groff \-mman \-Thtml\f[R].+\f[C]pandoc-citeproc --man | groff -mman -Tutf8\f[R].+To \f[C]pandoc-citeproc --man | groff -mman -Thtml\f[R]. .TP-.B \f[C]\-\-license\f[R]+.B \f[C]--license\f[R] Print the license. .TP-.B \f[C]\-q, \-\-quiet\f[R]+.B \f[C]-q, --quiet\f[R] Silence all warnings. .TP-.B \f[C]\-V, \-\-version\f[R]+.B \f[C]-V, --version\f[R] Print version. .SH NOTES .SS General@@ -304,7 +313,7 @@ \[lq]Database Guide\[rq] section of the biblatex manual (currently 2.8a). .PP-If you use a CSL\-YAML or CSL\-JSON database, or a CSL\-YAML metadata+If you use a CSL-YAML or CSL-JSON database, or a CSL-YAML metadata section in your markdown document, follow the \[lq]Citation Style Language 1.0.1 Language Specification\[rq] (<http://citationstyles.org/downloads/specification.html>).@@ -320,7 +329,7 @@ following rules: .IP \[bu] 2 English titles should be in title case.-Non\-English titles should be in sentence case, and the \f[C]langid\f[R]+Non-English titles should be in sentence case, and the \f[C]langid\f[R] field in biblatex should be set to the relevant language. (The following values are treated as English: \f[C]american\f[R], \f[C]british\f[R], \f[C]canadian\f[R], \f[C]english\f[R],@@ -362,8 +371,8 @@ .IP \[bu] 2 All titles should be in sentence case. .IP \[bu] 2-Use the \f[C]language\f[R] field for non\-English titles to prevent-their conversion to title case in styles that call for this.+Use the \f[C]language\f[R] field for non-English titles to prevent their+conversion to title case in styles that call for this. (Conversion happens only if \f[C]language\f[R] begins with \f[C]en\f[R] or is left empty.) .IP \[bu] 2@@ -381,7 +390,7 @@ .PP For a formally published conference paper, use the biblatex entry type \f[C]inproceedings\f[R] (which will be mapped to CSL-\f[C]paper\-conference\f[R]).+\f[C]paper-conference\f[R]). .PP For an unpublished manuscript, use the biblatex entry type \f[C]unpublished\f[R] without an \f[C]eventtitle\f[R] field (this entry@@ -403,7 +412,7 @@ Andrea Rossato and John MacFarlane. .SH SEE ALSO .PP-\f[C]pandoc\f[R] (1), \f[C]pandoc_markdown\f[R] (5).+\f[C]pandoc\f[R] (1). .PP-The pandoc\-citeproc source code and all documentation may be downloaded+The pandoc-citeproc source code and all documentation may be downloaded from <http://github.com/jgm/pandoc-citeproc/>.
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name:               pandoc-citeproc-version:            0.16.1.1+version:            0.16.1.2 cabal-version:      1.12 synopsis:           Supports using pandoc with citeproc 
src/Text/CSL/Eval.hs view
@@ -34,7 +34,7 @@ import           Data.String            (fromString) import qualified Data.Text              as T import           Text.Pandoc.Definition (Inline (Link, Span, Str), nullAttr)-import           Text.Pandoc.Shared     (stringify)+import           Text.Pandoc.Shared     (stringify, escapeURI) import           Text.Pandoc.Walk       (walk)  import           Text.CSL.Eval.Common@@ -239,7 +239,7 @@                "page"        -> getStringVar "page" >>= formatRange fm                "locator"     -> getLocVar >>= formatRange fm . snd                "url"         -> getStringVar "url" >>= \k ->-                                if null k then return [] else return [Output [OPan [Link nullAttr [Str k] (k,"")]] fm]+                                if null k then return [] else return [Output [OPan [Link nullAttr [Str k] (escapeURI k,"")]] fm]                "doi"         -> do d <- getStringVar "doi"                                    let (prefixPart, linkPart) = T.breakOn (T.pack "http") (T.pack (prefix fm))                                    let u = if T.null linkPart@@ -247,20 +247,20 @@                                               else T.unpack linkPart ++ d                                    if null d                                       then return []-                                      else return [Output [OPan [Link nullAttr [Str (T.unpack linkPart ++ d)] (u, "")]]+                                      else return [Output [OPan [Link nullAttr [Str (T.unpack linkPart ++ d)] (escapeURI u, "")]]                                             fm{ prefix = T.unpack prefixPart, suffix = suffix fm }]                "isbn"        -> getStringVar "isbn" >>= \d ->                                 if null d                                    then return []-                                   else return [Output [OPan [Link nullAttr [Str d] ("https://worldcat.org/isbn/" ++ d, "")]] fm]+                                   else return [Output [OPan [Link nullAttr [Str d] ("https://worldcat.org/isbn/" ++ escapeURI d, "")]] fm]                "pmid"        -> getStringVar "pmid" >>= \d ->                                 if null d                                    then return []-                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pubmed/" ++ d, "")]] fm]+                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pubmed/" ++ escapeURI d, "")]] fm]                "pmcid"       -> getStringVar "pmcid" >>= \d ->                                 if null d                                    then return []-                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pmc/articles/" ++ d, "")]] fm]+                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pmc/articles/" ++ escapeURI d, "")]] fm]                _ -> do (opts, as) <- gets (env >>> options &&& abbrevs)                        r <- getVar []                               (getFormattedValue opts as f fm s) s
src/Text/CSL/Pandoc.hs view
@@ -369,8 +369,12 @@         specialSpan cs =           Span ("",["reference-id-list"],             [("refids", unwords (map citationId cs))]) []+        go' (Str "(" : Cite cs [Note [Para xs]] : Str ")" : ys) =+             Str "(" : Cite cs xs : Str ")" : ys         go' (x : Cite cs [Note [Para xs]] : ys) | not (isSpacy x) =              x : Str "," : Space : comb (\zs -> [Cite cs zs]) xs ys+        go' (Str "(" : Note [Para xs] : Str ")" : ys) =+             Str "(" : xs ++ (Str ")" : ys)         go' (x : Note [Para xs] : ys) | not (isSpacy x) =              x : Str "," : Space : comb id xs ys         go' (Cite cs [Note [Para xs]] : ys) = comb (\zs -> [Cite cs zs]) xs ys
src/Text/CSL/Reference.hs view
@@ -62,11 +62,11 @@ import           Data.Aeson          hiding (Value) import qualified Data.Aeson          as Aeson import           Data.Aeson.Types    (Parser)-import           Data.Char           (isDigit, toLower)+import           Data.Char           (isDigit, toLower, isPunctuation) import           Data.Either         (lefts, rights) import           Data.Generics       hiding (Generic) import qualified Data.HashMap.Strict as H-import           Data.List           (findIndex, elemIndex)+import           Data.List           (find, elemIndex) import           Data.List.Split     (splitWhen) import           Data.Maybe          (fromMaybe, isNothing) import           Data.String@@ -80,7 +80,7 @@ import           Text.CSL.Util       (camelize, capitalize, inlinesToString,                                       mapping', parseBool, parseInt, parseMaybeInt,                                       parseString, readNum, safeRead, trim,-                                      uncamelize, AddYaml(..))+                                      uncamelize, AddYaml(..), splitStrWhen) import           Text.Pandoc         (Inline (Str)) import qualified Text.Parsec         as P import qualified Text.Parsec.String  as P@@ -492,7 +492,7 @@ instance FromJSON Reference where   parseJSON (Object v') = do      v <- parseSuppFields v' <|> return v'-     addPageFirst <$> (Reference <$>+     (Reference <$>        v .:? "id" .!= "" <*>        v .:? "other-ids" .!= [] <*>        v .:? "type" .!= NoType <*>@@ -569,15 +569,6 @@        v .:? "citation-number" .!= CNum 0 <*>        ((v .: "first-reference-note-number" >>= parseInt) <|> return 0) <*>        v .:? "citation-label" .!= mempty)-    where takeFirstNum (Formatted (Str xs : _)) =-            case takeWhile isDigit xs of-                   [] -> mempty-                   ds -> Formatted [Str ds]-          takeFirstNum x = x-          addPageFirst ref = if pageFirst ref == mempty && page ref /= mempty-                                then ref{ pageFirst =-                                            takeFirstNum (page ref) }-                                else ref   parseJSON _ = fail "Could not parse Reference"  -- Syntax for adding supplementary fields in note variable@@ -877,8 +868,8 @@  getReference :: [Reference] -> Cite -> Maybe Reference getReference  rs c-    = case (hasId (citeId c)) `findIndex` rs of-        Just i  -> Just $ setPageFirst $ rs !! i+    = case (hasId (citeId c)) `find` rs of+        Just r  -> Just $ setPageFirst r         Nothing -> Nothing   where hasId :: String -> Reference -> Bool         hasId ident r = ident `elem` (map unLiteral (refId r : refOtherIds r))@@ -955,7 +946,8 @@ setPageFirst :: Reference -> Reference setPageFirst ref =   let Formatted ils = page ref-      ils' = takeWhile (\i -> i /= Str "–" && i /= Str "-") ils+      ils' = takeWhile (\i -> i /= Str "–" && i /= Str "-") $+              splitStrWhen isPunctuation ils   in  if ils == ils'          then ref          else ref{ pageFirst = Formatted ils' }
+ tests/advanced-optical-materials.csl view
@@ -0,0 +1,155 @@+<?xml version="1.0" encoding="utf-8"?>+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">+  <info>+    <title>Advanced Optical Materials</title>+    <id>http://www.zotero.org/styles/advanced-optical-materials</id>+    <link href="http://www.zotero.org/styles/advanced-optical-materials" rel="self"/>+    <link href="http://www.zotero.org/styles/small" rel="template"/>+    <link href="http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)2195-1071/homepage/2298_forauthors.html" rel="documentation"/>+    <author>+      <name>Martin F. Schumann</name>+      <email>mfs@mfs.name</email>+    </author>+    <category citation-format="numeric"/>+    <category field="engineering"/>+    <eissn>2195-1071</eissn>+    <summary>A style for Wiley's Advanced Optical Materials</summary>+    <updated>2017-02-16T15:37:41+00:00</updated>+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>+  </info>+  <macro name="author">+    <names variable="author">+      <name initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>+      <label form="short" prefix=", " text-case="capitalize-first" suffix=" "/>+      <substitute>+        <names variable="editor"/>+        <names variable="translator"/>+      </substitute>+    </names>+  </macro>+  <macro name="editor">+    <names variable="editor">+      <label form="short" text-case="capitalize-first" suffix=".: " strip-periods="true"/>+      <name initialize-with="." delimiter=", " delimiter-precedes-last="always"/>+    </names>+  </macro>+  <macro name="year-date">+    <group font-weight="bold">+      <choose>+        <if variable="issued">+          <date variable="issued">+            <date-part name="year"/>+          </date>+        </if>+        <else>+          <text term="no date" form="short"/>+        </else>+      </choose>+    </group>+  </macro>+  <macro name="access-date">+    <group delimiter=", ">+      <date variable="accessed">+        <date-part name="month" prefix="accessed: " suffix=", " form="short"/>+        <date-part name="year"/>+      </date>+    </group>+  </macro>+  <macro name="access">+    <choose>+      <if variable="page" match="none">+        <choose>+          <if variable="DOI">+            <text variable="DOI" prefix="DOI: "/>+          </if>+        </choose>+        <choose>+          <if type="webpage">+            <text variable="URL"/>+          </if>+        </choose>+      </if>+    </choose>+  </macro>+  <macro name="publisher">+    <group delimiter=", ">+      <text variable="publisher" text-case="capitalize-all"/>+      <text variable="publisher-place" text-case="title"/>+    </group>+  </macro>+  <macro name="pages">+    <label variable="page" form="short" suffix=" "/>+    <text variable="page"/>+  </macro>+  <citation collapse="citation-number">+    <sort>+      <key variable="citation-number"/>+    </sort>+    <layout prefix="[" suffix="]" delimiter="," vertical-align="sup">+      <text variable="citation-number"/>+    </layout>+  </citation>+  <bibliography entry-spacing="0" second-field-align="flush" line-spacing="2">+    <layout suffix=".">+      <text variable="citation-number" prefix="[" suffix="]"/>+      <text macro="author" suffix=", "/>+      <choose>+        <if type="bill book graphic legal_case legislation motion_picture report song" match="any">+          <group delimiter=", ">+            <text variable="title" text-case="title" font-style="italic"/>+            <text macro="publisher"/>+            <text macro="year-date"/>+          </group>+        </if>+        <else-if type="chapter paper-conference" match="any">+          <group delimiter=", ">+            <group delimiter=" ">+              <text term="in"/>+              <text variable="container-title" form="short" text-case="title" font-style="italic"/>+              <text macro="editor" prefix="(" suffix=")"/>+            </group>+            <text macro="publisher"/>+            <text macro="year-date"/>+            <group delimiter=" ">+              <text macro="pages"/>+            </group>+          </group>+        </else-if>+        <else-if type="patent">+          <group delimiter=", ">+            <text variable="number" font-style="italic"/>+            <text macro="year-date"/>+          </group>+        </else-if>+        <else-if type="thesis">+          <group delimiter=", ">+            <text variable="title" text-case="title"/>+            <text variable="genre"/>+            <text variable="publisher"/>+            <text macro="year-date"/>+          </group>+        </else-if>+        <else-if type="webpage">+          <group delimiter=", ">+            <text variable="title"/>+            <text macro="access"/>+            <text macro="access-date"/>+          </group>+        </else-if>+        <else>+          <group delimiter=" ">+            <text variable="container-title" form="short" font-style="italic"/>+            <group delimiter=", ">+              <text macro="year-date"/>+              <group>+                <text variable="volume" font-style="italic"/>+              </group>+              <text variable="page-first"/>+            </group>+          </group>+          <text macro="access" prefix=", "/>+        </else>+      </choose>+    </layout>+  </bibliography>+</style>
+ tests/issue386.expected.native view
@@ -0,0 +1,5 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/advanced-optical-materials.csl"]),("references",MetaList [MetaMap (fromList [("DOI",MetaInlines [Str "10.1038/lsa.2012.20"]),("ISSN",MetaInlines [Str "2047-7538"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Ding"]),("given",MetaInlines [Str "K."])]),MetaMap (fromList [("family",MetaInlines [Str "Ning"]),("given",MetaInlines [Str "C.",Space,Str "Z."])])]),("container-title",MetaInlines [Str "Light",Space,Str "Sci.",Space,Str "Appl."]),("id",MetaInlines [Str "ding_metallic_2012"]),("issue",MetaInlines [Str "7"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "7"]),("year",MetaInlines [Str "2012"])])]),("page",MetaInlines [Str "e20-e20"]),("title",MetaInlines [Str "Metallic",Space,Str "subwavelength-cavity",Space,Str "semiconductor",Space,Str "nanolasers"]),("type",MetaInlines [Str "article-journal"]),("volume",MetaInlines [Str "1"])])])]})+[Para [Cite [Citation {citationId = "ding_metallic_2012", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 1}] [Str "[1]"]]+,Div ("refs",["references"],[])+ [Div ("ref-ding_metallic_2012",[],[])+  [Para [Str "[1]",Space,Str "K.",Space,Str "Ding,",Space,Str "C.",Space,Str "Z.",Space,Str "Ning,",Space,Emph [Str "Light",Space,Str "Sci.",Space,Str "Appl."],Space,Strong [Str "2012"],Str ",",Space,Emph [Str "1"],Str ",",Space,Str "e20."]]]]
+ tests/issue386.in.native view
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/advanced-optical-materials.csl"]),("references",MetaList [MetaMap (fromList [("DOI",MetaInlines [Str "10.1038/lsa.2012.20"]),("ISSN",MetaInlines [Str "2047-7538"]),("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Ding"]),("given",MetaInlines [Str "K."])]),MetaMap (fromList [("family",MetaInlines [Str "Ning"]),("given",MetaInlines [Str "C.",Space,Str "Z."])])]),("container-title",MetaInlines [Str "Light",Space,Str "Sci.",Space,Str "Appl."]),("id",MetaInlines [Str "ding_metallic_2012"]),("issue",MetaInlines [Str "7"]),("issued",MetaList [MetaMap (fromList [("month",MetaInlines [Str "7"]),("year",MetaInlines [Str "2012"])])]),("page",MetaInlines [Str "e20-e20"]),("title",MetaInlines [Str "Metallic",Space,Str "subwavelength-cavity",Space,Str "semiconductor",Space,Str "nanolasers"]),("type",MetaInlines [Str "article-journal"]),("volume",MetaInlines [Str "1"])])])]})+[Para [Cite [Citation {citationId = "ding_metallic_2012", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@ding_metallic_2012"]]]