packages feed

citeproc-hs 0.3.8 → 0.3.9

raw patch · 33 files changed

+1650/−521 lines, 33 filesdep +textdep +text-icudep ~pandoc-types

Dependencies added: text, text-icu

Dependency ranges changed: pandoc-types

Files

README view
@@ -110,7 +110,36 @@  It is possible to pass the flags also too [cabal-install]. +### Installing with ICU support +Sorting Unicode strings containing non ASCII characters is not+supported by the standard Haskell libraries and requires the+installation of the ICU libraries, available here:+++        http://site.icu-project.org/+++It is then necessary to install the Haskell bindings to these+libraries. These bindings are available here:+++        http://hackage.haskell.org/package/text-icu+++You then need to configure the citeproc-hs package with the+appropriate cabal flag:+++        runhaskell Setup.lhs configure -funicode_collation+++and then build as usual.++It is possible to pass the flags also too [cabal-install]. In this+case the installation of the ICU libraries is the only prerequisite.++ Using citeproc-hs with Pandoc ----------------------------- @@ -225,7 +254,7 @@ [citeproc-hs] at the present time. Specifically the [display] attribute has not been implemented yet. -The [citeproc-hs]-0.3.5 release passes 504 out of 693 tests of the+The [citeproc-hs]-0.3.9 release passes 586 out of 757 tests of the [citeproc-test] suite. The test-suite has been developed along with [citeproc-js], and the failure of some of those tests is not meaningful for [citeproc-hs].
citeproc-hs.cabal view
@@ -1,5 +1,5 @@ name:               citeproc-hs-version:            0.3.8+version:            0.3.9 homepage:           http://gorgias.mine.nu/repos/citeproc-hs/ synopsis:           A Citation Style Language implementation in Haskell @@ -40,6 +40,7 @@                     locales/locales-fr-CA.xml                     locales/locales-fr-FR.xml                     locales/locales-he-IL.xml+                    locales/locales-hr-HR.xml                     locales/locales-hu-HU.xml                     locales/locales-is-IS.xml                     locales/locales-it-IT.xml@@ -47,6 +48,7 @@                     locales/locales-km-KH.xml                     locales/locales-ko-KR.xml                     locales/locales-lt-LT.xml+                    locales/locales-lv-LV.xml                     locales/locales-mn-MN.xml                     locales/locales-nb-NO.xml                     locales/locales-nl-NL.xml@@ -86,6 +88,10 @@   description: Embed locale files into the library (needed for windows packaging)   default:     False +flag unicode_collation+  description: Use Haskell bindings to the International Components for Unicode (ICU) libraries+  default:     False+ library     exposed-modules:  Text.CSL                       Text.CSL.Eval@@ -111,7 +117,7 @@     ghc-prof-options: -prof -auto-all     hs-source-dirs:   src     build-depends:    containers, directory, mtl, json, utf8-string,-                      bytestring, filepath, pandoc-types >= 1.8 && < 1.11+                      bytestring, filepath, pandoc-types >= 1.8 && < 1.13      if flag(bibutils)        build-depends:   hs-bibutils >= 0.3@@ -135,6 +141,11 @@        build-depends: template-haskell, file-embed        extensions:    CPP        cpp-options:   -DEMBED_DATA_FILES++    if flag(unicode_collation)+       build-depends: text, text-icu+       extensions:    CPP+       cpp-options:   -DUNICODE_COLLATION      if impl(ghc >= 6.10)        build-depends: base >= 4, syb, parsec, old-locale, time
locales/locales-ca-AD.xml view
@@ -22,7 +22,7 @@     <term name="anonymous">anònim</term>     <term name="anonymous" form="short">anòn.</term>     <term name="at">a</term>-    <term name="available at">available at</term>+    <term name="available at">disponible a</term>     <term name="by">per</term>     <term name="circa">circa</term>     <term name="circa" form="short">c.</term>@@ -54,8 +54,8 @@       <multiple>ref.</multiple>     </term>     <term name="retrieved">recuperat</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">escala</term>+    <term name="version">versió</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->     <term name="ad">dC</term>@@ -66,7 +66,7 @@     <term name="close-quote">»</term>     <term name="open-inner-quote">“</term>     <term name="close-inner-quote">”</term>-    <term name="page-range-delimiter">–</term>+    <term name="page-range-delimiter">-</term>      <!-- ORDINALS -->     <term name="ordinal">a</term>@@ -203,8 +203,8 @@       <multiple>editors</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>il·lustrador</single>+      <multiple>il·lustradors</multiple>     </term>     <term name="translator">       <single>traductor</single>@@ -218,7 +218,7 @@     <!-- SHORT ROLE FORMS -->     <term name="director" form="short">       <single>dir.</single>-      <multiple>dirs.</multiple>+      <multiple>dir.</multiple>     </term>     <term name="editor" form="short">       <single>ed.</single>@@ -229,8 +229,8 @@       <multiple>ed.</multiple>     </term>     <term name="illustrator" form="short">-      <single>ill.</single>-      <multiple>ills.</multiple>+      <single>il·lust.</single>+      <multiple>il·lust.</multiple>     </term>     <term name="translator" form="short">       <single>trad.</single>@@ -242,13 +242,13 @@     </term>      <!-- VERB ROLE FORMS -->-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">dirigit per</term>     <term name="editor" form="verb">editat per</term>     <term name="editorial-director" form="verb">editat per</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">il·lustrat per</term>     <term name="interviewer" form="verb">entrevistat per</term>     <term name="recipient" form="verb">a</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="reviewed-author" form="verb">per</term>     <term name="translator" form="verb">traduït per</term>     <term name="editortranslator" form="verb">editat i traduït per</term> @@ -257,7 +257,7 @@     <term name="director" form="verb-short">dir.</term>     <term name="editor" form="verb-short">ed.</term>     <term name="editorial-director" form="verb-short">ed.</term>-    <term name="illustrator" form="verb-short">illus.</term>+    <term name="illustrator" form="verb-short">il·lust.</term>     <term name="translator" form="verb-short">trad.</term>     <term name="editortranslator" form="verb-short">ed. i trad. per</term> @@ -277,13 +277,13 @@      <!-- SHORT MONTH FORMS -->     <term name="month-01" form="short">gen.</term>-    <term name="month-02" form="short">febr.</term>+    <term name="month-02" form="short">feb.</term>     <term name="month-03" form="short">març</term>     <term name="month-04" form="short">abr.</term>     <term name="month-05" form="short">maig</term>     <term name="month-06" form="short">juny</term>     <term name="month-07" form="short">jul.</term>-    <term name="month-08" form="short">ag.</term>+    <term name="month-08" form="short">ago.</term>     <term name="month-09" form="short">set.</term>     <term name="month-10" form="short">oct.</term>     <term name="month-11" form="short">nov.</term>
locales/locales-en-GB.xml view
@@ -260,11 +260,11 @@      <!-- SHORT VERB ROLE FORMS -->     <term name="container-author" form="verb-short">by</term>-    <term name="director" form="verb-short">dir.</term>-    <term name="editor" form="verb-short">ed.</term>-    <term name="editorial-director" form="verb-short">ed.</term>-    <term name="illustrator" form="verb-short">illus.</term>-    <term name="translator" form="verb-short">trans.</term>+    <term name="director" form="verb-short">dir. by</term>+    <term name="editor" form="verb-short">ed. by</term>+    <term name="editorial-director" form="verb-short">ed. by</term>+    <term name="illustrator" form="verb-short">illus. by</term>+    <term name="translator" form="verb-short">trans. by</term>     <term name="editortranslator" form="verb-short">ed. &amp; trans. by</term>      <!-- LONG MONTH FORMS -->
locales/locales-en-US.xml view
@@ -260,11 +260,11 @@      <!-- SHORT VERB ROLE FORMS -->     <term name="container-author" form="verb-short">by</term>-    <term name="director" form="verb-short">dir.</term>-    <term name="editor" form="verb-short">ed.</term>-    <term name="editorial-director" form="verb-short">ed.</term>-    <term name="illustrator" form="verb-short">illus.</term>-    <term name="translator" form="verb-short">trans.</term>+    <term name="director" form="verb-short">dir. by</term>+    <term name="editor" form="verb-short">ed. by</term>+    <term name="editorial-director" form="verb-short">ed. by</term>+    <term name="illustrator" form="verb-short">illus. by</term>+    <term name="translator" form="verb-short">trans. by</term>     <term name="editortranslator" form="verb-short">ed. &amp; trans. by</term>      <!-- LONG MONTH FORMS -->
locales/locales-es-ES.xml view
@@ -22,7 +22,7 @@     <term name="anonymous">anónimo</term>     <term name="anonymous" form="short">anón.</term>     <term name="at">en</term>-    <term name="available at">available at</term>+    <term name="available at">disponible en</term>     <term name="by">de</term>     <term name="circa">circa</term>     <term name="circa" form="short">c.</term>@@ -54,8 +54,8 @@       <multiple>refs.</multiple>     </term>     <term name="retrieved">recuperado</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">escala</term>+    <term name="version">versión</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->     <term name="ad">d.&#160;C.</term>@@ -66,7 +66,7 @@     <term name="close-quote">»</term>     <term name="open-inner-quote">“</term>     <term name="close-inner-quote">”</term>-    <term name="page-range-delimiter">–</term>+    <term name="page-range-delimiter">-</term>      <!-- ORDINALS -->     <term name="ordinal">.ª</term>@@ -192,7 +192,7 @@     <!-- LONG ROLE FORMS -->     <term name="director">       <single>director</single>-      <multiple>directors</multiple>+      <multiple>directores</multiple>     </term>     <term name="editor">       <single>editor</single>@@ -203,8 +203,8 @@       <multiple>editores</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>ilustrador</single>+      <multiple>ilustradores</multiple>     </term>     <term name="translator">       <single>traductor</single>@@ -229,8 +229,8 @@       <multiple>eds.</multiple>     </term>     <term name="illustrator" form="short">-      <single>ill.</single>-      <multiple>ills.</multiple>+      <single>ilust.</single>+      <multiple>ilusts.</multiple>     </term>     <term name="translator" form="short">       <single>trad.</single>@@ -242,13 +242,13 @@     </term>      <!-- VERB ROLE FORMS -->-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">dirigido por</term>     <term name="editor" form="verb">editado por</term>     <term name="editorial-director" form="verb">editado por</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">ilustrado por</term>     <term name="interviewer" form="verb">entrevistado por</term>     <term name="recipient" form="verb">a</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="reviewed-author" form="verb">por</term>     <term name="translator" form="verb">traducido por</term>     <term name="editortranslator" form="verb">editado y traducido por</term> @@ -257,7 +257,7 @@     <term name="director" form="verb-short">dir.</term>     <term name="editor" form="verb-short">ed.</term>     <term name="editorial-director" form="verb-short">ed.</term>-    <term name="illustrator" form="verb-short">illus.</term>+    <term name="illustrator" form="verb-short">ilust.</term>     <term name="translator" form="verb-short">trad.</term>     <term name="editortranslator" form="verb-short">ed. y trad.</term> 
locales/locales-fr-CA.xml view
@@ -159,8 +159,14 @@     <term name="chapter" form="short">chap.</term>     <term name="column" form="short">col.</term>     <term name="figure" form="short">fig.</term>-    <term name="folio" form="short">fᵒ</term>-    <term name="issue" form="short">nᵒ</term>+    <term name="folio" form="short">+      <single>fᵒ</single>+      <multiple>fᵒˢ</multiple>+    </term>+    <term name="issue" form="short">+      <single>nᵒ</single>+      <multiple>nᵒˢ</multiple>+    </term>     <term name="line" form="short">l.</term>     <term name="note" form="short">n.</term>     <term name="opus" form="short">op.</term>
locales/locales-fr-FR.xml view
@@ -159,8 +159,14 @@     <term name="chapter" form="short">chap.</term>     <term name="column" form="short">col.</term>     <term name="figure" form="short">fig.</term>-    <term name="folio" form="short">fᵒ</term>-    <term name="issue" form="short">nᵒ</term>+    <term name="folio" form="short">+      <single>fᵒ</single>+      <multiple>fᵒˢ</multiple>+    </term>+    <term name="issue" form="short">+      <single>nᵒ</single>+      <multiple>nᵒˢ</multiple>+    </term>     <term name="line" form="short">l.</term>     <term name="note" form="short">n.</term>     <term name="opus" form="short">op.</term>
+ locales/locales-hr-HR.xml view
@@ -0,0 +1,304 @@+<?xml version="1.0" encoding="utf-8"?>+<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="hr-HR">+  <info>+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>+    <updated>2012-07-04T23:31:02+00:00</updated>+  </info>+  <style-options punctuation-in-quote="false"/>+  <date form="text">+    <date-part name="day" form="numeric-leading-zeros" suffix=". "/>+    <date-part name="month" suffix=" "/>+    <date-part name="year" suffix="."/>+  </date>+  <date form="numeric">+    <date-part name="year"/>+    <date-part name="month" form="numeric-leading-zeros" prefix="-" range-delimiter="/"/>+    <date-part name="day" form="numeric-leading-zeros" prefix="-" range-delimiter="/"/>+  </date>+  <terms>+    <term name="accessed">pristupljeno</term>+    <term name="and">i</term>+    <term name="and others">i ostali</term>+    <term name="anonymous">anonim</term>+    <term name="anonymous" form="short">anon.</term>+    <term name="at">na</term>+    <term name="available at">pristupačno na</term>+    <term name="by">od</term>+    <term name="circa">circa</term>+    <term name="circa" form="short">c.</term>+    <term name="cited">citirano</term>+    <term name="edition">+      <single>izdanje</single>+      <multiple>izdanja</multiple>+    </term>+    <term name="edition" form="short">izd.</term>+    <term name="et-al">i ostali</term>+    <term name="forthcoming">u pripremi</term>+    <term name="from">od</term>+    <term name="ibid">ibid.</term>+    <term name="in">u</term>+    <term name="in press">u štampi</term>+    <term name="internet">internet</term>+    <term name="interview">intervju</term>+    <term name="letter">pismo</term>+    <term name="no date">bez datuma</term>+    <term name="no date" form="short">bez datuma</term>+    <term name="online">na internetu</term>+    <term name="presented at">predstavljeno na</term>+    <term name="reference">+      <single>reference</single>+      <multiple>reference</multiple>+    </term>+    <term name="reference" form="short">+      <single>ref.</single>+      <multiple>ref.</multiple>+    </term>+    <term name="retrieved">preuzeto</term>+    <term name="scale">skala</term>+    <term name="version">verzija</term>++    <!-- ANNO DOMINI; BEFORE CHRIST -->+    <term name="ad">AD</term>+    <term name="bc">BC</term>++    <!-- PUNCTUATION -->+    <term name="open-quote">„</term>+    <term name="close-quote">“</term>+    <term name="open-inner-quote">‚</term>+    <term name="close-inner-quote">‘</term>+    <term name="page-range-delimiter">–</term>++    <!-- ORDINALS -->+    <term name="ordinal">th</term>+    <term name="ordinal-01">st</term>+    <term name="ordinal-02">nd</term>+    <term name="ordinal-03">rd</term>+    <term name="ordinal-11">th</term>+    <term name="ordinal-12">th</term>+    <term name="ordinal-13">th</term>++    <!-- LONG ORDINALS -->+    <term name="long-ordinal-01">prvi</term>+    <term name="long-ordinal-02">drugi</term>+    <term name="long-ordinal-03">treći</term>+    <term name="long-ordinal-04">četvrti</term>+    <term name="long-ordinal-05">peti</term>+    <term name="long-ordinal-06">šesti</term>+    <term name="long-ordinal-07">sedmi</term>+    <term name="long-ordinal-08">osmi</term>+    <term name="long-ordinal-09">deveti</term>+    <term name="long-ordinal-10">deseti</term>++    <!-- LONG LOCATOR FORMS -->+    <term name="book">+      <single>knjiga</single>+      <multiple>knjige</multiple>+    </term>+    <term name="chapter">+      <single>poglavlje</single>+      <multiple>poglavlja</multiple>+    </term>+    <term name="column">+      <single>kolona</single>+      <multiple>kolone</multiple>+    </term>+    <term name="figure">+      <single>crtež</single>+      <multiple>crteži</multiple>+    </term>+    <term name="folio">+      <single>folija</single>+      <multiple>folije</multiple>+    </term>+    <term name="issue">+      <single>broj</single>+      <multiple>brojevi</multiple>+    </term>+    <term name="line">+      <single>linija</single>+      <multiple>linije</multiple>+    </term>+    <term name="note">+      <single>beleška</single>+      <multiple>beleške</multiple>+    </term>+    <term name="opus">+      <single>opus</single>+      <multiple>opera</multiple>+    </term>+    <term name="page">+      <single>stranica</single>+      <multiple>stranice</multiple>+    </term>+    <term name="paragraph">+      <single>paragraf</single>+      <multiple>paragrafi</multiple>+    </term>+    <term name="part">+      <single>deo</single>+      <multiple>delova</multiple>+    </term>+    <term name="section">+      <single>odeljak</single>+      <multiple>odeljaka</multiple>+    </term>+    <term name="sub verbo">+      <single>sub verbo</single>+      <multiple>sub verbis</multiple>+    </term>+    <term name="verse">+      <single>strofa</single>+      <multiple>strofe</multiple>+    </term>+    <term name="volume">+      <single>tom</single>+      <multiple>tomova</multiple>+    </term>++    <!-- SHORT LOCATOR FORMS -->+    <term name="book" form="short">knj</term>+    <term name="chapter" form="short">pog</term>+    <term name="column" form="short">kol</term>+    <term name="figure" form="short">црт</term>+    <term name="folio" form="short">fol</term>+    <term name="issue" form="short">izd</term>+    <term name="line" form="short">l</term>+    <term name="note" form="short">n</term>+    <term name="opus" form="short">op</term>+    <term name="page" form="short">+      <single>str.</single>+      <multiple>str.</multiple>+    </term>+    <term name="paragraph" form="short">par</term>+    <term name="part" form="short">deo</term>+    <term name="section" form="short">od</term>+    <term name="sub verbo" form="short">+      <single>s.v.</single>+      <multiple>s.vv.</multiple>+    </term>+    <term name="verse" form="short">+      <single>s</single>+      <multiple>s</multiple>+    </term>+    <term name="volume" form="short">+      <single>tom</single>+      <multiple>tomova</multiple>+    </term>++    <!-- SYMBOL LOCATOR FORMS -->+    <term name="paragraph" form="symbol">+      <single>¶</single>+      <multiple>¶¶</multiple>+    </term>+    <term name="section" form="symbol">+      <single>§</single>+      <multiple>§§</multiple>+    </term>++    <!-- LONG ROLE FORMS -->+    <term name="director">+      <single>director</single>+      <multiple>directors</multiple>+    </term>+    <term name="editor">+      <single>priređivač</single>+      <multiple>priređivači</multiple>+    </term>+    <term name="editorial-director">+      <single>priređivač</single>+      <multiple>priređivači</multiple>+    </term>+    <term name="illustrator">+      <single>ilustrator</single>+      <multiple>ilustratori</multiple>+    </term>+    <term name="translator">+      <single>prevodilac</single>+      <multiple>prevodioci</multiple>+    </term>+    <term name="editortranslator">+      <single>priređivač &amp; prevodilac</single>+      <multiple>priređivači &amp; prevodioci</multiple>+    </term>++    <!-- SHORT ROLE FORMS -->+    <term name="director" form="short">+      <single>prir.</single>+      <multiple>prir.</multiple>+    </term>+    <term name="editor" form="short">+      <single>prir.</single>+      <multiple>prir.</multiple>+    </term>+    <term name="editorial-director" form="short">+      <single>prir.</single>+      <multiple>prir.</multiple>+    </term>+    <term name="illustrator" form="short">+      <single>il.</single>+      <multiple>il.</multiple>+    </term>+    <term name="translator" form="short">+      <single>prev.</single>+      <multiple>prev.</multiple>+    </term>+    <term name="editortranslator" form="short">+      <single>prir. &amp; prev.</single>+      <multiple>prir. &amp; prev.</multiple>+    </term>++    <!-- VERB ROLE FORMS -->+    <term name="director" form="verb">directed by</term>+    <term name="editor" form="verb">priredio</term>+    <term name="editorial-director" form="verb">priredio</term>+    <term name="illustrator" form="verb">ilustrovao</term>+    <term name="interviewer" form="verb">intervjuisao</term>+    <term name="recipient" form="verb">prima</term>+    <term name="reviewed-author" form="verb">od</term>+    <term name="translator" form="verb">preveo</term>+    <term name="editortranslator" form="verb">priredio &amp; preveo by</term>++    <!-- SHORT VERB ROLE FORMS -->+    <term name="container-author" form="verb-short">by</term>+    <term name="director" form="verb-short">dir.</term>+    <term name="editor" form="verb-short">prir.</term>+    <term name="editorial-director" form="verb-short">prir.</term>+    <term name="illustrator" form="verb-short">ilus.</term>+    <term name="translator" form="verb-short">prev.</term>+    <term name="editortranslator" form="verb-short">prir. &amp; prev. by</term>++    <!-- LONG MONTH FORMS -->+    <term name="month-01">januar</term>+    <term name="month-02">februar</term>+    <term name="month-03">mart</term>+    <term name="month-04">april</term>+    <term name="month-05">maj</term>+    <term name="month-06">jun</term>+    <term name="month-07">jul</term>+    <term name="month-08">avgust</term>+    <term name="month-09">septembar</term>+    <term name="month-10">oktobar</term>+    <term name="month-11">novembar</term>+    <term name="month-12">decembar</term>++    <!-- SHORT MONTH FORMS -->+    <term name="month-01" form="short">jan.</term>+    <term name="month-02" form="short">feb.</term>+    <term name="month-03" form="short">mart</term>+    <term name="month-04" form="short">apr.</term>+    <term name="month-05" form="short">maj</term>+    <term name="month-06" form="short">jun</term>+    <term name="month-07" form="short">jul</term>+    <term name="month-08" form="short">avg.</term>+    <term name="month-09" form="short">sep.</term>+    <term name="month-10" form="short">okt.</term>+    <term name="month-11" form="short">nov.</term>+    <term name="month-12" form="short">dec.</term>++    <!-- SEASONS -->+    <term name="season-01">proleće</term>+    <term name="season-02">leto</term>+    <term name="season-03">jesen</term>+    <term name="season-04">zima</term>+  </terms>+</locale>
locales/locales-it-IT.xml view
@@ -20,10 +20,10 @@     <term name="and">e</term>     <term name="and others">e altri</term>     <term name="anonymous">anonimo</term>-    <term name="anonymous" form="short">anon</term>+    <term name="anonymous" form="short">anon.</term>     <term name="at">a</term>     <term name="available at">available at</term>-    <term name="by">by</term>+    <term name="by">di</term>     <term name="circa">circa</term>     <term name="circa" form="short">c.</term>     <term name="cited">citato</term>@@ -31,7 +31,7 @@       <single>edizione</single>       <multiple>edizioni</multiple>     </term>-    <term name="edition" form="short">ed</term>+    <term name="edition" form="short">ed.</term>     <term name="et-al">et al.</term>     <term name="forthcoming">futuro</term>     <term name="from">da</term>@@ -41,8 +41,8 @@     <term name="internet">internet</term>     <term name="interview">intervista</term>     <term name="letter">lettera</term>-    <term name="no date">no date</term>-    <term name="no date" form="short">S.d.</term>+    <term name="no date">senza data</term>+    <term name="no date" form="short">s.d.</term>     <term name="online">in linea</term>     <term name="presented at">presentato al</term>     <term name="reference">@@ -58,36 +58,30 @@     <term name="version">version</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">AD</term>-    <term name="bc">BC</term>+    <term name="ad">d.C.</term>+    <term name="bc">a.C.</term>      <!-- PUNCTUATION -->     <term name="open-quote">«</term>     <term name="close-quote">»</term>-    <term name="open-inner-quote">‘</term>-    <term name="close-inner-quote">’</term>+    <term name="open-inner-quote">“</term>+    <term name="close-inner-quote">”</term>     <term name="page-range-delimiter">–</term>      <!-- ORDINALS -->-    <term name="ordinal">th</term>-    <term name="ordinal-01">st</term>-    <term name="ordinal-02">nd</term>-    <term name="ordinal-03">rd</term>-    <term name="ordinal-11">th</term>-    <term name="ordinal-12">th</term>-    <term name="ordinal-13">th</term>+    <term name="ordinal">°</term>      <!-- LONG ORDINALS -->-    <term name="long-ordinal-01">first</term>-    <term name="long-ordinal-02">second</term>-    <term name="long-ordinal-03">third</term>-    <term name="long-ordinal-04">fourth</term>-    <term name="long-ordinal-05">fifth</term>-    <term name="long-ordinal-06">sixth</term>-    <term name="long-ordinal-07">seventh</term>-    <term name="long-ordinal-08">eighth</term>-    <term name="long-ordinal-09">ninth</term>-    <term name="long-ordinal-10">tenth</term>+    <term name="long-ordinal-01">prima</term>+    <term name="long-ordinal-02">seconda</term>+    <term name="long-ordinal-03">terza</term>+    <term name="long-ordinal-04">quarta</term>+    <term name="long-ordinal-05">quinta</term>+    <term name="long-ordinal-06">sesta</term>+    <term name="long-ordinal-07">settima</term>+    <term name="long-ordinal-08">ottava</term>+    <term name="long-ordinal-09">nona</term>+    <term name="long-ordinal-10">decima</term>      <!-- LONG LOCATOR FORMS -->     <term name="book">@@ -156,33 +150,33 @@     </term>      <!-- SHORT LOCATOR FORMS -->-    <term name="book" form="short">lib</term>-    <term name="chapter" form="short">cap</term>-    <term name="column" form="short">col</term>-    <term name="figure" form="short">fig</term>-    <term name="folio" form="short">fgl</term>-    <term name="issue" form="short">n°</term>+    <term name="book" form="short">lib.</term>+    <term name="chapter" form="short">cap.</term>+    <term name="column" form="short">col.</term>+    <term name="figure" form="short">fig.</term>+    <term name="folio" form="short">fgl.</term>+    <term name="issue" form="short">n.</term>     <term name="line" form="short">l.</term>     <term name="note" form="short">n.</term>-    <term name="opus" form="short">op</term>+    <term name="opus" form="short">op.</term>     <term name="page" form="short">-      <single>pag</single>-      <multiple>pagg</multiple>+      <single>pag.</single>+      <multiple>pagg.</multiple>     </term>-    <term name="paragraph" form="short">cpv</term>-    <term name="part" form="short">pt</term>-    <term name="section" form="short">par</term>+    <term name="paragraph" form="short">cpv.</term>+    <term name="part" form="short">pt.</term>+    <term name="section" form="short">par.</term>     <term name="sub verbo" form="short">       <single>s.v.</single>       <multiple>s.vv.</multiple>     </term>     <term name="verse" form="short">-      <single>v</single>-      <multiple>vv</multiple>+      <single>v.</single>+      <multiple>vv.</multiple>     </term>     <term name="volume" form="short">-      <single>vol</single>-      <multiple>vol</multiple>+      <single>vol.</single>+      <multiple>vol.</multiple>     </term>      <!-- SYMBOL LOCATOR FORMS -->@@ -217,8 +211,8 @@       <multiple>traduttori</multiple>     </term>     <term name="editortranslator">-      <single>editor &amp; translator</single>-      <multiple>editors &amp; translators</multiple>+      <single>curatore e traduttore</single>+      <multiple>curatori e tradutori</multiple>     </term>      <!-- SHORT ROLE FORMS -->@@ -227,8 +221,8 @@       <multiple>dirs.</multiple>     </term>     <term name="editor" form="short">-      <single>cur</single>-      <multiple>cur</multiple>+      <single>a c. di</single>+      <multiple>a c. di</multiple>     </term>     <term name="editorial-director" form="short">       <single>ed.</single>@@ -239,12 +233,12 @@       <multiple>ills.</multiple>     </term>     <term name="translator" form="short">-      <single>trad</single>-      <multiple>trad</multiple>+      <single>trad.</single>+      <multiple>trad.</multiple>     </term>     <term name="editortranslator" form="short">-      <single>ed. &amp; tran.</single>-      <multiple>eds. &amp; trans.</multiple>+      <single>a c. di e trad. da</single>+      <multiple>a c. di e trad. da</multiple>     </term>      <!-- VERB ROLE FORMS -->@@ -256,49 +250,49 @@     <term name="recipient" form="verb">a</term>     <term name="reviewed-author" form="verb">by</term>     <term name="translator" form="verb">tradotto da</term>-    <term name="editortranslator" form="verb">edited &amp; translated by</term>+    <term name="editortranslator" form="verb">a cura di e tradotto da</term>      <!-- SHORT VERB ROLE FORMS -->-    <term name="container-author" form="verb-short">by</term>+    <term name="container-author" form="verb-short">di</term>     <term name="director" form="verb-short">dir.</term>-    <term name="editor" form="verb-short">cur. da</term>+    <term name="editor" form="verb-short">a c. di</term>     <term name="editorial-director" form="verb-short">ed.</term>     <term name="illustrator" form="verb-short">illus.</term>     <term name="translator" form="verb-short">trad. da</term>-    <term name="editortranslator" form="verb-short">ed. &amp; trans. by</term>+    <term name="editortranslator" form="verb-short">a c. di e trad. da</term>      <!-- LONG MONTH FORMS -->-    <term name="month-01">Gennaio</term>-    <term name="month-02">Febbraio</term>-    <term name="month-03">Marzo</term>-    <term name="month-04">Aprile</term>-    <term name="month-05">Maggio</term>-    <term name="month-06">Giugno</term>-    <term name="month-07">Luglio</term>-    <term name="month-08">Agosto</term>-    <term name="month-09">Settembre</term>-    <term name="month-10">Ottobre</term>-    <term name="month-11">Novembre</term>-    <term name="month-12">Dicembre</term>+    <term name="month-01">gennaio</term>+    <term name="month-02">febbraio</term>+    <term name="month-03">marzo</term>+    <term name="month-04">aprile</term>+    <term name="month-05">maggio</term>+    <term name="month-06">giugno</term>+    <term name="month-07">luglio</term>+    <term name="month-08">agosto</term>+    <term name="month-09">settembre</term>+    <term name="month-10">ottobre</term>+    <term name="month-11">novembre</term>+    <term name="month-12">dicembre</term>      <!-- SHORT MONTH FORMS -->-    <term name="month-01" form="short">Gen</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">Mag</term>-    <term name="month-06" form="short">Giu</term>-    <term name="month-07" form="short">Lug</term>-    <term name="month-08" form="short">Ago</term>-    <term name="month-09" form="short">Set</term>-    <term name="month-10" form="short">Ott</term>-    <term name="month-11" form="short">Nov</term>-    <term name="month-12" form="short">Dic</term>+    <term name="month-01" form="short">gen.</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">mag.</term>+    <term name="month-06" form="short">giu.</term>+    <term name="month-07" form="short">lug.</term>+    <term name="month-08" form="short">ago.</term>+    <term name="month-09" form="short">set.</term>+    <term name="month-10" form="short">ott.</term>+    <term name="month-11" form="short">nov.</term>+    <term name="month-12" form="short">dic.</term>      <!-- SEASONS -->-    <term name="season-01">Spring</term>-    <term name="season-02">Summer</term>-    <term name="season-03">Autumn</term>-    <term name="season-04">Winter</term>+    <term name="season-01">primavera</term>+    <term name="season-02">estate</term>+    <term name="season-03">autunno</term>+    <term name="season-04">inverno</term>   </terms> </locale>
+ locales/locales-lv-LV.xml view
@@ -0,0 +1,353 @@+<?xml version="1.0" encoding="utf-8"?>+<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="lv-LV">+  <info>+    <translator>+      <name>Andris Lupgins</name>+    </translator>+    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>+    <updated>2012-12-27T11:40:58+02:00</updated>+  </info>+  <style-options punctuation-in-quote="false"/>+  <date form="text" delimiter=" ">+    <!-- "2012. gada 28. martā" -->+    <date-part name="year" suffix=". gada"/>+    <date-part name="day" form="numeric" suffix="."/>+    <date-part name="month"/>+  </date>+  <date form="numeric" delimiter=".">+    <!-- "28.03.2012." -->+    <date-part name="day" form="numeric"/>+    <date-part name="month" form="numeric"/>+    <date-part name="year"/>+  </date>+  <terms>+    <term name="accessed">skatīts</term>+    <term name="ad">m.ē.</term>+    <term name="and">un</term>+    <term name="and others">un citi</term>+    <term name="anonymous">anonīms</term>+    <term name="anonymous" form="short">anon.</term>+    <term name="at"/>+    <term name="available at">pieejams</term>+    <term name="bc">p.m.ē.</term>+    <term name="by"/>+    <term name="circa">apmēram</term>+    <term name="circa" form="short">apm.</term>+    <term name="cited">citēts</term>+    <term name="edition" gender="feminine">+      <single>redakcija</single>+      <multiple>redakcijas</multiple>+    </term>+    <term name="edition" form="short">red.</term>+    <term name="et-al">u.c.</term>+    <term name="forthcoming">gaidāms</term>+    <term name="from">no</term>+    <term name="ibid">turpat</term>+    <term name="in">no</term>+    <term name="in press">presē</term>+    <term name="internet">internets</term>+    <term name="interview">intervija</term>+    <term name="letter">vēstule</term>+    <term name="no date">bez datuma</term>+    <term name="no date" form="short">b.g.</term>+    <term name="online">tiešsaiste</term>+    <term name="presented at">iesniegts</term>+    <term name="reference">+      <single>atsauce</single>+      <multiple>atsauces</multiple>+    </term>+    <term name="reference" form="short">+      <single>ats.</single>+      <multiple>ats.</multiple>+    </term>+    <term name="retrieved">iegūts</term>+    <term name="scale">mērogs</term>+    <term name="version">versija</term>++    <!-- PUNCTUATION -->+    <term name="open-quote">"</term>+    <term name="close-quote">"</term>+    <term name="open-inner-quote">"</term>+    <term name="close-inner-quote">"</term>+    <term name="page-range-delimiter">–</term>++    <!-- ORDINALS -->+    <term name="ordinal">-ais</term>+    <term name="ordinal" gender-form="feminine">-ā</term>+    +    <!-- LONG ORDINALS -->+    <term name="long-ordinal-01">pirmais</term>+    <term name="long-ordinal-02">otrais</term>+    <term name="long-ordinal-03">trešais</term>+    <term name="long-ordinal-04">ceturtais</term>+    <term name="long-ordinal-05">piektais</term>+    <term name="long-ordinal-06">sestais</term>+    <term name="long-ordinal-07">septītais</term>+    <term name="long-ordinal-08">astotais</term>+    <term name="long-ordinal-09">devītais</term>+    <term name="long-ordinal-10">desmitais</term>++    <term name="long-ordinal-01" gender-form="feminine">pirmā</term>+    <term name="long-ordinal-02" gender-form="feminine">otrā</term>+    <term name="long-ordinal-03" gender-form="feminine">trešā</term>+    <term name="long-ordinal-04" gender-form="feminine">ceturtā</term>+    <term name="long-ordinal-05" gender-form="feminine">piektā</term>+    <term name="long-ordinal-06" gender-form="feminine">sestā</term>+    <term name="long-ordinal-07" gender-form="feminine">septītā</term>+    <term name="long-ordinal-08" gender-form="feminine">astotā</term>+    <term name="long-ordinal-09" gender-form="feminine">devītā</term>+    <term name="long-ordinal-10" gender-form="feminine">desmitā</term>++    <!-- LONG LOCATOR FORMS -->+    <term name="book">+      <single>grāmata</single>+      <multiple>grāmatas</multiple>+    </term>+    <term name="chapter">+      <single>nodaļa</single>+      <multiple>nodaļas</multiple>+    </term>+    <term name="column">+      <single>sleja</single>+      <multiple>slejas</multiple>+    </term>+    <term name="figure">+      <single>ilustrācija</single>+      <multiple>ilustrācijas</multiple>+    </term>+    <term name="folio">+      <single>folio</single>+      <multiple>folio</multiple>+    </term>+    <term name="issue">+      <single>numurs</single>+      <multiple>numuri</multiple>+    </term>+    <term name="line">+      <single>rinda</single>+      <multiple>rindas</multiple>+    </term>+    <term name="note">+      <single>piezīme</single>+      <multiple>piezīmes</multiple>+    </term>+    <term name="opus">+      <single>opuss</single>+      <multiple>opusi</multiple>+    </term>+    <term name="page">+      <single>lappuse</single>+      <multiple>lappuses</multiple>+    </term>+    <term name="paragraph">+      <single>rindkopa</single>+      <multiple>rindkopas</multiple>+    </term>+    <term name="part">+      <single>daļa</single>+      <multiple>daļas</multiple>+    </term>+    <term name="section">+      <single>apakšnodaļa</single>+      <multiple>apakšnodaļas</multiple>+    </term>+    <term name="sub verbo">+      <single>skatīt</single>+      <multiple>skatīt</multiple>+    </term>+    <term name="verse">+      <single>pants</single>+      <multiple>panti</multiple>+    </term>+    <term name="volume">+      <single>sējums</single>+      <multiple>sējumi</multiple>+    </term>+    +    <!-- SHORT LOCATOR FORMS -->+    <term name="book" form="short">grām.</term>+    <term name="chapter" form="short">nod.</term>+    <term name="column" form="short">sl.</term>+    <term name="figure" form="short">il.</term>+    <term name="folio" form="short">fo.</term>+    <term name="issue" form="short">nr.</term>+    <term name="line" form="short">r.</term>+    <term name="note" form="short">piez.</term>+    <term name="opus" form="short">op.</term>+    <term name="page" form="short">+      <single>lpp.</single>+      <multiple>lpp.</multiple>+    </term>+    <term name="paragraph" form="short">rindk.</term>+    <term name="part" form="short">d.</term>+    <term name="section" form="short">apakšnod.</term>+    <term name="sub verbo" form="short">+      <single>sk.</single>+      <multiple>sk.</multiple>+    </term>+    <term name="verse" form="short">+      <single>p.</single>+      <multiple>p.</multiple>+    </term>+    <term name="volume" form="short">+      <single>sēj.</single>+      <multiple>sēj.</multiple>+    </term>++    <!-- SYMBOL LOCATOR FORMS -->+    <term name="paragraph" form="symbol">+      <single>¶</single>+      <multiple>¶¶</multiple>+    </term>+    <term name="section" form="symbol">+      <single>§</single>+      <multiple>§§</multiple>+    </term>++    <!-- LONG ROLE FORMS -->+    <term name="collection-editor">+      <single>krājuma redaktors</single>+      <multiple>krājuma redaktori</multiple>+    </term>+    <term name="composer">+      <single>sastādītājs</single>+      <multiple>sastādītāji</multiple>+    </term>+    <term name="container-author">+      <single>pamatmateriāla autors</single>+      <multiple>pamatmateriāla autori</multiple>+    </term>+    <term name="director">+      <single>vadītājs</single>+      <multiple>vadītāji</multiple>+    </term>+    <term name="editor">+      <single>redaktors</single>+      <multiple>redaktors</multiple>+    </term>+    <term name="editorial-director">+      <single>galvenais redaktors</single>+      <multiple>galvenie redaktori</multiple>+    </term>+    <term name="editortranslator">+      <single>redaktors un tulkotājs</single>+      <multiple>redaktors un tulkotājs</multiple>+    </term>+    <term name="illustrator">+      <single>ilustrators</single>+      <multiple>ilustratori</multiple>+    </term>+    <term name="interviewer">+      <single>intervētājs</single>+      <multiple>intervētāji</multiple>+    </term>+    <term name="recipient">+      <single>saņēmējs</single>+      <multiple>saņēmēji</multiple>+    </term>+    <term name="translator">+      <single>tulkotājs</single>+      <multiple>tulkotāji</multiple>+    </term>++    <!-- SHORT ROLE FORMS -->+    <term name="collection-editor" form="short">+      <single>kr. red.</single>+      <multiple>kr. red.</multiple>+    </term>+    <term name="composer" form="short">+      <single>sast.</single>+      <multiple>sast.</multiple>+    </term>+    <term name="container-author" form="short">+      <single>pamatmat. aut.</single>+      <multiple>pamatmat. aut.</multiple>+    </term>+    <term name="director" form="short">+      <single>vad.</single>+      <multiple>vad.</multiple>+    </term>+    <term name="editor" form="short">+      <single>red.</single>+      <multiple>red.</multiple>+    </term>+    <term name="editorial-director" form="short">+      <single>galv. red.</single>+      <multiple>galv. red.</multiple>+    </term>+    <term name="editortranslator" form="short">+      <single>red. un tulk.</single>+      <multiple>red. un tulk.</multiple>+    </term>+    <term name="illustrator" form="short">+      <single>ilustr.</single>+      <multiple>ilustr.</multiple>+    </term>+    <term name="interviewer" form="short">+      <single>interv.</single>+      <multiple>interv.</multiple>+    </term>+    <term name="recipient" form="short">+      <single>saņ.</single>+      <multiple>saņ.</multiple>+    </term>+    <term name="translator" form="short">+      <single>tulk.</single>+      <multiple>tulk.</multiple>+    </term>++    <!-- VERB ROLE FORMS -->+    <term name="composer" form="verb">sastādīja</term>+    <term name="director" form="verb">vadīja</term>+    <term name="editor" form="verb">sagatavoja</term>+    <term name="editorial-director" form="verb">sagatavoja</term>+    <term name="editortranslator" form="verb">sagatavoja un tulkoja</term>+    <term name="illustrator" form="verb">ilustrēja</term>+    <term name="interviewer" form="verb">intervēja</term>+    <term name="recipient" form="verb">saņēma</term>+    <term name="translator" form="verb">tulkoja</term>++    <!-- SHORT VERB ROLE FORMS -->+    <term name="container-author" form="verb-short"/>+    <term name="director" form="verb-short">sast.</term>+    <term name="editor" form="verb-short">sag.</term>+    <term name="editorial-director" form="verb-short">sag.</term>+    <term name="illustrator" form="verb-short">ilustr.</term>+    <term name="translator" form="verb-short">tulk.</term>+    <term name="editortranslator" form="verb-short">sag. un tulk.</term>++    <!-- LONG MONTH FORMS -->+    <term name="month-01">janvārī</term>+    <term name="month-02">februārī</term>+    <term name="month-03">martā</term>+    <term name="month-04">aprīlī</term>+    <term name="month-05">maijā</term>+    <term name="month-06">jūnijā</term>+    <term name="month-07">jūlijā</term>+    <term name="month-08">augustā</term>+    <term name="month-09">septembrī</term>+    <term name="month-10">oktobrī</term>+    <term name="month-11">novembrī</term>+    <term name="month-12">decembrī</term>++    <!-- SHORT MONTH FORMS -->+    <term name="month-01" form="short">janv.</term>+    <term name="month-02" form="short">febr.</term>+    <term name="month-03" form="short">mar.</term>+    <term name="month-04" form="short">apr.</term>+    <term name="month-05" form="short">mai.</term>+    <term name="month-06" form="short">jūn.</term>+    <term name="month-07" form="short">jūl.</term>+    <term name="month-08" form="short">aug.</term>+    <term name="month-09" form="short">sept.</term>+    <term name="month-10" form="short">okt.</term>+    <term name="month-11" form="short">nov.</term>+    <term name="month-12" form="short">dec.</term>++    <!-- SEASONS -->+    <term name="season-01">pavasaris</term>+    <term name="season-02">vasara</term>+    <term name="season-03">rudens</term>+    <term name="season-04">ziema</term>+  </terms>+</locale>
locales/locales-nb-NO.xml view
@@ -2,7 +2,7 @@ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="nb-NO">   <info>     <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>-    <updated>2012-07-04T23:31:02+00:00</updated>+    <updated>2013-03-01T12:20:00+01:00</updated>   </info>   <style-options punctuation-in-quote="false"/>   <date form="text">@@ -22,7 +22,7 @@     <term name="anonymous">anonym</term>     <term name="anonymous" form="short">anon.</term>     <term name="at">på</term>-    <term name="available at">available at</term>+    <term name="available at">tilgjengelig på</term>     <term name="by">av</term>     <term name="circa">circa</term>     <term name="circa" form="short">ca.</term>@@ -54,12 +54,12 @@       <multiple>refr.</multiple>     </term>     <term name="retrieved">hentet</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">målestokk</term>+    <term name="version">versjon</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">f.Kr</term>-    <term name="bc">e.Kr</term>+    <term name="ad">fvt.</term>+    <term name="bc">evt.</term>      <!-- PUNCTUATION -->     <term name="open-quote">«</term>@@ -191,8 +191,8 @@      <!-- LONG ROLE FORMS -->     <term name="director">-      <single>director</single>-      <multiple>directors</multiple>+      <single>regissør</single>+      <multiple>regissører</multiple>     </term>     <term name="editor">       <single>redaktør</single>@@ -203,8 +203,8 @@       <multiple>redaktører</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>illustratør</single>+      <multiple>illustratører</multiple>     </term>     <term name="translator">       <single>oversetter</single>@@ -217,8 +217,8 @@      <!-- SHORT ROLE FORMS -->     <term name="director" form="short">-      <single>dir.</single>-      <multiple>dirs.</multiple>+      <single>regi</single>+      <multiple>regi</multiple>     </term>     <term name="editor" form="short">       <single>red.</single>@@ -242,19 +242,19 @@     </term>      <!-- VERB ROLE FORMS -->-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">regissert av</term>     <term name="editor" form="verb">redigert av</term>     <term name="editorial-director" form="verb">redigert av</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">illustrert av</term>     <term name="interviewer" form="verb">intervjuet av</term>-    <term name="recipient" form="verb">mottatt av</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="recipient" form="verb">til</term>+    <term name="reviewed-author" form="verb">av</term>     <term name="translator" form="verb">oversatt av</term>     <term name="editortranslator" form="verb">redigert &amp; oversatt av</term>      <!-- SHORT VERB ROLE FORMS -->     <term name="container-author" form="verb-short">av</term>-    <term name="director" form="verb-short">dir.</term>+    <term name="director" form="verb-short">regi</term>     <term name="editor" form="verb-short">red.</term>     <term name="editorial-director" form="verb-short">red.</term>     <term name="illustrator" form="verb-short">illus.</term>
locales/locales-nl-NL.xml view
@@ -57,7 +57,7 @@       <single>ref.</single>       <multiple>refs.</multiple>     </term>-    <term name="retrieved">verkregen</term>+    <term name="retrieved">geraadpleegd</term>     <term name="scale">schaal</term>     <term name="version">versie</term> 
locales/locales-nn-NO.xml view
@@ -2,7 +2,7 @@ <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="nn-NO">   <info>     <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>-    <updated>2012-07-04T23:31:02+00:00</updated>+    <updated>2013-03-01T12:20:00+01:00</updated>   </info>   <style-options punctuation-in-quote="false"/>   <date form="text">@@ -22,7 +22,7 @@     <term name="anonymous">anonym</term>     <term name="anonymous" form="short">anon.</term>     <term name="at">på</term>-    <term name="available at">available at</term>+    <term name="available at">tilgjengeleg på</term>     <term name="by">av</term>     <term name="circa">circa</term>     <term name="circa" form="short">ca.</term>@@ -54,12 +54,12 @@       <multiple>refr.</multiple>     </term>     <term name="retrieved">henta</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">målestokk</term>+    <term name="version">versjon</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">f.Kr</term>-    <term name="bc">e.Kr</term>+    <term name="ad">fvt.</term>+    <term name="bc">evt.</term>      <!-- PUNCTUATION -->     <term name="open-quote">«</term>@@ -191,8 +191,8 @@      <!-- LONG ROLE FORMS -->     <term name="director">-      <single>director</single>-      <multiple>directors</multiple>+      <single>regissør</single>+      <multiple>regissørar</multiple>     </term>     <term name="editor">       <single>redaktør</single>@@ -203,8 +203,8 @@       <multiple>redaktørar</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>illustratør</single>+      <multiple>illustratørar</multiple>     </term>     <term name="translator">       <single>omsetjar</single>@@ -217,8 +217,8 @@      <!-- SHORT ROLE FORMS -->     <term name="director" form="short">-      <single>dir.</single>-      <multiple>dirs.</multiple>+      <single>regi</single>+      <multiple>regi</multiple>     </term>     <term name="editor" form="short">       <single>red.</single>@@ -242,19 +242,19 @@     </term>      <!-- VERB ROLE FORMS -->-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">regissert av</term>     <term name="editor" form="verb">redigert av</term>     <term name="editorial-director" form="verb">redigert av</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">illustrert av</term>     <term name="interviewer" form="verb">intervjua av</term>-    <term name="recipient" form="verb">motteke av</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="recipient" form="verb">til</term>+    <term name="reviewed-author" form="verb">av</term>     <term name="translator" form="verb">omsett av</term>     <term name="editortranslator" form="verb">redigert &amp; omsett av</term>      <!-- SHORT VERB ROLE FORMS -->     <term name="container-author" form="verb-short">av</term>-    <term name="director" form="verb-short">dir.</term>+    <term name="director" form="verb-short">regi</term>     <term name="editor" form="verb-short">red.</term>     <term name="editorial-director" form="verb-short">red.</term>     <term name="illustrator" form="verb-short">illus.</term>
locales/locales-pt-PT.xml view
@@ -22,8 +22,8 @@     <term name="anonymous">anónimo</term>     <term name="anonymous" form="short">anón</term>     <term name="at">em</term>-    <term name="available at">available at</term>-    <term name="by">by</term>+    <term name="available at">disponível em</term>+    <term name="by">por</term>     <term name="circa">circa</term>     <term name="circa" form="short">c.</term>     <term name="cited">citado</term>@@ -41,7 +41,7 @@     <term name="internet">internet</term>     <term name="interview">entrevista</term>     <term name="letter">carta</term>-    <term name="no date">no date</term>+    <term name="no date">sem data</term>     <term name="no date" form="short">sem data</term>     <term name="online">em linha</term>     <term name="presented at">apresentado na</term>@@ -55,7 +55,7 @@     </term>     <term name="retrieved">obtido</term>     <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="version">versão</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->     <term name="ad">AD</term>@@ -78,16 +78,16 @@     <term name="ordinal-13">th</term>      <!-- LONG ORDINALS -->-    <term name="long-ordinal-01">first</term>-    <term name="long-ordinal-02">second</term>-    <term name="long-ordinal-03">third</term>-    <term name="long-ordinal-04">fourth</term>-    <term name="long-ordinal-05">fifth</term>-    <term name="long-ordinal-06">sixth</term>-    <term name="long-ordinal-07">seventh</term>-    <term name="long-ordinal-08">eighth</term>-    <term name="long-ordinal-09">ninth</term>-    <term name="long-ordinal-10">tenth</term>+    <term name="long-ordinal-01">primeiro</term>+    <term name="long-ordinal-02">segundo</term>+    <term name="long-ordinal-03">terceiro</term>+    <term name="long-ordinal-04">quarto</term>+    <term name="long-ordinal-05">quinto</term>+    <term name="long-ordinal-06">sexto</term>+    <term name="long-ordinal-07">sétimo</term>+    <term name="long-ordinal-08">oitavo</term>+    <term name="long-ordinal-09">nono</term>+    <term name="long-ordinal-10">décimo</term>      <!-- LONG LOCATOR FORMS -->     <term name="book">@@ -296,9 +296,9 @@     <term name="month-12" form="short">Dez</term>      <!-- SEASONS -->-    <term name="season-01">Spring</term>-    <term name="season-02">Summer</term>-    <term name="season-03">Autumn</term>-    <term name="season-04">Winter</term>+    <term name="season-01">Primavera</term>+    <term name="season-02">Verão</term>+    <term name="season-03">Outono</term>+    <term name="season-04">Inverno</term>   </terms> </locale>
locales/locales-ro-RO.xml view
@@ -1,6 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="ro-RO">   <info>+    <translator>+      <name>Nicolae Turcan</name>+      <email>nturcan@gmail.com</email>+    </translator>     <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>     <updated>2012-07-04T23:31:02+00:00</updated>   </info>@@ -16,13 +20,13 @@     <date-part name="year"/>   </date>   <terms>-    <term name="accessed">data accesării:</term>+    <term name="accessed">data accesării</term>     <term name="and">și</term>     <term name="and others">și alții</term>     <term name="anonymous">anonim</term>     <term name="anonymous" form="short">anon.</term>     <term name="at">la</term>-    <term name="available at">available at</term>+    <term name="available at">valabil la</term>     <term name="by">de</term>     <term name="circa">circa</term>     <term name="circa" form="short">cca.</term>@@ -54,8 +58,8 @@       <multiple>ref.</multiple>     </term>     <term name="retrieved">preluat în</term>-    <term name="scale">scale</term>-    <term name="version">version</term>+    <term name="scale">scală</term>+    <term name="version">versiunea</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->     <term name="ad">d.Hr.</term>@@ -66,7 +70,7 @@     <term name="close-quote">”</term>     <term name="open-inner-quote">«</term>     <term name="close-inner-quote">»</term>-    <term name="page-range-delimiter">–</term>+    <term name="page-range-delimiter">-</term>      <!-- ORDINALS -->     <term name="ordinal">-lea</term>@@ -193,7 +197,7 @@     <!-- LONG ROLE FORMS -->     <term name="director">       <single>director</single>-      <multiple>directors</multiple>+      <multiple>directori</multiple>     </term>     <term name="editor">       <single>editor</single>@@ -204,8 +208,8 @@       <multiple>editori</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>ilustrator</single>+      <multiple>ilustratori</multiple>     </term>     <term name="translator">       <single>traducător</single>@@ -219,7 +223,7 @@     <!-- SHORT ROLE FORMS -->     <term name="director" form="short">       <single>dir.</single>-      <multiple>dirs.</multiple>+      <multiple>dir.</multiple>     </term>     <term name="editor" form="short">       <single>ed.</single>@@ -230,8 +234,8 @@       <multiple>ed.</multiple>     </term>     <term name="illustrator" form="short">-      <single>ill.</single>-      <multiple>ills.</multiple>+      <single>ilustr.</single>+      <multiple>ilustr.</multiple>     </term>     <term name="translator" form="short">       <single>trad.</single>@@ -243,13 +247,13 @@     </term>      <!-- VERB ROLE FORMS -->-    <term name="director" form="verb">directed by</term>+    <term name="director" form="verb">coordonat de</term>     <term name="editor" form="verb">ediție de</term>     <term name="editorial-director" form="verb">ediție de</term>-    <term name="illustrator" form="verb">illustrated by</term>+    <term name="illustrator" form="verb">ilustrații de</term>     <term name="interviewer" form="verb">interviu de</term>     <term name="recipient" form="verb">în</term>-    <term name="reviewed-author" form="verb">by</term>+    <term name="reviewed-author" form="verb">de</term>     <term name="translator" form="verb">traducere de</term>     <term name="editortranslator" form="verb">ediție &amp; traducere de</term> @@ -258,7 +262,7 @@     <term name="director" form="verb-short">dir.</term>     <term name="editor" form="verb-short">ed.</term>     <term name="editorial-director" form="verb-short">ed.</term>-    <term name="illustrator" form="verb-short">illus.</term>+    <term name="illustrator" form="verb-short">ilustr.</term>     <term name="translator" form="verb-short">trad.</term>     <term name="editortranslator" form="verb-short">ed. &amp; trad. de</term> 
locales/locales-sv-SE.xml view
@@ -22,10 +22,10 @@     <term name="anonymous">anonym</term>     <term name="anonymous" form="short">anon</term>     <term name="at">vid</term>-    <term name="available at">available at</term>-    <term name="by">by</term>-    <term name="circa">circa</term>-    <term name="circa" form="short">c.</term>+    <term name="available at">tillgänglig vid</term>+    <term name="by">av</term>+    <term name="circa">cirka</term>+    <term name="circa" form="short">ca</term>     <term name="cited">citerad</term>     <term name="edition">       <single>upplaga</single>@@ -41,13 +41,13 @@     <term name="internet">internet</term>     <term name="interview">intervju</term>     <term name="letter">brev</term>-    <term name="no date">no date</term>+    <term name="no date">inget datum</term>     <term name="no date" form="short">nd</term>     <term name="online">online</term>     <term name="presented at">presenterad vid</term>     <term name="reference">-      <single>reference</single>-      <multiple>references</multiple>+      <single>referens</single>+      <multiple>referenser</multiple>     </term>     <term name="reference" form="short">       <single>ref.</single>@@ -58,8 +58,8 @@     <term name="version">version</term>      <!-- ANNO DOMINI; BEFORE CHRIST -->-    <term name="ad">AD</term>-    <term name="bc">BC</term>+    <term name="ad">e. Kr.</term>+    <term name="bc">f. Kr.</term>      <!-- PUNCTUATION -->     <term name="open-quote">”</term>@@ -69,25 +69,23 @@     <term name="page-range-delimiter">–</term>      <!-- ORDINALS -->-    <term name="ordinal">th</term>-    <term name="ordinal-01">st</term>-    <term name="ordinal-02">nd</term>-    <term name="ordinal-03">rd</term>-    <term name="ordinal-11">th</term>-    <term name="ordinal-12">th</term>-    <term name="ordinal-13">th</term>+    <term name="ordinal">e</term>+    <term name="ordinal-01">a</term>+    <term name="ordinal-02">a</term>+    <term name="ordinal-11">e</term>+    <term name="ordinal-12">e</term>      <!-- LONG ORDINALS -->-    <term name="long-ordinal-01">first</term>-    <term name="long-ordinal-02">second</term>-    <term name="long-ordinal-03">third</term>-    <term name="long-ordinal-04">fourth</term>-    <term name="long-ordinal-05">fifth</term>-    <term name="long-ordinal-06">sixth</term>-    <term name="long-ordinal-07">seventh</term>-    <term name="long-ordinal-08">eighth</term>-    <term name="long-ordinal-09">ninth</term>-    <term name="long-ordinal-10">tenth</term>+    <term name="long-ordinal-01">första</term>+    <term name="long-ordinal-02">andra</term>+    <term name="long-ordinal-03">tredje</term>+    <term name="long-ordinal-04">fjärde</term>+    <term name="long-ordinal-05">femte</term>+    <term name="long-ordinal-06">sjätte</term>+    <term name="long-ordinal-07">sjunde</term>+    <term name="long-ordinal-08">åttonde</term>+    <term name="long-ordinal-09">nionde</term>+    <term name="long-ordinal-10">tionde</term>      <!-- LONG LOCATOR FORMS -->     <term name="book">@@ -135,7 +133,7 @@       <multiple>stycken</multiple>     </term>     <term name="part">-      <single>dek</single>+      <single>del</single>       <multiple>delar</multiple>     </term>     <term name="section">@@ -209,16 +207,16 @@       <multiple>editors</multiple>     </term>     <term name="illustrator">-      <single>illustrator</single>-      <multiple>illustrators</multiple>+      <single>illustratör</single>+      <multiple>illustratörer</multiple>     </term>     <term name="translator">       <single>översättare</single>       <multiple>översättare</multiple>     </term>     <term name="editortranslator">-      <single>editor &amp; translator</single>-      <multiple>editors &amp; translators</multiple>+      <single>redaktör &amp; översättare</single>+      <multiple>redaktörer &amp; översättare</multiple>     </term>      <!-- SHORT ROLE FORMS -->@@ -296,9 +294,9 @@     <term name="month-12" form="short">Dec</term>      <!-- SEASONS -->-    <term name="season-01">Spring</term>-    <term name="season-02">Summer</term>-    <term name="season-03">Autumn</term>-    <term name="season-04">Winter</term>+    <term name="season-01">Vår</term>+    <term name="season-02">Sommar</term>+    <term name="season-03">Höst</term>+    <term name="season-04">Vinter</term>   </terms> </locale>
src/Text/CSL/Eval.hs view
@@ -24,9 +24,8 @@ import Control.Arrow import Control.Applicative ( (<$>) ) import Control.Monad.State-import Data.Char+import Data.Char ( toLower, isDigit, isLetter ) import Data.List-import qualified Data.Map as M import Data.Maybe  import Text.CSL.Eval.Common@@ -36,7 +35,6 @@ import Text.CSL.Output.Plain import Text.CSL.Reference import Text.CSL.Style-import Text.Pandoc.Definition  -- | Produce the output with a 'Layout', the 'EvalMode', a 'Bool' -- 'True' if the evaluation happens for disambiguation purposes, the@@ -52,7 +50,7 @@                         then []                         else [noOutputError]                   x | title r == citeId cit ++ " not found!" -> [noBibDataError $ cit]-                    | otherwise                              -> x+                    | otherwise                              -> suppTC x       locale = case l of                  [x] -> x                  _   -> Locale [] [] [] [] []@@ -60,9 +58,14 @@       cit    = case em of                  EvalCite    c -> c                  EvalSorting c -> c-                 EvalBiblio  s -> emptyCite { citePosition = s }-      initSt = EvalState (mkRefMap r) (Env cit (localeTermMap locale) m+                 EvalBiblio  c -> c+      initSt = EvalState (mkRefMap r) (Env cit (localeTerms locale) m                          (localeDate locale) o [] a) [] em b False [] [] False [] [] []+      suppTC = let getLang = take 2 . map toLower in+               case (getLang $ localeLang locale, getLang $ language r) of+                 (_,  "en") -> id+                 ("en", []) -> id+                 _          -> proc' rmTitleCase  evalSorting :: EvalMode -> [Locale] -> [MacroMap] -> [Option] ->                [Sort] -> [Abbrev] -> Reference -> [Sorting]@@ -98,7 +101,7 @@     | Choose i ei e         <- el = evalIfThen i ei e     | Macro    s   fm       <- el = return . appendOutput fm =<< evalElements =<< getMacro s     | Const    s   fm       <- el = return $ rtfParser fm s-    | Number   s f fm       <- el = formatNumber f fm =<< getStringVar s+    | Number   s f fm       <- el = formatNumber f fm s =<< getStringVar s     | Variable s f fm d     <- el = return . addDelim d =<< concatMapM (getVariable f fm) s     | Group        fm d l   <- el = when' ((/=) [] <$> tryGroup l) $                                     return . outputList fm d =<< evalElements l@@ -120,7 +123,16 @@                                     evalElement $ Names rs ns nfm (d' `betterThen` d) []                              _   -> evalElement e -      tryGroup     l = get >>= \s -> evalElements (rmTermConst l) >>= \r -> put s >> return r+      tryGroup l = if hasVar l+                   then get >>= \s -> evalElements (rmTermConst l) >>= \r -> put s >> return r+                   else return [ONull]+      hasVar  = not . null . query hasVarQ+      hasVarQ e+          | Variable {} <- e = [e]+          | Date     {} <- e = [e]+          | Names    {} <- e = [e]+          | Number   {} <- e = [e]+          | otherwise        = []       rmTermConst [] = []       rmTermConst (e:es)           | Term  {} <- e = rmTermConst es@@ -129,24 +141,24 @@        ifEmpty p t e = p >>= \r -> if r == [] then t else return (e r) -      withNames e n f = modify (\s -> s { authSub = concat e+      withNames e n f = modify (\s -> s { authSub = e ++ authSub s                                         , env = (env s)                                           {names = n : names (env s)}}) >> f >>= \r ->-                        modify (\s -> s { authSub = []+                         modify (\s -> s { authSub = filter (not . flip elem e) (authSub s)                                         , env = (env s)                                           {names = tail $ names (env s)}}) >> return r        getFirst        [] = return []-      getFirst    (x:xs) = whenElse ((/=) []  <$> evalElement x)-                                    (consuming $  evalElement x)+      getFirst    (x:xs) = whenElse ((/=) []  <$> substituteWith x)+                                    (consuming $  substituteWith x)                                     (getFirst xs)-       getMacro         s = maybe [] id . lookup s <$> gets (macros . env)-      getVariable f fm s = case (map toLower s) of+      getVariable f fm s = if isTitleVar s || isTitleShortVar s+                           then consumeVariable s >> formatTitle s f fm else+                           case (map toLower s) of                              "year-suffix" -> getStringVar "ref-id" >>= \k  ->                                               return . return $ OYearSuf [] k [] fm                              "page"        -> getStringVar "page" >>= formatRange fm-                             "title"       -> formatTitle f fm                              "locator"     -> getLocVar >>= formatRange fm . snd                              "url"         -> getStringVar "url" >>= \k ->                                               if null k then return [] else return [OUrl (k,k) fm]@@ -188,7 +200,9 @@       chkType         t = let chk = (==) (formatVariable t) . show . fromMaybe NoType . fromValue                           in  getVar False chk "ref-type"       chkNumeric      v = do val <- getStringVar v-                             return (v `elem` numericVars && or (map isDigit val))+                             as  <- gets (abbrevs . env)+                             let val' = if getAbbreviation as v val == [] then val else getAbbreviation as v val+                             return (isNumericString val')       chkDate         v = getDateVar v >>= return . not . null . filter ((/=) [] . circa)       chkPosition     s = if s == "near-note"                           then gets (nearNote . cite . env)@@ -214,42 +228,46 @@     | otherwise                                  = []     where       value     = if stripPeriods fm then filter (/= '.') else id-      getAbbr v = if f /= Short then v else-                  case lookup "default" as of-                    Nothing -> v-                    Just x  -> case lookup s x of-                                 Nothing -> v-                                 Just x' -> case M.lookup v x' of-                                              Nothing  -> v-                                              Just x'' -> x''+      getAbbr v = if f == Short+                  then let ab = getAbbreviation as s v in+                       if null ab then v else ab+                  else v       nameOpts = ("name-as-sort-order","all") : o       sortDate = [ DatePart "year"  "numeric-leading-zeros" "" emptyFormatting                  , DatePart "month" "numeric-leading-zeros" "" emptyFormatting                  , DatePart "day"   "numeric-leading-zeros" "" emptyFormatting] -formatTitle :: Form -> Formatting -> State EvalState [Output]-formatTitle f fm-    | Short <- f = getIt "title-short" "title"-    | otherwise  = getIt "title" "title-short"+formatTitle :: String -> Form -> Formatting -> State EvalState [Output]+formatTitle s f fm+    | Short <- f+    , isTitleVar      s = try (getIt $ s ++ "-short") $ getIt s+    | isTitleShortVar s = try (getIt s) $ return . rtfParser fm =<< getTitleShort s+    | otherwise         = getIt s     where-      getIt x fb = do+      try g h = g >>= \r -> if r == [] then h else return r+      getIt x = do         o <- gets (options . env)         a <- gets (abbrevs . env)-        r <- getVar [] (getFormattedValue o a f fm x) x-        case r of-          [] -> getVar [] (getFormattedValue o a f fm x) fb-          _  -> return r+        getVar [] (getFormattedValue o a f fm x) x -formatNumber :: NumericForm -> Formatting -> String -> State EvalState [Output]-formatNumber f fm s-    | or (map isDigit s) = do tm <- gets (terms . env)-                              return . output fm . format tm . filter isDigit $ s-    | otherwise          = do return . output fm $ s+formatNumber :: NumericForm -> Formatting -> String -> String -> State EvalState [Output]+formatNumber f fm v n+    = gets (abbrevs . env) >>= \as ->+      if isNumericString (getAbbr as n)+      then gets (terms . env) >>=+           return . output fm . flip process (getAbbr as n)+      else return . output fm . getAbbr as $ n     where+      getAbbr       as   = if getAbbreviation as v n == [] then id else getAbbreviation as v+      checkRange'   ts   = if v == "page" then checkRange ts else id+      process       ts   = checkRange' ts . printNumStr . map (renderNumber ts) .+                           breakNumericString . words+      renderNumber  ts x = if isTransNumber x then format ts x else x+       format tm = case f of-                    Ordinal     -> ordinal tm-                    LongOrdinal -> longOrdinal tm-                    Roman       -> if readNum s < 6000 then roman else id+                    Ordinal     -> ordinal     tm v+                    LongOrdinal -> longOrdinal tm v+                    Roman       -> if readNum n < 6000 then roman else id                     _           -> id        roman     = foldr (++) [] . reverse . map (uncurry (!!)) . zip romanList .@@ -260,23 +278,66 @@ 	          ,[ "", "m", "mm", "mmm", "mmmm", "mmmmm"]                   ] ++checkRange :: [CslTerm] -> String -> String+checkRange _ [] = []+checkRange ts (x:xs) = if x == '-'+                       then pageRange ts ++ checkRange ts xs+                       else x             : checkRange ts xs++printNumStr :: [String] -> String+printNumStr []     = []+printNumStr (x:[]) = x+printNumStr (x:"-":y:xs) = x ++ "-"  ++ y ++ printNumStr xs+printNumStr (x:",":y:xs) = x ++ ", " ++ y ++ printNumStr xs+printNumStr (x:xs)+    | x == "-"  = x ++        printNumStr xs+    | otherwise = x ++ " " ++ printNumStr xs++pageRange :: [CslTerm] -> String+pageRange = maybe "\x2013" termPlural . findTerm "page-range-delimiter" Long++isNumericString :: String -> Bool+isNumericString [] = False+isNumericString s  = null . filter (not . isNumber &&& not . isSpecialChar >>> uncurry (&&)) $+                     words s++isTransNumber, isSpecialChar,isNumber :: String -> Bool+isTransNumber = and . map isDigit+isSpecialChar = and . map (flip elem "&-,")+isNumber      = filter (not . isLetter) >>> filter (not . flip elem "&-,") >>>+                map isDigit >>> and &&& not . null >>> uncurry (&&)++breakNumericString :: [String] -> [String]+breakNumericString [] = []+breakNumericString (x:xs)+    | isTransNumber x = x : breakNumericString xs+    | otherwise       = let (a,b) = break (flip elem "&-,") x+                            (c,d) = if null b then ("","") else (head' b, tail b)+                        in filter (/= []) $  a : c : breakNumericString (d : xs)+ formatRange :: Formatting -> String -> State EvalState [Output] formatRange _ [] = return [] formatRange fm p = do   ops <- gets (options . env)+  ts  <- gets (terms . env)   let opt = getOptionVal "page-range-format" ops-      splitRange = break (== '-') >>> trim *** trim . dropWhile (== '-')-      pages = map splitRange . split (== ',') $ p-      format a b = if b /= []-                   then flip Output emptyFormatting [ OStr a emptyFormatting, OPan [Str "\x2013"]-                                                    , OStr b emptyFormatting]-                   else flip Output emptyFormatting [ OStr a emptyFormatting]-      result = case opt of-                 "expanded" -> map (uncurry format . uncurry expandedRange) pages-                 "chicago"  -> map (uncurry format . uncurry chicagoRange ) pages-                 "minimal"  -> map (uncurry format . uncurry minimalRange ) pages-                 _          -> map (uncurry format                        ) pages-  return [flip OLoc fm $ addDelim ", " result]+      pages = tupleRange . breakNumericString . words $ p++      tupleRange [] = []+      tupleRange (x:"-":[]  ) = return (x,[])+      tupleRange (x:"-":y:xs) = (x, y) : tupleRange xs+      tupleRange (x:      xs) = (x,[]) : tupleRange xs++      joinRange (a, []) = a+      joinRange (a,  b) = a ++ "-" ++ b++      process = case opt of+                 "expanded" -> checkRange ts . printNumStr . map (joinRange . uncurry expandedRange)+                 "chicago"  -> checkRange ts . printNumStr . map (joinRange . uncurry chicagoRange )+                 "minimal"  -> checkRange ts . printNumStr . map (joinRange . uncurry minimalRange )+                 _          -> checkRange ts . printNumStr . map (joinRange)+  return [flip OLoc fm $ [OStr (process pages) emptyFormatting]]  expandedRange :: String -> String -> (String, String) expandedRange sa [] = (sa,[])
src/Text/CSL/Eval/Common.hs view
@@ -20,6 +20,7 @@ import Control.Monad.State import Data.Char ( toLower ) import Data.List ( elemIndex )+import qualified Data.Map as M import Data.Maybe  import Text.CSL.Reference@@ -33,7 +34,7 @@       , mode     :: EvalMode       , disamb   :: Bool       , consume  :: Bool-      , authSub  :: String+      , authSub  :: [String]       , consumed :: [String]       , edtrans  :: Bool       , etal     :: [[Output]]@@ -44,7 +45,7 @@ data Environment     = Env       { cite    :: Cite-      , terms   :: [TermMap]+      , terms   :: [CslTerm]       , macros  :: [MacroMap]       , dates   :: [Element]       , options :: [Option]@@ -55,20 +56,28 @@ data EvalMode     = EvalSorting Cite     | EvalCite    Cite-    | EvalBiblio  String -- the reference position+    | EvalBiblio  Cite -- for the reference position       deriving ( Show, Eq ) -getCite :: EvalMode -> Cite-getCite (EvalCite c) = c-getCite _            = emptyCite- isSorting :: EvalMode -> Bool isSorting m = case m of EvalSorting _ -> True; _ -> False +-- | With the variable name and the variable value search for an+-- abbreviation or return an empty string.+getAbbreviation :: [Abbrev] -> String -> String -> String+getAbbreviation as s v+    = case lookup "default" as of+        Nothing -> []+        Just x  -> case lookup (if s `elem` numericVars then "number" else s) x of+                     Nothing -> []+                     Just x' -> case M.lookup v x' of+                                  Nothing  -> []+                                  Just x'' -> x''+ -- | If the first parameter is 'True' the plural form will be retrieved. getTerm :: Bool -> Form -> String -> State EvalState String-getTerm b f s = maybe [] g . lookup (s,f') <$> gets (terms  . env) -- FIXME: vedere i fallback-    where g  = if b then snd else fst+getTerm b f s = maybe [] g . findTerm s f' <$> gets (terms  . env) -- FIXME: vedere i fallback+    where g  = if b then termPlural else termSingular           f' = case f of NotSet -> Long; _ -> f  getStringVar :: String -> State EvalState String@@ -121,10 +130,23 @@ isOptionSet :: String -> [Option] -> Bool isOptionSet s = maybe False (not . null) . lookup s +isTitleVar, isTitleShortVar :: String -> Bool+isTitleVar         = flip elem ["title", "container-title", "collection-title"]+isTitleShortVar    = flip elem ["title-short", "container-title-short"]++getTitleShort :: String -> State EvalState String+getTitleShort s = do v <- getStringVar (take (length s - 6) s)+                     a <- gets (abbrevs . env)+                     return $ getAbbreviation a (take (length s - 6) s) v+ isVarSet :: String -> State EvalState Bool-isVarSet s = if s /= "locator"-             then getVar False isValueSet s-             else getLocVar >>= return . (/=) "" . snd+isVarSet s+    | isTitleShortVar s = do r <- getVar False isValueSet s+                             if r then return r+                                  else return . not . null =<< getTitleShort s+    | otherwise = if s /= "locator"+                  then getVar False isValueSet s+                  else getLocVar >>= return . (/=) "" . snd  withRefMap :: (ReferenceMap -> a) -> State EvalState a withRefMap f = return . f =<< gets ref@@ -145,10 +167,11 @@           unsetConsume = modify $ \s -> s {consume = False }           doConsume    = do sl <- gets consumed                             modify $ \st -> st { ref = remove (ref st) sl }+          doRemove s (k,v) = if isValueSet v then [(formatVariable s,Value Empty)] else [(k,v)]           remove rm sl               | (s:ss) <- sl = case elemIndex (formatVariable s) (map fst rm) of                                  Just  i -> let nrm = take i rm ++-                                                      [(formatVariable s,Value Empty)] +++                                                      doRemove s (rm !! i) ++                                                       drop (i + 1) rm                                             in  remove nrm ss                                  Nothing ->     remove  rm ss
src/Text/CSL/Eval/Date.hs view
@@ -74,7 +74,7 @@     [x'] -> return x'     _    -> return $ Date [] NoFormDate emptyFormatting [] [] [] -formatDate :: EvalMode -> String -> [TermMap] -> [DatePart] -> [RefDate] -> [Output]+formatDate :: EvalMode -> String -> [CslTerm] -> [DatePart] -> [RefDate] -> [Output] formatDate em k tm dp date     | [d]     <- date = concatMap (formatDatePart False d) dp     | (a:b:_) <- date = return . ODate . concat $ (start a b ++ end a b ++ coda b)@@ -95,21 +95,21 @@       term f t = let f' = if f `elem` ["verb", "short", "verb-short", "symbol"]                           then read $ toRead f                           else Long-                 in maybe [] fst $ lookup (t, f') tm+                 in maybe [] termPlural $ findTerm t f' tm        addZero n = if length n == 1 then '0' : n else n       addZeros  = reverse . take 5 . flip (++) (repeat '0') . reverse       formatDatePart False (RefDate y m e d _ _) (DatePart n f _ fm)           | "year"  <- n, y /= [] = return $ OYear (formatYear  f    y) k fm           | "month" <- n, m /= [] = output fm      (formatMonth f fm m)-          | "day"   <- n, d /= [] = output fm      (formatDay   f    d)+          | "day"   <- n, d /= [] = output fm      (formatDay   f m  d)           | "month" <- n, m == []                         , e /= [] = output fm $ term f ("season-0" ++ e)        formatDatePart True (RefDate y m e d _ _) (DatePart n f rd fm)           | "year"  <- n, y /= [] = OYear (formatYear  f y) k (fm {suffix = []}) : formatDelim           | "month" <- n, m /= [] = output (fm {suffix = []}) (formatMonth f fm m) ++ formatDelim-          | "day"   <- n, d /= [] = output (fm {suffix = []}) (formatDay   f    d) ++ formatDelim+          | "day"   <- n, d /= [] = output (fm {suffix = []}) (formatDay   f m  d) ++ formatDelim           | "month" <- n, m == []                         , e /= [] = output (fm {suffix = []}) (term f $ "season-0" ++ e) ++ formatDelim           where@@ -132,34 +132,47 @@           where             iy = readNum y       formatMonth f fm m-          | "short"   <- f = getMonth $ period . fst-          | "long"    <- f = getMonth fst+          | "short"   <- f = getMonth $ period . termPlural+          | "long"    <- f = getMonth termPlural           | "numeric" <- f = m           | otherwise      = addZero m           where             period     = if stripPeriods fm then filter (/= '.') else id-            getMonth g = maybe m g $ lookup ("month-" ++ addZero m, read $ toRead f) tm-      formatDay f d+            getMonth g = maybe m g $ findTerm ("month-" ++ addZero m) (read $ toRead f) tm+      formatDay f m d           | "numeric-leading-zeros" <- f = addZero d-          | "ordinal"               <- f = ordinal tm d+          | "ordinal"               <- f = ordinal tm ("month-" ++ addZero m) d           | otherwise                    = d -ordinal :: [TermMap] -> String -> String-ordinal _ [] = []-ordinal tm s-    = case last s of-        '1' -> s ++ term "1"-        '2' -> s ++ term "2"-        '3' -> s ++ term "3"-        _   -> s ++ term "4"+ordinal :: [CslTerm] -> String -> String -> String+ordinal _ _ [] = []+ordinal ts v s+    | length s == 1 = let a = termPlural (getWith1 s) in+                      if  a == [] then setOrd (term []) else s ++ a+    | length s == 2 = let a = termPlural (getWith2 s)+                          b = getWith1 [last s] in+                      if  a /= []+                      then s ++ a+                      else if termPlural b == [] || (termMatch b /= [] && termMatch b /= "last-digit")+                           then setOrd (term []) else setOrd b+    | otherwise     = let a = getWith2  last2+                          b = getWith1 [last s] in+                      if termPlural a /= [] && termMatch a /= "whole-number"+                      then setOrd a+                      else if termPlural b == [] || (termMatch b /= [] && termMatch b /= "last-digit")+                           then setOrd (term []) else setOrd b     where-      term t = maybe [] fst $ lookup ("ordinal-0" ++ t, Long) tm+      setOrd   = (++) s . termPlural+      getWith1 = term . (++) "-0"+      getWith2 = term . (++) "-"+      last2    = reverse . take 2 . reverse $ s+      term   t = getOrdinal v ("ordinal" ++ t) ts -longOrdinal :: [TermMap] -> String -> String-longOrdinal _ [] = []-longOrdinal tm s+longOrdinal :: [CslTerm] -> String -> String -> String+longOrdinal _ _ [] = []+longOrdinal ts v s     | num > 10 ||-      num == 0  = ordinal tm s+      num == 0  = ordinal ts v s     | otherwise = case last s of                     '1' -> term "01"                     '2' -> term "02"@@ -173,8 +186,19 @@                     _   -> term "10"     where       num    = readNum s-      term t = maybe [] fst $ lookup ("long-ordinal-" ++ t, Long) tm+      term t = termPlural $ getOrdinal v ("long-ordinal-" ++ t) ts +getOrdinal :: String -> String -> [CslTerm] -> CslTerm+getOrdinal v s ts+    = case findTerm' s Long gender ts of+        Just  x -> x+        Nothing -> case findTerm' s Long Neuter ts of+                     Just  x -> x+                     Nothing -> newTerm+    where+      gender = if v `elem` numericVars || "month" `isPrefixOf` v+               then maybe Neuter termGender $ findTerm v Long ts+               else Neuter  parseRefDate :: RefDate -> [RefDate] parseRefDate r@(RefDate _ _ _ _ o c)
src/Text/CSL/Eval/Names.hs view
@@ -47,18 +47,14 @@         p   <- gets (citePosition . cite . env)         ops <- gets (options . env)         aus <- gets authSub-        r   <- if s == "author" && ags /= [] && p == "subsequent" &&-                  isOptionSet "subsequent-author-substitute" ops-               then return $ output emptyFormatting $-                    getOptionVal "subsequent-author-substitute" ops-               else do res <- agents p            s ags-                       st  <- get-                       fb  <- agents "subsequent" s ags-                       put st-                       if res /= []-                          then let role = if aus == "author" then aus ++ "sub" else s-                               in  return . return . OContrib k role res fb =<< gets etal-                          else     return []+        r   <- do res <- agents p            s ags+                  st  <- get+                  fb  <- agents "subsequent" s ags+                  put st+                  if res /= []+                    then let role = if aus == ["author"] then concat aus ++ "sub" else s+                         in  return . return . OContrib k role res fb =<< gets etal+                    else     return []         r'  <- evalNames skipEdTrans xs nl d         num <- gets contNum         return $ if r /= [] && r' /= []@@ -332,8 +328,12 @@     | "page"    <- s = checkPlural     | "volume"  <- s = checkPlural     | "ibid"    <- s = format' s p-    | otherwise      = format  s p+    | otherwise      = if isRole s then form (\fm' x -> [OLabel x fm']) id s p else format s p     where+      isRole = flip elem ["author", "collection-editor", "composer", "container-author"+                         ,"director", "editor", "editorial-director", "editortranslator"+                         ,"illustrator", "interviewer", "original-author", "recipient"+                         ,"reviewed-author", "translator"]       checkPlural = when' (isVarSet s) $ do                       v <- getStringVar s                       format  s ('-' `elem` v)
src/Text/CSL/Eval/Output.hs view
@@ -57,12 +57,12 @@     where       check x xs           | ONull <- x = xs-          | otherwise  = let text = renderPlainStrict $ formatOutputList [x]-                         in  if d /= [] && text /= []-                             then if head d == last text && head d `elem` ".,;:!?"+          | otherwise  = let text = renderPlainStrict . formatOutputList+                         in  if d /= [] && text [x] /= [] && text xs /= []+                             then if head d == last (text [x]) && head d `elem` ".,;:!?"                                   then x : ODel (tail d) : xs                                   else x : ODel       d  : xs-                             else      x : ODel       d  : xs+                             else      x                 : xs  noOutputError :: Output noOutputError = OStr "[CSL STYLE ERROR: reference with no printed form.]" emptyFormatting@@ -144,4 +144,4 @@                            ]       parseQ a b = try $ do         q <- string a >> manyTill anyChar (try $ string b >> notFollowedBy letter)-        return [Output (rtfParser emptyFormatting q) (emptyFormatting {quotes = True})]+        return [Output (rtfParser emptyFormatting q) (emptyFormatting {quotes = ParsedQuote})]
src/Text/CSL/Input/MODS.hs view
@@ -41,12 +41,12 @@  xpReference :: PU Reference xpReference-    = xpWrap ( \ ( ref-                , (ck,ty,ti,i,d)-                ,((au,ed,tr),(re,it,pu',dr),(co,ce,dg,om))-                ,((di',pg,vl,is),(nu,sc,ch))+    = xpWrap ( \ ((ref,oref)+                , (ck,(ty,gn),ti,i,d)+                ,((au,ed,tr,sp),(re,it,pu',dr),(co,ce,dg,om))+                ,((di',pg,vl,is),(nu,sc,ch,vs))                 , (di,ac,pu,pp,et)-                , ((ac',uri),no)+                , ((ac',uri),ln,st,no)                  ) ->                ref { refId            = ck `betterThen` take 10 (concat . words $ fst ti)                    , refType          = if ty /= NoType then ty else@@ -63,11 +63,13 @@                    , director         = dr `betterThen` director         ref                    , collectionEditor = ce `betterThen` collectionEditor ref                    , publisherPlace   = pp `betterThen` publisherPlace   ref+                   , numberOfVolumes  = vs `betterThen` numberOfVolumes  ref                    , containerAuthor  = containerAuthor  ref                    , url              = uri                    , note             = no                    , isbn             = i                    , doi              = d+                   , genre            = genre         ref `betterThen` gn                    , issued           = issued        ref `betterThen` di `betterThen` di'                    , accessed         = accessed      ref `betterThen` ac `betterThen` ac'                    , page             = page          ref `betterThen` pg@@ -77,25 +79,34 @@                    , number           = number        ref `betterThen` nu                    , section          = section       ref `betterThen` sc                    , chapterNumber    = chapterNumber ref `betterThen` ch+                   , language         = language      ref `betterThen` ln+                   , status           = status        ref `betterThen` st                    , publisher        = fromAgent pu                                            `betterThen` publisher ref                                            `betterThen` fromAgent pu'                                            `betterThen` fromAgent dg                                            `betterThen` fromAgent om+                                           `betterThen` fromAgent sp+                   , originalDate           = issued         oref+                   , originalTitle          = title          oref+                   , originalPublisher      = publisher      oref+                   , originalPublisherPlace = publisherPlace oref                    }-             , \r -> (  r-                     , (refId     r, refType          r, (title r, titleShort r), isbn r, doi r)-                     ,((author    r, editor           r, translator     r)-                      ,(recipient r, interviewer      r, emptyAgents, director  r)+             , \r -> ( (emptyReference,emptyReference)+                     , (refId     r,(refType r,genre r), (title r, titleShort r), isbn r, doi r)+                     ,((author    r, editor           r, translator r, director r)+                      ,(recipient r, interviewer      r, emptyAgents,  director r)                       ,(composer  r, collectionEditor r, emptyAgents, emptyAgents))                      ,((issued    r, page  r, volume r, issue r)-                      ,(number    r, section   r, chapterNumber r))+                      ,(number    r, section   r, chapterNumber r, numberOfVolumes r))                      , (issued    r, accessed r, emptyAgents, publisherPlace r, edition r)-                     ,((accessed  r, url r), note r)+                     ,((accessed  r, url r),  status r, language r, note r)                      )) $-      xp6Tuple (xpDefault emptyReference xpRelatedItem)-               (xp5Tuple  xpCiteKey xpRefType xpTitle xpIsbn xpDoi)-                xpAgents xpPart xpOrigin (xpPair xpUrl xpNote)+      xp6Tuple (xpPair (xpDefault emptyReference $ xpRelatedItem "host")+                       (xpDefault emptyReference $ xpRelatedItem "original"))+               (xp5Tuple xpCiteKey xpRefType xpTitle xpIsbn xpDoi)+                xpAgents xpPart xpOrigin+               (xp4Tuple xpUrl xpLang xpStatus xpNote)  xpCiteKey :: PU String xpCiteKey@@ -116,9 +127,9 @@                (xpDefault [] $ xpIElem "place"   $ xpIElem "placeTerm" xpText0)                (xpDefault [] $ xpIElem "edition" $                     xpText0) -xpRefType :: PU RefType+xpRefType :: PU (RefType, String) xpRefType-    = xpDefault NoType $+    = xpDefault (NoType,[]) $       xpWrap (readRefType, const []) xpGenre  xpGenre :: PU [String]@@ -128,18 +139,23 @@               (xpPair (xpDefault [] $ xpAttr "authority" xpText) xpText)               $ xpLift . snd -xpRelatedItem :: PU Reference-xpRelatedItem-    = xpIElem "relatedItem" . xpAddFixedAttr "type" "host" $-      xpWrap ( \( (ty,ct)-                ,((ca,ed,tr),(re,it,pu',dr),(co,ce,dg,om))-                ,((di,pg,vl,is),(nu,sc,ch))+xpRelatedItem :: String -> PU Reference+xpRelatedItem t+    = xpIElem "relatedItem" . xpAddFixedAttr "type" t $+      xpWrap ( \(((t3l,t3s),(t4l,_))+                ,((ty,gn),ct)+                ,((ca,ed,tr,sp),(re,it,pu',dr),(co,ce,dg,om))+                ,((di,pg,vl,is),(nu,sc,ch,vs))                 , (di',ac,pu,pp,et)+                , (ln, st)                 ) ->                emptyReference { refType             = ty+                              , title               = fst ct                               , containerAuthor     = ca-                              , containerTitle      = fst ct-                              , containerTitleShort = snd ct+                              , containerTitle      = if t3l /= [] then t3l else fst ct+                              , containerTitleShort = if t3s /= [] then t3s else snd ct+                              , collectionTitle     = t4l+                              , volumeTitle         = if t3l /= [] then fst ct else []                               , editor              = ed                               , edition             = et                               , translator          = tr@@ -157,21 +173,35 @@                               , number              = nu                               , section             = sc                               , chapterNumber       = ch+                              , genre               = gn+                              , numberOfVolumes     = vs+                              , language            = ln+                              , status              = st                               , publisher           = fromAgent $ pu `betterThen` pu' `betterThen`-                                                                  dg `betterThen` om+                                                                  dg `betterThen` om  `betterThen` sp                                }-             , \r -> ( (refType         r, (containerTitle  r, containerTitleShort r))-                     ,((containerAuthor r, editor           r, translator r)-                      ,(recipient       r, interviewer      r, emptyAgents, director  r)+             , \r -> (((volumeTitle r,[]),(collectionTitle r,[]))+                     ,((refType r,genre r), (containerTitle  r, containerTitleShort r))+                     ,((containerAuthor r, editor           r, translator r, director r)+                      ,(recipient       r, interviewer      r, emptyAgents,  director r)                       ,(composer        r, collectionEditor r, emptyAgents, emptyAgents))                      ,((issued  r, page  r, volume r, issue r)-                      ,(number  r, section   r, chapterNumber r))+                      ,(number  r, section   r, chapterNumber r, numberOfVolumes r))                      , (issued  r, accessed  r,emptyAgents, publisherPlace r, edition r)+                     , (language r, status r)                      )) $-      xp4Tuple (xpPair  xpRefType xpTitle)+      xp6Tuple  xpNestedTitles+               (xpPair xpRefType xpTitle)                 xpAgents xpPart xpOrigin+               (xpPair xpLang xpStatus) +xpNestedTitles :: PU ((String, String), (String, String))+xpNestedTitles+    = xpDefault (([],[]),([],[])) . getRelated $ xpPair xpTitle (getRelated xpTitle)+    where+      getRelated = xpIElem "relatedItem" . xpAddFixedAttr "type" "host"+ xpTitle :: PU (String,String) xpTitle     = xpWrap (\((a,b),c) -> createTitle a b c , \s -> (s,[])) $@@ -182,19 +212,22 @@               xpAddFixedAttr "type" "abbreviated" $ xpElem "title" xpText0)     where       createTitle [] [] [] = ([],[])-      createTitle s  [] [] = (s ,[])+      createTitle s  [] [] = breakLong s       createTitle s  [] ab = (s ,ab)       createTitle s sub [] = (s ++ colon s ++ sub,  s)       createTitle s sub ab = (s ++ colon s ++ sub, ab)       colon s = if last s == '!' || last s == '?' then " " else ": "+      breakLong s = let (a,b) = break (== ':') s+                    in  if b /= [] then (s,a) else (s, []) -xpAgents :: PU (([Agent],[Agent],[Agent])+xpAgents :: PU (([Agent],[Agent],[Agent],[Agent])                ,([Agent],[Agent],[Agent],[Agent])                ,([Agent],[Agent],[Agent],[Agent])) xpAgents-    = xpTriple (xpTriple (xpAgent "author"         "aut")+    = xpTriple (xp4Tuple (xpAgent "author"         "aut")                          (xpAgent "editor"         "edt")-                         (xpAgent "translator"     "trl"))+                         (xpAgent "translator"     "trl")+                         (xpAgent "sponsor"        "spn"))                (xp4Tuple (xpAgent "recipient"      "rcp")                          (xpAgent "interviewer"    "ivr")                          (xpAgent "publisher"      "pbl")@@ -252,21 +285,22 @@       readg = foldr (\(k,v) xs -> if k == "given"  then v:xs else xs) []  xpPart :: PU (([RefDate],String,String,String)-             ,(String,String,String))+             ,(String,String,String,String)) xpPart     = xpDefault none . xpIElem "part" .       xpWrap (readIt none,const []) $ xpList xpDetail     where-      none = (([],"","",""),("","",""))+      none = (([],"","",""),("","","",""))       readIt r [] = r-      readIt acc@((d,p,v,i),(n,s,c)) (x:xs)-          | Date      y <- x = readIt ((y,p,v,i),(n,s,c)) xs-          | Page      y <- x = readIt ((d,y,v,i),(n,s,c)) xs-          | Volume    y <- x = readIt ((d,p,y,i),(n,s,c)) xs-          | Issue     y <- x = readIt ((d,p,v,y),(n,s,c)) xs-          | Number    y <- x = readIt ((d,p,v,i),(y,s,c)) xs-          | ChapterNr y <- x = readIt ((d,p,v,i),(n,s,y)) xs-          | Section   y <- x = readIt ((d,p,v,i),(n,y,c)) xs+      readIt acc@((d,p,v,i),(n,s,c,vs)) (x:xs)+          | Date      y <- x = readIt ((y,p,v,i),(n,s,c,vs)) xs+          | Page      y <- x = readIt ((d,y,v,i),(n,s,c,vs)) xs+          | Volume    y <- x = readIt ((d,p,y,i),(n,s,c,vs)) xs+          | Issue     y <- x = readIt ((d,p,v,y),(n,s,c,vs)) xs+          | Number    y <- x = readIt ((d,p,v,i),(y,s,c,vs)) xs+          | ChapterNr y <- x = readIt ((d,p,v,i),(n,s,y,vs)) xs+          | Section   y <- x = readIt ((d,p,v,i),(n,y,c,vs)) xs+          | NrVols    y <- x = readIt ((d,p,v,i),(n,s,c, y)) xs           | otherwise        = acc  data Detail@@ -277,6 +311,7 @@     | Number    String     | ChapterNr String     | Section   String+    | NrVols    String       deriving ( Eq, Show )  xpDetail :: PU Detail@@ -286,6 +321,7 @@       tag _ = 0       ps = [ xpWrap (Date, const []) $ xpDate            , xpWrap (Page,     show) $ xpPage+           , xpWrap (NrVols,   show) $ xpVolumes            , xpWrap (Volume,   show) $ xp "volume"            , xpWrap (Issue,    show) $ xp "issue"            , xpWrap (Number,   show) $ xp "number"@@ -305,6 +341,11 @@                        (xpElem "end"   xpText))                (\(s,e) -> xpLift (s ++ "-" ++ e)) +xpVolumes :: PU String+xpVolumes+    = xpElemWithAttrValue "extent" "unit" "volumes" $+      xpElem "total" xpText+ xpUrl :: PU ([RefDate],String) xpUrl     = xpDefault ([],[]) . xpIElem "location" $@@ -325,6 +366,21 @@ xpNote :: PU (String) xpNote = xpDefault [] $ xpIElem "note" xpText +xpLang :: PU String+xpLang+    = xpDefault [] $+      xpChoice (xpIElem "recordInfo" $ xpIElem "languageOfCataloging" $+                xpIElem "language" $ xpIElem "languageTerm"  xpText)+               (xpIElem "recordInfo" $ xpIElem "languageOfCataloging" $+                xpIElem "languageTerm"  xpText)+                xpLift++xpStatus :: PU String+xpStatus+    = xpDefault [] $+      --xpElemWithAttrValue "note" "type" "publication status" xpText+      xpIElem "note" $ xpAddFixedAttr "type" "publication status" xpText+ readDate :: String -> [RefDate] readDate s = (parseDate         $ takeWhile (/= '/') s) ++              (parseDate . tail' $ dropWhile (/= '/') s)@@ -345,12 +401,16 @@ fromAgent :: [Agent] -> String fromAgent = foldr (<+>) [] . map show -readRefType :: [String] -> RefType-readRefType [] = NoType-readRefType (t:_) =+readRefType :: [String] -> (RefType, String)+readRefType [] = (NoType,[])+readRefType (t:ts) =   case M.lookup t genreTypeMapping of-    Just x  -> x-    Nothing -> ArticleJournal       -- Reasonable default (?)+    Just x  -> (x, if ts /= [] then head ts else [])+    Nothing -> if ts /= []+               then case M.lookup (head ts) genreTypeMapping of+                      Just  x -> (x, t)+                      Nothing -> (ArticleJournal, t)+               else (ArticleJournal, [])  -- The string constants come from http://www.loc.gov/standards/valuelist/marcgt.html, which are used in the -- "<genre></genre>" element (http://www.loc.gov/standards/mods/userguide/genre.html)@@ -360,9 +420,10 @@   , ( "book chapter",               Chapter          )   , ( "periodical",                 ArticleJournal   )   , ( "newspaper",                  ArticleNewspaper )+  , ( "magazine",                   ArticleNewspaper )   , ( "magazine article",           ArticleNewspaper )   , ( "encyclopedia",               EntryEncyclopedia)-  , ( "conference publication",     PaperConference  )+  , ( "conference publication",     Book             )   , ( "academic journal",           ArticleJournal   )   , ( "collection",                 Chapter          )   , ( "legal case and case notes",  LegalCase        )@@ -377,6 +438,7 @@   , ( "Ph.D. thesis",               Thesis           )   , ( "Masters thesis",             Thesis           )   , ( "report",                     Report           )+  , ( "technical report",           Report           )   , ( "review",                     Review           )   , ( "thesis",                     Thesis           )   , ( "unpublished",                NoType           )
src/Text/CSL/Output/Pandoc.hs view
@@ -25,7 +25,7 @@     , endWithPunct     ) where -import Data.Char ( toUpper, toLower, isPunctuation )+import Data.Char ( toUpper, toLower ) import Data.Maybe ( fromMaybe )  import Text.CSL.Style@@ -37,26 +37,48 @@ renderPandoc :: Style -> [FormattedOutput] -> [Inline] renderPandoc s     = proc (convertQuoted s) . proc' (clean s $ isPunctuationInQuote s) .-      concatMap (flipFlop . render s)+      flipFlop . render s  -- | Same as 'renderPandoc', but the output is wrapped in a pandoc -- paragraph block. renderPandoc' :: Style -> [FormattedOutput] -> Block renderPandoc' s     = Para . proc (convertQuoted s) . proc' (clean s $ isPunctuationInQuote s) .-      concatMap (flipFlop . render s)+      flipFlop . render s  -- | For the testsuite: we use 'Link' and 'Strikeout' to store -- "nocase" and "nodecor" rich text formatting classes. renderPandoc_ :: Style -> [FormattedOutput] -> [Inline] renderPandoc_ s     = proc (convertQuoted s) . proc (clean' s $ isPunctuationInQuote s) .-      concatMap (flipFlop . render s)+      flipFlop . render s -render :: Style -> FormattedOutput -> [Inline]-render _ (FPan i) = i-render _ (FDel s) = toStr s-render sty fo+render :: Style -> [FormattedOutput] -> [Inline]+render _ [] = []+render s (x:[])   = renderFo s x+render s (x:y:os) = let a = renderFo s x+                        b = renderFo s y+                        isPunct = and . map (flip elem ".!?") in+                    if isPunct (lastInline a) && isPunct (headInline b)+                    then a ++ render s (tailFO [y] ++ os)+                    else a ++ render s (y:os)++tailFO :: [FormattedOutput] -> [FormattedOutput]+tailFO [] = []+tailFO (f:fs)+    | FDel  s  <- f = FDel  (tail' s)       : fs+    | FPan is  <- f = FPan  (tailInline is) : fs+    | FN s  fm <- f = if prefix fm /= [] then FN s (tailFm fm)    : fs else FN    (tail' s) fm : fs+    | FS s  fm <- f = if prefix fm /= [] then FS s (tailFm fm)    : fs else FS    (tail' s) fm : fs+    | FO fm fo <- f = if prefix fm /= [] then FO   (tailFm fm) fo : fs else FO fm (tailFO fo)  : fs+    | otherwise     = f : tailFO fs+    where+      tailFm fm = fm { prefix = tail $ prefix fm }++renderFo :: Style -> FormattedOutput -> [Inline]+renderFo _ (FPan i) = i+renderFo _ (FDel s) = toStr s+renderFo sty fo     | FS str fm    <- fo = toPandoc fm $ toStr str     | FN str fm    <- fo = toPandoc fm $ toStr $ rmZeros str     | FO     fm xs <- fo = toPandoc fm $ rest xs@@ -74,9 +96,11 @@       toPandoc f i = addSuffix f $ toStr (prefix f) ++                      (quote f . format f . proc cleanStrict $ i)       format     f = font_variant f . font f . text_case f-      rest      xs = procList xs $ concatMap (render sty)-      quote    f i = if i /= [] && quotes f-                     then [Quoted DoubleQuote . valign f $ i]+      rest      xs = procList xs $ render sty+      quote    f i = if i /= [] && quotes f /= NoQuote+                     then if quotes f == NativeQuote+                          then [escape "inquote"   . valign f $ i]+                          else [Quoted DoubleQuote . valign f $ i]                      else valign f i       setCase f i           | Str     s <- i = Str $ f s@@ -85,8 +109,8 @@           | Link s r <- i = Link (map (setCase f) s) r           | otherwise     = setCase f i -      toCap        s = if s /= []       then toUpper (head s) : map toLower (tail s) else []-      toTitleCap   s = if isShortWord s then toUpper (head s) :              tail s  else s+      toCap        s = if s /= []       then toUpper (head s) : tail s else []+      toTitleCap   s = if isShortWord s then toUpper (head s) : tail s else s       isShortWord  s = not $ s `elem` ["a","an","and","as","at","but","by","down","for","from"                                       ,"in","into","nor","of","on","onto","or","over","so"                                       ,"the","till","to","up","via","with","yet"]@@ -174,19 +198,20 @@ clean' :: Style -> Bool -> [Inline] -> [Inline] clean' _ _   []  = [] clean' s b (i:is)-    | Quoted t inls <- i-    , b         = case headInline is of-                    [x] -> if isPunctuation x+    | Link inls (y,z) <- i, y == "inquote"+    , y == z    = case headInline is of+                    [x] -> if x `elem` ".," && b                            then if lastInline inls `elem` [".",",",";",":","!","?"]-                                then Quoted t (reverseQuoted t inls             ) : clean' s b (tailInline is)-                                else Quoted t (reverseQuoted t inls ++ [Str [x]]) : clean' s b (tailInline is)-                           else Quoted t (reverseQuoted t inls) : clean' s b  is-                    _   -> Quoted t (reverseQuoted  t inls) : clean' s b is-    | Quoted t inls <- i = Quoted t (reverseQuoted  t inls) : clean' s b is+                                then quote DoubleQuote inls                : clean' s b (tailInline is)+                                else quote DoubleQuote (inls ++ [Str [x]]) : clean' s b (tailInline is)+                           else quote DoubleQuote inls : clean' s b is+                    _   ->      quote DoubleQuote inls : clean' s b is+    | Quoted t inls <- i = quote t inls : clean' s b is     | otherwise = if lastInline [i] == headInline is && isPunct                   then i : clean' s b (tailInline is)                   else i : clean' s b is     where+      quote t x = Quoted t (reverseQuoted t x)       isPunct = and . map (flip elem ".,;:!? ") $ headInline is       reverseQuoted t = proc reverseQuoted'           where@@ -238,7 +263,8 @@ convertQuoted s = convertQuoted'     where       locale = let l = styleLocale s in case l of [x] -> x; _   -> Locale [] [] [] [] []-      getQuote  x y = entityToChar . fst . fromMaybe (x,[]) . lookup (y,Long) . localeTermMap $ locale+      getQuote  x y = entityToChar . termSingular . fromMaybe newTerm {termSingular = x} .+                      findTerm y Long . localeTerms $ locale       doubleQuotesO = getQuote "\"" "open-quote"       doubleQuotesC = getQuote "\"" "close-quote"       singleQuotesO = getQuote "'"  "open-inner-quote"
src/Text/CSL/Output/Plain.hs view
@@ -45,6 +45,7 @@ render b fo     | (FS str fm   ) <- fo = prefix fm <++> format fm (trim   str    ) <++> suffix fm     | (FN str fm   ) <- fo = prefix fm <++> format fm (trim   str    ) <++> suffix fm+    | (FUrl t fm   ) <- fo = prefix fm <++> format fm (trim $ fst  t ) <++> suffix fm     | (FO     fm xs) <- fo = prefix fm <++> format fm (trim $ rest xs) <++> suffix fm     | otherwise            = []     where@@ -54,7 +55,7 @@       (<++>)    = if b then (++) else (<>)       concatM f = foldr (<++>) [] . map f -      quote  f s = if s /= [] && quotes f then "\"" ++ s ++ "\"" else s+      quote  f s = if s /= [] && quotes f /= NoQuote then "\"" ++ s ++ "\"" else s       capital  s = toUpper (head s) : (tail s)       format f s = quote f . text_case f $ s @@ -91,11 +92,12 @@     where       parseEntity  = chr . readNum . takeWhile (/= ';') &&&                      entityToChar . tail' . dropWhile (/= ';')-      readNum ('x': n) = readNum $ "0x" ++ n-      readNum       n  = case readsPrec 1 n of-                           [(x,[])] -> x-                           _        -> error $ "Invalid character entity:" ++ n +readNum :: String -> Int+readNum ('x': n) = readNum $ "0x" ++ n+readNum       n  = case readsPrec 1 n of+                     [(x,[])] -> x+                     _        -> error $ "Invalid character entity:" ++ n  head' :: [a] -> [a] head' = foldr (\x _ -> [x]) []
src/Text/CSL/Parser.hs view
@@ -151,9 +151,10 @@  instance XmlPickler Formatting where     xpickle = xpWrap ( \(((p,s,ff),(fs,fv,fw)),(td,va,tc,d),(q,sp))-                         -> Formatting p s ff fs fv fw td va tc d q sp False False-                     , \(Formatting p s ff fs fv fw td va tc d q sp _ _)-                         -> (((p,s,ff),(fs,fv,fw)),(td,va,tc,d),(q,sp))) $+                         -> Formatting p s ff fs fv fw td va tc d+                            (if q then NativeQuote else NoQuote) sp False False+                     , \(Formatting p s ff fs fv fw td va tc d _ sp _ _)+                         -> (((p,s,ff),(fs,fv,fw)),(td,va,tc,d),(False,sp))) $               xpTriple (xpPair (xpTriple (xpAttrText' "prefix"      )                                          (xpAttrText' "suffix"      )                                          (xpAttrText' "font-family" ))@@ -192,6 +193,9 @@ instance XmlPickler Bool where     xpickle = xpWrap readable xpText +instance XmlPickler Gender where+    xpickle = xpWrap readable xpText+ instance XmlPickler Form where     xpickle = xpWrap readable                      (xpAttrWithDefault "long" "form" xpText)@@ -290,15 +294,21 @@                         xpTerms                         (xpList xpLocaleDate)) -xpTerms :: PU [TermMap]+xpTerms :: PU [CslTerm] xpTerms     = xpWrap (concat,return) $ xpList $       xpIElem "terms" $ xpList $ xpElem "term" $-      xpPair (xpPair (xpAttrText "name") xpickle)-             (xpChoice (xpWrap (\s -> (s,s), fst)  xpText0)-                       (xpPair (xpIElem "single"   xpText0)-                               (xpIElem "multiple" xpText0))-                        xpLift)+      xpWrap (\((n,f,g,gf,m),(s,p)) -> CT n f g gf s p m,+             undefined) $+             xpPair (xp5Tuple (xpAttrText "name")+                              xpickle+                              (xpAttrWithDefault Neuter "gender" xpickle)+                              (xpAttrWithDefault Neuter "gender-form" xpickle)+                              (xpAttrText' "match"))+                    (xpChoice (xpWrap (\s -> (s,s), fst)  xpText0)+                              (xpPair (xpIElem "single"   xpText0)+                              (xpIElem "multiple" xpText0))+                              xpLift)  xpMacros :: PU [MacroMap] xpMacros@@ -376,37 +386,41 @@  xpBibOpts :: PU [Option] xpBibOpts-    = xpWrap ( \((a,b,c,d,e),(f,g)) ->+    = xpWrap ( \((a,b,c,d,e,f),(g,h)) ->                  filter ((/=) [] . snd) $ [("hanging-indent",a)                                           ,("second-field-align",b)                                           ,("subsequent-author-substitute",c)-                                          ,("line-spacing",d)-                                          ,("entry-spacing",e)] ++ f ++ g-                , const (([],[],[],[],[]),([],[]))) $-      xpPair (xp5Tuple (xpAttrText' "hanging-indent")+                                          ,("subsequent-author-substitute-rule",d)+                                          ,("line-spacing",e)+                                          ,("entry-spacing",f)] ++ g ++ h+                , const (([],[],[],[],[],[]),([],[]))) $+      xpPair (xp6Tuple (xpAttrText' "hanging-indent")                        (xpAttrText' "second-field-align")                        (xpAttrText' "subsequent-author-substitute")+                       (xpAttrText' "subsequent-author-substitute-rule")                        (xpAttrText' "line-spacing")                        (xpAttrText' "entry-spacing")) $              xpPair xpNameOpt xpNamesOpt  xpCitOpts :: PU [Option] xpCitOpts-    = xpWrap ( \((a,b,c),(d,e,f,g,h),(i,l)) ->+    = xpWrap ( \((a,b,c),(d,e,f,g,h,i),(j,k)) ->                  filter ((/=) [] . snd) $ [("disambiguate-add-names",a)                                           ,("disambiguate-add-givenname",b)                                           ,("disambiguate-add-year-suffix",c)                                           ,("givenname-disambiguation-rule",d)                                           ,("collapse",e)-                                          ,("year-suffix-delimiter",f)-                                          ,("after-collapse-delimiter",g)-                                          ,("near-note-distance",h)] ++ i ++ l-                , const (([],[],[]),([],[],[],[],[]),([],[]))) $+                                          ,("cite-group-delimiter",f)+                                          ,("year-suffix-delimiter",g)+                                          ,("after-collapse-delimiter",h)+                                          ,("near-note-distance",i)] ++ j ++ k+                , const (([],[],[]),([],[],[],[],[],[]),([],[]))) $       xpTriple (xpTriple (xpAttrText' "disambiguate-add-names")                          (xpAttrText' "disambiguate-add-givenname")                          (xpAttrText' "disambiguate-add-year-suffix"))-               (xp5Tuple (xpAttrText' "givenname-disambiguation-rule")+               (xp6Tuple (xpAttrText' "givenname-disambiguation-rule")                          (xpAttrText' "collapse")+                         (xpAttrText' "cite-group-delimiter")                          (xpAttrText' "year-suffix-delimiter")                          (xpAttrText' "after-collapse-delimiter")                          (xpAttrText' "near-note-distance"))@@ -567,16 +581,23 @@       ,("en", "en-US")       ,("es", "es-ES")       ,("et", "et-EE")+      ,("fa", "fa-IR")+      ,("fi", "fi-FI")       ,("fr", "fr-FR")       ,("he", "he-IL")+      ,("hr", "hr-HR")       ,("hu", "hu-HU")       ,("is", "is-IS")       ,("it", "it-IT")       ,("ja", "ja-JP")+      ,("km", "km-KH")       ,("ko", "ko-KR")+      ,("lt", "lt-LT")+      ,("lv", "lv-LV")       ,("mn", "mn-MN")       ,("nb", "nb-NO")       ,("nl", "nl-NL")+      ,("nn", "nn-NO")       ,("pl", "pl-PL")       ,("pt", "pt-PT")       ,("ro", "ro-RO")
src/Text/CSL/Pickle.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE PatternGuards, CPP #-} ----------------------------------------------------------------------------- -- | -- Module      :  Text.CSL.Pickle
src/Text/CSL/Proc.hs view
@@ -83,12 +83,12 @@ -- 'Reference'. procRefs :: Style -> [Reference] -> [Reference] procRefs (Style {biblio = mb, csMacros = ms , styleLocale = l, styleAbbrevs = as, csOptions = opts}) rs-    = maybe rs process mb+    = maybe (setCNum rs) process mb     where       opts'   b = mergeOptions (bibOptions b) opts-      citNum  x = x { citationNumber = maybe 0 ((+) 1 . fromIntegral) . elemIndex x $ rs }+      setCNum   = map (\(x,y) -> x { citationNumber = fromIntegral y }) . flip zip ([1..] :: [Int])       sort_   b = evalSorting (EvalSorting emptyCite {citePosition = "first"})l ms (opts' b) (bibSort b) as-      process b = sortItems . map (citNum &&& sort_ b) $ rs+      process b = setCNum . sortItems . map (id &&& sort_ b) $ rs  sortItems :: Show a => [(a,[Sorting])] -> [a] sortItems [] = []@@ -111,15 +111,87 @@                        styleAbbrevs = as, csOptions = opts}) rs     = maybe [] process mb     where-      render  b = map (format b) . chkAut [] . filterRefs bos $ rs-      process b = flip map (render b) $ uncurry formatBiblioLayout (layFormat &&& layDelim $ bibLayout b)-      format  b (p,r) = evalLayout (bibLayout b) (EvalBiblio p) False l ms-                                   (mergeOptions (bibOptions b) opts) as r-      chkAut _ []     = []-      chkAut a (x:xs) = if author x `elem` a-                        then ("subsequent",x) : chkAut             a  xs-                        else ("first"     ,x) : chkAut (author x : a) xs+      process b   = flip map (render b) $ uncurry formatBiblioLayout (layFormat &&& layDelim $ bibLayout b)+      render  b   = subsequentAuthorSubstitute b . map (evalBib b) . filterRefs bos $ rs+      evalBib b r = evalLayout (bibLayout b) (EvalBiblio emptyCite {citePosition = "first"}) False l ms+                               (mergeOptions (bibOptions b) opts) as r +subsequentAuthorSubstitute :: Bibliography -> [[Output]] -> [[Output]]+subsequentAuthorSubstitute b = if null subAuthStr then id else chkCreator+    where+      subAuthStr  = getOptionVal "subsequent-author-substitute"      (bibOptions b)+      subAuthRule = getOptionVal "subsequent-author-substitute-rule" (bibOptions b)++      queryContrib = proc' rmLabel . query contribsQ+      getContrib = if null subAuthStr+                   then const []+                   else case subAuthRule of+                          "partial-first" -> head'  . query namesQ  . queryContrib+                          "partial-each"  ->          query namesQ  . queryContrib+                          _               ->                          queryContrib++      getPartialEach x xs = concat . head' . map fst . reverse .+                            sortBy (comparing $ length . snd) . filter ((<) 0 . length . snd) .+                            zip xs . map (takeWhile id . map (uncurry (==)) . zip x) $ xs++      chkCreator = if subAuthRule == "partial-each" then chPartialEach [] else chkCr []++      chkCr _ []     = []+      chkCr a (x:xs) = let contribs = getContrib x in+                       if  contribs `elem` a+                       then substituteAuth []+                            x : chkCr             a  xs+                       else x : chkCr (contribs : a) xs++      chPartialEach _ [] = []+      chPartialEach a (x:xs) = let contribs = getContrib x+                                   partial  = getPartialEach contribs a in+                               if not $ null partial+                               then substituteAuth partial x :+                                    if length partial < length contribs+                                    then chPartialEach (contribs : a) xs+                                    else chPartialEach             a  xs+                               else x  : chPartialEach (contribs : a) xs++      substituteAuth a = if subAuthRule == "complete-each"+                         then proc chNamas else proc (updateContribs a)++      updateContribs a o@(OContrib i r y ds os)+          = if r == "author" || r == "authorsub" then OContrib i r upCont ds os else o+          where+            upCont = case subAuthRule of+                       "partial-first" -> rmFirstName      y+                       "partial-each"  -> rmSelectedName a y+                       _               -> OStr subAuthStr emptyFormatting : proc rmNames y+      updateContribs _ o = o++      contribsQ o+          | OContrib _ r c _ _ <- o = if r == "author" || r == "authorsub" then c else []+          | otherwise               = []+      namesQ o+          | OName {} <- o = [o]+          | otherwise     = []+      rmSelectedName _ [] = []+      rmSelectedName a (o:os)+          | OName {} <- o = (if o `elem` a then OStr subAuthStr emptyFormatting else o) : rmSelectedName a os+          | otherwise     = o : rmSelectedName a os+      rmFirstName [] = []+      rmFirstName (o:os)+          | OName {} <- o = OStr subAuthStr emptyFormatting : os+          | otherwise     = o : rmFirstName os+      chNamas o+          | OName s _ os f <- o = OName s [OStr subAuthStr emptyFormatting] os f+          | otherwise           = o+      rmNames o+          | OName {} <- o = ONull+          | OStr  {} <- o = ONull+          | ODel  {} <- o = ONull+          | otherwise     = o+      rmLabel [] = []+      rmLabel (o:os)+          | OLabel {} <- o =     rmLabel os+          | otherwise      = o : rmLabel os+ filterRefs :: BibOpts -> [Reference] -> [Reference] filterRefs bos refs     | Select  s q <- bos = filter (select  s) . filter (quash q) $ refs@@ -211,7 +283,7 @@ -- pandoc terminology). localModifiers :: Style -> Bool -> Cite -> Output -> Output localModifiers s b c-    | authorInText   c = check . return . proc rmFormatting . contribOnly+    | authorInText   c = check . return . proc rmFormatting . contribOnly s     | suppressAuthor c = check . rmContrib . return     | otherwise        = id     where@@ -243,19 +315,6 @@           | Formatting {} <- f = emptyFormatting { prefix = prefix f                                                  , suffix = suffix f}           | otherwise          = f-      contribOnly o-          | isNumStyle [o]-          , OCitNum  {} <- o = Output [ OStr (query getRefTerm s) emptyFormatting-                                      , OSpace, o] emptyFormatting-          | OContrib _ "author"-                  _ _ _ <- o = o-          | OContrib _ "authorsub"-                  _ _ _ <- o = o-          | Output ot f <- o = Output (cleanOutput $ map contribOnly ot) f-          | OStr    x _ <- o-          , "ibid" <- filter (/= '.')-             (map toLower x) = o-          | otherwise        = ONull       rmCitNum o           | OCitNum {} <- o = ONull           | otherwise       = o@@ -284,7 +343,23 @@           , "ibid" <- filter (/= '.') (map toLower x) = rmContrib' os            | otherwise        = o : rmContrib' os-      getRefTerm :: TermMap -> String++contribOnly :: Style -> Output -> Output+contribOnly s o+    | isNumStyle [o]+    , OCitNum  {} <- o = Output [ OStr (query getRefTerm s) emptyFormatting+                                , OSpace, o] emptyFormatting+    | OContrib _ "author"+            _ _ _ <- o = o+    | OContrib _ "authorsub"+            _ _ _ <- o = o+    | Output ot f <- o = Output (cleanOutput $ map (contribOnly s) ot) f+    | OStr    x _ <- o+    , "ibid" <- filter (/= '.')+       (map toLower x) = o+    | otherwise        = ONull+    where+      getRefTerm :: CslTerm -> String       getRefTerm t-          | (("reference", Long), (x,_)) <- t = capitalize x-          | otherwise                         = []+          | CT "reference" Long _ _ x _ _ <- t = capitalize x+          | otherwise                          = []
src/Text/CSL/Proc/Collapse.hs view
@@ -66,6 +66,31 @@                                                   ] emptyFormatting                              else map (flip OCitNum f) x +groupCites :: [(Cite, Output)] -> [(Cite, Output)]+groupCites []     = []+groupCites (x:xs) = let equal    = filter ((==) (namesOf $ snd x) . namesOf . snd) xs+                        notequal = filter ((/=) (namesOf $ snd x) . namesOf . snd) xs+                    in  x : equal ++ groupCites notequal+    where+      contribsQ o+          | OContrib _ _ c _ _ <- o = [c]+          | otherwise               = []+      namesOf y = if null (query contribsQ y) then [] else proc rmNameHash . proc rmGivenNames $ head (query contribsQ y)++getYearAndSuf :: Output -> Output+getYearAndSuf x+    = case query getOYear x of+        [] -> noOutputError+        x' -> Output x' emptyFormatting+    where+      getOYear o+          | OYear    {} : _ <- o = [head o]+          | OYearSuf {} : _ <- o = [head o]+          | OPan     {} : _ <- o = [head o]+          | OLoc     {} : _ <- o = [head o]+          | ODel _ : OLoc {} : _ <- o = [head o]+          | otherwise = []+ collapseYear :: Style -> String -> CitationGroup -> CitationGroup collapseYear s ranged (CG cs f d os) = CG cs f [] (process os)     where@@ -76,16 +101,6 @@        format []     = []       format (x:xs) = x : map getYearAndSuf xs-      getYearAndSuf x = case query getOYear x of-                          [] -> noOutputError-                          x' -> Output x' emptyFormatting-      getOYear o-          | OYear    {} : _ <- o = [head o]-          | OYearSuf {} : _ <- o = [head o]-          | OPan     {} : _ <- o = [head o]-          | OLoc     {} : _ <- o = [head o]-          | ODel _ : OLoc {} : _ <- o = [head o]-          | otherwise = []        isRanged = case ranged of                    "year-suffix-ranged" -> True@@ -95,11 +110,16 @@                       else collapseYearSuf isRanged yearSufDel        rmAffixes x = x {citePrefix = emptyAffix, citeSuffix = emptyAffix}+      delim = let d' = getOptionVal "cite-group-delimiter" . citOptions . citation $ s+              -- FIXME: see https://bitbucket.org/bdarcus/citeproc-test/issue/15+              -- in  if null d' then if null d then ", " else d else d'+              in  if null d' then ", " else d'+       collapsYS a = case a of                       []  -> (emptyCite, ONull)                       [x] -> rmAffixes . fst &&& uncurry addCiteAffixes $ x                       _   -> (,) (rmAffixes $ fst $ head a) . flip Output emptyFormatting .-                             addDelim d . collapseRange .+                             addDelim delim . collapseRange .                              uncurry zip . second format . unzip $ a        doCollapse []     = []@@ -110,10 +130,10 @@                              else (a, Output (b : [ODel d          ]) emptyFormatting) : doCollapse xs        contribsQ o-          | OContrib _ _ c _ _ <- o = [c]+          | OContrib _ _ c _ _ <- o = [proc' rmNameHash . proc' rmGivenNames $ c]           | otherwise               = []       namesOf = query contribsQ-      process = doCollapse . groupBy (\a b -> namesOf (snd a) == namesOf (snd b))+      process = doCollapse . groupBy (\a b -> namesOf (snd a) == namesOf (snd b)) . groupCites  collapseYearSuf :: Bool -> String -> [(Cite,Output)] -> [Output] collapseYearSuf ranged ysd = process
src/Text/CSL/Proc/Disamb.hs view
@@ -68,8 +68,10 @@       needYSuff = filter_        snd  $ zip duplics withNames        newNames :: [CiteData]-      newNames  = when_ (hasNamesOpt || hasGNameOpt) $ disambAddNames givenNames $ needNames ++-                  if hasYSuffOpt && givenNames == NoGiven then [] else needYSuff+      newNames  = if hasNamesOpt+                  then disambAddNames givenNames $ needNames +++                       if hasYSuffOpt && givenNames == NoGiven then [] else needYSuff+                  else map (\cd -> cd {disambed = collision cd} ) $ needNames ++ needYSuff        newGName :: [NameData]       newGName  = when_ hasGNameOpt $ concatMap disambAddGivenNames nameDupls@@ -88,7 +90,8 @@        yearSuffs = when_ hasYSuffOpt . generateYearSuffix bibs . query getYearSuffixes $ withYearS -      addNames  = proc (updateContrib givenNames newNames newGName)+      addGNames = if hasGNameOpt then newGName else []+      addNames  = proc (updateContrib givenNames newNames addGNames)       processed = if hasYSuffOpt                   then proc (updateYearSuffixes yearSuffs) .                        addNames $ withYearS@@ -128,16 +131,16 @@       addGName = map (\(c,n) -> c { nameDataSolved = if null n then nameCollision c else head n }) disSolved  updateContrib :: GiveNameDisambiguation -> [CiteData] -> [NameData] -> Output -> Output+updateContrib ByCite [] _ o = o updateContrib g c n o     | OContrib k r s d dd <- o = case filter (key &&& sameAs >>> uncurry (:) >>> elem k) c of-                                  x:_ | clean (disambData x) == clean (d:dd) ->-                                          OContrib k r (map processGNames $ disambed x) [] dd-                                  _ | null c, AllNames <- g -> OContrib k r (map processGNames s) d dd-                                    | otherwise             -> o+                                  x:_  -> OContrib k r (processGNames $ disambed x) [] dd+                                  _ -> if null c+                                       then OContrib k r (processGNames s) d dd+                                       else o     | otherwise = o     where-      clean         = if g == NoGiven then proc rmNameHash . proc rmGivenNames else id-      processGNames = if g /= NoGiven then updateOName n else id+      processGNames = if g /= NoGiven then proc' (updateOName n) else id  updateOName :: [NameData] -> Output -> Output updateOName n o@@ -201,7 +204,8 @@                                       then rmExtras xs                                       else Output (rmExtras x) f : rmExtras xs     | OContrib _ _ x _ _ : xs <- os = OContrib [] [] x [] [] : rmExtras xs-    | OYear        y _ f : xs <- os = OYear y [] f : rmExtras xs+    | OYear        y _ f : xs <- os = OYear      y  [] f : rmExtras xs+    | OYearSuf   s _ _ f : xs <- os = OYearSuf s [] [] f : rmExtras xs     | ODel             _ : xs <- os = rmExtras xs     | OLoc           _ _ : xs <- os = rmExtras xs     | x                  : xs <- os = x : rmExtras xs@@ -225,7 +229,7 @@                                             else c {key     = fst y                                                    ,citYear = snd y}       contribsQ o-          | OContrib k _ _ d dd <- o = [CD k [out] d (d:dd) [] [] []]+          | OContrib k _ s d dd <- o = [CD k s d (d:dd) [] [] []]           | otherwise                = []  getYears :: Output -> [(String,String)]@@ -259,7 +263,7 @@  generateYearSuffix :: [Reference] -> [(String, [Output])] -> [(String,String)] generateYearSuffix refs-    = concatMap (flip zip suffs) .+    = flip zip suffs . concat .       -- sort clashing cites using their position in the sorted bibliography       getFst . map sort' . map (filter ((/=) 0 . snd)) . map (map getP) .       -- group clashing cites@@ -280,7 +284,7 @@       setYS c o           | OYearSuf _ k _ f <- o = OYearSuf [] k (getCollision k c) f           | otherwise             = o-      collide = if b then disambed else disambYS+      collide = if b then collision else disambYS       getCollision k c = case find ((==) k . key) c of                            Just x -> if collide x == []                                      then [OStr (citYear x) emptyFormatting]
src/Text/CSL/Reference.hs view
@@ -158,6 +158,7 @@     , titleShort          :: String     , reviewedTitle       :: String     , containerTitle      :: String+    , volumeTitle         :: String     , collectionTitle     :: String     , containerTitleShort :: String     , collectionNumber    :: String --Int@@ -203,6 +204,7 @@     , dimensions          :: String     , scale               :: String     , categories          :: [String]+    , language            :: String      , citationNumber           :: CNum     , firstReferenceNoteNumber :: Int@@ -240,6 +242,7 @@     , titleShort          = []     , reviewedTitle       = []     , containerTitle      = []+    , volumeTitle         = []     , collectionTitle     = []     , containerTitleShort = []     , collectionNumber    = []@@ -285,6 +288,7 @@     , dimensions          = []     , scale               = []     , categories          = []+    , language            = []      , citationNumber           = CNum 0     , firstReferenceNoteNumber = 0@@ -325,7 +329,7 @@  processCites :: [Reference] -> [[Cite]] -> [[(Cite, Reference)]] processCites rs cs-    = setCitationNumber $ procGr [[]] cs+    = procGr [[]] cs     where       procRef r = case filter ((==) (refId r) . citeId) $ concat cs of                     x:_ -> r { firstReferenceNoteNumber = readNum $ citeNoteNumber x}@@ -358,17 +362,9 @@                        last a == [] && citeId c == citeId (head . last $ init a)             isLocSet = citeLocator c /= "" -setCitationNumber :: [[(Cite, Reference)]] -> [[(Cite, Reference)]]-setCitationNumber csrs = map (map setIt) csrs-    where-      selectFirst = map citeId . filter ((==) "first" . citePosition) . concatMap (map fst)-      setIt (c,r) = case elemIndex (citeId c) (selectFirst csrs) of-                      Just i  -> (c,r {citationNumber = CNum (i + 1)})-                      Nothing -> (c,r)- setPageFirst :: Reference -> Reference-setPageFirst r = if ('-' `elem` page r)-                 then r { pageFirst = takeWhile (/= '-') $ page r}+setPageFirst r = if ('–' `elem` page r || '-' `elem` page r)+                 then r { pageFirst = takeWhile (not . flip elem "–-") $ page r}                  else r  setNearNote :: Style -> [[Cite]] -> [[Cite]]
src/Text/CSL/Style.hs view
@@ -15,13 +15,20 @@  module Text.CSL.Style where -import Data.List ( nubBy, isPrefixOf )+import Control.Arrow+import Data.List ( nubBy, isPrefixOf, isInfixOf ) import Data.Generics ( Typeable, Data, everywhere-                     , everywhere', everything, mkT, mkQ)+                     , everywhere', everything, mkT, mkQ )+import Data.Maybe ( listToMaybe ) import qualified Data.Map as M import Text.JSON import Text.Pandoc.Definition ( Inline, Target ) +#ifdef UNICODE_COLLATION+import qualified Data.Text     as T+import qualified Data.Text.ICU as T+#endif+ -- | The representation of a parsed CSL style. data Style     = Style@@ -42,7 +49,7 @@       { localeVersion :: String       , localeLang    :: String       , localeOptions :: [Option]-      , localeTermMap :: [TermMap]+      , localeTerms   :: [CslTerm]       , localeDate    :: [Element]       } deriving ( Show, Read, Eq, Typeable, Data ) @@ -57,20 +64,58 @@              filter ((\x -> x /= [] && x `isPrefixOf` s) . localeLang) ls ++              filter ((==) [] . localeLang) ls       doMerge x = return l { localeOptions = newOpt     x-                           , localeTermMap = newTermMap x+                           , localeTerms   = newTerms   x                            , localeDate    = newDate    x                            }+      cht          = cslTerm &&& termForm &&& termGenderForm+      checkedLoc   = if hasOrdinals ls then rmOrdinals (localeTerms l) else localeTerms l+      newTerms   x = nubBy (\a b -> cht a == cht b) (concatMap localeTerms   x ++ checkedLoc)       newOpt     x = nubBy (\a b -> fst a == fst b) (concatMap localeOptions x ++ localeOptions l)-      newTermMap x = nubBy (\a b -> fst a == fst b) (concatMap localeTermMap x ++ localeTermMap l)       newDate    x = nubBy (\(Date _ a _ _ _ _)                              (Date _ b _ _ _ _) -> a == b) (concatMap localeDate x ++ localeDate l) +data CslTerm+    = CT+      { cslTerm        :: String+      , termForm       :: Form+      , termGender     :: Gender+      , termGenderForm :: Gender+      , termSingular   :: String+      , termPlural     :: String+      , termMatch      :: String+      } deriving ( Show, Read, Eq, Typeable, Data )++newTerm :: CslTerm+newTerm = CT [] Long Neuter Neuter [] [] []++findTerm :: String -> Form -> [CslTerm] -> Maybe CslTerm+findTerm s f+    = listToMaybe . filter (cslTerm &&& termForm >>> (==) (s, f))++findTerm' :: String -> Form -> Gender -> [CslTerm] -> Maybe CslTerm+findTerm' s f g+    = listToMaybe . filter (cslTerm &&& termForm &&& termGenderForm >>> (==) (s,(f,g)))++hasOrdinals :: Data a => a -> Bool+hasOrdinals = or . query hasOrd+    where+      hasOrd o+          | CT {cslTerm = t} <- o+          , "ordinal" `isInfixOf` t = [True]+          | otherwise               = [False]++rmOrdinals :: Data a => a -> a+rmOrdinals = proc' doRemove+    where+      doRemove [] = []+      doRemove (o:os)+          | CT {cslTerm = t} <- o+          , "ordinal" `isInfixOf` t =   doRemove os+          | otherwise               = o:doRemove os+ type Abbrev     = (String, [(String, M.Map String String)]) -type TermMap-    = ((String,Form),(String,String))- type MacroMap     = (String,[Element]) @@ -180,10 +225,16 @@ compare' :: String -> String -> Ordering compare' x y     = case (head x, head y) of-        ('-','-') -> compare y x+        ('-','-') -> comp y x         ('-', _ ) -> LT         (_  ,'-') -> GT-        _         -> compare x y+        _         -> comp x y+      where+#ifdef UNICODE_COLLATION+        comp a b = T.collate (T.collator T.Current) (T.pack a) (T.pack b)+#else+        comp a b = compare a b+#endif  data Form     = Long@@ -195,6 +246,12 @@     | NotSet       deriving ( Eq, Show, Read, Typeable, Data ) +data Gender+    = Feminine+    | Masculine+    | Neuter+      deriving ( Eq, Show, Read, Typeable, Data )+ data NumericForm     = Numeric     | Ordinal@@ -257,7 +314,7 @@       , verticalAlign  :: String       , textCase       :: String       , display        :: String-      , quotes         :: Bool+      , quotes         :: Quote       , stripPeriods   :: Bool       , noCase         :: Bool       , noDecor        :: Bool@@ -265,9 +322,20 @@  instance Show Formatting where show _ = "emptyFormatting" +rmTitleCase :: Formatting -> Formatting+rmTitleCase f+    | Formatting _ _ _ _ _ _ _ _ "title" _ _ _ _ _ <- f = f {textCase = []}+    | otherwise                                         = f++data Quote+    = NativeQuote+    | ParsedQuote+    | NoQuote+    deriving ( Read, Eq, Ord, Typeable, Data )+ emptyFormatting :: Formatting emptyFormatting-    = Formatting [] [] [] [] [] [] [] [] [] [] False False False False+    = Formatting [] [] [] [] [] [] [] [] [] [] NoQuote False False False  unsetAffixes :: Formatting -> Formatting unsetAffixes f = f {prefix = [], suffix = []}@@ -285,7 +353,7 @@                               (bh `betterThen` ah)                               (bi `betterThen` ai)                               (bj `betterThen` aj)-                              (bk || ak)+                              (if bk == NoQuote then ak else bk)                               (bl || al)                               (bm || am)                               (bn || an)@@ -322,6 +390,7 @@     | OPan    [Inline]     | ODel     String                                   -- ^ A delimiter string.     | OStr     String             Formatting            -- ^ A simple 'String'+    | OLabel   String             Formatting            -- ^ A label used for roles     | ONum     Int                Formatting            -- ^ A number (used to count contributors)     | OCitNum  Int                Formatting            -- ^ The citation number     | ODate   [Output]                                  -- ^ A (possibly) ranged date@@ -444,6 +513,8 @@     | ODel     s         <- o = FDel s     | OStr     []      _ <- o = FNull     | OStr     s       f <- o = FS s         f+    | OLabel   []      _ <- o = FNull+    | OLabel   s       f <- o = FS s         f     | ODate    os        <- o = FO emptyFormatting (format os)     | OYear    s _     f <- o = FS s         f     | OYearSuf s _ _   f <- o = FS s         f
src/Text/CSL/Test.hs view
@@ -24,7 +24,7 @@ import Control.Arrow import Control.Monad.State import Data.ByteString.Lazy.UTF8 ( fromString )-import Data.Char (toLower)+import Data.Char (toLower, chr) import Data.List import Data.Maybe (isJust) import Data.Time@@ -242,13 +242,11 @@                  (_,       Just cs) -> cs                  _                  -> [map (\r -> emptyCite { citeId = refId r }) $ testInput t]       (BD cits bib) = citeproc opts style (testInput t) cites-      fixCits = if isJust (testCitations t)-                then flip (zipWith $ \c n -> ">>[" ++ show n ++ "] " ++ c) ([0..] :: [Int])-                else id-      output = case testMode t of-                 "citation" -> unlines'  . fixCits . map (pandocToHTML . renderPandoc_ style) $ cits+      output = superscript $+               case testMode t of+                 "citation" -> unlines'  . map (pandocToHTML . renderPandoc_ style) $ cits                  _          -> pandocBib . map (pandocToHTML . renderPandoc_ style) $ bib-  return (output == testResult t, output)+  return (output == getResult t, output)  test :: FilePath -> IO Bool test = doTest readJsonFile 0@@ -270,7 +268,7 @@                putStrLn' "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"                putStrLn' $ f ++ " failed!"                putStrLn' "Expected:"-               putStrLn' $ (testResult t)+               putStrLn' $ getResult t                putStrLn' "\nGot:"                putStrLn' $ o                when (v >= 3) $ putStrLn (show t)@@ -301,3 +299,44 @@   et <- getCurrentTime   putStrLn $ (++) (formatTime defaultTimeLocale "%H:%M:%S" et) $ " <--------------END"   putStrLn $ "Time: " ++ show (diffUTCTime et st)++getResult :: Test -> String+getResult t+    = if isJust (testCitations t) && testMode t == "citation"+      then unlines' . map  (\(a,b) -> drop (length (show b) + 5) a) .+           flip zip ([0..] :: [Int]) . lines . testResult $ t+      else testResult t++superscript :: String -> String+superscript [] = []+superscript (x:xs)+    = let a = lookup x (map (first (chr . readNum)) sups) in+      case a of+        Nothing -> x : superscript xs+        Just x' -> "<sup>" ++ [chr $ readNum x'] ++ "</sup>" ++ superscript xs+    where+      sups = [("0x00AA","0x0061"),("0x00B2","0x0032"),("0x00B3","0x0033"),("0x00B9","0x0031")+             ,("0x00BA","0x006F"),("0x02B0","0x0068"),("0x02B1","0x0266"),("0x02B2","0x006A")+             ,("0x02B3","0x0072"),("0x02B4","0x0279"),("0x02B5","0x027B"),("0x02B6","0x0281")+             ,("0x02B7","0x0077"),("0x02B8","0x0079"),("0x02E0","0x0263"),("0x02E1","0x006C")+             ,("0x02E2","0x0073"),("0x02E3","0x0078"),("0x02E4","0x0295"),("0x1D2C","0x0041")+             ,("0x1D2D","0x00C6"),("0x1D2E","0x0042"),("0x1D30","0x0044"),("0x1D31","0x0045")+             ,("0x1D32","0x018E"),("0x1D33","0x0047"),("0x1D34","0x0048"),("0x1D35","0x0049")+             ,("0x1D36","0x004A"),("0x1D37","0x004B"),("0x1D38","0x004C"),("0x1D39","0x004D")+             ,("0x1D3A","0x004E"),("0x1D3C","0x004F"),("0x1D3D","0x0222"),("0x1D3E","0x0050")+             ,("0x1D3F","0x0052"),("0x1D40","0x0054"),("0x1D41","0x0055"),("0x1D42","0x0057")+             ,("0x1D43","0x0061"),("0x1D44","0x0250"),("0x1D45","0x0251"),("0x1D46","0x1D02")+             ,("0x1D47","0x0062"),("0x1D48","0x0064"),("0x1D49","0x0065"),("0x1D4A","0x0259")+             ,("0x1D4B","0x025B"),("0x1D4C","0x025C"),("0x1D4D","0x0067"),("0x1D4F","0x006B")+             ,("0x1D50","0x006D"),("0x1D51","0x014B"),("0x1D52","0x006F"),("0x1D53","0x0254")+             ,("0x1D54","0x1D16"),("0x1D55","0x1D17"),("0x1D56","0x0070"),("0x1D57","0x0074")+             ,("0x1D58","0x0075"),("0x1D59","0x1D1D"),("0x1D5A","0x026F"),("0x1D5B","0x0076")+             ,("0x1D5C","0x1D25"),("0x1D5D","0x03B2"),("0x1D5E","0x03B3"),("0x1D5F","0x03B4")+             ,("0x1D60","0x03C6"),("0x1D61","0x03C7"),("0x2070","0x0030"),("0x2071","0x0069")+             ,("0x2074","0x0034"),("0x2075","0x0035"),("0x2076","0x0036"),("0x2077","0x0037")+             ,("0x2078","0x0038"),("0x2079","0x0039"),("0x207A","0x002B"),("0x207B","0x2212")+             ,("0x207C","0x003D"),("0x207D","0x0028"),("0x207E","0x0029"),("0x207F","0x006E")+             ,("0x3194","0x4E09"),("0x3195","0x56DB"),("0x3196","0x4E0A"),("0x3197","0x4E2D")+             ,("0x3198","0x4E0B"),("0x3199","0x7532"),("0x319A","0x4E59"),("0x319B","0x4E19")+             ,("0x319C","0x4E01"),("0x319D","0x5929"),("0x319E","0x5730"),("0x319F","0x4EBA")+             ,("0x02C0","0x0294"),("0x02C1","0x0295"),("0x06E5","0x0648"),("0x06E6","0x064A")]