pandoc-citeproc 0.10.2.1 → 0.10.2.2
raw patch · 6 files changed
+226/−10 lines, 6 files
Files
- changelog +4/−0
- pandoc-citeproc.cabal +1/−1
- src/Text/CSL/Reference.hs +11/−6
- src/Text/CSL/Style.hs +4/−2
- stack.yaml +2/−1
- tests/isme.csl +204/−0
changelog view
@@ -1,3 +1,7 @@+pandoc-citeproc (0.10.2.2)++ * Fix overlapping instances with aeson-1.0.2.1 (#263).+ pandoc-citeproc (0.10.2.1) * Allow pandoc 1.18.x.
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name: pandoc-citeproc-version: 0.10.2.1+version: 0.10.2.2 cabal-version: >= 1.12 synopsis: Supports using pandoc with citeproc
src/Text/CSL/Reference.hs view
@@ -1,7 +1,13 @@ {-# LANGUAGE GeneralizedNewtypeDeriving, PatternGuards, OverloadedStrings, DeriveDataTypeable, ExistentialQuantification, FlexibleInstances, ScopedTypeVariables, GeneralizedNewtypeDeriving, IncoherentInstances,- DeriveGeneric #-}+ DeriveGeneric, CPP #-}+#if MIN_VERSION_base(4,8,0)+#define OVERLAPS {-# OVERLAPPING #-}+#else+{-# LANGUAGE OverlappingInstances #-}+#define OVERLAPS+#endif ----------------------------------------------------------------------------- -- | -- Module : Text.CSL.Reference@@ -161,7 +167,8 @@ , "circa" &= T.pack (if circa r then "1" else "") ] -instance FromJSON [RefDate] where+instance OVERLAPS+ FromJSON [RefDate] where parseJSON (Array xs) = mapM parseJSON $ V.toList xs parseJSON (Object v) = do dateParts <- v .:? "date-parts"@@ -196,7 +203,8 @@ (Just y, Nothing, Nothing) -> [y] _ -> [] -instance ToJSON [RefDate] where+instance OVERLAPS+ ToJSON [RefDate] where toJSON [] = Array V.empty toJSON xs = object' $ case filter (not . null) (map toDatePart xs) of@@ -204,9 +212,6 @@ dps -> (["date-parts" .= dps ] ++ ["circa" .= (1 :: Int) | or (map circa xs)] ++ ["season" .= s | s <- map season xs, s /= mempty])---- instance ToJSON [RefDate]--- toJSON xs = Array (V.fromList $ map toJSON xs) setCirca :: Bool -> RefDate -> RefDate setCirca circa' rd = rd{ circa = circa' }
src/Text/CSL/Style.hs view
@@ -702,7 +702,8 @@ v .:? "cite-hash" .!= 0 parseJSON _ = fail "Could not parse Cite" -instance FromJSON [[Cite]] where+instance OVERLAPS+ FromJSON [[Cite]] where parseJSON (Array v) = mapM parseJSON $ V.toList v parseJSON _ = return [] @@ -904,7 +905,8 @@ ] ++ ["comma-suffix" .= commaSuffix agent | nameSuffix agent /= mempty] ++ ["parse-names" .= True | parseNames agent ] -instance FromJSON [Agent] where+instance OVERLAPS+ FromJSON [Agent] where parseJSON (Array xs) = mapM parseJSON $ V.toList xs parseJSON (Object v) = (:[]) `fmap` parseJSON (Object v) parseJSON _ = fail "Could not parse [Agent]"
stack.yaml view
@@ -14,4 +14,5 @@ - texmath-0.8.6.6 - doctemplates-0.1.0.2 - pandoc-types-1.17.0.4-resolver: lts-7.4+- aeson-1.0.2.1+resolver: lts-7.5
+ tests/isme.csl view
@@ -0,0 +1,204 @@+<?xml version="1.0" encoding="utf-8"?>+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">+ <info>+ <title>The ISME Journal</title>+ <id>http://www.zotero.org/styles/the-isme-journal</id>+ <link href="http://www.zotero.org/styles/the-isme-journal" rel="self"/>+ <link href="http://mts-isme.nature.com/cgi-bin/main.plex?form_type=display_auth_instructions" rel="documentation"/>+ <author>+ <name>Jessica Leigh</name>+ <email>blackwednesday@gmail.com</email>+ </author>+ <category citation-format="author-date"/>+ <category field="biology"/>+ <issn>1751-7362</issn>+ <eissn>1751-7370</eissn>+ <summary>The ISME Journal style, which is not the same as for Nature</summary>+ <updated>2014-12-02T15:48:05+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="editor">+ <names variable="editor">+ <name and="symbol" delimiter=", " name-as-sort-order="all" sort-separator=", " initialize-with="">+ <name-part name="family" text-case="capitalize-first"/>+ <name-part name="given" text-case="capitalize-first"/>+ </name>+ <label form="short" prefix=" (" strip-periods="true" suffix=")"/>+ </names>+ </macro>+ <macro name="series-editor">+ <names variable="original-author">+ <label form="short" text-case="capitalize-first" suffix=" "/>+ <name and="symbol" delimiter=", "/>+ </names>+ </macro>+ <macro name="author">+ <names variable="author">+ <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always" initialize-with=""/>+ <label form="short" prefix=" (" strip-periods="true" suffix=")"/>+ <et-al font-style="italic"/>+ <substitute>+ <names variable="editor"/>+ <names variable="translator"/>+ </substitute>+ </names>+ </macro>+ <macro name="author-short">+ <names variable="author">+ <name form="short" and="text" delimiter=", " delimiter-precedes-last="never"/>+ <et-al font-style="italic"/>+ <substitute>+ <names variable="editor"/>+ <names variable="translator"/>+ </substitute>+ </names>+ </macro>+ <macro name="access">+ <choose>+ <if variable="page" match="none">+ <choose>+ <if variable="DOI">+ <text variable="DOI" prefix="doi:"/>+ </if>+ <else-if variable="URL">+ <text variable="URL"/>+ <group prefix=" (" suffix=")">+ <text term="accessed" text-case="capitalize-first" suffix=" "/>+ <date variable="accessed">+ <date-part name="month" suffix=" "/>+ <date-part name="day" suffix=", "/>+ <date-part name="year"/>+ </date>+ </group>+ </else-if>+ </choose>+ </if>+ </choose>+ </macro>+ <macro name="title">+ <choose>+ <if type="thesis">+ <text variable="title"/>+ </if>+ <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">+ <text variable="title"/>+ </else-if>+ <else>+ <text variable="title"/>+ </else>+ </choose>+ </macro>+ <macro name="publisher">+ <group delimiter=": ">+ <text variable="publisher"/>+ <text variable="publisher-place"/>+ </group>+ </macro>+ <macro name="year-date">+ <date variable="issued">+ <date-part name="year"/>+ </date>+ </macro>+ <macro name="day-month">+ <date variable="issued">+ <date-part name="month"/>+ <date-part name="day" prefix=" "/>+ </date>+ </macro>+ <macro name="page">+ <label variable="page" suffix=" " form="short"/>+ <text variable="page"/>+ </macro>+ <macro name="edition">+ <choose>+ <if is-numeric="edition">+ <group delimiter=" ">+ <number variable="edition" form="ordinal"/>+ <text term="edition" form="short"/>+ </group>+ </if>+ <else>+ <text variable="edition" suffix="."/>+ </else>+ </choose>+ </macro>+ <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year">+ <layout prefix="(" suffix=")" delimiter="; ">+ <group delimiter=", ">+ <text macro="author-short"/>+ <text macro="year-date"/>+ <text variable="locator"/>+ </group>+ </layout>+ </citation>+ <bibliography hanging-indent="false" et-al-min="7" et-al-use-first="2">+ <sort>+ <key macro="author"/>+ <key variable="title"/>+ </sort>+ <layout suffix=".">+ <group delimiter=" ">+ <text macro="author" suffix="."/>+ <text macro="year-date" prefix="(" suffix=")."/>+ </group>+ <choose>+ <if type="article-newspaper article-magazine" match="any">+ <group delimiter=" ">+ <text macro="title" prefix=" " suffix="."/>+ </group>+ <group prefix=" " delimiter=", ">+ <text variable="container-title"/>+ <text macro="day-month"/>+ <text variable="edition"/>+ </group>+ </if>+ <else-if type="thesis">+ <text macro="title" prefix=" " suffix="."/>+ <group prefix=" " delimiter=", ">+ <text macro="edition"/>+ <text macro="editor" suffix="."/>+ <text variable="genre"/>+ <text macro="publisher"/>+ </group>+ </else-if>+ <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">+ <group delimiter=" ">+ <text macro="title" prefix=" " suffix="."/>+ <text macro="edition"/>+ <text macro="publisher"/>+ </group>+ </else-if>+ <else-if type="chapter paper-conference" match="any">+ <group delimiter=" ">+ <text macro="title" prefix=" " suffix="."/>+ <group prefix="In:" delimiter=", " suffix=".">+ <text variable="container-title" font-style="italic"/>+ <group delimiter=" ">+ <text macro="editor" prefix=" "/>+ <text variable="collection-title"/>+ <text variable="volume" prefix="Vol. "/>+ <text macro="series-editor"/>+ </group>+ <text macro="publisher" prefix=" "/>+ <text macro="page" prefix=" "/>+ </group>+ </group>+ </else-if>+ <else>+ <group suffix=".">+ <text macro="title" prefix=" "/>+ <text macro="editor" prefix=" "/>+ </group>+ <group prefix=" " suffix="." delimiter=" ">+ <text variable="container-title" form="short" strip-periods="true" font-style="italic"/>+ <group delimiter=":">+ <text variable="volume" font-weight="bold"/>+ <text variable="page"/>+ </group>+ </group>+ </else>+ </choose>+ <text prefix=" " macro="access" suffix="."/>+ </layout>+ </bibliography>+</style>