packages feed

citeproc 0.8.1 → 0.8.1.1

raw patch · 8 files changed

+242/−19 lines, 8 filesdep ~containersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: containers

API changes (from Hackage documentation)

- Citeproc.Types: data Lang
+ Citeproc.Types: data () => Lang

Files

CHANGELOG.md view
@@ -1,5 +1,13 @@ # citeproc changelog +## 0.8.1.1++  * Include `10/` prefix in short DOI links (#136).++  * Properly implement `demote-non-dropping-particle="sort-only"` (#141).+    We had previously gotten sorting behavior right for this, but+    not display behavior.+ ## 0.8.1    * In Pandoc and CslJson CaseTransform, group punctuation in clusters (#127).
citeproc.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                citeproc-version:             0.8.1+version:             0.8.1.1 synopsis:            Generates citations and bibliography from CSL styles. description:         citeproc parses CSL style files and uses them to                      generate a list of formatted citations and bibliography
src/Citeproc/Eval.hs view
@@ -1616,7 +1616,7 @@                       coerce (referenceId ref)             return NullOutput -    "DOI"   -> handleIdent fixShortDOI IdentDOI+    "DOI"   -> handleIdent id IdentDOI     "PMCID" -> handleIdent id IdentPMCID     "PMID"  -> handleIdent id IdentPMID     "URL"   -> handleIdent id IdentURL@@ -2470,19 +2470,17 @@         maybe NullOutput (familyFormatting . (:[]) . literal) $           nameFamily name   let suffix = maybe NullOutput literal $ nameSuffix name-  let useSortOrder = inSortKey ||-                     case nameAsSortOrder nameFormat of-                       Just NameAsSortOrderAll -> True-                       Just NameAsSortOrderFirst -> order == 1-                       _ -> False+  let nameAsSort = case nameAsSortOrder nameFormat of+                          Just NameAsSortOrderAll -> True+                          Just NameAsSortOrderFirst -> order == 1+                          _ -> False   return $ formatted formatting . (:[]) $     if isByzantineName name        then          case nameForm nameFormat of               LongName-                | demoteNonDroppingParticle == DemoteNever ||-                  demoteNonDroppingParticle == DemoteSortOnly-                , useSortOrder->+                | demoteNonDroppingParticle == DemoteNever+                , inSortKey || nameAsSort ->                       familyAffixes                       [ nonDroppingParticle <+>                         family ] <:>@@ -2490,8 +2488,26 @@                       [ given <+>                         droppingParticle ] <:>                       suffix+                | demoteNonDroppingParticle == DemoteSortOnly+                , inSortKey ->+                      familyAffixes+                      [ family ] <:>+                      givenAffixes+                      [ given <+>+                        droppingParticle <+>+                        nonDroppingParticle ] <:>+                      suffix+                | demoteNonDroppingParticle == DemoteSortOnly+                , nameAsSort ->+                      familyAffixes+                      [ nonDroppingParticle <+>+                        family ] <:>+                      givenAffixes+                      [ given <+>+                        droppingParticle ] <:>+                      suffix                 | demoteNonDroppingParticle == DemoteDisplayAndSort-                , useSortOrder->+                , inSortKey || nameAsSort ->                       familyAffixes                       [ family ] <:>                       givenAffixes
src/Citeproc/Types.hs view
@@ -1483,7 +1483,7 @@ identifierToURL :: Identifier -> Text identifierToURL ident =     case ident of-      IdentDOI t   -> tolink "https://doi.org/" (fixShortDOI t)+      IdentDOI t   -> tolink "https://doi.org/" t       IdentPMCID t -> tolink "https://www.ncbi.nlm.nih.gov/pmc/articles/" t       IdentPMID t  -> tolink "https://www.ncbi.nlm.nih.gov/pubmed/" t       IdentURL t   -> tolink "https://" t@@ -1492,6 +1492,8 @@                            then x                            else pref <> x +{-# DEPRECATED fixShortDOI+   "This function is no longer used and will be removed." #-} -- see https://shortdoi.org fixShortDOI :: Text -> Text fixShortDOI x = if "10/" `T.isPrefixOf` x
+ test/extra/issue_141.txt view
@@ -0,0 +1,199 @@+>>===== MODE =====>>+bibliography+<<===== MODE =====<<++>>===== RESULT =====>>+<div class="csl-bib-body">+  <div class="csl-entry"><span style="font-variant:small-caps;">van</span> <span style="font-variant:small-caps;">Inwagen</span>, Peter. 1975.</div>+  <div class="csl-entry"><span style="font-variant:small-caps;">Lewis</span>, David, and Stephanie R. <span style="font-variant:small-caps;">Lewis</span>. 1970.</div>+</div>+<<===== RESULT =====<<+++>>===== CSL =====>>+<?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" page-range-format="expanded">+  <info>+    <title>title</title>+    <id>id</id>+    <category citation-format="author-date"/>+    <category field="generic-base"/>+    <summary>Based on the author-date variant of the Chicago style</summary>+    <updated>2024-05-30T19:54:33+00:00</updated>+  </info>+  <locale xml:lang="en">+    <terms>+      <term name="editor" form="verb-short">ed.</term>+      <term name="container-author" form="verb">by</term>+      <term name="translator" form="verb-short">trans.</term>+      <term name="editortranslator" form="verb">edited and translated by</term>+      <term name="translator" form="short">trans.</term>+    </terms>+  </locale>+  <macro name="contributors">+    <group delimiter=". ">+      <names variable="author">+        <name and="text" name-as-sort-order="first" sort-separator=", " delimiter=", " delimiter-precedes-last="always">+          <name-part name="family" font-variant="small-caps"/>+        </name>+        <label form="short" prefix=", "/>+        <substitute>+          <names variable="editor"/>+          <names variable="translator"/>+          <names variable="director"/>+        </substitute>+      </names>+    </group>+  </macro>+  <macro name="contributors-short">+    <names variable="author">+      <name form="short" and="text" delimiter=", " initialize-with=". "/>+      <substitute>+        <names variable="editor"/>+        <names variable="translator"/>+        <names variable="director"/>+      </substitute>+    </names>+  </macro>+  <macro name="date">+    <choose>+      <if variable="issued">+        <group delimiter=" ">+          <date variable="original-date" form="text" date-parts="year" prefix="(" suffix=")"/>+          <date variable="issued">+            <date-part name="year"/>+          </date>+        </group>+      </if>+      <else-if variable="status">+        <text variable="status" text-case="capitalize-first"/>+      </else-if>+      <else>+        <text term="no date" form="short"/>+      </else>+    </choose>+  </macro>+  <macro name="date-in-text">+    <choose>+      <if variable="issued">+        <group delimiter=" ">+          <date variable="original-date" form="text" date-parts="year" prefix="[" suffix="]"/>+          <date variable="issued">+            <date-part name="year"/>+          </date>+        </group>+      </if>+      <else-if variable="status">+        <text variable="status"/>+      </else-if>+      <else>+        <text term="no date" form="short"/>+      </else>+    </choose>+  </macro>+  <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" givenname-disambiguation-rule="primary-name" collapse="year" after-collapse-delimiter="; ">+    <layout prefix="(" suffix=")" delimiter="; ">+      <group delimiter=", ">+        <choose>+          <if variable="issued accessed" match="any">+            <group delimiter=" ">+              <text macro="contributors-short"/>+              <text macro="date-in-text"/>+            </group>+          </if>+          <else>+            <group delimiter=", ">+              <text macro="contributors-short"/>+              <text macro="date-in-text"/>+            </group>+          </else>+        </choose>+      </group>+    </layout>+  </citation>+  <bibliography hanging-indent="true" et-al-min="11" et-al-use-first="7" subsequent-author-substitute="—" entry-spacing="0">+    <sort>+      <key macro="contributors"/>+      <key variable="issued"/>+    </sort>+    <layout suffix=".">+      <group delimiter=". ">+        <text macro="contributors"/>+        <text macro="date"/>+      </group>+    </layout>+  </bibliography>+</style>+<<===== CSL =====<<+++>>===== CITATION-ITEMS =====>>+[ [ {"id":"lewis_dk-lewis:1970", "type":"normal"} ]+, [ {"id":"vaninwagen:1975", "type":"normal"} ] ]+<<===== CITATION-ITEMS =====<<++++>>===== INPUT =====>>+[+  {+    "DOI": "10.1080/00048407012341181",+    "author": [+      {+        "family": "Lewis",+        "given": "David"+      },+      {+        "family": "Lewis",+        "given": "Stephanie R."+      }+    ],+    "container-title": "Australasian Journal of Philosophy",+    "id": "lewis_dk-lewis:1970",+    "issue": "2",+    "issued": {+      "date-parts": [+        [+          1970+        ]+      ]+    },+    "note": "reprinted in ",+    "page": "206-212",+    "title": "Holes",+    "type": "article-journal",+    "volume": "48"+  },+  {+    "DOI": "10.1007/bf01624156",+    "author": [+      {+        "family": "Inwagen",+        "given": "Peter",+        "non-dropping-particle": "van"+      }+    ],+    "container-title": "Philosophical Studies",+    "id": "vaninwagen:1975",+    "issue": "3",+    "issued": {+      "date-parts": [+        [+          1975+        ]+      ]+    },+    "page": "185-199",+    "title": "The incompatibility of Free Will and Determinism",+    "type": "article-journal",+    "volume": "27"+  }+]+<<===== INPUT =====<<+++>>===== VERSION =====>>+1.0+<<===== VERSION =====<<+
@@ -18,11 +18,11 @@ >>===== RESULT =====>> <div class="csl-bib-body">   <div class="csl-entry"><a href="https://doi.org/10.1021/ja01577a030">Apple. 2010</a></div>-  <div class="csl-entry"><a href="https://doi.org/bbbbb">Blueberry. 2011</a></div>+  <div class="csl-entry"><a href="https://doi.org/10/bbbbb">Blueberry. 2011</a></div>   <div class="csl-entry"><a href="https://pandoc.org/">Cherry. 2012</a></div>   <div class="csl-entry"><a href="https://www.ncbi.nlm.nih.gov/pubmed/30310042">Durian. 2013</a></div>   <div class="csl-entry"><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190">Elderberry. 2014</a></div>-  <div class="csl-entry"><a href="https://doi.org/bbbbb">Fig. 2015</a></div>+  <div class="csl-entry"><a href="https://doi.org/10/bbbbb">Fig. 2015</a></div>   <div class="csl-entry"><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190">Grapefruit. 2016</a></div>   <div class="csl-entry"><a href="https://www.ncbi.nlm.nih.gov/pubmed/30310042">Honeydew. 2017</a></div> </div>
@@ -2,8 +2,6 @@   - plain URLs appearing in bibliography items should be linkified   - when a link's prefix+anchor matches its target, the       prefix should be included in the anchor-  - shortDOIs should be handled correctly, meaning that every shortDOI of-      the form 10/abcde should be converted to the DOI abcde  >>===== MODE =====>> bibliography@@ -18,7 +16,7 @@ >>===== RESULT =====>> <div class="csl-bib-body">   <div class="csl-entry">Apple. AAAA. 2010. <a href="https://doi.org/10.1021/ja01577a030">https://doi.org/10.1021/ja01577a030</a></div>-  <div class="csl-entry">Blueberry. BBBB. 2011. <a href="https://doi.org/bbbbb">https://doi.org/bbbbb</a></div>+  <div class="csl-entry">Blueberry. BBBB. 2011. <a href="https://doi.org/10/bbbbb">https://doi.org/10/bbbbb</a></div>   <div class="csl-entry">Cherry. CCCC. 2012. <a href="https://pandoc.org/">https://pandoc.org/</a></div>   <div class="csl-entry">Durian. DDDD. 2013. <a href="https://www.ncbi.nlm.nih.gov/pubmed/30310042">https://www.ncbi.nlm.nih.gov/pubmed/30310042</a></div>   <div class="csl-entry">Elderberry. EEEE. 2014. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190">https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190</a></div>
@@ -17,11 +17,11 @@ >>===== RESULT =====>> <div class="csl-bib-body">   <div class="csl-entry">Apple. <a href="https://doi.org/10.1021/ja01577a030">AAAA</a>. 2010</div>-  <div class="csl-entry">Blueberry. <a href="https://doi.org/bbbbb">BBBB</a>. 2011</div>+  <div class="csl-entry">Blueberry. <a href="https://doi.org/10/bbbbb">BBBB</a>. 2011</div>   <div class="csl-entry">Cherry. <a href="https://pandoc.org/">CCCC</a>. 2012</div>   <div class="csl-entry">Durian. <a href="https://www.ncbi.nlm.nih.gov/pubmed/30310042">DDDD</a>. 2013</div>   <div class="csl-entry">Elderberry. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190">EEEE</a>. 2014</div>-  <div class="csl-entry">Fig. <a href="https://doi.org/bbbbb">FFFF</a>. 2015</div>+  <div class="csl-entry">Fig. <a href="https://doi.org/10/bbbbb">FFFF</a>. 2015</div>   <div class="csl-entry">Grapefruit. <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3531190">GGGG</a>. 2016</div>   <div class="csl-entry">Honeydew. <a href="https://www.ncbi.nlm.nih.gov/pubmed/30310042">HHHH</a>. 2017</div> </div>