packages feed

citeproc 0.1.0.1 → 0.1.0.2

raw patch · 5 files changed

+279/−26 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,8 +1,11 @@ # citeproc changelog -## 0.1+## 0.1.0.2 -* Initial release.+  * Don't enclose contents of e:choose in a Formatted element (#19).+    The e:choose element is "transparent" and the delimiter+    controlling its formatting should be inserted between+    the items it returns.  ## 0.1.0.1 @@ -20,4 +23,8 @@   * Remove unneeded import    * `citeproc` executable: strip BOM before parsing style (#18).++## 0.1++  * Initial release. 
citeproc.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                citeproc-version:             0.1.0.1+version:             0.1.0.2 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
man/citeproc.1 view
@@ -1,6 +1,6 @@-.\" Automatically generated by Pandoc 2.11+.\" Automatically generated by Pandoc 2.11.0.1 .\"-.TH "citeproc" "1" "" "citeproc 0.1.0.1" ""+.TH "citeproc" "1" "" "citeproc 0.1.0.2" "" .hy .SH NAME .PP
src/Citeproc/Eval.hs view
@@ -837,7 +837,7 @@     Just ref -> do         k <- normalizeSortKey . toText .               renderOutput defaultCiteprocOptions . grouped-              <$> withRWS newContext (mapM eElement elts)+              <$> withRWS newContext (mconcat <$> mapM eElement elts)         return $ SortKeyValue (sortdir, Just k)      where       newContext oldContext s =@@ -952,7 +952,7 @@                    },                 st{ stateReference = ref                   , stateUsedYearSuffix = False }))-                $ do xs <- mapM eElement (layoutElements layout)+                $ do xs <- mconcat <$> mapM eElement (layoutElements layout)                      let mblang = parseLang <$>                                   (lookupVariable "language" ref                                     >>= valToText)@@ -1081,21 +1081,23 @@                       | otherwise -> (IbidWithLocator :) . (Ibid :)              else id)         $ [Subsequent]- -eElement :: CiteprocOutput a => Element a -> Eval a (Output a)++eElement :: CiteprocOutput a => Element a -> Eval a [Output a] eElement (Element etype formatting) =   case etype of     EText textType ->-      withFormatting formatting (eText textType)-    ENumber var nform -> withFormatting formatting (eNumber var nform)-    EGroup isMacro els -> eGroup isMacro formatting els+      (:[]) <$> withFormatting formatting (eText textType)+    ENumber var nform ->+      (:[]) <$> withFormatting formatting (eNumber var nform)+    EGroup isMacro els ->+      (:[]) <$> eGroup isMacro formatting els     EChoose chooseParts -> eChoose chooseParts     ELabel var termform pluralize ->-      eLabel var termform pluralize formatting+      (:[]) <$> eLabel var termform pluralize formatting     EDate var dateType mbShowDateParts dps ->-      eDate var dateType mbShowDateParts dps formatting+      (:[]) <$> eDate var dateType mbShowDateParts dps formatting     ENames vars namesFormat subst ->-      eNames vars namesFormat subst formatting+      (:[]) <$> eNames vars namesFormat subst formatting  withFormatting :: CiteprocOutput a                => Formatting -> Eval a (Output a) -> Eval a (Output a)@@ -1715,12 +1717,12 @@                                st)) $ eSubstitute els            return $              case res of-               Tagged TagNames{} _ -> formatted formatting [res]+               (Tagged TagNames{} _:_) -> formatted formatting res                -- important to have title (or whatever) tagged as                -- substituting for Names, for purposes of                -- disambiguation:                _ -> formatted formatting-                    [Tagged (TagNames "" namesFormat []) res]+                    [Tagged (TagNames "" namesFormat []) $ grouped res]          _ -> return NullOutput      else do         xs <- mapM (formatNames namesFormat nameFormat nameFormatting)@@ -1741,15 +1743,15 @@  eSubstitute :: CiteprocOutput a             => [Element a]-            -> Eval a (Output a)+            -> Eval a [Output a] eSubstitute els =   case els of-    [] -> return NullOutput+    [] -> return []     (e:es) -> do       res <- eElement e-      case res of-        NullOutput -> eSubstitute es-        _ -> return res+      case filter (/= NullOutput) res of+        [] -> eSubstitute es+        xs -> return xs  formatNames :: CiteprocOutput a             => NamesFormat@@ -2161,7 +2163,7 @@   -- calls at least one variable but all of the variables   -- it calls are empty.   VarCount oldVars oldNonempty <- gets stateVarCount-  xs <- mapM eElement els+  xs <- mconcat <$> mapM eElement els   VarCount newVars newNonempty <- gets stateVarCount   -- see   -- https://github.com/citation-style-language/documentation/blob/master/specification.rst#group@@ -2175,8 +2177,8 @@               else NullOutput  eChoose :: CiteprocOutput a-        => [(Match, [Condition], [Element a])] -> Eval a (Output a)-eChoose [] = return NullOutput+        => [(Match, [Condition], [Element a])] -> Eval a [Output a]+eChoose [] = return [] eChoose ((match, conditions, els):rest) = do   ref <- gets stateReference   label <- asks contextLabel@@ -2218,7 +2220,7 @@                    MatchAny  -> any testCondition                    MatchNone -> not . any testCondition) conditions   if matched-     then grouped <$> mapM eElement els+     then mconcat <$> mapM eElement els      else eChoose rest  
+ test/extra/issue19.txt view
@@ -0,0 +1,244 @@+>>===== MODE =====>>+bibliography+<<===== MODE =====<<+++++>>===== RESULT =====>>+<div class="csl-bib-body">+  <div class="csl-entry">Díaz-León, E. (2013). What Is Social Construction? Eur J Philos 1–16.</div>+  <div class="csl-entry">Díaz-León, E. (2015). In Defence of Historical Constructivism about Races. Ergo, an Open Access Journal of Philosophy <i>2</i>.</div>+  <div class="csl-entry">Díaz-León, E. (2016). &#60;i&#62;Wo&#62; as a Politically Significant Term: A Solution to the Puzzle. Hypatia 245–258.</div>+</div>+<<===== RESULT =====<<+++>>===== CSL =====>>+<?xml version="1.0" encoding="utf-8"?>+<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="in-text" default-locale="en-US" demote-non-dropping-particle="sort-only" page-range-format="expanded">+  <info>+    <title>Cell</title>+    <id>http://www.zotero.org/styles/cell</id>+    <link href="http://www.zotero.org/styles/cell" rel="self"/>+    <link href="http://www.cell.com/authors" rel="documentation"/>+    <author>+      <name>Adam Mark</name>+      <email>a.mark@uoguelph.ca</email>+    </author>+    <contributor>+      <name>Julian Onions</name>+      <email>julian.onions@gmail.com</email>+    </contributor>+    <contributor>+      <name>Aurimas Vinckevicius</name>+      <email>aurimas.dev@gmail.com</email>+    </contributor>+    <category citation-format="author-date"/>+    <category field="biology"/>+    <issn>0092-8674</issn>+    <eissn>1097-4172</eissn>+    <summary>The Cell journal style. Original by Julian Onions.</summary>+    <updated>2013-01-26T22:06:38+00:00</updated>+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>+  </info>+  <macro name="author-short">+    <names variable="author">+      <name form="short" and="text"/>+    </names>+  </macro>+  <macro name="author-count">+    <names variable="author">+      <name form="count"/>+    </names>+  </macro>+  <macro name="author">+    <names variable="author">+      <name name-as-sort-order="all" initialize-with="." and="text" delimiter-precedes-last="always"/>+    </names>+  </macro>+  <macro name="issued">+    <date variable="issued">+      <date-part name="year"/>+    </date>+  </macro>+  <macro name="publisher">+    <group prefix="(" delimiter=": " suffix=")">+      <text variable="publisher-place"/>+      <text variable="publisher"/>+    </group>+  </macro>+  <macro name="editor">+    <names variable="editor">+      <name initialize-with="." and="text" delimiter-precedes-last="always"/>+      <label form="short" prefix=", "/>+    </names>+  </macro>+  <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" collapse="year">+    <sort>+      <key macro="author-short" names-min="1" names-use-first="1"/>+      <key macro="author-count" names-min="3" names-use-first="3"/>+      <key macro="author" names-min="3" names-use-first="1"/>+      <key macro="issued"/>+      <key variable="title"/>+    </sort>+    <layout prefix="(" suffix=")" delimiter="; ">+      <group delimiter=", ">+        <text macro="author-short"/>+        <text macro="issued"/>+      </group>+    </layout>+  </citation>+  <bibliography et-al-min="11" et-al-use-first="10">+    <sort>+      <key macro="author-short" names-min="1" names-use-first="1"/>+      <key macro="author-count" names-min="3" names-use-first="3"/>+      <key macro="author" names-min="3" names-use-first="1"/>+      <key macro="issued"/>+    </sort>+    <layout suffix=".">+      <group delimiter=" ">+        <text macro="author"/>+        <text macro="issued" prefix="(" suffix=")."/>+        <choose>+          <if type="article article-magazine article-newspaper article-journal review" match="any">+            <text variable="title" suffix="."/>+            <text variable="container-title" form="short" text-case="title"/>+            <group delimiter=", ">+              <text variable="volume" font-style="italic"/>+              <text variable="page"/>+            </group>+          </if>+          <else-if type="chapter paper-conference" match="any">+            <text variable="title" suffix="."/>+            <text variable="container-title" prefix="In " suffix="," text-case="title"/>+            <text macro="editor"/>+            <text macro="publisher" suffix=","/>+            <label variable="page" form="short"/>+            <text variable="page"/>+          </else-if>+          <else-if type="thesis">+            <text variable="title" suffix="."/>+            <text variable="genre" suffix="."/>+            <text variable="publisher"/>+          </else-if>+          <else>+            <text variable="title"/>+            <text macro="publisher"/>+          </else>+        </choose>+      </group>+    </layout>+  </bibliography>+</style>+<<===== CSL =====<<+++++>>===== INPUT =====>>+[+  {+    "id": "diaz2013",+    "type": "article-journal",+    "title": "What Is Social Construction?",+    "container-title": "European Journal of Philosophy",+    "page": "1-16",+    "URL": "http://onlinelibrary.wiley.com/doi/10.1111/ejop.12033/abstract",+    "DOI": "10.1111/ejop.12033",+    "ISSN": "1468-0378",+    "language": "en",+    "author": [+      {+        "family": "Díaz-León",+        "given": "Esa"+      }+    ],+    "issued": {+      "date-parts": [+        [+          2013,+          5,+          1+        ]+      ]+    },+    "accessed": {+      "date-parts": [+        [+          2015,+          11,+          14+        ]+      ]+    },+    "container-title-short": "Eur J Philos"+  },+  {+    "id": "diaz2015",+    "type": "article-journal",+    "title": "In Defence of Historical Constructivism about Races",+    "container-title": "Ergo, an Open Access Journal of Philosophy",+    "volume": "2",+    "URL": "http://hdl.handle.net/2027/spo.12405314.0002.021",+    "DOI": "10.3998/ergo.12405314.0002.021",+    "ISSN": "2330-4014",+    "author": [+      {+        "family": "Díaz-León",+        "given": "Esa"+      }+    ],+    "issued": {+      "date-parts": [+        [+          2015+        ]+      ]+    }+  },+  {+    "id": "diaz2016",+    "type": "article-journal",+    "title": "<i>Wo> as a Politically Significant Term: A Solution to the Puzzle",+    "container-title": "Hypatia",+    "page": "245-258",+    "URL": "http://onlinelibrary.wiley.com.uaccess.univie.ac.at/doi/10.1111/hypa.12234/abstract",+    "DOI": "10.1111/hypa.12234",+    "ISSN": "1527-2001",+    "title-short": "<i>Woman</i> as a Politically Significant Term",+    "language": "en",+    "author": [+      {+        "family": "Díaz-León",+        "given": "Esa"+      }+    ],+    "issued": {+      "date-parts": [+        [+          2016,+          2,+          1+        ]+      ]+    },+    "accessed": {+      "date-parts": [+        [+          2016,+          2,+          18+        ]+      ]+    },+    "container-title-short": "Hypatia"+  }+]+<<===== INPUT =====<<+++>>===== VERSION =====>>+1.0+<<===== VERSION =====<<+