packages feed

pandoc-citeproc 0.14.4 → 0.14.5

raw patch · 7 files changed

+40/−233 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog view
@@ -1,3 +1,12 @@+pandoc-citeproc (0.14.5)++  * Add flag to silence all warnings (#350, Albert Krewinkel).+    Introduce new command line flag `--quiet`/`-q` which can be used to+    suppress all warnings.+  * Use HTTPS for PMID and PMCID hyperlinks (#349, Daniel Himmelstein.)+  * Fix pattern match in do block that could fail, so pandoc-citeproc+    compiles with ghc 8.6.+ pandoc-citeproc (0.14.4)    * Allow latest aeson (Adam Bergmark, #336).
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name:               pandoc-citeproc-version:            0.14.4+version:            0.14.5 cabal-version:      1.12 synopsis:           Supports using pandoc with citeproc 
pandoc-citeproc.hs view
@@ -77,7 +77,7 @@                            [] -> UTF8.getContents                            xs -> mconcat <$> mapM UTF8.readFile xs          readBiblioString (const True) bibformat bibstring >>=-           warnDuplicateKeys >>=+           (if Quiet `elem` flags then return else warnDuplicateKeys) >>=            if Bib2YAML `elem` flags               then outputYamlBlock .                    B8.intercalate (B.singleton 10) .@@ -86,7 +86,7 @@                 encodePretty' defConfig{ confIndent = Spaces 2                                        , confCompare = compare                                        , confNumFormat = Generic }-       else toJSONFilter doCites+       else toJSONFilter (doCites (Quiet `elem` flags))  formatFromExtension :: FilePath -> Maybe BibFormat formatFromExtension = readFormat . dropWhile (=='.') . takeExtension@@ -114,11 +114,11 @@         go _            = Nothing  -doCites :: Pandoc -> IO Pandoc-doCites doc = do+doCites :: Bool -> Pandoc -> IO Pandoc+doCites beQuiet doc = do   doc' <- processCites' doc   let warnings = query findWarnings doc'-  mapM_ (UTF8.hPutStrLn stderr) warnings+  unless beQuiet $ mapM_ (UTF8.hPutStrLn stderr) warnings   return doc'  findWarnings :: Inline -> [String]@@ -137,6 +137,7 @@     | Format String     | Bib2YAML     | Bib2JSON+    | Quiet   deriving (Ord, Eq, Show)  options :: [OptDescr Option]@@ -147,6 +148,7 @@   , 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"+  , Option ['q'] ["quiet"] (NoArg Quiet) "silence all warnings"   , Option ['f'] ["format"] (ReqArg Format "FORMAT") "bibliography format"   ] 
src/Text/CSL/Eval.hs view
@@ -241,11 +241,11 @@                "pmid"        -> getStringVar "pmid" >>= \d ->                                 if null d                                    then return []-                                   else return [Output [OPan [Link nullAttr [Str d] ("http://www.ncbi.nlm.nih.gov/pubmed/" ++ d, "")]] fm]+                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pubmed/" ++ d, "")]] fm]                "pmcid"       -> getStringVar "pmcid" >>= \d ->                                 if null d                                    then return []-                                   else return [Output [OPan [Link nullAttr [Str d] ("http://www.ncbi.nlm.nih.gov/pmc/articles/" ++ d, "")]] fm]+                                   else return [Output [OPan [Link nullAttr [Str d] ("https://www.ncbi.nlm.nih.gov/pmc/articles/" ++ d, "")]] fm]                _ -> do (opts, as) <- gets (env >>> options &&& abbrevs)                        r <- getVar []                               (getFormattedValue opts as f fm s) s
src/Text/CSL/Eval/Date.hs view
@@ -54,22 +54,24 @@   case f of     NoFormDate -> outputList fm dl .                   concatMap (formatDate em k tm dp) <$> mapM getDateVar s-    _          -> do Date _ _ lfm ldl ldp _ <- getDate f-                     let go dps = return . outputList (updateFM fm lfm) (if ldl /= [] then ldl else dl) .-                                  concatMap (formatDate em k tm dps)-                         update l x@(DatePart a b c d) =-                             case filter ((==) a . dpName) l of-                               (DatePart _ b' c' d':_) -> DatePart a (updateS  b b')-                                                                     (updateS  c c')-                                                                     (updateFM d d')-                               _                       -> x-                         updateDP = map (update dp) ldp-                         date     = mapM getDateVar s-                     case dp' of-                       "year-month" -> go (filter ((/=) "day"  . dpName) updateDP) =<< date-                       "year"       -> go (filter ((==) "year" . dpName) updateDP) =<< date-                       _            -> go                                updateDP  =<< date-+    _          -> do res <- getDate f+                     case res of+                       Date _ _ lfm ldl ldp _ -> do+                         let go dps = return . outputList (updateFM fm lfm) (if ldl /= [] then ldl else dl) .+                                      concatMap (formatDate em k tm dps)+                             update l x@(DatePart a b c d) =+                                 case filter ((==) a . dpName) l of+                                   (DatePart _ b' c' d':_) -> DatePart a (updateS  b b')+                                                                         (updateS  c c')+                                                                         (updateFM d d')+                                   _                       -> x+                             updateDP = map (update dp) ldp+                             date     = mapM getDateVar s+                         case dp' of+                           "year-month" -> go (filter ((/=) "day"  . dpName) updateDP) =<< date+                           "year"       -> go (filter ((==) "year" . dpName) updateDP) =<< date+                           _            -> go                                updateDP  =<< date+                       _ -> return [] evalDate _ = return []  getDate :: DateForm -> State EvalState Element
stack.yaml view
@@ -15,8 +15,10 @@ - rfc5051-0.1.0.3 - hs-bibutils-6.5.0.0 - yaml-0.9.0+- hslua-1.0.0+- hslua-module-text-0.2.0 - github: jgm/pandoc-  commit: 889254e1d5c7b683b93f623207347a773e25776b+  commit: c292a0bae3167570511543d3d96a0385b9b5f2d8 ghc-options:    "$locals": -fhide-source-paths resolver: lts-12.0
− tests/jats.csl
@@ -1,208 +0,0 @@-<?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>-