summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnMacFarlane <>2018-01-19 07:37:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-01-19 07:37:00 (GMT)
commitbcb70ab799002b0b54703dd5dd0ce2998fb9f408 (patch)
treeca114f285be4bd8834142fc98007217a5118804a
parent93e7168ba280b3338f3715d67c516b16c15ebce5 (diff)
version 0.140.14
-rw-r--r--changelog13
-rw-r--r--pandoc-citeproc.cabal2
-rw-r--r--src/Text/CSL/Eval/Date.hs6
-rw-r--r--src/Text/CSL/Reference.hs127
-rw-r--r--tests/jats.csl208
-rw-r--r--tests/modern-language-association-7th-edition.csl460
6 files changed, 569 insertions, 247 deletions
diff --git a/changelog b/changelog
index b634545..bc82ba8 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,16 @@
+pandoc-citeproc (0.14)
+
+ * Fix non-numerical season parsing in RefDate (#316).
+ These changes allow non-numerical dates to be handled.
+ API changes: season in RefDate is now Maybe Season instead
+ of Maybe Int. Text.CSL.Reference exports Season(..) and
+ seasonToInt.
+
+ * Fix parsing of season field in DateRef object.
+
+ * Treat date-part with all 0s the same as empty.
+ This is used to indicate an open-ended range.
+
pandoc-citeproc (0.13.0.1)
* Suppress empty footnotes.
diff --git a/pandoc-citeproc.cabal b/pandoc-citeproc.cabal
index 9635e81..9152213 100644
--- a/pandoc-citeproc.cabal
+++ b/pandoc-citeproc.cabal
@@ -1,5 +1,5 @@
name: pandoc-citeproc
-version: 0.13.0.1
+version: 0.14
cabal-version: >= 1.12
synopsis: Supports using pandoc with citeproc
diff --git a/src/Text/CSL/Eval/Date.hs b/src/Text/CSL/Eval/Date.hs
index 94d3f5e..f4ec293 100644
--- a/src/Text/CSL/Eval/Date.hs
+++ b/src/Text/CSL/Eval/Date.hs
@@ -127,7 +127,11 @@ formatDate em k tm dp date
formatDatePart (RefDate y m e d o _) (DatePart n f _ fm)
| "year" <- n, Just y' <- y = return $ OYear (formatYear f y') k fm
| "month" <- n, Just m' <- m = output fm (formatMonth f fm m')
- | "month" <- n, Just e' <- e = output fm $ term f (printf "season-%02d" e')
+ | "month" <- n, Just e' <- e =
+ case e' of
+ RawSeason s -> [OStr s fm]
+ _ -> output fm $ term f (printf "season-%02d"
+ $ fromMaybe 0 $ seasonToInt e')
| "day" <- n, Just d' <- d = output fm (formatDay f m d')
| "year" <- n, o /= mempty = output fm (unLiteral o)
| otherwise = []
diff --git a/src/Text/CSL/Reference.hs b/src/Text/CSL/Reference.hs
index e45dee2..9bec268 100644
--- a/src/Text/CSL/Reference.hs
+++ b/src/Text/CSL/Reference.hs
@@ -35,6 +35,8 @@ module Text.CSL.Reference ( Literal(..)
, fromValue
, isValueSet
, Empty(..)
+ , Season(..)
+ , seasonToInt
, RefDate(..)
, handleLiteral
, toDatePart
@@ -62,7 +64,7 @@ import Data.Char (isDigit, toLower)
import Data.Either (lefts, rights)
import Data.Generics hiding (Generic)
import qualified Data.HashMap.Strict as H
-import Data.List (elemIndex, intercalate)
+import Data.List (elemIndex)
import Data.List.Split (splitWhen)
import Data.Maybe (fromMaybe, isNothing)
import Data.String
@@ -132,10 +134,55 @@ isValueSet val
data Empty = Empty deriving ( Typeable, Data, Generic )
+data Season = Spring | Summer | Autumn | Winter | RawSeason String
+ deriving (Show, Read, Eq, Typeable, Data, Generic)
+
+instance ToYaml Season where
+ toYaml Spring = toYaml (1 :: Int)
+ toYaml Summer = toYaml (2 :: Int)
+ toYaml Autumn = toYaml (3 :: Int)
+ toYaml Winter = toYaml (4 :: Int)
+ toYaml (RawSeason s) = toYaml (T.pack s)
+
+seasonToInt :: Season -> Maybe Int
+seasonToInt Spring = Just 1
+seasonToInt Summer = Just 2
+seasonToInt Autumn = Just 3
+seasonToInt Winter = Just 4
+seasonToInt _ = Nothing
+
+intToSeason :: Int -> Maybe Season
+intToSeason 1 = Just Spring
+intToSeason 2 = Just Summer
+intToSeason 3 = Just Autumn
+intToSeason 4 = Just Winter
+intToSeason _ = Nothing
+
+pseudoMonthToSeason :: Int -> Maybe Season
+pseudoMonthToSeason n
+ | n >= 13 && n <= 16 = intToSeason (n - 12)
+ | n >= 21 && n <= 24 = intToSeason (n - 20)
+ | otherwise = Nothing
+
+-- | Parse JSON value as Maybe Season.
+parseMaybeSeason :: Maybe Aeson.Value -> Parser (Maybe Season)
+parseMaybeSeason Nothing = return Nothing
+parseMaybeSeason (Just x) = do
+ mbn <- parseMaybeInt (Just x) <|> return Nothing
+ case mbn of
+ Just n -> case intToSeason n of
+ Just s -> return $ Just s
+ Nothing -> fail $ "Could not read season: " ++ show n
+ Nothing -> do
+ s <- parseString x
+ if null s
+ then return Nothing
+ else return $ Just $ RawSeason s
+
data RefDate =
RefDate { year :: Maybe Int
, month :: Maybe Int
- , season :: Maybe Int
+ , season :: Maybe Season
, day :: Maybe Int
, other :: Literal
, circa :: Bool
@@ -158,20 +205,13 @@ instance FromJSON RefDate where
Error e -> fail $ "Could not parse RefDate: " ++ e
_ -> fail "Could not parse RefDate"
where handlePseudoMonths r =
- case month r of
- Just 13 -> r{ month = Nothing, season = Just 1 }
- Just 14 -> r{ month = Nothing, season = Just 2 }
- Just 15 -> r{ month = Nothing, season = Just 3 }
- Just 16 -> r{ month = Nothing, season = Just 4 }
- Just 21 -> r{ month = Nothing, season = Just 1 }
- Just 22 -> r{ month = Nothing, season = Just 2 }
- Just 23 -> r{ month = Nothing, season = Just 3 }
- Just 24 -> r{ month = Nothing, season = Just 4 }
- _ -> r
+ case month r >>= pseudoMonthToSeason of
+ Just s -> r{ month = Nothing, season = Just s }
+ Nothing -> r
parseJSON (Object v) = RefDate <$>
(v .:? "year" >>= parseMaybeInt) <*>
(v .:? "month" >>= parseMaybeInt) <*>
- (v .:? "season" >>= parseMaybeInt) <*>
+ (v .:? "season" >>= parseMaybeSeason) <*>
(v .:? "day" >>= parseMaybeInt) <*>
v .:? "literal" .!= "" <*>
((v .: "circa" >>= parseBool) <|> pure False)
@@ -205,7 +245,7 @@ instance OVERLAPS
raw' <- v .:? "raw"
dateParts <- v .:? "date-parts"
circa' <- (v .: "circa" >>= parseBool) <|> pure False
- season' <- v .:? "season"
+ season' <- v .:? "season" >>= parseMaybeSeason
case dateParts of
Just (Array xs) | isNothing raw' && not (V.null xs)
-> mapM (fmap (setCirca circa' .
@@ -219,11 +259,33 @@ instance OVERLAPS
instance OVERLAPS
ToJSON [RefDate] where
toJSON [] = Array V.empty
- toJSON xs = object' $
- case filter (not . null) (map toDatePart xs) of
- [] -> ["literal" .= intercalate "; " (map (unLiteral . other) xs)]
- dps -> "date-parts" .= dps :
- ["circa" .= (1 :: Int) | any circa xs]
+ toJSON xs = toJSON $ map toJSONDate xs
+
+toJSONDate :: RefDate -> Aeson.Value
+toJSONDate rd = object' $
+ [ "date-parts" .= dateparts | not (emptyDatePart dateparts) ] ++
+ ["circa" .= (1 :: Int) | circa rd] ++
+ (case season rd of
+ Just (RawSeason s) -> ["season" .= s]
+ _ -> []) ++
+ (case other rd of
+ Literal l | not (null l) -> ["literal" .= l]
+ _ -> [])
+ where dateparts = toDatePart rd
+ emptyDatePart [] = True
+ emptyDatePart xs = all (== 0) xs
+
+toDatePart :: RefDate -> [Int]
+toDatePart refdate =
+ case (year refdate, month refdate
+ `mplus`
+ ((12+) <$> (season refdate >>= seasonToInt)),
+ day refdate) of
+ (Just (y :: Int), Just (m :: Int), Just (d :: Int))
+ -> [y, m, d]
+ (Just y, Just m, Nothing) -> [y, m]
+ (Just y, Nothing, Nothing) -> [y]
+ _ -> []
-- Zotero doesn't properly support date ranges, so a common
@@ -238,23 +300,11 @@ handleLiteral d@(RefDate Nothing Nothing Nothing Nothing (Literal xs) b)
_ -> [d]
handleLiteral d = [d]
-toDatePart :: RefDate -> [Int]
-toDatePart refdate =
- case (year refdate, month refdate
- `mplus`
- ((+ 12) <$> season refdate),
- day refdate) of
- (Just (y :: Int), Just (m :: Int), Just (d :: Int))
- -> [y, m, d]
- (Just y, Just m, Nothing) -> [y, m]
- (Just y, Nothing, Nothing) -> [y]
- _ -> []
-
setCirca :: Bool -> RefDate -> RefDate
setCirca circa' rd = rd{ circa = circa' }
-setSeason :: Maybe Int -> RefDate -> RefDate
-setSeason season' rd = rd{ season = season' }
+setSeason :: Season -> RefDate -> RefDate
+setSeason season' rd = rd{ season = Just season' }
data RefType
= NoType
@@ -934,8 +984,8 @@ isoDate = P.try $ do
(m,s) <- case m' >>= safeRead of
Just (n::Int)
| n >= 1 && n <= 12 -> return (Just n, Nothing)
- | n >= 13 && n <= 16 -> return (Nothing, Just (n - 12))
- | n >= 21 && n <= 24 -> return (Nothing, Just (n - 20))
+ | n >= 13 && n <= 16 -> return (Nothing, pseudoMonthToSeason n)
+ | n >= 21 && n <= 24 -> return (Nothing, pseudoMonthToSeason n)
Nothing | isNothing m' -> return (Nothing, Nothing)
_ -> fail "Improper month"
d <- P.option Nothing $ safeRead <$> P.try (P.char '-' >> P.many1 P.digit)
@@ -971,8 +1021,11 @@ rawDateOld = do
let pseason = P.try $ do
xs <- P.many1 P.letter
case elemIndex (map toLower $ take 3 xs) seasons of
- Nothing -> fail "Improper season"
- Just n -> return (Just (n+1))
+ Just 0 -> return (Just Spring)
+ Just 1 -> return (Just Summer)
+ Just 2 -> return (Just Autumn)
+ Just 3 -> return (Just Winter)
+ _ -> fail "Improper season"
let pday = P.try $ do
xs <- P.many1 P.digit
case safeRead xs of
diff --git a/tests/jats.csl b/tests/jats.csl
deleted file mode 100644
index 6487286..0000000
--- a/tests/jats.csl
+++ /dev/null
@@ -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>
-
diff --git a/tests/modern-language-association-7th-edition.csl b/tests/modern-language-association-7th-edition.csl
new file mode 100644
index 0000000..c2fc292
--- /dev/null
+++ b/tests/modern-language-association-7th-edition.csl
@@ -0,0 +1,460 @@
+<?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">
+ <info>
+ <title>Modern Language Association 7th edition</title>
+ <title-short>MLA</title-short>
+ <id>http://www.zotero.org/styles/modern-language-association-7th-edition</id>
+ <link href="http://www.zotero.org/styles/modern-language-association-7th-edition" rel="self"/>
+ <link href="http://owl.english.purdue.edu/owl/section/2/11/" rel="documentation"/>
+ <author>
+ <name>Ilouise S. Bradford</name>
+ <email>isbradford@gmail.com</email>
+ </author>
+ <contributor>
+ <name>Sarah Ficke</name>
+ <email>sficke@email.unc.edu</email>
+ </contributor>
+ <contributor>
+ <name>Sebastian Karcher</name>
+ <email>karcher@u.northwestern.edu</email>
+ </contributor>
+ <contributor>
+ <name>Christian Werthschulte</name>
+ <email>Christian.Werthschulte@rub.de</email>
+ </contributor>
+ <contributor>
+ <name>Simon Kornblith</name>
+ <email>simon@simonster.com</email>
+ </contributor>
+ <contributor>
+ <name>James Johnston</name>
+ <email>thejamesjohnston@gmail.com</email>
+ </contributor>
+ <category citation-format="author"/>
+ <category field="generic-base"/>
+ <summary>This style adheres to the MLA 7th edition handbook and contains modifications to these types of sources: e-mail, forum posts, interviews, manuscripts, maps, presentations, TV broadcasts, and web pages.</summary>
+ <updated>2017-04-27T18:03:35+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>
+ <locale xml:lang="en">
+ <terms>
+ <term name="month-01" form="short">Jan.</term>
+ <term name="month-02" form="short">Feb.</term>
+ <term name="month-03" form="short">Mar.</term>
+ <term name="month-04" form="short">Apr.</term>
+ <term name="month-05" form="short">May</term>
+ <term name="month-06" form="short">June</term>
+ <term name="month-07" form="short">July</term>
+ <term name="month-08" form="short">Aug.</term>
+ <term name="month-09" form="short">Sept.</term>
+ <term name="month-10" form="short">Oct.</term>
+ <term name="month-11" form="short">Nov.</term>
+ <term name="month-12" form="short">Dec.</term>
+ <term name="volume" form="short">
+ <single>Vol.</single>
+ <multiple>vols</multiple>
+ </term>
+ <term name="edition" form="short">ed</term>
+ <term name="editor" form="verb-short">ed.</term>
+ <term name="translator" form="verb-short">trans.</term>
+ <term name="translator" form="short">trans.</term>
+ </terms>
+ </locale>
+ <macro name="editor-translator">
+ <names variable="editor translator" delimiter=". ">
+ <label form="verb-short" text-case="capitalize-first" suffix=" "/>
+ <name and="text" delimiter=", "/>
+ </names>
+ </macro>
+ <macro name="author">
+ <names variable="author">
+ <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
+ <label form="short" prefix=", "/>
+ <substitute>
+ <names variable="editor"/>
+ <names variable="translator"/>
+ <text macro="title"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="author-short">
+ <names variable="author">
+ <name form="short" and="text" delimiter=", " initialize-with=". "/>
+ <substitute>
+ <names variable="editor"/>
+ <names variable="translator"/>
+ <text macro="title-short"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="access">
+ <group delimiter=" ">
+ <date variable="accessed">
+ <date-part name="day" suffix=" "/>
+ <date-part name="month" form="short" suffix=" "/>
+ <date-part name="year"/>
+ </date>
+ </group>
+ </macro>
+ <macro name="issued-full-date">
+ <choose>
+ <if variable="issued">
+ <date variable="issued">
+ <date-part name="day" suffix=" "/>
+ <date-part name="month" form="short" suffix=" " strip-periods="false"/>
+ <date-part name="year"/>
+ </date>
+ </if>
+ <else>
+ <text term="no date" form="short"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="medium">
+ <choose>
+ <if type="motion_picture">
+ <choose>
+ <if variable="medium">
+ <text variable="medium" prefix=" "/>
+ </if>
+ <else>
+ <text value="Film" prefix=" "/>
+ </else>
+ </choose>
+ </if>
+ <else-if type="broadcast">
+ <choose>
+ <if variable="medium">
+ <text variable="medium" prefix=" "/>
+ </if>
+ <else>
+ <text value="Television" prefix=" "/>
+ </else>
+ </choose>
+ </else-if>
+ <else-if type="manuscript">
+ <text value=""/>
+ </else-if>
+ <else-if type="personal_communication" match="any">
+ <text value="" prefix=" "/>
+ </else-if>
+ <else-if type="speech" match="any">
+ <text value=""/>
+ </else-if>
+ <else-if type="interview">
+ <text variable="medium" prefix=" "/>
+ </else-if>
+ <else-if type="song">
+ <choose>
+ <if variable="medium">
+ <text variable="medium" prefix=" "/>
+ </if>
+ <else>
+ <text value="Audio Recording" prefix=" "/>
+ </else>
+ </choose>
+ </else-if>
+ <else-if type="graphic" variable="medium" match="all">
+ <text variable="medium" prefix=" "/>
+ </else-if>
+ <else>
+ <choose>
+ <if variable="URL DOI" match="any">
+ <text variable="source" prefix=" " suffix="." font-style="italic"/>
+ <group>
+ <text value="Web." prefix=" "/>
+ </group>
+ <text prefix=" " suffix="." macro="access"/>
+ </if>
+ <else>
+ <text value="Print" prefix=" "/>
+ </else>
+ </choose>
+ </else>
+ </choose>
+ </macro>
+ <macro name="title">
+ <choose>
+ <if type="bill book graphic legal_case legislation manuscript motion_picture report song" match="any">
+ <text variable="title" font-style="italic" text-case="title"/>
+ </if>
+ <else-if type="interview personal_communication" match="any">
+ <text variable="title" text-case="title" quotes="false"/>
+ </else-if>
+ <else>
+ <text variable="title" text-case="title" quotes="true"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="title-short">
+ <choose>
+ <if type="bill book graphic legal_case legislation manuscript motion_picture report song" match="any">
+ <text variable="title" text-case="title" form="short" font-style="italic"/>
+ </if>
+ <else>
+ <text variable="title" text-case="title" form="short" quotes="true"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="pages">
+ <choose>
+ <if variable="page">
+ <text variable="page"/>
+ </if>
+ <else-if type="personal_communication interview" match="any">
+ <text value=""/>
+ </else-if>
+ <else>
+ <text value="n. pag"/>
+ </else>
+ </choose>
+ </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"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="volume">
+ <choose>
+ <if is-numeric="volume">
+ <group delimiter=" ">
+ <text term="volume" form="short" strip-periods="false"/>
+ <number variable="volume"/>
+ </group>
+ </if>
+ <else>
+ <text variable="volume"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="number-of-volumes-only">
+ <choose>
+ <if variable="volume" match="none">
+ <choose>
+ <if is-numeric="number-of-volumes">
+ <group delimiter=" ">
+ <number variable="number-of-volumes"/>
+ <text term="volume" form="short" plural="true" strip-periods="true"/>
+ </group>
+ </if>
+ <else>
+ <text variable="number-of-volumes"/>
+ </else>
+ </choose>
+ </if>
+ </choose>
+ </macro>
+ <macro name="number-of-volumes-optional">
+ <choose>
+ <if variable="volume">
+ <choose>
+ <if is-numeric="number-of-volumes">
+ <group delimiter=" ">
+ <number variable="number-of-volumes"/>
+ <text term="volume" form="short" plural="true" strip-periods="true"/>
+ </group>
+ </if>
+ <else>
+ <text variable="number-of-volumes"/>
+ </else>
+ </choose>
+ </if>
+ </choose>
+ </macro>
+ <macro name="collection-title">
+ <text variable="collection-title" text-case="title" prefix=" "/>
+ </macro>
+ <macro name="collection-number">
+ <text variable="collection-number" prefix=" " suffix="."/>
+ </macro>
+ <macro name="publisher">
+ <choose>
+ <if variable="publisher">
+ <text variable="publisher"/>
+ </if>
+ <else>
+ <text value="N.p."/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="publisher-year">
+ <group delimiter=", ">
+ <group delimiter=": ">
+ <text variable="publisher-place"/>
+ <text macro="publisher"/>
+ </group>
+ <date variable="issued">
+ <date-part name="year"/>
+ </date>
+ </group>
+ </macro>
+ <citation et-al-min="2" et-al-use-first="1" disambiguate-add-names="true" disambiguate-add-givenname="true">
+ <layout prefix="(" suffix=")" delimiter="; ">
+ <group delimiter=" ">
+ <choose>
+ <if variable="author editor translator" match="any">
+ <group delimiter=", ">
+ <text macro="author-short"/>
+ <choose>
+ <if disambiguate="true">
+ <text macro="title-short"/>
+ </if>
+ </choose>
+ </group>
+ </if>
+ <else>
+ <text macro="title-short"/>
+ </else>
+ </choose>
+ <text variable="locator"/>
+ </group>
+ </layout>
+ </citation>
+ <bibliography hanging-indent="true" et-al-min="4" et-al-use-first="1" line-spacing="2" entry-spacing="0" subsequent-author-substitute="---">
+ <sort>
+ <key macro="author"/>
+ <key variable="title"/>
+ </sort>
+ <layout suffix=".">
+ <text macro="author" suffix="."/>
+ <text macro="title" prefix=" " suffix="."/>
+ <choose>
+ <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
+ <text macro="editor-translator" prefix=" " suffix="."/>
+ <text macro="edition" prefix=" " suffix="."/>
+ <text macro="volume" prefix=" " suffix="."/>
+ <text macro="number-of-volumes-only" prefix=" " suffix="."/>
+ <text macro="publisher-year" prefix=" " suffix="."/>
+ </if>
+ <else-if type="chapter paper-conference" match="any">
+ <group>
+ <text variable="container-title" text-case="title" font-style="italic" prefix=" " suffix="."/>
+ <text macro="editor-translator" prefix=" " suffix="."/>
+ <text macro="edition" prefix=" " suffix="."/>
+ <text macro="volume" prefix=" " suffix="."/>
+ <text macro="number-of-volumes-only" prefix=" " suffix="."/>
+ <text macro="publisher-year" prefix=" " suffix="."/>
+ </group>
+ <text variable="page" prefix=" " suffix="."/>
+ </else-if>
+ <else-if type="thesis">
+ <text variable="genre" prefix=" " suffix="."/>
+ <group delimiter=", ">
+ <text macro="publisher" prefix=" "/>
+ <date variable="issued" prefix=" " suffix=".">
+ <date-part name="year"/>
+ </date>
+ </group>
+ <text variable="archive_location" prefix=" " suffix="."/>
+ </else-if>
+ <else-if type="manuscript">
+ <date variable="issued" prefix=" " suffix=".">
+ <date-part name="year"/>
+ </date>
+ <text variable="genre" prefix=" " suffix="."/>
+ <text variable="archive_location" prefix=" " suffix="."/>
+ <text variable="publisher-place" prefix=" "/>
+ </else-if>
+ <else-if type="personal_communication">
+ <date variable="issued" prefix=" " suffix=".">
+ <date-part name="day" suffix=" "/>
+ <date-part name="month" form="short" suffix=" "/>
+ <date-part name="year"/>
+ </date>
+ <choose>
+ <if variable="genre">
+ <text prefix=" " suffix="." variable="genre"/>
+ </if>
+ <else>
+ <text prefix=" " suffix="." value="E-mail"/>
+ </else>
+ </choose>
+ </else-if>
+ <else-if type="map">
+ <text variable="genre" prefix=" " suffix="."/>
+ <text variable="publisher-place" prefix=" " suffix=":"/>
+ <text macro="publisher" prefix=" "/>
+ <date variable="issued" prefix=" " suffix=",">
+ <date-part name="year"/>
+ </date>
+ </else-if>
+ <else-if type="speech">
+ <text variable="event" prefix=" " suffix="."/>
+ <text variable="publisher-place" prefix=" " suffix="."/>
+ <date variable="issued" prefix=" " suffix=".">
+ <date-part name="year"/>
+ </date>
+ <text variable="genre" prefix=" " suffix="."/>
+ </else-if>
+ <else-if type="webpage post-weblog" match="any">
+ <text variable="genre" prefix=" " suffix="."/>
+ <text variable="container-title" font-style="italic" prefix=" " suffix="."/>
+ <group delimiter=", " prefix=" ">
+ <text macro="publisher"/>
+ <text macro="issued-full-date" suffix="."/>
+ </group>
+ </else-if>
+ <else-if type="broadcast">
+ <text variable="container-title" font-style="italic" prefix=" " suffix="."/>
+ <text macro="publisher" prefix=" " suffix=","/>
+ <date variable="issued" prefix=" " suffix=".">
+ <date-part name="day" suffix=" "/>
+ <date-part name="month" form="short" suffix=" " strip-periods="false"/>
+ <date-part name="year"/>
+ </date>
+ </else-if>
+ <else>
+ <group prefix=" " suffix="." delimiter=": ">
+ <group delimiter=" ">
+ <text macro="editor-translator" suffix="."/>
+ <text variable="container-title" font-style="italic"/>
+ <choose>
+ <if type="article-journal">
+ <group delimiter=" ">
+ <group delimiter=".">
+ <text variable="volume"/>
+ <text variable="issue"/>
+ </group>
+ <date variable="issued" prefix="(" suffix="):">
+ <date-part name="year"/>
+ </date>
+ </group>
+ <text macro="pages" prefix=" "/>
+ </if>
+ <else>
+ <group>
+ <date variable="issued">
+ <date-part name="day" suffix=" "/>
+ <date-part name="month" form="short" suffix=" " strip-periods="false"/>
+ <date-part name="year"/>
+ </date>
+ <choose>
+ <if variable="URL DOI" match="any">
+ <text variable="page" prefix=": "/>
+ </if>
+ <else>
+ <text macro="pages" prefix=": "/>
+ </else>
+ </choose>
+ </group>
+ </else>
+ </choose>
+ </group>
+ </group>
+ </else>
+ </choose>
+ <text macro="medium" suffix="."/>
+ <text macro="number-of-volumes-optional" suffix="." prefix=" "/>
+ <text macro="collection-title"/>
+ <text macro="collection-number"/>
+ </layout>
+ </bibliography>
+</style>