packages feed

pandoc-citeproc 0.10.4.1 → 0.10.5

raw patch · 37 files changed

+1139/−177 lines, 37 filesdep +file-embedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: file-embed

API changes (from Hackage documentation)

+ Text.CSL.Data: getLicense :: IO ByteString
+ Text.CSL.Data: getManPage :: IO ByteString
+ Text.CSL.Eval.Output: formatString :: String -> Formatted
+ Text.CSL.Eval.Output: pAffix :: Parsec String () [Inline]
+ Text.CSL.Eval.Output: pRaw :: Parsec String () Inline
+ Text.CSL.Eval.Output: pSpace :: Parsec String () Inline
+ Text.CSL.Eval.Output: pString :: Parsec String () Inline
+ Text.CSL.Input.Bibtex: Lang :: String -> String -> Lang
+ Text.CSL.Input.Bibtex: data Lang
+ Text.CSL.Input.Bibtex: getLangFromEnv :: IO Lang
+ Text.CSL.Input.Bibtex: langToLocale :: Lang -> String
+ Text.CSL.Reference: CLabel :: String -> CLabel
+ Text.CSL.Reference: [unCLabel] :: CLabel -> String
+ Text.CSL.Reference: instance Data.Aeson.Types.FromJSON.FromJSON Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance Data.Aeson.Types.ToJSON.ToJSON Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance Data.Data.Data Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance Data.Yaml.Builder.ToYaml Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance GHC.Base.Monoid Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance GHC.Classes.Eq Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance GHC.Generics.Generic Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance GHC.Read.Read Text.CSL.Reference.CLabel
+ Text.CSL.Reference: instance GHC.Show.Show Text.CSL.Reference.CLabel
+ Text.CSL.Reference: newtype CLabel
+ Text.CSL.Style: OCitLabel :: String -> Formatting -> Output
- Text.CSL: Reference :: Literal -> RefType -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> [Literal] -> Literal -> CNum -> Int -> Literal -> Reference
+ Text.CSL: Reference :: Literal -> RefType -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> [Literal] -> Literal -> CNum -> Int -> CLabel -> Reference
- Text.CSL: [citationLabel] :: Reference -> Literal
+ Text.CSL: [citationLabel] :: Reference -> CLabel
- Text.CSL.Reference: Reference :: Literal -> RefType -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> [Literal] -> Literal -> CNum -> Int -> Literal -> Reference
+ Text.CSL.Reference: Reference :: Literal -> RefType -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [Agent] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> [RefDate] -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Formatted -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> Literal -> [Literal] -> Literal -> CNum -> Int -> CLabel -> Reference
- Text.CSL.Reference: [citationLabel] :: Reference -> Literal
+ Text.CSL.Reference: [citationLabel] :: Reference -> CLabel

Files

LICENSE view
@@ -1,5 +1,5 @@ Copyright (c) 2008-2013, Andrea Rossato-Copyright (c) 2013-2015, John MacFarlane+Copyright (c) 2013-2017, John MacFarlane All rights reserved.  Redistribution and use in source and binary forms, with or without modification,
changelog view
@@ -1,3 +1,67 @@+pandoc-citeproc (0.10.5)++  * Use file-embed instead of hsb2hs for embed_data_files flag (#285).+  * Allow `&` in bibtex keys (#289).  They are discouraged because of+    problems in tables, but technically they are allowed.+  * Allow + in bibtex field name (#290).  BibLaTeX now allows things like+    `author+an` for annotations.  See "Data Annotations" in the bibtex manual.+    Note that we don't actually parse the annotations, we just don't+    crash on bibtex files that include them.+  * caseTransform:  fix corner case where last word has internal periods+    (#288).  E.g. in `www.example.com`, previously `com` was capitalized+    as the last word.+  * If there's a list of csl, locale, or abbrev files, use the last one.+  * Don't catch exceptions in reading CSL file.  Previously some exceptions+    were silently caught, leading to unexpected use of the default.+  * Util.findFile:  return right away if absolute path.+  * Added mechanism for inserting raw content into delimiters, prefixes, suffixes.+    So, for example, in your CSL file you can have++        prefix="{{html}}&lt;i&gt;{{/html}}"++    and this will turn into++        RawInline (Format "html") "<i>"++    rather than, as before++        Str "<i>",++    which would get escaped in the output.+    See jgm/pandoc#3536 for the motivation.+  * Text.CSL.Pandoc: Simplified code for looking up default CSL.+  * Fix titlecase bug involving em/en dashes (#284).+  * Export license from Text.CSL.Data.Embedded.+  * Added `--license` to CLI and `getLicense` to Text.CSL.Data (API change).+  * Updated chicago-author-date.csl and locales xml.+  * Add `getManPage` to Text.CSL.Data and `--man` option to CLI (API change).+    `pandoc-citeproc --man` now simply spits out the man page in+    groff format.  For a plain text version, use+    `pandoc-citeproc --man | groff -mman -Tutf8`.  For an HTML version,+    `pandoc-citeproc --man | groff -mman -Thtml`.+  * Updates to be able to compile and test with current pandoc HEAD.+  * Automatically link ISBN references to Worldcat (#279).+    This is similar to existing support for DOIs.  Thanks to Eric Marsden.+  * Text.CSL.Input.Bibtex: export `Lang`, `langToLocale`, `getLangFromEnv`+    (#281, API change).+  * Adjusted treatment of `\hyphen` now that pandoc includes trailing space...+    in RawInline.  See jgm/pandoc#1773 and commit+    f4a452f89174828fea77614a4b6a067fc4675ba5.+  * Support citation-label variable (#160, Lukas Atkinson).+    The `citation-label` was not rendered, even when this label was+    explicitly set in the bibliography. This is now fixed. Citation labels+    are modelled after citation numbers. In particular, citation labels can+    also be hyperlinked.  API changes:++    In `Text.CSL,Reference`: The exported type `CLabel` describes a label+    name in the CSL variables. This allows us to distinguish labels from+    ordinary strings. This type is analogous to `CNum`.++    In `Text.CSL.Style`: In `Output` the `OCitLabel` case describes a label+    in the rendered output. This case is analogous to `OCitNum`.+  * Allow aeson 1.2.+  * Fixed overlapping instance problem in test-citeproc w/ recent aeson.+ pandoc-citeproc (0.10.4.1)    * Raise version bounds for xml-conduit.
chicago-author-date.csl view
@@ -1,5 +1,5 @@ <?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" page-range-format="chicago">+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="display-and-sort" page-range-format="chicago">   <info>     <title>Chicago Manual of Style 16th edition (author-date)</title>     <id>http://www.zotero.org/styles/chicago-author-date</id>
locales/locales-ca-AD.xml view
@@ -16,7 +16,7 @@     <date-part name="year"/>   </date>   <terms>-    <term name="accessed">accedit</term>+    <term name="accessed">consulta</term>     <term name="and">i</term>     <term name="and others">i altres</term>     <term name="anonymous">anònim</term>
locales/locales-de-AT.xml view
@@ -58,8 +58,8 @@     <term name="version">Version</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">n.&#160;Chr.</term>-    <term name="bc">v.&#160;Chr.</term>+    <term name="ad">&#160;n.&#160;Chr.</term>+    <term name="bc">&#160;v.&#160;Chr.</term>      <!-- PUNCTUATION -->     <term name="open-quote">„</term>
locales/locales-de-CH.xml view
@@ -58,8 +58,8 @@     <term name="version">Version</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">n.&#160;Chr.</term>-    <term name="bc">v.&#160;Chr.</term>+    <term name="ad">&#160;n.&#160;Chr.</term>+    <term name="bc">&#160;v.&#160;Chr.</term>      <!-- PUNCTUATION -->     <term name="open-quote">«</term>
locales/locales-de-DE.xml view
@@ -58,8 +58,8 @@     <term name="version">Version</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">n.&#160;Chr.</term>-    <term name="bc">v.&#160;Chr.</term>+    <term name="ad">&#160;n.&#160;Chr.</term>+    <term name="bc">&#160;v.&#160;Chr.</term>      <!-- PUNCTUATION -->     <term name="open-quote">„</term>
locales/locales-fa-IR.xml view
@@ -6,13 +6,13 @@   </info>   <style-options punctuation-in-quote="true"/>   <date form="text">+    <date-part name="day" suffix=" "/>     <date-part name="month" suffix=" "/>-    <date-part name="day" form="numeric-leading-zeros" suffix=", "/>     <date-part name="year"/>   </date>   <date form="numeric">-    <date-part name="month" form="numeric-leading-zeros" suffix="/"/>     <date-part name="day" form="numeric-leading-zeros" suffix="/"/>+    <date-part name="month" form="numeric-leading-zeros" suffix="/"/>     <date-part name="year"/>   </date>   <terms>@@ -22,18 +22,18 @@     <term name="anonymous">ناشناس</term>     <term name="anonymous" form="short">ناشناس</term>     <term name="at">در</term>-    <term name="available at">available at</term>+    <term name="available at">قابل دسترس در</term>     <term name="by">توسط</term>-    <term name="circa">circa</term>+    <term name="circa">تقریباً</term>     <term name="circa" form="short">c.</term>-    <term name="cited">یادکرد</term>+    <term name="cited">ارجاع شده</term>     <term name="edition">       <single>ویرایش</single>       <multiple>ویرایش‌های</multiple>     </term>     <term name="edition" form="short">ویرایش</term>-    <term name="et-al">و دیگران</term>-    <term name="forthcoming">forthcoming</term>+    <term name="et-al">و همکاران</term>+    <term name="forthcoming">در دست انتشار</term>     <term name="from">از</term>     <term name="ibid">همان</term>     <term name="in">در</term>@@ -43,7 +43,7 @@     <term name="letter">نامه</term>     <term name="no date">بدون تاریخ</term>     <term name="no date" form="short">بدون تاریخ</term>-    <term name="online">برخط</term>+    <term name="online">آنلاین</term>     <term name="presented at">ارائه شده در</term>     <term name="reference">       <single>مرجع</single>@@ -55,11 +55,11 @@     </term>     <term name="retrieved">retrieved</term>     <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="version">نسخه</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">AD</term>-    <term name="bc">BC</term>+    <term name="ad">بعد از میلاد</term>+    <term name="bc">قبل از میلاد</term>      <!-- PUNCTUATION -->     <term name="open-quote">“</term>@@ -141,8 +141,8 @@       <multiple>قسمت‌های</multiple>     </term>     <term name="sub verbo">-      <single>sub verbo</single>-      <multiple>sub verbis</multiple>+      <single>در ذیلِ واژه</single>+      <multiple>در ذیلِ واژه‌های</multiple>     </term>     <term name="verse">       <single>بیت</single>@@ -160,8 +160,8 @@     <term name="figure" form="short">تصویر</term>     <term name="folio" form="short">برگ</term>     <term name="issue" form="short">ش</term>-    <term name="line" form="short">l.</term>-    <term name="note" form="short">n.</term>+    <term name="line" form="short">خط</term>+    <term name="note" form="short">یادداشت</term>     <term name="opus" form="short">قطعه</term>     <term name="page" form="short">       <single>ص</single>@@ -203,24 +203,24 @@       <multiple>directors</multiple>     </term>     <term name="editor">-      <single>ویرایشگر</single>-      <multiple>ویرایشگران</multiple>+      <single>ویراستار</single>+      <multiple>ویراستاران</multiple>     </term>     <term name="editorial-director">-      <single>ویرایشگر</single>-      <multiple>ویرایشگران</multiple>+      <single>ویراستار</single>+      <multiple>ویراستاران</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>طراح گرافیک</single>+      <multiple>طراحان گرافیک</multiple>     </term>     <term name="translator">       <single>مترجم</single>       <multiple>مترجمین</multiple>     </term>     <term name="editortranslator">-      <single>ویرایشگر و مترجم</single>-      <multiple>ویرایشگران و مترجمین</multiple>+      <single>ویراستار و مترجم</single>+      <multiple>ویراستاران و مترجمین</multiple>     </term>      <!-- SHORT ROLE FORMS -->@@ -229,35 +229,35 @@       <multiple>dirs.</multiple>     </term>     <term name="editor" form="short">-      <single>ویرایشگر</single>-      <multiple>ویرایشگران</multiple>+      <single>ویراستار</single>+      <multiple>ویراستاران</multiple>     </term>     <term name="editorial-director" form="short">-      <single>ویرایشگر</single>-      <multiple>ویرایشگران</multiple>+      <single>ویراستار</single>+      <multiple>ویراستاران</multiple>     </term>     <term name="illustrator" form="short">-      <single>ill.</single>-      <multiple>ills.</multiple>+      <single>تصویرگر</single>+      <multiple>تصویرگران</multiple>     </term>     <term name="translator" form="short">       <single>مترجم</single>       <multiple>مترجمین</multiple>     </term>     <term name="editortranslator" form="short">-      <single>ویرایشگر و مترجم</single>-      <multiple>ویرایشگران و مترجمین</multiple>+      <single>ویراستار و مترجم</single>+      <multiple>ویراستاران و مترجمین</multiple>     </term>      <!-- VERB ROLE FORMS -->     <term name="container-author" form="verb">توسط</term>-    <term name="director" form="verb">directed by</term>-    <term name="editor" form="verb">edited by</term>+    <term name="director" form="verb">زیر نظر</term>+    <term name="editor" form="verb">ویراسته‌ی</term>     <term name="editorial-director" form="verb">ویراسته‌ی</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">طراحی گرافیکی از</term>     <term name="interviewer" form="verb">مصاحبه توسط</term>     <term name="recipient" form="verb">به</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="reviewed-author" form="verb">بازبینی توسط</term>     <term name="translator" form="verb">ترجمه‌ی</term>     <term name="editortranslator" form="verb">ترجمه و ویراسته‌ی</term> @@ -265,7 +265,7 @@     <term name="director" form="verb-short">dir.</term>     <term name="editor" form="verb-short">ویراسته‌ی</term>     <term name="editorial-director" form="verb-short">ویراسته‌ی</term>-    <term name="illustrator" form="verb-short">illus.</term>+    <term name="illustrator" form="verb-short">طراحی از</term>     <term name="translator" form="verb-short">ترجمه‌ی</term>     <term name="editortranslator" form="verb-short">ترجمه و ویراسته‌ی</term> 
locales/locales-lt-LT.xml view
@@ -5,18 +5,16 @@       <name>Valdemaras Klumbys</name>     </translator>     <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>-    <updated>2012-07-04T23:31:02+00:00</updated>+    <updated>2017-01-18T10:31:02+00:00</updated>   </info>   <style-options punctuation-in-quote="false"/>   <date form="text" delimiter=" ">-     <!-- "2011 m. lapkričio 1 d." -->     <date-part name="year" suffix=" m."/>     <date-part name="month"/>     <date-part name="day" form="numeric" suffix=" d."/>   </date>   <date form="numeric" delimiter="-">-     <!-- "2011-11-01" -->     <date-part name="year"/>     <date-part name="month" form="numeric-leading-zeros"/>@@ -29,22 +27,22 @@     <term name="anonymous">anonimas</term>     <term name="anonymous" form="short">anon.</term>     <term name="at"></term>-    <term name="available at">available at</term>+    <term name="available at">adresas</term>     <term name="by"></term>-    <term name="circa">circa</term>-    <term name="circa" form="short">ca.</term>-    <term name="cited">cituojama pagal</term>-    <term name="edition">+    <term name="circa">apie</term>+    <term name="circa" form="short">apie</term>+    <term name="cited">žiūrėta</term>+    <term name="edition" gender="masculine">       <single>leidimas</single>       <multiple>leidimai</multiple>     </term>     <term name="edition" form="short">leid.</term>-    <term name="et-al">et al.</term>+    <term name="et-al">ir kt.</term>     <term name="forthcoming">ruošiamas</term>     <term name="from"></term>-    <term name="ibid">ibid.</term>+    <term name="ibid">ten pat</term>     <term name="in"></term>-    <term name="in press">spaudoje</term>+    <term name="in press">priimta spaudai</term>     <term name="internet">prieiga per internetą</term>     <term name="interview">interviu</term>     <term name="letter">laiškas</term>@@ -61,8 +59,8 @@       <multiple>nuor.</multiple>     </term>     <term name="retrieved">gauta</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">mastelis</term>+    <term name="version">versija</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->     <term name="ad">po Kr.</term>@@ -77,6 +75,12 @@      <!-- ORDINALS -->     <term name="ordinal">-asis</term>+    <term name="ordinal" gender-form="masculine">-asis</term>+    <term name="ordinal" gender-form="feminine">-oji</term>+    <term name="ordinal-03" gender-form="masculine">-iasis</term>+    <term name="ordinal-13" gender-form="masculine">-asis</term>+    <term name="ordinal-03" gender-form="feminine">-ioji</term>+    <term name="ordinal-13" gender-form="feminine">-oji</term>      <!-- LONG ORDINALS -->     <term name="long-ordinal-01">pirmasis</term>@@ -90,6 +94,17 @@     <term name="long-ordinal-09">devintasis</term>     <term name="long-ordinal-10">dešimtasis</term> +    <term name="long-ordinal-01" gender-form="feminine">pirmoji</term>+    <term name="long-ordinal-02" gender-form="feminine">antroji</term>+    <term name="long-ordinal-03" gender-form="feminine">trečioji</term>+    <term name="long-ordinal-04" gender-form="feminine">ketvirtoji</term>+    <term name="long-ordinal-05" gender-form="feminine">penktoji</term>+    <term name="long-ordinal-06" gender-form="feminine">šeštoji</term>+    <term name="long-ordinal-07" gender-form="feminine">septintoji</term>+    <term name="long-ordinal-08" gender-form="feminine">aštuntoji</term>+    <term name="long-ordinal-09" gender-form="feminine">devintoji</term>+    <term name="long-ordinal-10" gender-form="feminine">dešimtoji</term>+         <!-- LONG LOCATOR FORMS -->     <term name="book">       <single>knyga</single>@@ -111,7 +126,7 @@       <single>lapas</single>       <multiple>lapai</multiple>     </term>-    <term name="issue">+    <term name="issue" gender="masculine">       <single>numeris</single>       <multiple>numeriai</multiple>     </term>@@ -124,14 +139,14 @@       <multiple>pastabos</multiple>     </term>     <term name="opus">-      <single>opus</single>-      <multiple>opera</multiple>+      <single>kūrinys</single>+      <multiple>kūriniai</multiple>     </term>     <term name="page">       <single>puslapis</single>       <multiple>puslapiai</multiple>     </term>-    <term name="number-of-pages">+    <term name="number-of-pages" gender="masculine">       <single>puslapis</single>       <multiple>puslapiai</multiple>     </term>@@ -155,7 +170,7 @@       <single>eilėraštis</single>       <multiple>eilėraščiai</multiple>     </term>-    <term name="volume">+    <term name="volume" gender="masculine">       <single>tomas</single>       <multiple>tomai</multiple>     </term>@@ -167,9 +182,9 @@     <term name="figure" form="short">il.</term>     <term name="folio" form="short">l.</term>     <term name="issue" form="short">nr.</term>-    <term name="line" form="short">l.</term>-    <term name="note" form="short">n.</term>-    <term name="opus" form="short">op.</term>+    <term name="line" form="short">eil.</term>+    <term name="note" form="short">pstb.</term>+    <term name="opus" form="short">kūr.</term>     <term name="page" form="short">       <single>p.</single>       <multiple>p.</multiple>@@ -206,8 +221,8 @@      <!-- LONG ROLE FORMS -->     <term name="director">-      <single>director</single>-      <multiple>directors</multiple>+      <single>vadovas</single>+      <multiple>vadovai</multiple>     </term>     <term name="editor">       <single>sudarytojas</single>@@ -218,8 +233,8 @@       <multiple>atsakingieji redaktoriai</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>iliustratorius</single>+      <multiple>iliustratoriai</multiple>     </term>     <term name="translator">       <single>vertėjas</single>@@ -232,8 +247,8 @@      <!-- SHORT ROLE FORMS -->     <term name="director" form="short">-      <single>dir.</single>-      <multiple>dirs.</multiple>+      <single>vad.</single>+      <multiple>vad.</multiple>     </term>     <term name="editor" form="short">       <single>sud.</single>@@ -244,8 +259,8 @@       <multiple>ats. red.</multiple>     </term>     <term name="illustrator" form="short">-      <single>ill.</single>-      <multiple>ills.</multiple>+      <single>iliustr.</single>+      <multiple>iliustr.</multiple>     </term>     <term name="translator" form="short">       <single>vert.</single>@@ -258,21 +273,21 @@      <!-- VERB ROLE FORMS -->     <term name="container-author" form="verb"></term>-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">vadovavo</term>     <term name="editor" form="verb">sudarė</term>     <term name="editorial-director" form="verb">parengė</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">iliustravo</term>     <term name="interviewer" form="verb">interviu ėmė</term>     <term name="recipient" form="verb">gavo</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="reviewed-author" form="verb">recenzavo</term>     <term name="translator" form="verb">vertė</term>     <term name="editortranslator" form="verb">sudarė ir vertė</term>      <!-- SHORT VERB ROLE FORMS -->-    <term name="director" form="verb-short">dir.</term>+    <term name="director" form="verb-short">vad.</term>     <term name="editor" form="verb-short">sud.</term>     <term name="editorial-director" form="verb-short">pareng.</term>-    <term name="illustrator" form="verb-short">illus.</term>+    <term name="illustrator" form="verb-short">iliustr.</term>     <term name="translator" form="verb-short">vert.</term>     <term name="editortranslator" form="verb-short">sud. ir vert.</term> 
man/man1/pandoc-citeproc.1 view
@@ -1,14 +1,14 @@ .\"t-.\" Automatically generated by Pandoc 1.17.3+.\" Automatically generated by Pandoc 2.0 .\"-.TH "pandoc\-citeproc" "1" "2016-10-13" "pandoc-citeproc 0.10.1.2" ""+.TH "pandoc\-citeproc" "1" "2017-06-04" "pandoc-citeproc 0.10.5" "" .hy .SH NAME .PP pandoc\-citeproc \- filter to resolve citations in a pandoc document. .SH SYNOPSIS .PP-pandoc\-citeproc [options] [file..]+pandoc\-citeproc options (#options) [file..] .SH DESCRIPTION .PP The \f[C]pandoc\-citeproc\f[] executable has two modes, filter mode and@@ -26,8 +26,8 @@ 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[] (5) man page under "Citations" for-details on how to encode citations in pandoc\[aq]s markdown.)+(See the \f[C]pandoc_markdown\f[] (5) man page under \[lq]Citations\[rq]+for details on how to encode citations in pandoc's markdown.) .PP To process citations with pandoc, call pandoc\-citeproc as a filter: .IP@@ -250,18 +250,26 @@ generally guess this from the extension. .PP This mode supersedes the old \f[C]biblio2yaml\f[] program.+.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:+.IP+.nf+\f[C]+{{jats}}&lt;ref&gt;{{/jats}}+\f[]+.fi+.PP+Without the tags, the string will be interpreted as a string and escaped+in the output, rather than being passed through raw.+.PP+This feature allows stylesheets to be customized to give different+output for different output formats.+However, stylesheets customized in this way will not be useable by other+CSL implementations. .SH OPTIONS .TP-.B \f[C]\-h,\ \-\-help\f[]-Print usage information.-.RS-.RE-.TP-.B \f[C]\-V,\ \-\-version\f[]-Print version.-.RS-.RE-.TP .B \f[C]\-y,\ \-\-bib2yaml\f[] Convert bibliography to YAML suitable for inclusion in pandoc metadata. .RS@@ -279,15 +287,39 @@ \f[C]copac\f[], \f[C]mods\f[], and \f[C]json\f[]. .RS .RE+.TP+.B \f[C]\-h,\ \-\-help\f[]+Print usage information.+.RS+.RE+.TP+.B \f[C]\-\-man\f[]+Print the man page in groff man format.+To get a plain text version,+\f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Tutf8\f[].+To \f[C]pandoc\-citeproc\ \-\-man\ |\ groff\ \-mman\ \-Thtml\f[].+.RS+.RE+.TP+.B \f[C]\-\-license\f[]+Print the license.+.RS+.RE+.TP+.B \f[C]\-V,\ \-\-version\f[]+Print version.+.RS+.RE .SH NOTES .SS General .PP If you use a biblatex database, closely follow the specifications in the-"Database Guide" section of the biblatex manual (currently 2.8a).+\[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-section in your markdown document, follow the "Citation Style Language-1.0.1 Language Specification"+section in your markdown document, follow the \[lq]Citation Style+Language 1.0.1 Language Specification\[rq] (<http://citationstyles.org/downloads/specification.html>). Particularly relevant are <http://citationstyles.org/downloads/specification.html#appendix-iii-types>@@ -295,7 +327,7 @@ fields) and <http://citationstyles.org/downloads/specification.html#appendix-iv-variables> (which does contain comments).-.SS Titles: Title vs. Sentence Case+.SS Titles: Title vs.\ Sentence Case .PP If you are using a bibtex or biblatex bibliography, then observe the following rules:@@ -309,8 +341,8 @@ \f[C]UKenglish\f[].) .IP \[bu] 2 As is standard with bibtex/biblatex, proper names should be protected-with curly braces so that they won\[aq]t be lowercased in styles that-call for sentence case.+with curly braces so that they won't be lowercased in styles that call+for sentence case. For example: .RS 2 .IP@@ -334,8 +366,8 @@ Though this is not necessary in bibtex/biblatex, it is necessary with citeproc, which stores titles internally in sentence case, and converts to title case in styles that require it.-Here we protect "nm" so that it doesn\[aq]t get converted to "Nm" at-this stage.+Here we protect \[lq]nm\[rq] so that it doesn't get converted to+\[lq]Nm\[rq] at this stage. .RE .PP If you are using a CSL bibliography (either JSON or YAML), then observe@@ -358,7 +390,7 @@ \f[] .fi .RE-.SS Conference Papers, Published vs. Unpublished+.SS Conference Papers, Published vs.\ Unpublished .PP For a formally published conference paper, use the biblatex entry type \f[C]inproceedings\f[] (which will be mapped to CSL@@ -373,12 +405,12 @@ \f[C]eventtitle\f[] field (this entry type will be mapped to CSL \f[C]speech\f[]). Use the biblatex \f[C]type\f[] field to indicate the type, e.g.-"Paper", or "Poster".+\[lq]Paper\[rq], or \[lq]Poster\[rq]. \f[C]venue\f[] and \f[C]eventdate\f[] may be useful too, though \f[C]eventdate\f[] will not be rendered by most CSL styles.-Note that \f[C]venue\f[] is for the event\[aq]s venue, unlike-\f[C]location\f[] which describes the publisher\[aq]s location; do not-use the latter for an unpublished conference paper.+Note that \f[C]venue\f[] is for the event's venue, unlike+\f[C]location\f[] which describes the publisher's location; do not use+the latter for an unpublished conference paper. .SH AUTHORS .PP Andrea Rossato and John MacFarlane.
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name:               pandoc-citeproc-version:            0.10.4.1+version:            0.10.5 cabal-version:      >= 1.12 synopsis:           Supports using pandoc with citeproc @@ -34,6 +34,7 @@                     locales/*.xml                     -- documentation                     README.md+                    LICENSE                     man/man1/pandoc-citeproc.1                     changelog extra-source-files: stack.yaml@@ -44,6 +45,7 @@                     tests/biblio.bib                     tests/biblio2yaml/*.bibtex                     tests/biblio2yaml/*.biblatex+                    tests/biblio2yaml/pandoc-2/*.biblatex  source-repository head   type:          git@@ -100,7 +102,7 @@                       pandoc-types >= 1.16 && < 1.18,                       pandoc >= 1.16 && < 2.1,                       tagsoup,-                      aeson >= 0.7 && < 1.2,+                      aeson >= 0.7 && < 1.3,                       text,                       vector,                       xml-conduit >= 1.2 && < 1.6,@@ -123,7 +125,7 @@        cpp-options:     -DUSE_BIBUTILS      if flag(embed_data_files)-       Build-Tools:   hsb2hs >= 0.3.1+       build-depends: file-embed >= 0.0 && < 0.1        cpp-options:   -DEMBED_DATA_FILES        other-modules: Text.CSL.Data.Embedded        if os(darwin)
pandoc-citeproc.hs view
@@ -22,6 +22,7 @@ import Data.Version (showVersion) import Paths_pandoc_citeproc (version) import Text.CSL.Pandoc (processCites')+import Text.CSL.Data (getManPage, getLicense) import Text.Pandoc.JSON hiding (Format) import Text.Pandoc.Walk import qualified Text.Pandoc.UTF8 as UTF8@@ -40,6 +41,12 @@   when (Help `elem` flags) $ do     UTF8.putStrLn $ usageInfo header options     exitWith ExitSuccess+  when (Man `elem` flags) $ do+    getManPage >>= BL.putStr+    exitWith ExitSuccess+  when (License `elem` flags) $ do+    getLicense >>= BL.putStr+    exitWith ExitSuccess   if Bib2YAML `elem` flags || Bib2JSON `elem` flags      then do        let mbformat = case [f | Format f <- flags] of@@ -107,12 +114,21 @@ findWarnings _ = []  data Option =-    Help | Version | Convert | Format String | Bib2YAML | Bib2JSON+      Help+    | Man+    | License+    | Version+    | Convert+    | Format String+    | Bib2YAML+    | Bib2JSON   deriving (Ord, Eq, Show)  options :: [OptDescr Option] options =   [ Option ['h'] ["help"] (NoArg Help) "show usage information"+  , Option [] ["man"] (NoArg Man) "print man page to stdout"+  , Option [] ["license"] (NoArg License) "print license to stdout"   , Option ['V'] ["version"] (NoArg Version) "show program version"   , Option ['y'] ["bib2yaml"] (NoArg Bib2YAML) "convert bibliography to YAML"   , Option ['j'] ["bib2json"] (NoArg Bib2JSON) "convert bibliography to JSON"
src/Text/CSL/Data.hs view
@@ -16,6 +16,8 @@     ( getLocale     , CSLLocaleException(..)     , getDefaultCSL+    , getManPage+    , getLicense     , langBase     ) where @@ -25,7 +27,7 @@ import qualified Control.Exception as E #ifdef EMBED_DATA_FILES import Data.Maybe (fromMaybe)-import Text.CSL.Data.Embedded (localeFiles, defaultCSL)+import Text.CSL.Data.Embedded (localeFiles, defaultCSL, manpage, license) #else import Paths_pandoc_citeproc (getDataFileName) import System.Directory  (doesFileExist)@@ -79,6 +81,22 @@   return $ L.fromChunks [defaultCSL] #else   getDataFileName "chicago-author-date.csl" >>= L.readFile+#endif++getManPage :: IO L.ByteString+getManPage =+#ifdef EMBED_DATA_FILES+  return $ L.fromChunks [manpage]+#else+  getDataFileName "man/man1/pandoc-citeproc.1" >>= L.readFile+#endif++getLicense :: IO L.ByteString+getLicense =+#ifdef EMBED_DATA_FILES+  return $ L.fromChunks [license]+#else+  getDataFileName "LICENSE" >>= L.readFile #endif  langBase :: [(String, String)]
+ src/Text/CSL/Data/Embedded.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE TemplateHaskell #-}++-- to be processed using hsb2hs+module Text.CSL.Data.Embedded (localeFiles, defaultCSL, manpage, license) where+import Data.FileEmbed+import qualified Data.ByteString.Char8 as S++localeFiles :: [(FilePath, S.ByteString)]+localeFiles = $(embedDir "locales")++defaultCSL :: S.ByteString+defaultCSL = $(embedFile "chicago-author-date.csl")++manpage :: S.ByteString+manpage = $(embedFile "man/man1/pandoc-citeproc.1")++license :: S.ByteString+license = $(embedFile "LICENSE")
− src/Text/CSL/Data/Embedded.hsb
@@ -1,10 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--- to be processed using hsb2hs-module Text.CSL.Data.Embedded (localeFiles, defaultCSL) where-import qualified Data.ByteString.Char8 as S--localeFiles :: [(FilePath, S.ByteString)]-localeFiles = %blobs "locales/"--defaultCSL :: S.ByteString-defaultCSL = %blob "chicago-author-date.csl"
src/Text/CSL/Eval.hs view
@@ -221,6 +221,10 @@                                       then return []                                       else return [Output [OPan [Link nullAttr [Str (T.unpack linkPart ++ d)] (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]                "pmid"        -> getStringVar "pmid" >>= \d ->                                 if null d                                    then return []@@ -291,6 +295,7 @@     | Just v <- fromValue val :: Maybe Int       = output  fm (if v == 0 then [] else show v)     | Just v <- fromValue val :: Maybe Int       = output  fm (if v == 0 then [] else show v)     | Just v <- fromValue val :: Maybe CNum      = if v == 0 then [] else [OCitNum (unCNum v) fm]+    | Just v <- fromValue val :: Maybe CLabel    = if v == mempty then [] else [OCitLabel (unCLabel v) fm]     | Just v <- fromValue val :: Maybe [RefDate] = formatDate (EvalSorting emptyCite) [] [] sortDate v     | Just v <- fromValue val :: Maybe [Agent]   = concatMap (formatName (EvalSorting emptyCite) True f                                                               fm nameOpts []) v
src/Text/CSL/Eval/Output.hs view
@@ -23,7 +23,33 @@ import Text.Pandoc.Walk (walk) import Data.String (fromString) import Data.Maybe (mapMaybe)+import Text.Parsec +-- Parse affix or delimiter into Formatted, splitting out+-- raw components in @{{format}}...{{/format}}@.+formatString :: String -> Formatted+formatString s =+  case parse pAffix s s of+       Left _    -> fromString s+       Right ils -> Formatted ils++pAffix :: Parsec String () [Inline]+pAffix = many (pRaw <|> pString <|> pSpace)++pRaw :: Parsec String () Inline+pRaw = try $ do+  string "{{"+  format <- many1 letter+  string "}}"+  contents <- manyTill anyChar (try (string ("{{/" ++ format ++ "}}")))+  return $ RawInline (Format format) contents++pString :: Parsec String () Inline+pString = Str <$> (many1 (noneOf " \t\n\r{}") <|> count 1 (oneOf "{}"))++pSpace :: Parsec String () Inline+pSpace = Space <$ many1 (oneOf " \t\n\r")+ output :: Formatting -> String -> [Output] output fm s     | ' ':xs <- s = OSpace : output fm xs@@ -104,9 +130,9 @@       OPan     i          -> Formatted i       ODel     []         -> Formatted []       ODel     " "        -> Formatted [Space]-      ODel     s          -> fromString s+      ODel     s          -> formatString s       OStr     []      _  -> Formatted []-      OStr     s       f  -> addFormatting f $ fromString s+      OStr     s       f  -> addFormatting f $ formatString s       OErr NoOutput       -> Formatted [Span ("",["citeproc-no-output"],[])                                      [Strong [Str "???"]]]       OErr (ReferenceNotFound r)@@ -114,14 +140,17 @@                                             [("data-reference-id",r)])                                      [Strong [Str "???"]]]       OLabel   []      _  -> Formatted []-      OLabel   s       f  -> formatOutput (OStr s f)+      OLabel   s       f  -> addFormatting f $ formatString s       ODate    os         -> formatOutputList os-      OYear    s _     f  -> formatOutput (OStr s f)-      OYearSuf s _ _   f  -> formatOutput (OStr s f)+      OYear    s _     f  -> addFormatting f $ formatString s+      OYearSuf s _ _   f  -> addFormatting f $ formatString s       ONum     i       f  -> formatOutput (OStr (show i) f)       OCitNum  i       f  -> if i == 0                                 then Formatted [Strong [Str "???"]]                                 else formatOutput (OStr (show i) f)+      OCitLabel s      f  -> if s == ""+                                then Formatted [Strong [Str "???"]]+                                else formatOutput (OStr s f)       OName  _ os _    f  -> formatOutput (Output os f)       OContrib _ _ os _ _ -> formatOutputList os       OLoc     os      f  -> formatOutput (Output os f)@@ -137,13 +166,13 @@                          url -> Formatted [Link nullAttr (unFormatted i) (url, "")]         pref i = case prefix f of                       "" -> i-                      x  -> fromString x <> i+                      x  -> formatString x <> i         addSuffix i           | null (suffix f)       = i           | case suffix f of {(c:_) | isPunct c -> True; _ -> False}           , case lastInline (unFormatted i) of {(c:_) | isPunct c -> True; _ -> False}-                                  = i <> fromString (tail $ suffix f)-          | otherwise             = i <> fromString (suffix f)+                                  = i <> formatString (tail $ suffix f)+          | otherwise             = i <> formatString (suffix f)          strip_periods (Formatted ils) = Formatted (walk removePeriod ils)         removePeriod (Str xs) | stripPeriods f = Str (filter (/='.') xs)
src/Text/CSL/Input/Bibtex.hs view
@@ -15,6 +15,9 @@     ( readBibtex     , readBibtexString     , readBibtexString'+    , Lang(..)+    , langToLocale+    , getLangFromEnv     )     where @@ -48,7 +51,7 @@ adjustSpans :: Lang -> Inline -> [Inline] adjustSpans _ (Span ("",[],[]) xs) = xs adjustSpans lang (RawInline (Format "latex") s)-  | s == "\\hyphen" = [Str "-"]+  | s == "\\hyphen" || s == "\\hyphen " = [Str "-"]   | otherwise = bottomUp (concatMap (adjustSpans lang)) $ parseRawLaTeX lang s adjustSpans _ x = [x] @@ -84,6 +87,7 @@                 , fields     :: [(String, String)]                 } +-- | Get 'Lang' from the environment variable LANG, defaulting to en-US. getLangFromEnv :: IO Lang getLangFromEnv = do   env <- getEnvironment@@ -94,17 +98,23 @@                                    _                  -> Lang "en" "US"                   Nothing -> Lang "en" "US" +-- | Parse a BibTeX or BibLaTeX file into a list of 'Reference's.+-- If the first parameter is true, the file will be treated as+-- BibTeX; otherwse as BibLaTeX.  If the second parameter is+-- true, an "untitlecase" transformation will be performed. readBibtex :: Bool -> Bool -> FilePath -> IO [Reference] readBibtex isBibtex caseTransform f =   UTF8.readFile f >>= readBibtexString isBibtex caseTransform +-- | Like 'readBibtex' but operates on a String rather than a file. readBibtexString :: Bool -> Bool -> String -> IO [Reference] readBibtexString isBibtex caseTransform contents = do   lang <- getLangFromEnv   locale <- parseLocale (langToLocale lang)   return $ readBibtexString' isBibtex caseTransform lang locale contents --- pure version of readBibtexString+-- | Pure version of readBibtexString (does not try to get the language+-- from the environment). readBibtexString' :: Bool -> Bool -> Lang -> Locale -> String -> [Reference] readBibtexString' isBibtex caseTransform lang locale bibstring =   let items = case runParser (bibEntries <* eof) [] "stdin" bibstring of@@ -172,10 +182,10 @@                       ) (char '"')  fieldName :: BibParser String-fieldName = (map toLower) <$> many1 (letter <|> digit <|> oneOf "-_:")+fieldName = (map toLower) <$> many1 (letter <|> digit <|> oneOf "-_:+")  isBibtexKeyChar :: Char -> Bool-isBibtexKeyChar c = isAlphaNum c || c `elem` ".:;?!`'()/*@_+=-[]*"+isBibtexKeyChar c = isAlphaNum c || c `elem` ".:;?!`'()/*@_+=-[]*&"  bibItem :: BibParser Item bibItem = do@@ -333,8 +343,10 @@        "indexsorttitle" -> []        _                -> [z] +-- | A representation of a language and localization. data Lang = Lang String String  -- e.g. "en" "US" +-- | Prints a 'Lang' in BCP 47 format. langToLocale :: Lang -> String langToLocale (Lang x y) = x ++ ('-':y) 
src/Text/CSL/Pandoc.hs view
@@ -29,11 +29,10 @@ import qualified Control.Exception as E import Control.Monad.State import System.FilePath-import System.Directory (doesFileExist, getAppUserDataDirectory)+import System.Directory (getAppUserDataDirectory) import Text.CSL.Util (findFile, splitStrWhen, tr', parseRomanNumeral, trim) import System.IO.Error (isDoesNotExistError) import Data.Maybe (fromMaybe)-import Text.XML (XMLException(..))  -- | Process a 'Pandoc' document by adding citations formatted -- according to a CSL style.  Add a bibliography (if one is called@@ -159,30 +158,15 @@                 >>= toPath   let mbLocale = (lookupMeta "lang" meta `mplus` lookupMeta "locale" meta)                    >>= toPath-  let getDefaultCSL' = case mbcsldir of-                            Just csldir -> do-                              let f = csldir </> "chicago-author-date.csl"-                              exists <- doesFileExist f-                              if exists-                                 then L.readFile f-                                 else getDefaultCSL-                            Nothing -> getDefaultCSL+  let tryReadCSLFile Nothing _  = mzero+      tryReadCSLFile (Just d) f = E.catch (readCSLFile mbLocale (d </> f))+                                     (\(_ :: E.SomeException) -> mzero)   csl <- case cslfile of-               Just f | not (null f) -> E.catch-                   (readCSLFile mbLocale f) $ \e ->-                        E.throwIO (InvalidXMLFile f e)-               _ -> do-                 -- get default CSL: look first in ~/.csl, and take-                 -- from distribution if not found-                 raw <- case mbpandocdir of-                          Just pandocdir -> do-                            let f = pandocdir </> "default.csl"-                            exists <- doesFileExist f-                            if exists-                               then L.readFile f-                               else getDefaultCSL'-                          Nothing -> getDefaultCSL'-                 localizeCSL mbLocale $ parseCSL' raw+               Just f | not (null f) -> readCSLFile mbLocale f+               _ ->  tryReadCSLFile mbpandocdir "default.csl"+                   `mplus` tryReadCSLFile mbcsldir "chicago-author-date.csl"+                   `mplus` (getDefaultCSL >>=+                             localizeCSL mbLocale . parseCSL')   -- set LANG environment from locale; this affects unicode collation   -- if pandoc-citeproc compiled with unicode_collation flag   case styleLocale csl of@@ -214,6 +198,10 @@  toPath :: MetaValue -> Maybe String toPath (MetaString s) = Just s+-- take last in a list+toPath (MetaList xs) = case reverse xs of+                             []    -> Nothing+                             (x:_) -> toPath x toPath (MetaInlines ils) = Just $ stringify ils toPath _ = Nothing 
src/Text/CSL/Proc.hs view
@@ -123,6 +123,8 @@          OYearSuf y citeid d f{hyperlink = "#ref-" ++ citeid}       addLink' citeid (OCitNum n f) =          OCitNum n f{hyperlink = "#ref-" ++ citeid}+      addLink' citeid (OCitLabel l f) =+         OCitLabel l f{hyperlink = "#ref-" ++ citeid}       addLink' _ x = x  -- | Given the CSL 'Style' and the list of 'Reference's sort the list
src/Text/CSL/Reference.hs view
@@ -36,6 +36,7 @@                           , mkRefDate                           , RefType(..)                           , CNum(..)+                          , CLabel(..)                           , Reference(..)                           , emptyReference                           , numericVars@@ -113,6 +114,7 @@     | Just v <- fromValue val :: Maybe [RefDate] = v /= []     | Just v <- fromValue val :: Maybe Int       = v /= 0     | Just v <- fromValue val :: Maybe CNum      = v /= 0+    | Just v <- fromValue val :: Maybe CLabel    = v /= mempty     | Just _ <- fromValue val :: Maybe Empty     = True     | otherwise = False @@ -298,6 +300,21 @@ instance ToYaml CNum where   toYaml r = Y.string (T.pack $ show $ unCNum r) +newtype CLabel = CLabel { unCLabel :: String } deriving ( Show, Read, Eq, Typeable, Data, Generic )++instance Monoid CLabel where+    mempty = CLabel mempty+    mappend (CLabel a) (CLabel b) = CLabel (mappend a b)++instance FromJSON CLabel where+  parseJSON x = CLabel `fmap` parseString x++instance ToJSON CLabel where+  toJSON (CLabel s) = toJSON s++instance ToYaml CLabel where+  toYaml (CLabel s) = toYaml $ T.pack s+ -- | The 'Reference' record. data Reference =     Reference@@ -379,7 +396,7 @@      , citationNumber           :: CNum     , firstReferenceNoteNumber :: Int-    , citationLabel            :: Literal+    , citationLabel            :: CLabel     } deriving ( Eq, Show, Read, Typeable, Data, Generic )  instance FromJSON Reference where@@ -460,7 +477,7 @@        v .:? "language" .!= "" <*>        v .:? "citation-number" .!= CNum 0 <*>        ((v .: "first-reference-note-number" >>= parseInt) <|> return 0) <*>-       v .:? "citation-label" .!= "")+       v .:? "citation-label" .!= mempty)     where takeFirstNum (Formatted (Str xs : _)) =             case takeWhile isDigit xs of                    []   -> mempty@@ -658,7 +675,9 @@          then id          else (("first-reference-note-number" Y..=                 firstReferenceNoteNumber ref) :)-    , "citation-label" &= citationLabel ref+    , if citationLabel ref == mempty+         then id+         else (("citation-label" Y..= citationLabel ref) :)     ]  emptyReference :: Reference
src/Text/CSL/Style.hs view
@@ -650,6 +650,7 @@     | OLabel   String             Formatting            -- ^ A label used for roles     | ONum     Int                Formatting            -- ^ A number (used to count contributors)     | OCitNum  Int                Formatting            -- ^ The citation number+    | OCitLabel String            Formatting            -- ^ The citation label     | ODate   [Output]                                  -- ^ A (possibly) ranged date     | OYear    String    String   Formatting            -- ^ The year and the citeId     | OYearSuf String    String   [Output]   Formatting -- ^ The year suffix, the citeId and a holder for collision data
src/Text/CSL/Util.hs view
@@ -186,10 +186,19 @@  splitUpStr :: [Inline] -> [Inline] splitUpStr ils =-  case reverse (splitStrWhen (\c -> isPunctuation c || c == '\160') ils) of-       [] -> []-       (x:xs) -> reverse $ Span ("",["lastword"],[]) [x] : xs+  case reverse (combineInternalPeriods+         (splitStrWhen (\c -> isPunctuation c || c == '\160') ils)) of+         [] -> []+         (x:xs) -> reverse $ Span ("",["lastword"],[]) [x] : xs +-- We want to make sure that the periods in www.example.com, for+-- example, are not interpreted as sentence-ending punctuation.+combineInternalPeriods :: [Inline] -> [Inline]+combineInternalPeriods [] = []+combineInternalPeriods (Str xs:Str ".":Str ys:zs) =+  combineInternalPeriods $ Str (xs ++ "." ++ ys) : zs+combineInternalPeriods (x:xs) = x : combineInternalPeriods xs+ unTitlecase :: [Inline] -> [Inline] unTitlecase zs = evalState (caseTransform untc zs) SentenceBoundary   where untc w = do@@ -286,7 +295,7 @@                put WordBoundary                return $ Space : acc         go acc (Str [c])-          | c `elem` "-/\2013\2014\160" = do+          | c `elem` "-/\x2013\x2014\160" = do                put WordBoundary                return $ Str [c] : acc           | isPunctuation c = do@@ -416,11 +425,17 @@  findFile :: [FilePath] -> FilePath -> IO (Maybe FilePath) findFile [] _ = return Nothing-findFile (p:ps) f = do-  exists <- doesFileExist (p </> f)-  if exists-     then return $ Just (p </> f)-     else findFile ps f+findFile (p:ps) f+ | isAbsolute f = do+     exists <- doesFileExist f+     if exists+        then return (Just f)+        else return Nothing+ | otherwise = do+     exists <- doesFileExist (p </> f)+     if exists+        then return $ Just (p </> f)+        else findFile ps f  (&=) :: (ToYaml a, Monoid a, Eq a)      => Text -> a -> [(Text, YamlBuilder)] -> [(Text, YamlBuilder)]
stack.yaml view
@@ -9,8 +9,9 @@ - '.' - location:     git: https://github.com/jgm/pandoc.git-    commit: cfdbe85e7178e2a82f141192736dc2e0d6daed8a+    commit: 55d679e382954dd458acd6233609851748522d99   extra-dep: true extra-deps: - xml-conduit-1.5.0-resolver: lts-8.0+- skylighting-0.3.3+resolver: lts-8.12
+ tests/biblio2yaml/issue288.biblatex view
@@ -0,0 +1,30 @@+@thesis{Leavitt_2016,+location = {{Los Angeles, CA}},+title = {Upvoting the News: {{Breaking}} News Aggregation, Crowd Collaboration,+and Algorithm-Driven Attention on Reddit.Com},+timestamp = {2017-04-06T14:13:22Z},+langid = {english},+institution = {{University of Southern California}},+type = {Dissertation},+author = {Leavitt, Alex},+date = {2016-08},+}++---+references:+- id: Leavitt_2016+  type: thesis+  author:+  - family: Leavitt+    given: Alex+  issued:+  - year: '2016'+    month: '8'+  title: 'Upvoting the news: Breaking news aggregation, crowd collaboration, and+    algorithm-driven attention on reddit.com'+  title-short: Upvoting the news+  publisher: University of Southern California+  publisher-place: Los Angeles, CA+  genre: Dissertation+  language: en-US+...
+ tests/biblio2yaml/pandoc-2/ctan.biblatex view
@@ -0,0 +1,69 @@+@comment{++Adapted from biblatex-example.bib+++Formatted with pandoc and chicago-author-date.csl, 2013-10-23:++(“CTAN: The Comprehensive TeX Archive Network” 2006)++“CTAN: The Comprehensive TeX Archive Network.” 2006.+<http://www.ctan.org>.+++Formatted with pandoc and apa.csl, 2013-10-23:++(“CTAN: The Comprehensive TeX Archive Network,” 2006)++CTAN: The Comprehensive TeX Archive Network. (2006). Retrieved October+01, 2006, from <http://www.ctan.org>+++NOTES:++- biblio2yaml+	- if there is no shorttitle, but title and subtitle, the title alone should also be mapped to title-short++- citeproc+	- citeproc should use title-short (if available) instead of title for in-text citations when there is no author++}++@Online{ctan,+  title        = {{CTAN}},+  date         = 2006,+  url          = {http://www.ctan.org},+  subtitle     = {{The Comprehensive TeX Archive Network}},+  urldate      = {2006-10-01},+  label        = {CTAN},+  hyphenation  = {american},+  annotation   = {This is an online entry. The \textsc{url}, which is+                  given in the url field, is transformed into a+                  clickable link if hyperref support has been+                  enabled. Note the format of the urldate field+                  (yyyy-mm-dd) in the database file. Also note the+                  label field which may be used as a fallback by+                  citation styles which need an author and\slash or a+                  year},+}++---+references:+- id: ctan+  type: webpage+  issued:+  - year: '2006'+  accessed:+  - year: '2006'+    month: '10'+    day: '1'+  title: 'CTAN: The Comprehensive TeX Archive Network'+  title-short: CTAN+  annote: This is an online entry. The [url]{.smallcaps}, which is given in the url+    field, is transformed into a clickable link if hyperref support has been enabled.+    Note the format of the urldate field (yyyy-mm-dd) in the database file. Also note+    the label field which may be used as a fallback by citation styles which need+    an author and/or a year+  URL: http://www.ctan.org+  language: en-US+...
+ tests/biblio2yaml/pandoc-2/formatting.biblatex view
@@ -0,0 +1,15 @@+@article{item1,+    Title = {The Title:+     \textit{italics},+     \textbf{bold},+     \textsubscript{subscript},+     \textsuperscript{superscript},+     \textsc{small-caps}}+}+---+references:+- id: item1+  type: article-journal+  title: 'The title: *Italics*, **bold**, ~subscript~, ^superscript^, [small-caps]{.smallcaps}'+  title-short: The title+...
+ tests/biblio2yaml/pandoc-2/jaffe.biblatex view
@@ -0,0 +1,77 @@+@comment{++Adapted from biblatex-example.bib++Formatted with pandoc and chicago-author-date.csl, 2013-10-23:++(Jaffé 1885–1888)++Jaffé, Philipp, ed. 1885–1888. *Regesta Pontificum Romanorum ab condita+ecclesia ad annum post Christum natum \<span+Style="font-variant:small-caps;"\>mcxcviii\</span\>*. 2nd ed. 2.+Leipzig.+++Formatted with pandoc and apa.csl, 2013-10-23:++(Jaffé, 1885–1888)++Jaffé, P. (Ed.). (1885–1888). *Regesta Pontificum Romanorum ab condita+ecclesia ad annum post Christum natum \<span+style="font-variant:small-caps;"\>mcxcviii\</span\>* (2nd ed., 1-2).+Leipzig.+++NOTES:++- biblatex conversion:+	- hyphenation = {latin}+- citeproc:+	- "vols." is missing+		- works in Zotero+		- This does not show up in the tests from the citeproc test suite that currently fail.+	- "\<span ...\> needs to be fixed.+		- maybe add markdown syntax ^^small caps^^ ?+		- in pandoc "plain" output, small caps could be converted to uppercase chars: "MCXCVIII" would definitely look better here.++}++@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},+  editoratype  = {redactor},+  indextitle   = {Regesta Pontificum Romanorum},+  shorttitle   = {Regesta Pontificum Romanorum},+  annotation   = {A collection entry with edition and+                  volumes fields. Note the editora and+                  editoratype fields},+  hyphenation  = {latin},+}++---+references:+- id: jaffe+  type: book+  editor:+  - family: Jaffé+    given: Philipp+  issued:+  - year: '1885'+  - year: '1888'+  title: Regesta Pontificum Romanorum ab condita ecclesia ad annum post Christum natum+    [mcxcviii]{.smallcaps}+  title-short: Regesta Pontificum Romanorum+  publisher-place: Leipzig+  number-of-volumes: '2'+  edition: '2'+  annote: A collection entry with edition and volumes fields. Note the editora and+    editoratype fields+  language: la+...
+ tests/biblio2yaml/pandoc-2/kastenholz.biblatex view
@@ -0,0 +1,115 @@+@comment{++Adapted from biblatex-example.bib+++Formatted with pandoc and chicago-author-date.csl, 2013-10-23:++(Kastenholz and Hünenberger 2006)++Kastenholz, M. A., and Philippe H. Hünenberger. 2006. “Computation of+Methodologyindependent Ionic Solvation Free Energies from Molecular+Simulations: I. the Electrostatic Potential in Molecular Liquids.”+*J. Chem. Phys.* 124.+doi:[10.1063/1.2172593](https://doi.org/10.1063/1.2172593 "10.1063/1.2172593").+++Formatted with pandoc and apa.csl, 2013-10-23:++(Kastenholz & Hünenberger, 2006)++Kastenholz, M. A., & Hünenberger, P. H. (2006). Computation of+methodologyindependent ionic solvation free energies from molecular+simulations: I. the electrostatic potential in molecular liquids.+*J. Chem. Phys.*, *124*.+doi:[10.1063/1.2172593](https://doi.org/10.1063/1.2172593 "10.1063/1.2172593")+++NOTES:++- biblio2xaml+	- fix conversion of "\hyphen”+	- the string "doi:" should not appear as part of the content of the "doi" field ++}++@string{ jchph   = {J.~Chem. Phys.} }++@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},+  hyphenation  = {american},+  indextitle   = {Computation of ionic solvation free energies},+  annotation   = {An article entry with an eid and a+                  doi field. Note that the \textsc{doi} is transformed+                  into a clickable link if hyperref support has been+                  enabled},+  abstract     = {The computation of ionic solvation free energies from+                  atomistic simulations is a surprisingly difficult problem that+                  has found no satisfactory solution for 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).},+}++---+references:+- id: kastenholz+  type: article-journal+  author:+  - family: Kastenholz+    given: M. A.+  - family: Hünenberger+    given: Philippe H.+  issued:+  - year: '2006'+  title: 'Computation of methodology-independent ionic solvation free energies from+    molecular simulations: I. The electrostatic potential in molecular liquids'+  title-short: Computation of methodology-independent ionic solvation free energies+    from molecular simulations+  container-title: J. Chem. Phys.+  volume: '124'+  annote: An article entry with an eid and a doi field. Note that the [doi]{.smallcaps}+    is transformed into a clickable link if hyperref support has been enabled+  abstract: The computation of ionic solvation free energies from atomistic simulations+    is a surprisingly difficult problem that has found no satisfactory solution for+    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).+  DOI: 10.1063/1.2172593+  language: en-US+...
+ tests/biblio2yaml/pandoc-2/online.biblatex view
@@ -0,0 +1,67 @@+@comment{adapted from http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/examples/biblatex-examples.bib}++@online{markey,+	Annotation = {An online entry for a tutorial. Note the format of the date field (yyyy-mm-dd) in the database file.},+	Author = {Markey, Nicolas},+	Date = {2005-10-16},+	Hyphenation = {american},+	Sorttitle = {Tame the Beast},+	Subtitle = {The {B} to {X} of {BibTeX}},+	Title = {Tame the {BeaST}},+	Url = {http://tug.ctan.org/tex-archive/info/bibtex/tamethebeast/ttb_en.pdf},+	Urldate = {2006-10-01},+	Version = {1.3},+}++@online{CTAN,+	Annotation = {This is an online entry. The \textsc{url}, which is given in the url field, is transformed into a clickable link if hyperref support has been enabled. Note the format of the urldate field (yyyy-mm-dd) in the database file. Also note the label field which may be used as a fallback by citation styles which need an author and\slash or a year},+	Date = 2006,+	Hyphenation = {american},+	Label = {CTAN},+	Subtitle = {The {Comprehensive TeX Archive Network}},+	Title = {{CTAN}},+	Url = {http://www.ctan.org},+	Urldate = {2006-10-01},+}++---+references:+- id: markey+  type: webpage+  author:+  - family: Markey+    given: Nicolas+  issued:+  - year: '2005'+    month: '10'+    day: '16'+  accessed:+  - year: '2006'+    month: '10'+    day: '1'+  title: 'Tame the BeaST: The B to X of BibTeX'+  title-short: Tame the BeaST+  version: '1.3'+  annote: An online entry for a tutorial. Note the format of the date field (yyyy-mm-dd)+    in the database file.+  URL: http://tug.ctan.org/tex-archive/info/bibtex/tamethebeast/ttb_en.pdf+  language: en-US++- id: CTAN+  type: webpage+  issued:+  - year: '2006'+  accessed:+  - year: '2006'+    month: '10'+    day: '1'+  title: 'CTAN: The Comprehensive TeX Archive Network'+  title-short: CTAN+  annote: This is an online entry. The [url]{.smallcaps}, which is given in the url+    field, is transformed into a clickable link if hyperref support has been enabled.+    Note the format of the urldate field (yyyy-mm-dd) in the database file. Also note+    the label field which may be used as a fallback by citation styles which need+    an author and/or a year+  URL: http://www.ctan.org+  language: en-US+...
+ tests/biblio2yaml/pandoc-2/sigfridsson.biblatex view
@@ -0,0 +1,96 @@+@comment{++Adapted from biblatex-example.bib++Formatted with pandoc and chicago-author-date.csl, 2013-10-23:++(Sigfridsson and Ryde 1998)++Sigfridsson, Emma, and Ulf Ryde. 1998. “Comparison of Methods for+Deriving Atomic Charges from the Electrostatic Potential and Moments.”+*Journal of Computational Chemistry* 19 (4): 377–395.+doi:[10.1002/(SICI)1096-987X(199803)19:4\<377::AID-JCC1\>3.0.CO;2-P](https://doi.org/10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P "10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P").+++Formatted with pandoc and apa.csl, 2013-10-23:++(Sigfridsson & Ryde, 1998)++Sigfridsson, E., & Ryde, U. (1998). Comparison of methods for deriving+atomic charges from the electrostatic potential and moments. *Journal of+Computational Chemistry*, *19*(4), 377–395.+doi:[10.1002/(SICI)1096-987X(199803)19:4\<377::AID-JCC1\>3.0.CO;2-P](https://doi.org/10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P "10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P")+++NOTES:++- biblio2xaml+	- the string "doi:" should not appear as part of the content of the "doi" field ++}++@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},+  hyphenation  = {american},+  indextitle   = {Methods for deriving atomic charges},+  annotation   = {An article entry with volume,+                  number, and doi fields. Note that the+                  \textsc{doi} is transformed into a clickable link if+                  hyperref support has been enabled},+  abstract     = {Four methods for deriving partial atomic charges from the+                  quantum chemical electrostatic potential (CHELP, CHELPG,+                  Merz-Kollman, and RESP) have been compared and critically+                  evaluated. It is shown that charges strongly depend on how and+                  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.},+}++---+references:+- id: sigfridsson+  type: article-journal+  author:+  - family: Sigfridsson+    given: Emma+  - family: Ryde+    given: Ulf+  issued:+  - year: '1998'+  title: Comparison of methods for deriving atomic charges from the electrostatic+    potential and moments+  container-title: Journal of Computational Chemistry+  page: '377-395'+  volume: '19'+  issue: '4'+  annote: An article entry with volume, number, and doi fields. Note that the [doi]{.smallcaps}+    is transformed into a clickable link if hyperref support has been enabled+  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.'+  DOI: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P+  language: en-US+...
+ tests/issue160.csl view
@@ -0,0 +1,28 @@+<?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>Issue 160 Test Style</title>+    <id>issue-160-test</id>+    <category citation-format="label"/>+    <updated>2017-02-04T19:31:46+0000</updated>+  </info>+  <citation>+    <layout prefix="[" suffix="]" delimiter=",">+      <text variable="citation-label"/>+    </layout>+  </citation>+  <bibliography>+    <layout>+      <text variable="citation-label" prefix="[" suffix="] "/>+      <group delimiter=". " suffix=".">+        <names variable="author">+          <name delimiter=", " delimiter-precedes-last="always"/>+        </names>+        <text variable="title"/>+        <date variable="issued">+          <date-part name="year"/>+        </date>+      </group>+    </layout>+  </bibliography>+</style>
+ tests/issue160.expected.native view
@@ -0,0 +1,10 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/issue160.csl"]),("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("citation-label",MetaInlines [Str "Jane11"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("year",MetaString "2011")])),("title",MetaInlines [Str "A",Space,Str "book"]),("type",MetaInlines [Str "book"])])])]})+[Header 2 ("no-citation-label",[],[]) [Str "No",Space,Str "citation-label"]+,Para [Str "Foo",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 1}] [Str "[Jane11]"],Str "."]+,Header 2 ("expected",[],[]) [Str "Expected"]+,BlockQuote+ [Para [Str "Foo",Space,Str "[Jane11]."]+ ,Para [Str "[Jane11]",Space,Str "Jane",Space,Str "Doe.",Space,Str "A",Space,Str "book.",Space,Str "2011."]]+,Div ("refs",["references"],[])+ [Div ("ref-item1",[],[])+  [Para [Str "[Jane11]",Space,Str "Jane",Space,Str "Doe.",Space,Str "A",Space,Str "book.",Space,Str "2011."]]]]
+ tests/issue160.in.native view
@@ -0,0 +1,7 @@+Pandoc (Meta {unMeta = fromList [("csl",MetaInlines [Str "tests/issue160.csl"]),("references",MetaList [MetaMap (fromList [("author",MetaList [MetaMap (fromList [("family",MetaInlines [Str "Doe"]),("given",MetaInlines [Str "Jane"])])]),("citation-label",MetaInlines [Str "Jane11"]),("id",MetaInlines [Str "item1"]),("issued",MetaMap (fromList [("year",MetaString "2011")])),("title",MetaInlines [Str "A",Space,Str "book"]),("type",MetaInlines [Str "book"])])])]})+[Header 2 ("no-citation-label",[],[]) [Str "No",Space,Str "citation-label"]+,Para [Str "Foo",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@item1]"],Str "."]+,Header 2 ("expected",[],[]) [Str "Expected"]+,BlockQuote+ [Para [Str "Foo",Space,Str "[Jane11]."]+ ,Para [Str "[Jane11]",Space,Str "Jane",Space,Str "Doe.",Space,Str "A",Space,Str "book.",Space,Str "2011."]]]
+ tests/jats.csl view
@@ -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>+
tests/test-citeproc.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances,-    ScopedTypeVariables #-}+    ScopedTypeVariables, CPP #-}+ import Text.Printf import System.Exit import qualified Control.Exception as E@@ -16,7 +17,6 @@ import System.FilePath import System.Directory import Data.List (sort, isInfixOf)-import qualified Data.Vector as V import qualified Data.Map as M import Text.CSL.Style hiding (Number) import Text.CSL.Reference@@ -72,9 +72,12 @@          x               -> fail $ "Could not parse CiteObject" ++ show x   parseJSON x = fail $ "Could not parse CiteObject " ++ show x +#if MIN_VERSION_aeson(0,10,0)+#else instance FromJSON [CiteObject] where   parseJSON (Array v) = mapM parseJSON $ V.toList v   parseJSON _ = return []+#endif  data TestResult =     Passed
tests/test-pandoc-citeproc.hs view
@@ -1,8 +1,10 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE ScopedTypeVariables #-} module Main where import System.Exit import System.Directory import System.FilePath+import qualified Control.Exception as E import Data.Maybe (fromMaybe) import System.IO import Data.Monoid (mempty)@@ -99,8 +101,16 @@ biblio2yamlTest :: String -> IO TestResult biblio2yamlTest fp = do   hPutStr stderr $ "[biblio2yaml/" ++ fp ++ "] "-  let yamlf = "tests/biblio2yaml/" ++ fp-  raw <- UTF8.readFile yamlf+  let yamld = "tests/biblio2yaml/"+#if MIN_VERSION_pandoc(2,0,0)+  -- in a few cases we need different test output for pandoc >= 2+  -- because smallcaps render differently, for example.+  raw <- E.catch (UTF8.readFile (yamld ++ "/pandoc-2/" ++ fp))+         (\(_ :: E.SomeException) ->+           (UTF8.readFile (yamld ++ fp)))+#else+  raw <- UTF8.readFile (yamld ++ fp)+#endif   let yamlStart = "---"   let (biblines, yamllines) = break (== yamlStart) $ lines raw   let bib = unlines biblines