git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'master' of github.com:jgm/pandoc
ad9447cJohn MacFarlane
.travis.yml−1
@@ -2,7 +2,6 @@ language: haskell
2before_install:
2before_install:
3 - cabal install cabal-dev
3 - cabal install cabal-dev
4 - 'git clone https://github.com/jgm/pandoc-types && cabal-dev add-source pandoc-types'
4 - 'git clone https://github.com/jgm/pandoc-types && cabal-dev add-source pandoc-types'
5− - 'git clone https://github.com/jgm/citeproc-hs && cabal-dev add-source citeproc-hs'
6install:
5install:
7 - cabal-dev install-deps --enable-tests
6 - cabal-dev install-deps --enable-tests
8script:
7script:
README+42−63
@@ -598,54 +598,6 @@ Options affecting specific writers
598Citation rendering
598Citation rendering
599------------------
599------------------
600
600
601−`--bibliography=`*FILE*
602−: Specify bibliography database to be used in resolving
603− citations. The database type will be determined from the
604− extension of *FILE*, which may be `.mods` (MODS format),
605− `.bib` (BibLaTeX format, which will normally work for BibTeX
606− files as well), `.bibtex` (BibTeX format),
607− `.ris` (RIS format), `.enl` (EndNote format),
608− `.xml` (EndNote XML format), `.wos` (ISI format),
609− `.medline` (MEDLINE format), `.copac` (Copac format),
610− or `.json` (citeproc JSON). If you want to use multiple
611− bibliographies, just use this option repeatedly.
612−
613−`--csl=`*FILE*
614−: Specify [CSL] style to be used in formatting citations and
615− the bibliography. If *FILE* is not found, pandoc will look
616− for it in
617−
618− $HOME/.csl
619−
620− in unix,
621−
622− C:\Documents And Settings\USERNAME\Application Data\csl
623−
624− in Windows XP, and
625−
626− C:\Users\USERNAME\AppData\Roaming\csl
627−
628− in Windows 7. If the `--csl` option is not specified, pandoc
629− will use a default style: either `default.csl` in the
630− user data directory (see `--data-dir`), or, if that is
631− not present, the Chicago author-date style.
632−
633−`--citation-abbreviations=`*FILE*
634−: Specify a file containing abbreviations for journal titles and
635− other bibliographic fields (indicated by setting `form="short"`
636− in the CSL node for the field). The format is described at
637− <http://citationstylist.org/2011/10/19/abbreviations-for-zotero-test-release/>.
638− Here is a short example:
639−
640− { "default": {
641− "container-title": {
642− "Lloyd's Law Reports": "Lloyd's Rep",
643− "Estates Gazette": "EG",
644− "Scots Law Times": "SLT"
645− }
646− }
647− }
648−
649`--natbib`
601`--natbib`
650: Use natbib for citations in LaTeX output.
602: Use natbib for citations in LaTeX output.
651
603
@@ -2378,9 +2330,14 @@ Citations
2378
2330
2379**Extension: `citations`**
2331**Extension: `citations`**
2380
2332
2333+Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
2381−Pandoc can automatically generate citations and a bibliography in a number of
2334+citations and a bibliography in a number of styles. Basic usage is
2382−styles (using Andrea Rossato's `hs-citeproc`). In order to use this feature,
2335+
2383−you will need a bibliographic database in one of the following formats:
2336+ pandoc --filter pandoc-citeproc myinput.txt
2337+
2338+In order to use this feature, you will need to specify a bibliography file
2339+using the `bibliography` metadata field in a YAML metadata section.
2340+The bibliography may have any of these formats:
2384
2341
2385 Format File extension
2342 Format File extension
2386 ------------ --------------
2343 ------------ --------------
@@ -2398,18 +2355,40 @@ you will need a bibliographic database in one of the following formats:
2398Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2355Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2399files, but you can use `.bibtex` to force BibTeX.
2356files, but you can use `.bibtex` to force BibTeX.
2400
2357
2401−You will need to specify the bibliography file using the `--bibliography`
2358+Alternatively you can use a `references` field in the document's YAML
2402−command-line option (which may be repeated if you have several
2359+metadata. This should include an array of YAML-encoded references,
2403−bibliographies).
2360+for example:
2404−
2361+
2362+ ---
2363+ references:
2364+ - id: fenner2012a
2365+ title: One-click science marketing
2366+ author:
2367+ - family: Fenner
2368+ given: Martin
2369+ container-title: Nature Materials
2370+ volume: 11
2371+ URL: 'http://dx.doi.org/10.1038/nmat3283'
2372+ DOI: 10.1038/nmat3283
2373+ issue: 4
2374+ publisher: Nature Publishing Group
2375+ page: 261-263
2376+ type: article-journal
2377+ issued:
2378+ year: 2012
2379+ month: 3
2380+ ...
2381+
2382+(The program `mods2yaml`, which comes with `pandoc-citeproc`, can help produce
2383+these from a MODS reference collection.)
2384+
2405−By default, pandoc will use a Chicago author-date format for citations
2385+By default, `pandoc-citeproc` will use a Chicago author-date format for
2406−and references. To use another style, you will need to use the
2386+citations and references. To use another style, you will need to specify
2407−`--csl` option to specify a [CSL] 1.0 style file. A primer on
2387+a [CSL] 1.0 style file in the `csl` metadata field. A primer on creating and
2408−creating and modifying CSL styles can be found at
2388+modifying CSL styles can be found at
2409−<http://citationstyles.org/downloads/primer.html>.
2389+<http://citationstyles.org/downloads/primer.html>. A repository of CSL styles
2410−A repository of CSL styles can be found at
2411−<https://github.com/citation-style-language/styles>.
2390+can be found at <https://github.com/citation-style-language/styles>. See also
2412−See also <http://zotero.org/styles> for easy browsing.
2391+<http://zotero.org/styles> for easy browsing.
2413
2392
2414Citations go inside square brackets and are separated by semicolons.
2393Citations go inside square brackets and are separated by semicolons.
2415Each citation must have a key, composed of '@' + the citation
2394Each citation must have a key, composed of '@' + the citation
data/default.csldeleted−458
@@ -1,458 +0,0 @@
1−<?xml version="1.0" encoding="utf-8"?>
2−<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
3− <info>
4− <title>Chicago Manual of Style (author-date)</title>
5− <id>http://www.zotero.org/styles/chicago-author-date</id>
6− <link href="http://www.zotero.org/styles/chicago-author-date" rel="self"/>
7− <link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
8− <author>
9− <name>Julian Onions</name>
10− <email>julian.onions@gmail.com</email>
11− </author>
12− <contributor>
13− <name>Sebastian Karcher</name>
14− </contributor>
15− <contributor>
16− <name>Richard Karnesky</name>
17− <email>karnesky+zotero@gmail.com</email>
18− <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri>
19− </contributor>
20− <category citation-format="author-date"/>
21− <category field="generic-base"/>
22− <summary>The author-date variant of the Chicago style</summary>
23− <updated>2013-03-28T05:37:10+00:00</updated>
24− <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
25− </info>
26− <locale>
27− <terms>
28− <term name="editor" form="verb-short">ed.</term>
29− <term name="container-author" form="verb">by</term>
30− <term name="translator" form="verb-short">trans.</term>
31− <term name="translator" form="short">trans.</term>
32− </terms>
33− </locale>
34− <macro name="secondary-contributors">
35− <choose>
36− <if type="chapter paper-conference" match="none">
37− <group delimiter=". ">
38− <names variable="editor translator">
39− <label form="verb" text-case="capitalize-first" suffix=" " plural="never"/>
40− <name and="text" delimiter=", "/>
41− </names>
42− </group>
43− </if>
44− </choose>
45− </macro>
46− <macro name="container-contributors">
47− <choose>
48− <if type="chapter paper-conference" match="any">
49− <group prefix=", " delimiter=", ">
50− <names variable="container-author editor" delimiter=", ">
51− <label form="verb" suffix=" " plural="never"/>
52− <name and="text" delimiter=", "/>
53− </names>
54− </group>
55− </if>
56− </choose>
57− </macro>
58− <macro name="editor">
59− <names variable="editor">
60− <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
61− <label form="short" prefix=", "/>
62− </names>
63− </macro>
64− <macro name="translator">
65− <names variable="translator">
66− <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
67− <label form="short" prefix=", " plural="never"/>
68− </names>
69− </macro>
70− <macro name="recipient">
71− <choose>
72− <if type="personal_communication">
73− <choose>
74− <if variable="genre">
75− <text variable="genre" text-case="capitalize-first"/>
76− </if>
77− <else>
78− <text term="letter" text-case="capitalize-first"/>
79− </else>
80− </choose>
81− </if>
82− </choose>
83− <names variable="recipient" delimiter=", ">
84− <label form="verb" prefix=" " text-case="lowercase" suffix=" "/>
85− <name and="text" delimiter=", "/>
86− </names>
87− </macro>
88− <macro name="contributors">
89− <names variable="author">
90− <name and="text" name-as-sort-order="first" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
91− <label form="short" plural="never" prefix=", "/>
92− <substitute>
93− <names variable="editor"/>
94− <names variable="translator"/>
95− <text macro="title"/>
96− </substitute>
97− </names>
98− <text macro="recipient"/>
99− </macro>
100− <macro name="contributors-short">
101− <names variable="author">
102− <name form="short" and="text" delimiter=", " initialize-with=". "/>
103− <substitute>
104− <names variable="editor"/>
105− <names variable="translator"/>
106− <text macro="title"/>
107− </substitute>
108− </names>
109− </macro>
110− <macro name="interviewer">
111− <names variable="interviewer" delimiter=", ">
112− <label form="verb" prefix=" " text-case="capitalize-first" suffix=" "/>
113− <name and="text" delimiter=", "/>
114− </names>
115− </macro>
116− <macro name="archive">
117− <group delimiter=". ">
118− <text variable="archive_location" text-case="capitalize-first"/>
119− <text variable="archive"/>
120− <text variable="archive-place"/>
121− </group>
122− </macro>
123− <macro name="access">
124− <group delimiter=". ">
125− <choose>
126− <if type="graphic report" match="any">
127− <text macro="archive"/>
128− </if>
129− <else-if type="article-magazine article-newspaper bill book chapter graphic legal_case legislation motion_picture paper-conference report song thesis" match="none">
130− <text macro="archive"/>
131− </else-if>
132− </choose>
133− <text variable="DOI" prefix="doi:"/>
134− <choose>
135− <if variable="DOI issued" match="none">
136− <choose>
137− <if variable="URL accessed" match="all">
138− <group delimiter=" ">
139− <text term="accessed" text-case="capitalize-first"/>
140− <date variable="accessed" delimiter=" ">
141− <date-part name="month"/>
142− <date-part name="day"/>
143− </date>
144− </group>
145− </if>
146− </choose>
147− </if>
148− <else-if type="webpage">
149− <date variable="issued" delimiter=" ">
150− <date-part name="month"/>
151− <date-part name="day"/>
152− </date>
153− </else-if>
154− </choose>
155− <choose>
156− <if type="legal_case" match="none">
157− <text variable="URL"/>
158− </if>
159− </choose>
160− </group>
161− </macro>
162− <macro name="title">
163− <choose>
164− <if variable="title" match="none">
165− <choose>
166− <if type="personal_communication" match="none">
167− <text variable="genre" text-case="capitalize-first"/>
168− </if>
169− </choose>
170− </if>
171− <else-if type="bill book graphic legal_case legislation motion_picture song" match="any">
172− <text variable="title" text-case="title" font-style="italic"/>
173− </else-if>
174− <else>
175− <text variable="title" text-case="title" quotes="true"/>
176− </else>
177− </choose>
178− </macro>
179− <macro name="edition">
180− <choose>
181− <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
182− <choose>
183− <if is-numeric="edition">
184− <group delimiter=" " prefix=". ">
185− <number variable="edition" form="ordinal"/>
186− <text term="edition" form="short" strip-periods="true"/>
187− </group>
188− </if>
189− <else>
190− <text variable="edition" prefix=". "/>
191− </else>
192− </choose>
193− </if>
194− <else-if type="chapter paper-conference" match="any">
195− <choose>
196− <if is-numeric="edition">
197− <group delimiter=" " prefix=", ">
198− <number variable="edition" form="ordinal"/>
199− <text term="edition" form="short"/>
200− </group>
201− </if>
202− <else>
203− <text variable="edition" prefix=", "/>
204− </else>
205− </choose>
206− </else-if>
207− </choose>
208− </macro>
209− <macro name="locators">
210− <choose>
211− <if type="article-journal">
212− <text variable="volume" prefix=" "/>
213− <text variable="issue" prefix=" (" suffix=")"/>
214− </if>
215− <else-if type="legal_case">
216− <text variable="volume" prefix=", "/>
217− <text variable="container-title" prefix=" "/>
218− <text variable="page" prefix=" "/>
219− </else-if>
220− <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
221− <group prefix=". " delimiter=". ">
222− <group>
223− <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
224− <number variable="volume" form="numeric"/>
225− </group>
226− <group>
227− <number variable="number-of-volumes" form="numeric"/>
228− <text term="volume" form="short" prefix=" " plural="true"/>
229− </group>
230− </group>
231− </else-if>
232− <else-if type="chapter paper-conference" match="any">
233− <choose>
234− <if variable="page" match="none">
235− <group prefix=". ">
236− <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
237− <number variable="volume" form="numeric"/>
238− </group>
239− </if>
240− </choose>
241− </else-if>
242− </choose>
243− </macro>
244− <macro name="locators-chapter">
245− <choose>
246− <if type="chapter paper-conference" match="any">
247− <choose>
248− <if variable="page">
249− <group prefix=", ">
250− <text variable="volume" suffix=":"/>
251− <text variable="page"/>
252− </group>
253− </if>
254− </choose>
255− </if>
256− </choose>
257− </macro>
258− <macro name="locators-article">
259− <choose>
260− <if type="article-newspaper">
261− <group prefix=", " delimiter=", ">
262− <group>
263− <text variable="edition" suffix=" "/>
264− <text term="edition" prefix=" "/>
265− </group>
266− <group>
267− <text term="section" form="short" suffix=" "/>
268− <text variable="section"/>
269− </group>
270− </group>
271− </if>
272− <else-if type="article-journal">
273− <text variable="page" prefix=": "/>
274− </else-if>
275− </choose>
276− </macro>
277− <macro name="point-locators">
278− <choose>
279− <if variable="locator">
280− <choose>
281− <if locator="page" match="none">
282− <choose>
283− <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
284− <choose>
285− <if variable="volume">
286− <group>
287− <text term="volume" form="short" suffix=" "/>
288− <number variable="volume" form="numeric"/>
289− <label variable="locator" form="short" prefix=", " suffix=" "/>
290− </group>
291− </if>
292− <else>
293− <label variable="locator" form="short" suffix=" "/>
294− </else>
295− </choose>
296− </if>
297− <else>
298− <label variable="locator" form="short" suffix=" "/>
299− </else>
300− </choose>
301− </if>
302− <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
303− <number variable="volume" form="numeric" suffix=":"/>
304− </else-if>
305− </choose>
306− <text variable="locator"/>
307− </if>
308− </choose>
309− </macro>
310− <macro name="container-prefix">
311− <text term="in" text-case="capitalize-first"/>
312− </macro>
313− <macro name="container-title">
314− <choose>
315− <if type="chapter paper-conference" match="any">
316− <text macro="container-prefix" suffix=" "/>
317− </if>
318− </choose>
319− <choose>
320− <if type="legal_case" match="none">
321− <text variable="container-title" text-case="title" font-style="italic"/>
322− </if>
323− </choose>
324− </macro>
325− <macro name="publisher">
326− <group delimiter=": ">
327− <text variable="publisher-place"/>
328− <text variable="publisher"/>
329− </group>
330− </macro>
331− <macro name="date">
332− <choose>
333− <if variable="issued">
334− <date variable="issued">
335− <date-part name="year"/>
336− </date>
337− </if>
338− <else-if variable="accessed">
339− <date variable="accessed">
340− <date-part name="year"/>
341− </date>
342− </else-if>
343− </choose>
344− </macro>
345− <macro name="day-month">
346− <date variable="issued">
347− <date-part name="month"/>
348− <date-part name="day" prefix=" "/>
349− </date>
350− </macro>
351− <macro name="collection-title">
352− <text variable="collection-title" text-case="title"/>
353− <text variable="collection-number" prefix=" "/>
354− </macro>
355− <macro name="event">
356− <group>
357− <text term="presented at" suffix=" "/>
358− <text variable="event"/>
359− </group>
360− </macro>
361− <macro name="description">
362− <choose>
363− <if type="interview">
364− <group delimiter=". ">
365− <text macro="interviewer"/>
366− <text variable="medium" text-case="capitalize-first"/>
367− </group>
368− </if>
369− <else>
370− <text variable="medium" text-case="capitalize-first" prefix=". "/>
371− </else>
372− </choose>
373− <choose>
374− <if variable="title" match="none"/>
375− <else-if type="thesis"/>
376− <else>
377− <group delimiter=" " prefix=". ">
378− <text variable="genre" text-case="capitalize-first"/>
379− <choose>
380− <if type="report">
381− <text variable="number"/>
382− </if>
383− </choose>
384− </group>
385− </else>
386− </choose>
387− <!--This is for computer programs only. Localization new to 1.0.1, so may be missing in many locales-->
388− <group delimiter=" " prefix=" (" suffix=")">
389− <text term="version"/>
390− <text variable="version"/>
391− </group>
392− </macro>
393− <macro name="issue">
394− <choose>
395− <if type="article-journal">
396− <text macro="day-month" prefix=" (" suffix=")"/>
397− </if>
398− <else-if type="legal_case">
399− <text variable="authority" prefix=". "/>
400− </else-if>
401− <else-if type="speech">
402− <group prefix=" " delimiter=", ">
403− <text macro="event"/>
404− <text macro="day-month"/>
405− <text variable="event-place"/>
406− </group>
407− </else-if>
408− <else-if type="article-newspaper article-magazine" match="any">
409− <text macro="day-month" prefix=", "/>
410− </else-if>
411− <else>
412− <group prefix=". " delimiter=", ">
413− <choose>
414− <if type="thesis">
415− <text variable="genre" text-case="capitalize-first"/>
416− </if>
417− </choose>
418− <text macro="publisher"/>
419− </group>
420− </else>
421− </choose>
422− </macro>
423− <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" givenname-disambiguation-rule="primary-name">
424− <layout prefix="(" suffix=")" delimiter="; ">
425− <group delimiter=", ">
426− <group delimiter=" ">
427− <text macro="contributors-short"/>
428− <text macro="date"/>
429− </group>
430− <text macro="point-locators"/>
431− </group>
432− </layout>
433− </citation>
434− <bibliography hanging-indent="true" et-al-min="11" et-al-use-first="7" subsequent-author-substitute="&#8212;&#8212;&#8212;" entry-spacing="0">
435− <sort>
436− <key macro="contributors"/>
437− <key variable="issued"/>
438− </sort>
439− <layout suffix=".">
440− <group delimiter=". ">
441− <text macro="contributors"/>
442− <text macro="date"/>
443− <text macro="title"/>
444− </group>
445− <text macro="description"/>
446− <text macro="secondary-contributors" prefix=". "/>
447− <text macro="container-title" prefix=". "/>
448− <text macro="container-contributors"/>
449− <text macro="edition"/>
450− <text macro="locators-chapter"/>
451− <text macro="locators"/>
452− <text macro="collection-title" prefix=". "/>
453− <text macro="issue"/>
454− <text macro="locators-article"/>
455− <text macro="access" prefix=". "/>
456− </layout>
457− </bibliography>
458−</style>
make_osx_package.sh−1
@@ -16,7 +16,6 @@ mkdir -p $RESOURCES
16
16
17echo Building pandoc...
17echo Building pandoc...
18cabal-dev install-deps
18cabal-dev install-deps
19−cabal-dev install --reinstall --force-reinstalls --flags="embed_data_files" citeproc-hs
20cabal-dev configure --prefix=/usr/local --datasubdir=$BASE --docdir=/usr/local/doc/$BASE
19cabal-dev configure --prefix=/usr/local --datasubdir=$BASE --docdir=/usr/local/doc/$BASE
21cabal-dev build
20cabal-dev build
22cabal-dev copy --destdir=$ROOT
21cabal-dev copy --destdir=$ROOT
pandoc.cabal+3−14
@@ -99,8 +99,6 @@ Data-Files:
99 data/slideous/slideous.js,
99 data/slideous/slideous.js,
100 -- data for dzslides writer
100 -- data for dzslides writer
101 data/dzslides/template.html,
101 data/dzslides/template.html,
102− -- data for citeproc
103− data/default.csl,
104 -- sample lua custom writer
102 -- sample lua custom writer
105 data/sample.lua
103 data/sample.lua
106 -- documentation
104 -- documentation
@@ -125,10 +123,6 @@ Extra-Source-Files:
125 tests/insert,
123 tests/insert,
126 tests/lalune.jpg,
124 tests/lalune.jpg,
127 tests/movie.jpg,
125 tests/movie.jpg,
128− tests/biblio.bib,
129− tests/chicago-author-date.csl,
130− tests/ieee.csl,
131− tests/mhra.csl,
132 tests/latex-reader.latex,
126 tests/latex-reader.latex,
133 tests/latex-reader.native,
127 tests/latex-reader.native,
134 tests/textile-reader.textile,
128 tests/textile-reader.textile,
@@ -136,9 +130,7 @@ Extra-Source-Files:
136 tests/markdown-reader-more.txt,
130 tests/markdown-reader-more.txt,
137 tests/markdown-reader-more.native,
131 tests/markdown-reader-more.native,
138 tests/markdown-citations.txt,
132 tests/markdown-citations.txt,
139− tests/markdown-citations.chicago-author-date.txt,
133+ tests/markdown-citations.native,
140− tests/markdown-citations.mhra.txt,
141− tests/markdown-citations.ieee.txt,
142 tests/textile-reader.textile,
134 tests/textile-reader.textile,
143 tests/mediawiki-reader.wiki,
135 tests/mediawiki-reader.wiki,
144 tests/mediawiki-reader.native,
136 tests/mediawiki-reader.native,
@@ -246,11 +238,10 @@ Library
246 old-locale >= 1 && < 1.1,
238 old-locale >= 1 && < 1.1,
247 time >= 1.2 && < 1.5,
239 time >= 1.2 && < 1.5,
248 HTTP >= 4000.0.5 && < 4000.3,
240 HTTP >= 4000.0.5 && < 4000.3,
249− texmath >= 0.6.3 && < 0.7,
241+ texmath >= 0.6.4 && < 0.7,
250 xml >= 1.3.12 && < 1.4,
242 xml >= 1.3.12 && < 1.4,
251 random >= 1 && < 1.1,
243 random >= 1 && < 1.1,
252 extensible-exceptions >= 0.1 && < 0.2,
244 extensible-exceptions >= 0.1 && < 0.2,
253− citeproc-hs >= 0.3.7 && < 0.4,
254 pandoc-types >= 1.12 && < 1.13,
245 pandoc-types >= 1.12 && < 1.13,
255 aeson >= 0.6 && < 0.7,
246 aeson >= 0.6 && < 0.7,
256 tagsoup >= 0.12.5 && < 0.14,
247 tagsoup >= 0.12.5 && < 0.14,
@@ -323,7 +314,6 @@ Library
323 Text.Pandoc.UTF8,
314 Text.Pandoc.UTF8,
324 Text.Pandoc.Templates,
315 Text.Pandoc.Templates,
325 Text.Pandoc.XML,
316 Text.Pandoc.XML,
326− Text.Pandoc.Biblio,
327 Text.Pandoc.SelfContained,
317 Text.Pandoc.SelfContained,
328 Text.Pandoc.Process
318 Text.Pandoc.Process
329 Other-Modules: Text.Pandoc.Readers.Haddock.Lex,
319 Other-Modules: Text.Pandoc.Readers.Haddock.Lex,
@@ -353,8 +343,7 @@ Executable pandoc
353 extensible-exceptions >= 0.1 && < 0.2,
343 extensible-exceptions >= 0.1 && < 0.2,
354 highlighting-kate >= 0.5.5 && < 0.6,
344 highlighting-kate >= 0.5.5 && < 0.6,
355 aeson >= 0.6 && < 0.7,
345 aeson >= 0.6 && < 0.7,
356− HTTP >= 4000.0.5 && < 4000.3,
346+ HTTP >= 4000.0.5 && < 4000.3
357− citeproc-hs >= 0.3.7 && < 0.4
358 Ghc-Options: -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind
347 Ghc-Options: -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind
359 Ghc-Prof-Options: -auto-all -caf-all -rtsopts -with-rtsopts=-K16m
348 Ghc-Prof-Options: -auto-all -caf-all -rtsopts -with-rtsopts=-K16m
360 if os(windows)
349 if os(windows)
pandoc.hs+9−71
@@ -35,7 +35,7 @@ import Text.Pandoc.PDF (makePDF)
35import Text.Pandoc.Readers.LaTeX (handleIncludes)
35import Text.Pandoc.Readers.LaTeX (handleIncludes)
36import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, readDataFile,
36import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, readDataFile,
37 safeRead, headerShift, normalize, err, warn )
37 safeRead, headerShift, normalize, err, warn )
38−import Text.Pandoc.XML ( toEntities, fromEntities )
38+import Text.Pandoc.XML ( toEntities )
39import Text.Pandoc.SelfContained ( makeSelfContained )
39import Text.Pandoc.SelfContained ( makeSelfContained )
40import Text.Pandoc.Process (pipeProcess)
40import Text.Pandoc.Process (pipeProcess)
41import Text.Highlighting.Kate ( languages, Style, tango, pygments,
41import Text.Highlighting.Kate ( languages, Style, tango, pygments,
@@ -46,20 +46,18 @@ import System.FilePath
46import System.Console.GetOpt
46import System.Console.GetOpt
47import Data.Char ( toLower )
47import Data.Char ( toLower )
48import Data.List ( intercalate, isPrefixOf, sort )
48import Data.List ( intercalate, isPrefixOf, sort )
49−import System.Directory ( getAppUserDataDirectory, doesFileExist, findExecutable )
49+import System.Directory ( getAppUserDataDirectory, findExecutable )
50import System.IO ( stdout, stderr )
50import System.IO ( stdout, stderr )
51import System.IO.Error ( isDoesNotExistError )
51import System.IO.Error ( isDoesNotExistError )
52import qualified Control.Exception as E
52import qualified Control.Exception as E
53import Control.Exception.Extensible ( throwIO )
53import Control.Exception.Extensible ( throwIO )
54import qualified Text.Pandoc.UTF8 as UTF8
54import qualified Text.Pandoc.UTF8 as UTF8
55−import qualified Text.CSL as CSL
56import Control.Monad (when, unless, liftM)
55import Control.Monad (when, unless, liftM)
57import Data.Foldable (foldrM)
56import Data.Foldable (foldrM)
58import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))
57import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))
59import Network.URI (parseURI, isURI, URI(..))
58import Network.URI (parseURI, isURI, URI(..))
60import qualified Data.ByteString.Lazy as B
59import qualified Data.ByteString.Lazy as B
61import qualified Data.ByteString as BS
60import qualified Data.ByteString as BS
62−import Text.CSL.Reference (Reference(..))
63import Data.Aeson (eitherDecode', encode)
61import Data.Aeson (eitherDecode', encode)
64
62
65copyrightMessage :: String
63copyrightMessage :: String
@@ -70,7 +68,7 @@ copyrightMessage = "\nCopyright (C) 2006-2013 John MacFarlane\n" ++
70
68
71compileInfo :: String
69compileInfo :: String
72compileInfo =
70compileInfo =
73− "\nCompiled with citeproc-hs " ++ VERSION_citeproc_hs ++ ", texmath " ++
71+ "\nCompiled with texmath " ++
74 VERSION_texmath ++ ", highlighting-kate " ++ VERSION_highlighting_kate ++
72 VERSION_texmath ++ ", highlighting-kate " ++ VERSION_highlighting_kate ++
75 ".\nSyntax highlighting is supported for the following languages:\n " ++
73 ".\nSyntax highlighting is supported for the following languages:\n " ++
76 wrapWords 4 78
74 wrapWords 4 78
@@ -91,14 +89,14 @@ isTextFormat :: String -> Bool
91isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"]
89isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","epub3"]
92
90
93externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
91externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
94−externalFilter f args' d = E.handle filterException $
92+externalFilter f args' d = do
93+ (exitcode, outbs, errbs) <- E.handle filterException $
95− do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d
94+ pipeProcess Nothing f args' $ encode d
96 when (not $ B.null errbs) $ B.hPutStr stderr errbs
95 when (not $ B.null errbs) $ B.hPutStr stderr errbs
97 case exitcode of
96 case exitcode of
98 ExitSuccess -> return $ either error id $ eitherDecode' outbs
97 ExitSuccess -> return $ either error id $ eitherDecode' outbs
99− ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++
98+ ExitFailure _ -> err 83 $ "Error running filter " ++ f
100− UTF8.toStringLazy outbs
101− where filterException :: E.SomeException -> IO Pandoc
99+ where filterException :: E.SomeException -> IO a
102 filterException e = err 83 $ "Error running filter " ++ f ++
100 filterException e = err 83 $ "Error running filter " ++ f ++
103 "\n" ++ show e
101 "\n" ++ show e
104
102
@@ -146,9 +144,6 @@ data Opt = Opt
146 , optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks
144 , optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks
147 , optDataDir :: Maybe FilePath
145 , optDataDir :: Maybe FilePath
148 , optCiteMethod :: CiteMethod -- ^ Method to output cites
146 , optCiteMethod :: CiteMethod -- ^ Method to output cites
149− , optBibliography :: [String]
150− , optCslFile :: Maybe FilePath
151− , optAbbrevsFile :: Maybe FilePath
152 , optListings :: Bool -- ^ Use listings package for code blocks
147 , optListings :: Bool -- ^ Use listings package for code blocks
153 , optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
148 , optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
154 , optSlideLevel :: Maybe Int -- ^ Header level that creates slides
149 , optSlideLevel :: Maybe Int -- ^ Header level that creates slides
@@ -203,9 +198,6 @@ defaultOpts = Opt
203 , optIndentedCodeClasses = []
198 , optIndentedCodeClasses = []
204 , optDataDir = Nothing
199 , optDataDir = Nothing
205 , optCiteMethod = Citeproc
200 , optCiteMethod = Citeproc
206− , optBibliography = []
207− , optCslFile = Nothing
208− , optAbbrevsFile = Nothing
209 , optListings = False
201 , optListings = False
210 , optLaTeXEngine = "pdflatex"
202 , optLaTeXEngine = "pdflatex"
211 , optSlideLevel = Nothing
203 , optSlideLevel = Nothing
@@ -288,7 +280,7 @@ options =
288 "STRING")
280 "STRING")
289 "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks"
281 "" -- "Classes (whitespace- or comma-separated) to use for indented code-blocks"
290
282
291− , Option "" ["filter"]
283+ , Option "F" ["filter"]
292 (ReqArg
284 (ReqArg
293 (\arg opt -> return opt { optPlugins = externalFilter arg :
285 (\arg opt -> return opt { optPlugins = externalFilter arg :
294 optPlugins opt })
286 optPlugins opt })
@@ -650,24 +642,6 @@ options =
650 "PROGRAM")
642 "PROGRAM")
651 "" -- "Name of latex program to use in generating PDF"
643 "" -- "Name of latex program to use in generating PDF"
652
644
653− , Option "" ["bibliography"]
654− (ReqArg
655− (\arg opt -> return opt { optBibliography = (optBibliography opt) ++ [arg] })
656− "FILENAME")
657− ""
658−
659− , Option "" ["csl"]
660− (ReqArg
661− (\arg opt -> return opt { optCslFile = Just arg })
662− "FILENAME")
663− ""
664−
665− , Option "" ["citation-abbreviations"]
666− (ReqArg
667− (\arg opt -> return opt { optAbbrevsFile = Just arg })
668− "FILENAME")
669− ""
670−
671 , Option "" ["natbib"]
645 , Option "" ["natbib"]
672 (NoArg
646 (NoArg
673 (\opt -> return opt { optCiteMethod = Natbib }))
647 (\opt -> return opt { optCiteMethod = Natbib }))
@@ -904,9 +878,6 @@ main = do
904 , optIdentifierPrefix = idPrefix
878 , optIdentifierPrefix = idPrefix
905 , optIndentedCodeClasses = codeBlockClasses
879 , optIndentedCodeClasses = codeBlockClasses
906 , optDataDir = mbDataDir
880 , optDataDir = mbDataDir
907− , optBibliography = reffiles
908− , optCslFile = mbCsl
909− , optAbbrevsFile = cslabbrevs
910 , optCiteMethod = citeMethod
881 , optCiteMethod = citeMethod
911 , optListings = listings
882 , optListings = listings
912 , optLaTeXEngine = latexEngine
883 , optLaTeXEngine = latexEngine
@@ -1007,36 +978,6 @@ main = do
1007 $ lines dztempl
978 $ lines dztempl
1008 return $ ("dzslides-core", dzcore) : variables'
979 return $ ("dzslides-core", dzcore) : variables'
1009 else return variables'
980 else return variables'
1010−
1011− -- unescape reference ids, which may contain XML entities, so
1012− -- that we can do lookups with regular string equality
1013− let unescapeRefId ref = ref{ refId = fromEntities (refId ref) }
1014−
1015− refs <- mapM (\f -> E.catch (CSL.readBiblioFile f)
1016− (\e -> let _ = (e :: E.SomeException)
1017− in err 23 $ "Error reading bibliography `" ++ f ++
1018− "'" ++ "\n" ++ show e))
1019− reffiles >>=
1020− return . map unescapeRefId . concat
1021−
1022− mbsty <- if citeMethod == Citeproc && not (null refs)
1023− then do
1024− csl <- CSL.parseCSL =<<
1025− case mbCsl of
1026− Nothing -> readDataFileUTF8 datadir
1027− "default.csl"
1028− Just cslfile -> do
1029− exists <- doesFileExist cslfile
1030− if exists
1031− then UTF8.readFile cslfile
1032− else do
1033− csldir <- getAppUserDataDirectory "csl"
1034− readDataFileUTF8 (Just csldir)
1035− (replaceExtension cslfile "csl")
1036− abbrevs <- maybe (return []) CSL.readJsonAbbrevFile cslabbrevs
1037− return $ Just csl { CSL.styleAbbrevs = abbrevs }
1038− else return Nothing
1039−
1040 let sourceURL = case sources of
981 let sourceURL = case sources of
1041 [] -> Nothing
982 [] -> Nothing
1042 (x:_) -> case parseURI x of
983 (x:_) -> case parseURI x of
@@ -1054,8 +995,6 @@ main = do
1054 , readerColumns = columns
995 , readerColumns = columns
1055 , readerTabStop = tabStop
996 , readerTabStop = tabStop
1056 , readerOldDashes = oldDashes
997 , readerOldDashes = oldDashes
1057− , readerReferences = refs
1058− , readerCitationStyle = mbsty
1059 , readerIndentedCodeClasses = codeBlockClasses
998 , readerIndentedCodeClasses = codeBlockClasses
1060 , readerApplyMacros = not laTeXOutput
999 , readerApplyMacros = not laTeXOutput
1061 , readerDefaultImageExtension = defaultImageExtension
1000 , readerDefaultImageExtension = defaultImageExtension
@@ -1069,7 +1008,6 @@ main = do
1069 writerHTMLMathMethod = mathMethod,
1008 writerHTMLMathMethod = mathMethod,
1070 writerIncremental = incremental,
1009 writerIncremental = incremental,
1071 writerCiteMethod = citeMethod,
1010 writerCiteMethod = citeMethod,
1072− writerBiblioFiles = reffiles,
1073 writerIgnoreNotes = False,
1011 writerIgnoreNotes = False,
1074 writerNumberSections = numberSections,
1012 writerNumberSections = numberSections,
1075 writerNumberOffset = numberFrom,
1013 writerNumberOffset = numberFrom,
src/Text/Pandoc/Biblio.hsdeleted−216
@@ -1,216 +0,0 @@
1−{-# LANGUAGE PatternGuards #-}
2−{-
3−Copyright (C) 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>
4−
5−This program is free software; you can redistribute it and/or modify
6−it under the terms of the GNU General Public License as published by
7−the Free Software Foundation; either version 2 of the License, or
8−(at your option) any later version.
9−
10−This program is distributed in the hope that it will be useful,
11−but WITHOUT ANY WARRANTY; without even the implied warranty of
12−MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13−GNU General Public License for more details.
14−
15−You should have received a copy of the GNU General Public License
16−along with this program; if not, write to the Free Software
17−Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18−-}
19−
20−{- |
21− Module : Text.Pandoc.Biblio
22− Copyright : Copyright (C) 2008-2010 Andrea Rossato
23− License : GNU GPL, version 2 or above
24−
25− Maintainer : Andrea Rossato <andrea.rossato@unitn.it>
26− Stability : alpha
27− Portability : portable
28−-}
29−
30−module Text.Pandoc.Biblio ( processBiblio ) where
31−
32−import Data.List
33−import Data.Char ( isDigit, isPunctuation )
34−import qualified Data.Map as M
35−import Text.CSL hiding ( Cite(..), Citation(..), endWithPunct )
36−import qualified Text.CSL as CSL ( Cite(..) )
37−import Text.Pandoc.Definition
38−import Text.Pandoc.Generic
39−import Text.Pandoc.Walk
40−import Text.Pandoc.Shared (stringify)
41−import Text.Parsec hiding (State)
42−import Control.Monad
43−import Control.Monad.State
44−
45−-- | Process a 'Pandoc' document by adding citations formatted
46−-- according to a CSL style, using 'citeproc' from citeproc-hs.
47−processBiblio :: Maybe Style -> [Reference] -> Pandoc -> Pandoc
48−processBiblio Nothing _ p = p
49−processBiblio _ [] p = p
50−processBiblio (Just style) r p =
51− let p' = evalState (bottomUpM setHash p) 1
52− grps = query getCitation p'
53− result = citeproc procOpts style r (setNearNote style $
54− map (map toCslCite) grps)
55− cits_map = M.fromList $ zip grps (citations result)
56− biblioList = map (renderPandoc' style) (bibliography result)
57− Pandoc m b = bottomUp mvPunct . deNote . topDown (processCite style cits_map) $ p'
58− (bs, lastb) = case reverse b of
59− x@(Header _ _ _) : xs -> (reverse xs, [x])
60− _ -> (b, [])
61− in Pandoc m $ bs ++ [Div ("",["references"],[]) (lastb ++ biblioList)]
62−
63−-- | Substitute 'Cite' elements with formatted citations.
64−processCite :: Style -> M.Map [Citation] [FormattedOutput] -> Inline -> Inline
65−processCite s cs (Cite t _) =
66− case M.lookup t cs of
67− Just (x:xs)
68− | isTextualCitation t && not (null xs) ->
69− let xs' = renderPandoc s xs
70− in if styleClass s == "note"
71− then Cite t (renderPandoc s [x] ++ [Note [Para xs']])
72− else Cite t (renderPandoc s [x] ++ [Space | not (startWithPunct xs')] ++ xs')
73− | otherwise -> if styleClass s == "note"
74− then Cite t [Note [Para $ renderPandoc s (x:xs)]]
75− else Cite t (renderPandoc s (x:xs))
76− _ -> Strong [Str "???"] -- TODO raise error instead?
77−processCite _ _ x = x
78−
79−isNote :: Inline -> Bool
80−isNote (Note _) = True
81−isNote (Cite _ [Note _]) = True
82−isNote _ = False
83−
84−mvPunct :: [Inline] -> [Inline]
85−mvPunct (Space : Space : xs) = Space : xs
86−mvPunct (Space : x : ys) | isNote x, startWithPunct ys =
87− Str (headInline ys) : x : tailFirstInlineStr ys
88−mvPunct (Space : x : ys) | isNote x = x : ys
89−mvPunct xs = xs
90−
91−-- A replacement for citeproc-hs's endWithPunct, which wrongly treats
92−-- a sentence ending in '.)' as not ending with punctuation, leading
93−-- to an extra period.
94−endWithPunct :: [Inline] -> Bool
95−endWithPunct [] = True
96−endWithPunct xs@(_:_) = case reverse (stringify [last xs]) of
97− [] -> True
98− (')':c:_) | isEndPunct c -> True
99− (c:_) | isEndPunct c -> True
100− | otherwise -> False
101− where isEndPunct c = c `elem` ".,;:!?"
102−
103−deNote :: Pandoc -> Pandoc
104−deNote = topDown go
105− where go (Cite (c:cs) [Note xs]) =
106− Cite (c:cs) [Note $ bottomUp go' $ sanitize c xs]
107− go (Note xs) = Note $ bottomUp go' xs
108− go x = x
109− go' (Note [Para xs]:ys) =
110− if startWithPunct ys && endWithPunct xs
111− then initInline xs ++ ys
112− else xs ++ ys
113− go' xs = xs
114− sanitize :: Citation -> [Block] -> [Block]
115− sanitize Citation{citationPrefix = pref} [Para xs] =
116− case (null pref, endWithPunct xs) of
117− (True, False) -> [Para $ xs ++ [Str "."]]
118− (True, True) -> [Para xs]
119− (False, False) -> [Para $ toCapital $ xs ++ [Str "."]]
120− (False, True) -> [Para $ toCapital xs]
121− sanitize _ bs = bs
122−
123−isTextualCitation :: [Citation] -> Bool
124−isTextualCitation (c:_) = citationMode c == AuthorInText
125−isTextualCitation _ = False
126−
127−-- | Retrieve all citations from a 'Pandoc' docuument. To be used with
128−-- 'query'.
129−getCitation :: Inline -> [[Citation]]
130−getCitation i | Cite t _ <- i = [t]
131− | otherwise = []
132−
133−setHash :: Citation -> State Int Citation
134−setHash c = do
135− ident <- get
136− put $ ident + 1
137− return c{ citationHash = ident }
138−
139−toCslCite :: Citation -> CSL.Cite
140−toCslCite c
141− = let (l, s) = locatorWords $ citationSuffix c
142− (la,lo) = parseLocator l
143− s' = case (l,s) of
144− -- treat a bare locator as if it begins with space
145− -- so @item1 [blah] is like [@item1, blah]
146− ("",(x:_))
147− | not (isPunct x) -> [Space] ++ s
148− _ -> s
149− isPunct (Str (x:_)) = isPunctuation x
150− isPunct _ = False
151− citMode = case citationMode c of
152− AuthorInText -> (True, False)
153− SuppressAuthor -> (False,True )
154− NormalCitation -> (False,False)
155− in emptyCite { CSL.citeId = citationId c
156− , CSL.citePrefix = PandocText $ citationPrefix c
157− , CSL.citeSuffix = PandocText s'
158− , CSL.citeLabel = la
159− , CSL.citeLocator = lo
160− , CSL.citeNoteNumber = show $ citationNoteNum c
161− , CSL.authorInText = fst citMode
162− , CSL.suppressAuthor = snd citMode
163− , CSL.citeHash = citationHash c
164− }
165−
166−locatorWords :: [Inline] -> (String, [Inline])
167−locatorWords inp =
168− case parse pLocatorWords "suffix" $ breakup inp of
169− Right r -> r
170− Left _ -> ("",inp)
171− where breakup [] = []
172− breakup (Str x : xs) = map Str (splitup x) ++ breakup xs
173− breakup (x : xs) = x : breakup xs
174− splitup = groupBy (\x y -> x /= '\160' && y /= '\160')
175−
176−pLocatorWords :: Parsec [Inline] st (String, [Inline])
177−pLocatorWords = do
178− l <- pLocator
179− s <- getInput -- rest is suffix
180− if length l > 0 && last l == ','
181− then return (init l, Str "," : s)
182− else return (l, s)
183−
184−pMatch :: (Inline -> Bool) -> Parsec [Inline] st Inline
185−pMatch condition = try $ do
186− t <- anyToken
187− guard $ condition t
188− return t
189−
190−pSpace :: Parsec [Inline] st Inline
191−pSpace = pMatch (\t -> t == Space || t == Str "\160")
192−
193−pLocator :: Parsec [Inline] st String
194−pLocator = try $ do
195− optional $ pMatch (== Str ",")
196− optional pSpace
197− f <- (guardFollowingDigit >> return [Str "p"]) -- "page" the default
198− <|> many1 (notFollowedBy pSpace >> anyToken)
199− gs <- many1 pWordWithDigits
200− return $ stringify f ++ (' ' : unwords gs)
201−
202−guardFollowingDigit :: Parsec [Inline] st ()
203−guardFollowingDigit = do
204− t <- lookAhead anyToken
205− case t of
206− Str (d:_) | isDigit d -> return ()
207− _ -> mzero
208−
209−pWordWithDigits :: Parsec [Inline] st String
210−pWordWithDigits = try $ do
211− optional pSpace
212− r <- many1 (notFollowedBy pSpace >> anyToken)
213− let s = stringify r
214− guard $ any isDigit s
215− return s
216−
src/Text/Pandoc/Options.hs−7
@@ -48,7 +48,6 @@ import Data.Set (Set)
48import qualified Data.Set as Set
48import qualified Data.Set as Set
49import Data.Default
49import Data.Default
50import Text.Pandoc.Highlighting (Style, pygments)
50import Text.Pandoc.Highlighting (Style, pygments)
51−import qualified Text.CSL as CSL
52
51
53-- | Individually selectable syntax extensions.
52-- | Individually selectable syntax extensions.
54data Extension =
53data Extension =
@@ -205,8 +204,6 @@ data ReaderOptions = ReaderOptions{
205 , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
204 , readerOldDashes :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
206 -- in parsing dashes; -- is em-dash;
205 -- in parsing dashes; -- is em-dash;
207 -- - before numerial is en-dash
206 -- - before numerial is en-dash
208− , readerReferences :: [CSL.Reference] -- ^ Bibliographic references
209− , readerCitationStyle :: Maybe CSL.Style -- ^ Citation style
210 , readerApplyMacros :: Bool -- ^ Apply macros to TeX math
207 , readerApplyMacros :: Bool -- ^ Apply macros to TeX math
211 , readerIndentedCodeClasses :: [String] -- ^ Default classes for
208 , readerIndentedCodeClasses :: [String] -- ^ Default classes for
212 -- indented code blocks
209 -- indented code blocks
@@ -223,8 +220,6 @@ instance Default ReaderOptions
223 , readerColumns = 80
220 , readerColumns = 80
224 , readerTabStop = 4
221 , readerTabStop = 4
225 , readerOldDashes = False
222 , readerOldDashes = False
226− , readerReferences = []
227− , readerCitationStyle = Nothing
228 , readerApplyMacros = True
223 , readerApplyMacros = True
229 , readerIndentedCodeClasses = []
224 , readerIndentedCodeClasses = []
230 , readerDefaultImageExtension = ""
225 , readerDefaultImageExtension = ""
@@ -289,7 +284,6 @@ data WriterOptions = WriterOptions
289 , writerSourceURL :: Maybe String -- ^ Absolute URL + directory of 1st source file
284 , writerSourceURL :: Maybe String -- ^ Absolute URL + directory of 1st source file
290 , writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory
285 , writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory
291 , writerCiteMethod :: CiteMethod -- ^ How to print cites
286 , writerCiteMethod :: CiteMethod -- ^ How to print cites
292− , writerBiblioFiles :: [FilePath] -- ^ Biblio files to use for citations
293 , writerHtml5 :: Bool -- ^ Produce HTML5
287 , writerHtml5 :: Bool -- ^ Produce HTML5
294 , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
288 , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
295 , writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show
289 , writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show
@@ -332,7 +326,6 @@ instance Default WriterOptions where
332 , writerSourceURL = Nothing
326 , writerSourceURL = Nothing
333 , writerUserDataDir = Nothing
327 , writerUserDataDir = Nothing
334 , writerCiteMethod = Citeproc
328 , writerCiteMethod = Citeproc
335− , writerBiblioFiles = []
336 , writerHtml5 = False
329 , writerHtml5 = False
337 , writerHtmlQTags = False
330 , writerHtmlQTags = False
338 , writerBeamer = False
331 , writerBeamer = False
src/Text/Pandoc/Readers/LaTeX.hs+3−5
@@ -38,7 +38,6 @@ import Text.Pandoc.Definition
38import Text.Pandoc.Walk
38import Text.Pandoc.Walk
39import Text.Pandoc.Shared
39import Text.Pandoc.Shared
40import Text.Pandoc.Options
40import Text.Pandoc.Options
41−import Text.Pandoc.Biblio (processBiblio)
42import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
41import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
43import qualified Text.Pandoc.UTF8 as UTF8
42import qualified Text.Pandoc.UTF8 as UTF8
44import Data.Char ( chr, ord )
43import Data.Char ( chr, ord )
@@ -47,6 +46,7 @@ import Text.Pandoc.Builder
47import Data.Char (isLetter)
46import Data.Char (isLetter)
48import Control.Applicative
47import Control.Applicative
49import Data.Monoid
48import Data.Monoid
49+import Data.Maybe (fromMaybe)
50import System.Environment (getEnv)
50import System.Environment (getEnv)
51import System.FilePath (replaceExtension, (</>))
51import System.FilePath (replaceExtension, (</>))
52import Data.List (intercalate, intersperse)
52import Data.List (intercalate, intersperse)
@@ -67,9 +67,7 @@ parseLaTeX = do
67 eof
67 eof
68 st <- getState
68 st <- getState
69 let meta = stateMeta st
69 let meta = stateMeta st
70− refs <- getOption readerReferences
71− mbsty <- getOption readerCitationStyle
72− let (Pandoc _ bs') = processBiblio mbsty refs $ doc bs
70+ let (Pandoc _ bs') = doc bs
73 return $ Pandoc meta bs'
71 return $ Pandoc meta bs'
74
72
75type LP = Parser [Char] ParserState
73type LP = Parser [Char] ParserState
@@ -903,7 +901,7 @@ environments = M.fromList
903 lookup "numbers" options == Just "left" ]
901 lookup "numbers" options == Just "left" ]
904 ++ maybe [] (:[]) (lookup "language" options
902 ++ maybe [] (:[]) (lookup "language" options
905 >>= fromListingsLanguage)
903 >>= fromListingsLanguage)
906− let attr = ("",classes,kvs)
904+ let attr = (fromMaybe "" (lookup "label" options),classes,kvs)
907 codeBlockWith attr <$> (verbEnv "lstlisting"))
905 codeBlockWith attr <$> (verbEnv "lstlisting"))
908 , ("minted", do options <- option [] keyvals
906 , ("minted", do options <- option [] keyvals
909 lang <- grouped (many1 $ satisfy (/='}'))
907 lang <- grouped (many1 $ satisfy (/='}'))
src/Text/Pandoc/Readers/Markdown.hs+1−4
@@ -54,7 +54,6 @@ import Text.Pandoc.Parsing hiding (tableWith)
54import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
54import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
55import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
55import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
56 isTextTag, isCommentTag )
56 isTextTag, isCommentTag )
57−import Text.Pandoc.Biblio (processBiblio)
58import Data.Monoid (mconcat, mempty)
57import Data.Monoid (mconcat, mempty)
59import Control.Applicative ((<$>), (<*), (*>), (<$))
58import Control.Applicative ((<$>), (<*), (*>), (<$))
60import Control.Monad
59import Control.Monad
@@ -327,9 +326,7 @@ parseMarkdown = do
327 st <- getState
326 st <- getState
328 let meta = runF (stateMeta' st) st
327 let meta = runF (stateMeta' st) st
329 let Pandoc _ bs = B.doc $ runF blocks st
328 let Pandoc _ bs = B.doc $ runF blocks st
330− mbsty <- getOption readerCitationStyle
331− refs <- getOption readerReferences
332− return $ processBiblio mbsty refs $ Pandoc meta bs
329+ return $ Pandoc meta bs
333
330
334addWarning :: Maybe SourcePos -> String -> MarkdownParser ()
331addWarning :: Maybe SourcePos -> String -> MarkdownParser ()
335addWarning mbpos msg =
332addWarning mbpos msg =
src/Text/Pandoc/Readers/TeXMath.hs+2−82
@@ -30,93 +30,13 @@ Conversion of TeX math to a list of 'Pandoc' inline elements.
30module Text.Pandoc.Readers.TeXMath ( readTeXMath ) where
30module Text.Pandoc.Readers.TeXMath ( readTeXMath ) where
31
31
32import Text.Pandoc.Definition
32import Text.Pandoc.Definition
33−import Text.TeXMath.Types
33+import Text.TeXMath
34−import Text.TeXMath.Parser
35
34
36-- | Converts a raw TeX math formula to a list of 'Pandoc' inlines.
35-- | Converts a raw TeX math formula to a list of 'Pandoc' inlines.
37-- Defaults to raw formula between @$@ characters if entire formula
36-- Defaults to raw formula between @$@ characters if entire formula
38-- can't be converted.
37-- can't be converted.
39readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
38readTeXMath :: String -- ^ String to parse (assumes @'\n'@ line endings)
40 -> [Inline]
39 -> [Inline]
41−readTeXMath inp = case texMathToPandoc inp of
40+readTeXMath inp = case texMathToPandoc DisplayInline inp of
42 Left _ -> [Str ("$" ++ inp ++ "$")]
41 Left _ -> [Str ("$" ++ inp ++ "$")]
43 Right res -> res
42 Right res -> res
44−
45−texMathToPandoc :: String -> Either String [Inline]
46−texMathToPandoc inp = inp `seq`
47− case parseFormula inp of
48− Left err -> Left err
49− Right exps -> case expsToInlines exps of
50− Nothing -> Left "Formula too complex for [Inline]"
51− Just r -> Right r
52−
53−expsToInlines :: [Exp] -> Maybe [Inline]
54−expsToInlines xs = do
55− res <- mapM expToInlines xs
56− return (concat res)
57−
58−expToInlines :: Exp -> Maybe [Inline]
59−expToInlines (ENumber s) = Just [Str s]
60−expToInlines (EIdentifier s) = Just [Emph [Str s]]
61−expToInlines (EMathOperator s) = Just [Str s]
62−expToInlines (ESymbol t s) = Just $ addSpace t (Str s)
63− where addSpace Op x = [x, thinspace]
64− addSpace Bin x = [medspace, x, medspace]
65− addSpace Rel x = [widespace, x, widespace]
66− addSpace Pun x = [x, thinspace]
67− addSpace _ x = [x]
68− thinspace = Str "\x2006"
69− medspace = Str "\x2005"
70− widespace = Str "\x2004"
71−expToInlines (EStretchy x) = expToInlines x
72−expToInlines (EDelimited start end xs) = do
73− xs' <- mapM expToInlines xs
74− return $ [Str start] ++ concat xs' ++ [Str end]
75−expToInlines (EGrouped xs) = expsToInlines xs
76−expToInlines (ESpace "0.167em") = Just [Str "\x2009"]
77−expToInlines (ESpace "0.222em") = Just [Str "\x2005"]
78−expToInlines (ESpace "0.278em") = Just [Str "\x2004"]
79−expToInlines (ESpace "0.333em") = Just [Str "\x2004"]
80−expToInlines (ESpace "1em") = Just [Str "\x2001"]
81−expToInlines (ESpace "2em") = Just [Str "\x2001\x2001"]
82−expToInlines (ESpace _) = Just [Str " "]
83−expToInlines (EBinary _ _ _) = Nothing
84−expToInlines (ESub x y) = do
85− x' <- expToInlines x
86− y' <- expToInlines y
87− return $ x' ++ [Subscript y']
88−expToInlines (ESuper x y) = do
89− x' <- expToInlines x
90− y' <- expToInlines y
91− return $ x' ++ [Superscript y']
92−expToInlines (ESubsup x y z) = do
93− x' <- expToInlines x
94− y' <- expToInlines y
95− z' <- expToInlines z
96− return $ x' ++ [Subscript y'] ++ [Superscript z']
97−expToInlines (EDown x y) = expToInlines (ESub x y)
98−expToInlines (EUp x y) = expToInlines (ESuper x y)
99−expToInlines (EDownup x y z) = expToInlines (ESubsup x y z)
100−expToInlines (EText TextNormal x) = Just [Str x]
101−expToInlines (EText TextBold x) = Just [Strong [Str x]]
102−expToInlines (EText TextMonospace x) = Just [Code nullAttr x]
103−expToInlines (EText TextItalic x) = Just [Emph [Str x]]
104−expToInlines (EText _ x) = Just [Str x]
105−expToInlines (EOver (EGrouped [EIdentifier [c]]) (ESymbol Accent [accent])) =
106− case accent of
107− '\x203E' -> Just [Emph [Str [c,'\x0304']]] -- bar
108− '\x00B4' -> Just [Emph [Str [c,'\x0301']]] -- acute
109− '\x0060' -> Just [Emph [Str [c,'\x0300']]] -- grave
110− '\x02D8' -> Just [Emph [Str [c,'\x0306']]] -- breve
111− '\x02C7' -> Just [Emph [Str [c,'\x030C']]] -- check
112− '.' -> Just [Emph [Str [c,'\x0307']]] -- dot
113− '\x00B0' -> Just [Emph [Str [c,'\x030A']]] -- ring
114− '\x20D7' -> Just [Emph [Str [c,'\x20D7']]] -- arrow right
115− '\x20D6' -> Just [Emph [Str [c,'\x20D6']]] -- arrow left
116− '\x005E' -> Just [Emph [Str [c,'\x0302']]] -- hat
117− '\x0302' -> Just [Emph [Str [c,'\x0302']]] -- hat
118− '~' -> Just [Emph [Str [c,'\x0303']]] -- tilde
119− _ -> Nothing
120−expToInlines _ = Nothing
121−
122−
src/Text/Pandoc/Writers/LaTeX.hs+8−8
@@ -43,7 +43,6 @@ import Data.Char ( toLower, isPunctuation )
43import Control.Applicative ((<|>))
43import Control.Applicative ((<|>))
44import Control.Monad.State
44import Control.Monad.State
45import Text.Pandoc.Pretty
45import Text.Pandoc.Pretty
46−import System.FilePath (dropExtension)
47import Text.Pandoc.Slides
46import Text.Pandoc.Slides
48import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
47import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
49 formatLaTeXInline, formatLaTeXBlock,
48 formatLaTeXInline, formatLaTeXBlock,
@@ -120,7 +119,6 @@ pandocToLaTeX options (Pandoc meta blocks) = do
120 (biblioTitle :: String) <- liftM (render colwidth) $ inlineListToLaTeX lastHeader
119 (biblioTitle :: String) <- liftM (render colwidth) $ inlineListToLaTeX lastHeader
121 let main = render colwidth $ vsep body
120 let main = render colwidth $ vsep body
122 st <- get
121 st <- get
123− let biblioFiles = intercalate "," $ map dropExtension $ writerBiblioFiles options
124 let context = defField "toc" (writerTableOfContents options) $
122 let context = defField "toc" (writerTableOfContents options) $
125 defField "toc-depth" (show (writerTOCDepth options -
123 defField "toc-depth" (show (writerTOCDepth options -
126 if writerChapters options
124 if writerChapters options
@@ -152,11 +150,9 @@ pandocToLaTeX options (Pandoc meta blocks) = do
152 $ writerHighlightStyle options )
150 $ writerHighlightStyle options )
153 else id) $
151 else id) $
154 (case writerCiteMethod options of
152 (case writerCiteMethod options of
155− Natbib -> defField "biblio-files" biblioFiles .
153+ Natbib -> defField "biblio-title" biblioTitle .
156− defField "biblio-title" biblioTitle .
157 defField "natbib" True
154 defField "natbib" True
158− Biblatex -> defField "biblio-files" biblioFiles .
155+ Biblatex -> defField "biblio-title" biblioTitle .
159− defField "biblio-title" biblioTitle .
160 defField "biblatex" True
156 defField "biblatex" True
161 _ -> id) $
157 _ -> id) $
162 metadata
158 metadata
@@ -313,7 +309,7 @@ blockToLaTeX (BlockQuote lst) = do
313 _ -> do
309 _ -> do
314 contents <- blockListToLaTeX lst
310 contents <- blockListToLaTeX lst
315 return $ "\\begin{quote}" $$ contents $$ "\\end{quote}"
311 return $ "\\begin{quote}" $$ contents $$ "\\end{quote}"
316−blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do
312+blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do
317 opts <- gets stOptions
313 opts <- gets stOptions
318 case () of
314 case () of
319 _ | isEnabled Ext_literate_haskell opts && "haskell" `elem` classes &&
315 _ | isEnabled Ext_literate_haskell opts && "haskell" `elem` classes &&
@@ -344,7 +340,11 @@ blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do
344 [ (if key == "startFrom"
340 [ (if key == "startFrom"
345 then "firstnumber"
341 then "firstnumber"
346 else key) ++ "=" ++ attr |
342 else key) ++ "=" ++ attr |
347− (key,attr) <- keyvalAttr ]
343+ (key,attr) <- keyvalAttr ] ++
344+ (if identifier == ""
345+ then []
346+ else [ "label=" ++ identifier ])
347+
348 else []
348 else []
349 printParams
349 printParams
350 | null params = empty
350 | null params = empty
tests/Tests/Old.hs+4−14
@@ -63,7 +63,10 @@ tests = [ testGroup "markdown"
63 "markdown-reader-more.txt" "markdown-reader-more.native"
63 "markdown-reader-more.txt" "markdown-reader-more.native"
64 , lhsReaderTest "markdown+lhs"
64 , lhsReaderTest "markdown+lhs"
65 ]
65 ]
66− , testGroup "citations" markdownCitationTests
66+ , testGroup "citations"
67+ [ test "citations" ["-r", "markdown", "-w", "native"]
68+ "markdown-citations.txt" "markdown-citations.native"
69+ ]
67 ]
70 ]
68 , testGroup "rst"
71 , testGroup "rst"
69 [ testGroup "writer" (writerTests "rst" ++ lhsWriterTests "rst")
72 [ testGroup "writer" (writerTests "rst" ++ lhsWriterTests "rst")
@@ -190,19 +193,6 @@ fb2WriterTest title opts inputfile normfile =
190 ignoreBinary = unlines . filter (not . startsWith "<binary ") . lines
193 ignoreBinary = unlines . filter (not . startsWith "<binary ") . lines
191 startsWith tag str = all (uncurry (==)) $ zip tag str
194 startsWith tag str = all (uncurry (==)) $ zip tag str
192
195
193−markdownCitationTests :: [Test]
194−markdownCitationTests
195− = map styleToTest ["chicago-author-date","ieee","mhra"]
196− ++ [test "natbib" wopts "markdown-citations.txt"
197− "markdown-citations.txt"]
198− where
199− ropts = ["-r", "markdown", "-w", "markdown-citations", "--bibliography",
200− "biblio.bib", "--no-wrap"]
201− wopts = ["-r", "markdown", "-w", "markdown", "--no-wrap", "--natbib"]
202− styleToTest style = test style (ropts ++ ["--csl", style ++ ".csl"])
203− "markdown-citations.txt"
204− ("markdown-citations." ++ style ++ ".txt")
205−
206-- | Run a test without normalize function, return True if test passed.
196-- | Run a test without normalize function, return True if test passed.
207test :: String -- ^ Title of test
197test :: String -- ^ Title of test
208 -> [String] -- ^ Options to pass to pandoc
198 -> [String] -- ^ Options to pass to pandoc
tests/Tests/Readers/LaTeX.hs+7
@@ -55,6 +55,13 @@ tests = [ testGroup "basic"
55 "hi % this is a comment\nthere\n" =?> para "hi there"
55 "hi % this is a comment\nthere\n" =?> para "hi there"
56 ]
56 ]
57
57
58+ , testGroup "code blocks"
59+ [ "identifier" =:
60+ "\\begin{lstlisting}[label=test]\\end{lstlisting}" =?> codeBlockWith ("test", [], [("label","test")]) ""
61+ , "no identifier" =:
62+ "\\begin{lstlisting}\\end{lstlisting}" =?> codeBlock ""
63+ ]
64+
58 , testGroup "citations"
65 , testGroup "citations"
59 [ natbibCitations
66 [ natbibCitations
60 , biblatexCitations
67 , biblatexCitations
tests/Tests/Writers/LaTeX.hs+7
@@ -10,6 +10,9 @@ import Tests.Arbitrary()
10latex :: (ToString a, ToPandoc a) => a -> String
10latex :: (ToString a, ToPandoc a) => a -> String
11latex = writeLaTeX def . toPandoc
11latex = writeLaTeX def . toPandoc
12
12
13+latexListing :: (ToString a, ToPandoc a) => a -> String
14+latexListing = writeLaTeX def{ writerListings = True } . toPandoc
15+
13{-
16{-
14 "my test" =: X =?> Y
17 "my test" =: X =?> Y
15
18
@@ -31,6 +34,10 @@ tests :: [Test]
31tests = [ testGroup "code blocks"
34tests = [ testGroup "code blocks"
32 [ "in footnotes" =: note (para "hi" <> codeBlock "hi") =?>
35 [ "in footnotes" =: note (para "hi" <> codeBlock "hi") =?>
33 "\\footnote{hi\n\n\\begin{Verbatim}\nhi\n\\end{Verbatim}\n}"
36 "\\footnote{hi\n\n\\begin{Verbatim}\nhi\n\\end{Verbatim}\n}"
37+ , test latexListing "identifier" $ codeBlockWith ("id",[],[]) "hi" =?>
38+ ("\\begin{lstlisting}[label=id]\nhi\n\\end{lstlisting}" :: String)
39+ , test latexListing "no identifier" $ codeBlock "hi" =?>
40+ ("\\begin{lstlisting}\nhi\n\\end{lstlisting}" :: String)
34 ]
41 ]
35 , testGroup "math"
42 , testGroup "math"
36 [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
43 [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>
tests/biblio.bibdeleted−26
@@ -1,26 +0,0 @@
1−@Book{item1,
2−author="John Doe",
3−title="First Book",
4−year="2005",
5−address="Cambridge",
6−publisher="Cambridge University Press"
7−}
8−
9−@Article{item2,
10−author="John Doe",
11−title="Article",
12−year="2006",
13−journal="Journal of Generic Studies",
14−volume="6",
15−pages="33-34"
16−}
17−
18−@InCollection{пункт3,
19−author="John Doe and Jenny Roe",
20−title="Why Water Is Wet",
21−booktitle="Third Book",
22−editor="Sam Smith",
23−publisher="Oxford University Press",
24−address="Oxford",
25−year="2007"
26−}
tests/chicago-author-date.csldeleted−458
@@ -1,458 +0,0 @@
1−<?xml version="1.0" encoding="utf-8"?>
2−<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
3− <info>
4− <title>Chicago Manual of Style (author-date)</title>
5− <id>http://www.zotero.org/styles/chicago-author-date</id>
6− <link href="http://www.zotero.org/styles/chicago-author-date" rel="self"/>
7− <link href="http://www.chicagomanualofstyle.org/tools_citationguide.html" rel="documentation"/>
8− <author>
9− <name>Julian Onions</name>
10− <email>julian.onions@gmail.com</email>
11− </author>
12− <contributor>
13− <name>Sebastian Karcher</name>
14− </contributor>
15− <contributor>
16− <name>Richard Karnesky</name>
17− <email>karnesky+zotero@gmail.com</email>
18− <uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri>
19− </contributor>
20− <category citation-format="author-date"/>
21− <category field="generic-base"/>
22− <summary>The author-date variant of the Chicago style</summary>
23− <updated>2013-03-28T05:37:10+00:00</updated>
24− <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
25− </info>
26− <locale>
27− <terms>
28− <term name="editor" form="verb-short">ed.</term>
29− <term name="container-author" form="verb">by</term>
30− <term name="translator" form="verb-short">trans.</term>
31− <term name="translator" form="short">trans.</term>
32− </terms>
33− </locale>
34− <macro name="secondary-contributors">
35− <choose>
36− <if type="chapter paper-conference" match="none">
37− <group delimiter=". ">
38− <names variable="editor translator">
39− <label form="verb" text-case="capitalize-first" suffix=" " plural="never"/>
40− <name and="text" delimiter=", "/>
41− </names>
42− </group>
43− </if>
44− </choose>
45− </macro>
46− <macro name="container-contributors">
47− <choose>
48− <if type="chapter paper-conference" match="any">
49− <group prefix=", " delimiter=", ">
50− <names variable="container-author editor" delimiter=", ">
51− <label form="verb" suffix=" " plural="never"/>
52− <name and="text" delimiter=", "/>
53− </names>
54− </group>
55− </if>
56− </choose>
57− </macro>
58− <macro name="editor">
59− <names variable="editor">
60− <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
61− <label form="short" prefix=", "/>
62− </names>
63− </macro>
64− <macro name="translator">
65− <names variable="translator">
66− <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
67− <label form="short" prefix=", " plural="never"/>
68− </names>
69− </macro>
70− <macro name="recipient">
71− <choose>
72− <if type="personal_communication">
73− <choose>
74− <if variable="genre">
75− <text variable="genre" text-case="capitalize-first"/>
76− </if>
77− <else>
78− <text term="letter" text-case="capitalize-first"/>
79− </else>
80− </choose>
81− </if>
82− </choose>
83− <names variable="recipient" delimiter=", ">
84− <label form="verb" prefix=" " text-case="lowercase" suffix=" "/>
85− <name and="text" delimiter=", "/>
86− </names>
87− </macro>
88− <macro name="contributors">
89− <names variable="author">
90− <name and="text" name-as-sort-order="first" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
91− <label form="short" plural="never" prefix=", "/>
92− <substitute>
93− <names variable="editor"/>
94− <names variable="translator"/>
95− <text macro="title"/>
96− </substitute>
97− </names>
98− <text macro="recipient"/>
99− </macro>
100− <macro name="contributors-short">
101− <names variable="author">
102− <name form="short" and="text" delimiter=", " initialize-with=". "/>
103− <substitute>
104− <names variable="editor"/>
105− <names variable="translator"/>
106− <text macro="title"/>
107− </substitute>
108− </names>
109− </macro>
110− <macro name="interviewer">
111− <names variable="interviewer" delimiter=", ">
112− <label form="verb" prefix=" " text-case="capitalize-first" suffix=" "/>
113− <name and="text" delimiter=", "/>
114− </names>
115− </macro>
116− <macro name="archive">
117− <group delimiter=". ">
118− <text variable="archive_location" text-case="capitalize-first"/>
119− <text variable="archive"/>
120− <text variable="archive-place"/>
121− </group>
122− </macro>
123− <macro name="access">
124− <group delimiter=". ">
125− <choose>
126− <if type="graphic report" match="any">
127− <text macro="archive"/>
128− </if>
129− <else-if type="article-magazine article-newspaper bill book chapter graphic legal_case legislation motion_picture paper-conference report song thesis" match="none">
130− <text macro="archive"/>
131− </else-if>
132− </choose>
133− <text variable="DOI" prefix="doi:"/>
134− <choose>
135− <if variable="DOI issued" match="none">
136− <choose>
137− <if variable="URL accessed" match="all">
138− <group delimiter=" ">
139− <text term="accessed" text-case="capitalize-first"/>
140− <date variable="accessed" delimiter=" ">
141− <date-part name="month"/>
142− <date-part name="day"/>
143− </date>
144− </group>
145− </if>
146− </choose>
147− </if>
148− <else-if type="webpage">
149− <date variable="issued" delimiter=" ">
150− <date-part name="month"/>
151− <date-part name="day"/>
152− </date>
153− </else-if>
154− </choose>
155− <choose>
156− <if type="legal_case" match="none">
157− <text variable="URL"/>
158− </if>
159− </choose>
160− </group>
161− </macro>
162− <macro name="title">
163− <choose>
164− <if variable="title" match="none">
165− <choose>
166− <if type="personal_communication" match="none">
167− <text variable="genre" text-case="capitalize-first"/>
168− </if>
169− </choose>
170− </if>
171− <else-if type="bill book graphic legal_case legislation motion_picture song" match="any">
172− <text variable="title" text-case="title" font-style="italic"/>
173− </else-if>
174− <else>
175− <text variable="title" text-case="title" quotes="true"/>
176− </else>
177− </choose>
178− </macro>
179− <macro name="edition">
180− <choose>
181− <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
182− <choose>
183− <if is-numeric="edition">
184− <group delimiter=" " prefix=". ">
185− <number variable="edition" form="ordinal"/>
186− <text term="edition" form="short" strip-periods="true"/>
187− </group>
188− </if>
189− <else>
190− <text variable="edition" prefix=". "/>
191− </else>
192− </choose>
193− </if>
194− <else-if type="chapter paper-conference" match="any">
195− <choose>
196− <if is-numeric="edition">
197− <group delimiter=" " prefix=", ">
198− <number variable="edition" form="ordinal"/>
199− <text term="edition" form="short"/>
200− </group>
201− </if>
202− <else>
203− <text variable="edition" prefix=", "/>
204− </else>
205− </choose>
206− </else-if>
207− </choose>
208− </macro>
209− <macro name="locators">
210− <choose>
211− <if type="article-journal">
212− <text variable="volume" prefix=" "/>
213− <text variable="issue" prefix=" (" suffix=")"/>
214− </if>
215− <else-if type="legal_case">
216− <text variable="volume" prefix=", "/>
217− <text variable="container-title" prefix=" "/>
218− <text variable="page" prefix=" "/>
219− </else-if>
220− <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
221− <group prefix=". " delimiter=". ">
222− <group>
223− <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
224− <number variable="volume" form="numeric"/>
225− </group>
226− <group>
227− <number variable="number-of-volumes" form="numeric"/>
228− <text term="volume" form="short" prefix=" " plural="true"/>
229− </group>
230− </group>
231− </else-if>
232− <else-if type="chapter paper-conference" match="any">
233− <choose>
234− <if variable="page" match="none">
235− <group prefix=". ">
236− <text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
237− <number variable="volume" form="numeric"/>
238− </group>
239− </if>
240− </choose>
241− </else-if>
242− </choose>
243− </macro>
244− <macro name="locators-chapter">
245− <choose>
246− <if type="chapter paper-conference" match="any">
247− <choose>
248− <if variable="page">
249− <group prefix=", ">
250− <text variable="volume" suffix=":"/>
251− <text variable="page"/>
252− </group>
253− </if>
254− </choose>
255− </if>
256− </choose>
257− </macro>
258− <macro name="locators-article">
259− <choose>
260− <if type="article-newspaper">
261− <group prefix=", " delimiter=", ">
262− <group>
263− <text variable="edition" suffix=" "/>
264− <text term="edition" prefix=" "/>
265− </group>
266− <group>
267− <text term="section" form="short" suffix=" "/>
268− <text variable="section"/>
269− </group>
270− </group>
271− </if>
272− <else-if type="article-journal">
273− <text variable="page" prefix=": "/>
274− </else-if>
275− </choose>
276− </macro>
277− <macro name="point-locators">
278− <choose>
279− <if variable="locator">
280− <choose>
281− <if locator="page" match="none">
282− <choose>
283− <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
284− <choose>
285− <if variable="volume">
286− <group>
287− <text term="volume" form="short" suffix=" "/>
288− <number variable="volume" form="numeric"/>
289− <label variable="locator" form="short" prefix=", " suffix=" "/>
290− </group>
291− </if>
292− <else>
293− <label variable="locator" form="short" suffix=" "/>
294− </else>
295− </choose>
296− </if>
297− <else>
298− <label variable="locator" form="short" suffix=" "/>
299− </else>
300− </choose>
301− </if>
302− <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any">
303− <number variable="volume" form="numeric" suffix=":"/>
304− </else-if>
305− </choose>
306− <text variable="locator"/>
307− </if>
308− </choose>
309− </macro>
310− <macro name="container-prefix">
311− <text term="in" text-case="capitalize-first"/>
312− </macro>
313− <macro name="container-title">
314− <choose>
315− <if type="chapter paper-conference" match="any">
316− <text macro="container-prefix" suffix=" "/>
317− </if>
318− </choose>
319− <choose>
320− <if type="legal_case" match="none">
321− <text variable="container-title" text-case="title" font-style="italic"/>
322− </if>
323− </choose>
324− </macro>
325− <macro name="publisher">
326− <group delimiter=": ">
327− <text variable="publisher-place"/>
328− <text variable="publisher"/>
329− </group>
330− </macro>
331− <macro name="date">
332− <choose>
333− <if variable="issued">
334− <date variable="issued">
335− <date-part name="year"/>
336− </date>
337− </if>
338− <else-if variable="accessed">
339− <date variable="accessed">
340− <date-part name="year"/>
341− </date>
342− </else-if>
343− </choose>
344− </macro>
345− <macro name="day-month">
346− <date variable="issued">
347− <date-part name="month"/>
348− <date-part name="day" prefix=" "/>
349− </date>
350− </macro>
351− <macro name="collection-title">
352− <text variable="collection-title" text-case="title"/>
353− <text variable="collection-number" prefix=" "/>
354− </macro>
355− <macro name="event">
356− <group>
357− <text term="presented at" suffix=" "/>
358− <text variable="event"/>
359− </group>
360− </macro>
361− <macro name="description">
362− <choose>
363− <if type="interview">
364− <group delimiter=". ">
365− <text macro="interviewer"/>
366− <text variable="medium" text-case="capitalize-first"/>
367− </group>
368− </if>
369− <else>
370− <text variable="medium" text-case="capitalize-first" prefix=". "/>
371− </else>
372− </choose>
373− <choose>
374− <if variable="title" match="none"/>
375− <else-if type="thesis"/>
376− <else>
377− <group delimiter=" " prefix=". ">
378− <text variable="genre" text-case="capitalize-first"/>
379− <choose>
380− <if type="report">
381− <text variable="number"/>
382− </if>
383− </choose>
384− </group>
385− </else>
386− </choose>
387− <!--This is for computer programs only. Localization new to 1.0.1, so may be missing in many locales-->
388− <group delimiter=" " prefix=" (" suffix=")">
389− <text term="version"/>
390− <text variable="version"/>
391− </group>
392− </macro>
393− <macro name="issue">
394− <choose>
395− <if type="article-journal">
396− <text macro="day-month" prefix=" (" suffix=")"/>
397− </if>
398− <else-if type="legal_case">
399− <text variable="authority" prefix=". "/>
400− </else-if>
401− <else-if type="speech">
402− <group prefix=" " delimiter=", ">
403− <text macro="event"/>
404− <text macro="day-month"/>
405− <text variable="event-place"/>
406− </group>
407− </else-if>
408− <else-if type="article-newspaper article-magazine" match="any">
409− <text macro="day-month" prefix=", "/>
410− </else-if>
411− <else>
412− <group prefix=". " delimiter=", ">
413− <choose>
414− <if type="thesis">
415− <text variable="genre" text-case="capitalize-first"/>
416− </if>
417− </choose>
418− <text macro="publisher"/>
419− </group>
420− </else>
421− </choose>
422− </macro>
423− <citation et-al-min="4" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" givenname-disambiguation-rule="primary-name">
424− <layout prefix="(" suffix=")" delimiter="; ">
425− <group delimiter=", ">
426− <group delimiter=" ">
427− <text macro="contributors-short"/>
428− <text macro="date"/>
429− </group>
430− <text macro="point-locators"/>
431− </group>
432− </layout>
433− </citation>
434− <bibliography hanging-indent="true" et-al-min="11" et-al-use-first="7" subsequent-author-substitute="&#8212;&#8212;&#8212;" entry-spacing="0">
435− <sort>
436− <key macro="contributors"/>
437− <key variable="issued"/>
438− </sort>
439− <layout suffix=".">
440− <group delimiter=". ">
441− <text macro="contributors"/>
442− <text macro="date"/>
443− <text macro="title"/>
444− </group>
445− <text macro="description"/>
446− <text macro="secondary-contributors" prefix=". "/>
447− <text macro="container-title" prefix=". "/>
448− <text macro="container-contributors"/>
449− <text macro="edition"/>
450− <text macro="locators-chapter"/>
451− <text macro="locators"/>
452− <text macro="collection-title" prefix=". "/>
453− <text macro="issue"/>
454− <text macro="locators-article"/>
455− <text macro="access" prefix=". "/>
456− </layout>
457− </bibliography>
458−</style>
tests/ieee.csldeleted−302
@@ -1,302 +0,0 @@
1−<?xml version="1.0" encoding="utf-8"?>
2−<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
3− <info>
4− <title>IEEE</title>
5− <id>http://www.zotero.org/styles/ieee</id>
6− <link href="http://www.zotero.org/styles/ieee" rel="self"/>
7− <author>
8− <name>Michael Berkowitz</name>
9− <email>mberkowi@gmu.edu</email>
10− </author>
11− <contributor>
12− <name>Julian Onions</name>
13− <email>julian.onions@gmail.com</email>
14− </contributor>
15− <contributor>
16− <name>Rintze Zelle</name>
17− <uri>http://twitter.com/rintzezelle</uri>
18− </contributor>
19− <contributor>
20− <name>Stephen Frank</name>
21− <uri>http://www.zotero.org/sfrank</uri>
22− </contributor>
23− <contributor>
24− <name>Sebastian Karcher</name>
25− </contributor>
26− <category field="engineering"/>
27− <category field="generic-base"/>
28− <category citation-format="numeric"/>
29− <updated>2011-09-15T07:01:02+00:00</updated>
30− <rights>
31− This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License:
32− http://creativecommons.org/licenses/by-sa/3.0/
33− </rights>
34− <link href="http://www.ieee.org/portal/cms_docs_iportals/iportals/publications/authors/transjnl/stylemanual.pdf" rel="documentation"/>
35− <link href="http://www.ieee.org/documents/auinfo07.pdf" rel="documentation"/>
36− </info>
37− <!-- Macros -->
38− <macro name="edition">
39− <choose>
40− <if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
41− <choose>
42− <if is-numeric="edition">
43− <group delimiter=" ">
44− <number variable="edition" form="ordinal"/>
45− <text term="edition" form="short" suffix="." strip-periods="true"/>
46− </group>
47− </if>
48− <else>
49− <text variable="edition" text-case="capitalize-first" suffix="."/>
50− </else>
51− </choose>
52− </if>
53− </choose>
54− </macro>
55− <macro name="issued">
56− <choose>
57− <if type="article-journal report" match="any">
58− <date variable="issued">
59− <date-part name="month" form="short" suffix=" "/>
60− <date-part name="year" form="long"/>
61− </date>
62− </if>
63− <else-if type="bill book graphic legal_case motion_picture song thesis chapter paper-conference" match="any">
64− <date variable="issued">
65− <date-part name="year" form="long"/>
66− </date>
67− </else-if>
68− <else>
69− <date variable="issued">
70− <date-part name="day" form="numeric-leading-zeros" suffix="-"/>
71− <date-part name="month" form="short" suffix="-" strip-periods="true"/>
72− <date-part name="year" form="long"/>
73− </date>
74− </else>
75− </choose>
76− </macro>
77− <macro name="author">
78− <names variable="author">
79− <name initialize-with=". " delimiter=", " and="text"/>
80− <label form="short" prefix=", " text-case="capitalize-first" suffix="." strip-periods="true"/>
81− <substitute>
82− <names variable="editor"/>
83− <names variable="translator"/>
84− </substitute>
85− </names>
86− </macro>
87− <macro name="editor">
88− <names variable="editor">
89− <name initialize-with=". " delimiter=", " and="text"/>
90− <label form="short" prefix=", " text-case="capitalize-first" suffix="." strip-periods="true"/>
91− </names>
92− </macro>
93− <macro name="locators">
94− <group delimiter=", ">
95− <text macro="edition"/>
96− <group delimiter=" ">
97− <text term="volume" form="short" suffix="." strip-periods="true"/>
98− <number variable="volume" form="numeric"/>
99− </group>
100− <group delimiter=" ">
101− <number variable="number-of-volumes" form="numeric"/>
102− <text term="volume" form="short" suffix="." plural="true" strip-periods="true"/>
103− </group>
104− <group delimiter=" ">
105− <text term="issue" form="short" suffix="." strip-periods="true"/>
106− <number variable="issue" form="numeric"/>
107− </group>
108− </group>
109− </macro>
110− <macro name="title">
111− <choose>
112− <if type="bill book graphic legal_case motion_picture song" match="any">
113− <text variable="title" font-style="italic"/>
114− </if>
115− <else>
116− <text variable="title" quotes="true"/>
117− </else>
118− </choose>
119− </macro>
120− <macro name="publisher">
121− <choose>
122− <if type="bill book graphic legal_case motion_picture song chapter paper-conference" match="any">
123− <text variable="publisher-place" suffix=": "/>
124− <text variable="publisher"/>
125− </if>
126− <else>
127− <group delimiter=", ">
128− <text variable="publisher"/>
129− <text variable="publisher-place"/>
130− </group>
131− </else>
132− </choose>
133− </macro>
134− <macro name="event">
135− <choose>
136− <if type="paper-conference">
137− <choose>
138− <!-- Published Conference Paper -->
139− <if variable="container-title">
140− <group delimiter=", ">
141− <text variable="container-title" prefix="in " font-style="italic"/>
142− <text variable="event-place"/>
143− </group>
144− </if>
145− <!-- Unpublished Conference Paper -->
146− <else>
147− <group delimiter=", ">
148− <text variable="event" prefix="presented at the "/>
149− <text variable="event-place"/>
150− </group>
151− </else>
152− </choose>
153− </if>
154− </choose>
155− </macro>
156− <macro name="access">
157− <choose>
158− <if type="webpage">
159− <choose>
160− <if variable="URL">
161− <group delimiter=". ">
162− <text value="[Online]"/>
163− <text variable="URL" prefix="Available: "/>
164− <group prefix="[" suffix="]">
165− <date variable="accessed" prefix="Accessed: ">
166− <date-part name="day" form="numeric-leading-zeros" suffix="-"/>
167− <date-part name="month" form="short" suffix="-" strip-periods="true"/>
168− <date-part name="year" form="long"/>
169− </date>
170− </group>
171− </group>
172− </if>
173− </choose>
174− </if>
175− </choose>
176− </macro>
177− <macro name="page">
178− <group>
179− <label variable="page" form="short" suffix=". " strip-periods="true"/>
180− <text variable="page"/>
181− </group>
182− </macro>
183− <!-- Citation -->
184− <citation collapse="citation-number">
185− <sort>
186− <key variable="citation-number"/>
187− </sort>
188− <layout prefix="[" suffix="]" delimiter="], [">
189− <text variable="citation-number"/>
190− </layout>
191− </citation>
192− <!-- Bibliography -->
193− <bibliography entry-spacing="0" second-field-align="flush">
194− <layout suffix=".">
195− <!-- Citation Number -->
196− <text variable="citation-number" prefix="[" suffix="]"/>
197− <!-- Author(s) -->
198− <text macro="author" prefix=" " suffix=", "/>
199− <!-- Rest of Citation -->
200− <choose>
201− <!-- Specific Formats -->
202− <if type="article-journal">
203− <group delimiter=", ">
204− <text macro="title"/>
205− <text variable="container-title" font-style="italic" form="short"/>
206− <text macro="locators"/>
207− <text macro="page"/>
208− <text macro="issued"/>
209− </group>
210− </if>
211− <else-if type="paper-conference">
212− <group delimiter=", ">
213− <text macro="title"/>
214− <text macro="event"/>
215− <text macro="issued"/>
216− <text macro="locators"/>
217− <text macro="page"/>
218− </group>
219− </else-if>
220− <else-if type="report">
221− <group delimiter=", ">
222− <text macro="title"/>
223− <text macro="publisher"/>
224− <group delimiter=" ">
225− <text variable="genre"/>
226− <text variable="number"/>
227− </group>
228− <text macro="issued"/>
229− </group>
230− </else-if>
231− <else-if type="thesis">
232− <group delimiter=", ">
233− <text macro="title"/>
234− <text variable="genre"/>
235− <text macro="publisher"/>
236− <text macro="issued"/>
237− </group>
238− </else-if>
239− <else-if type="webpage">
240− <group delimiter=", " suffix=". ">
241− <text macro="title"/>
242− <text variable="container-title" font-style="italic"/>
243− <text macro="issued"/>
244− </group>
245− <text macro="access"/>
246− </else-if>
247− <else-if type="patent">
248− <text macro="title" suffix=", "/>
249− <text variable="number" prefix="U.S. Patent "/>
250− <text macro="issued"/>
251− </else-if>
252− <!-- Generic/Fallback Formats -->
253− <else-if type="bill book graphic legal_case motion_picture report song" match="any">
254− <group delimiter=", " suffix=". ">
255− <text macro="title"/>
256− <text macro="locators"/>
257− </group>
258− <group delimiter=", ">
259− <text macro="publisher"/>
260− <text macro="issued"/>
261− <text macro="page"/>
262− </group>
263− </else-if>
264− <else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any">
265− <group delimiter=", ">
266− <text macro="title"/>
267− <text variable="container-title" font-style="italic"/>
268− <text macro="locators"/>
269− <text macro="publisher"/>
270− <text macro="page"/>
271− <text macro="issued"/>
272− </group>
273− </else-if>
274− <else-if type="chapter paper-conference" match="any">
275− <group delimiter=", " suffix=", ">
276− <text macro="title"/>
277− <text variable="container-title" prefix="in " font-style="italic"/>
278− <text macro="locators"/>
279− </group>
280− <text macro="editor" suffix=" "/>
281− <group delimiter=", ">
282− <text macro="publisher"/>
283− <text macro="issued"/>
284− <text macro="page"/>
285− </group>
286− </else-if>
287− <else>
288− <group delimiter=", " suffix=". ">
289− <text macro="title"/>
290− <text variable="container-title" font-style="italic"/>
291− <text macro="locators"/>
292− </group>
293− <group delimiter=", ">
294− <text macro="publisher"/>
295− <text macro="page"/>
296− <text macro="issued"/>
297− </group>
298− </else>
299− </choose>
300− </layout>
301− </bibliography>
302−</style>
tests/markdown-citations.chicago-author-date.txtdeleted−51
@@ -1,51 +0,0 @@
1−Pandoc with citeproc-hs
2−=======================
3−
4−- ([CSL BIBLIOGRAPHIC DATA ERROR: reference "nonexistent" not found.])
5−
6−- ([CSL BIBLIOGRAPHIC DATA ERROR: reference "nonexistent" not found.])
7−
8−- Doe (2005) says blah.
9−
10−- Doe (2005, 30) says blah.
11−
12−- Doe (2005, 30, with suffix) says blah.
13−
14−- Doe (2005; 2006, 30; see also Doe and Roe 2007) says blah.
15−
16−- In a note.[^1]
17−
18−- A citation group (see Doe 2005, chap. 3; also Doe and Roe 2007, 34–35).
19−
20−- Another one (see Doe 2005, 34–35).
21−
22−- And another one in a note.[^2]
23−
24−- Citation with a suffix and locator (Doe 2005, 33, 35–37, and nowhere else).
25−
26−- Citation with suffix only (Doe 2005 and nowhere else).
27−
28−- Now some modifiers.[^3]
29−
30−- With some markup (*see* Doe 2005, 32).
31−
32−<div class="references">
33−
34−References
35−==========
36−
37−“Nonexistent Not Found!”
38−
39−Doe, John. 2005. *First Book*. Cambridge: Cambridge University Press.
40−
41−———. 2006. “Article.” *Journal of Generic Studies* 6: 33–34.
42−
43−Doe, John, and Jenny Roe. 2007. “Why Water Is Wet.” In *Third Book*, edited by Sam Smith. Oxford: Oxford University Press.
44−
45−</div>
46−
47−[^1]: Doe and Roe (2007, 12) and a citation without locators (Doe and Roe 2007).
48−
49−[^2]: Some citations (see Doe 2005, chap. 3; Doe and Roe 2007; Doe 2006).
50−
51−[^3]: Like a citation without author: (2005), and now Doe with a locator (2006, 44).
tests/markdown-citations.ieee.txtdeleted−51
@@ -1,51 +0,0 @@
1−Pandoc with citeproc-hs
2−=======================
3−
4−- []
5−
6−-
7−
8−- Reference 2 says blah.
9−
10−- Reference 2 says blah.
11−
12−- Reference 2 says blah.
13−
14−- Reference 2 [4] says blah.
15−
16−- In a note.[^1]
17−
18−- A citation group [2], [4].
19−
20−- Another one [2].
21−
22−- And another one in a note.[^2]
23−
24−- Citation with a suffix and locator [2].
25−
26−- Citation with suffix only [2].
27−
28−- Now some modifiers.[^3]
29−
30−- With some markup [2].
31−
32−<div class="references">
33−
34−References
35−==========
36−
37−[1]“nonexistent not found!” .
38−
39−[2] J. Doe, *First Book*. Cambridge: Cambridge University Press, 2005.
40−
41−[3] J. Doe, “Article,” *Journal of Generic Studies*, vol. 6, pp. 33–34, 2006.
42−
43−[4] J. Doe and J. Roe, “Why Water Is Wet,” in *Third Book*, S. Smith, Ed. Oxford: Oxford University Press, 2007.
44−
45−</div>
46−
47−[^1]: Reference 4 and a citation without locators [4].
48−
49−[^2]: Some citations [2–4].
50−
51−[^3]: Like a citation without author: [2], and now Doe with a locator [3].
tests/markdown-citations.mhra.txtdeleted−73
@@ -1,73 +0,0 @@
1−Pandoc with citeproc-hs
2−=======================
3−
4−- [^1]
5−
6−- [^2]
7−
8−- John Doe[^3] says blah.
9−
10−- Doe[^4] says blah.
11−
12−- Doe[^5] says blah.
13−
14−- Doe[^6] says blah.
15−
16−- In a note.[^7]
17−
18−- A citation group.[^8]
19−
20−- Another one.[^9]
21−
22−- And another one in a note.[^10]
23−
24−- Citation with a suffix and locator.[^11]
25−
26−- Citation with suffix only.[^12]
27−
28−- Now some modifiers.[^13]
29−
30−- With some markup.[^14]
31−
32−<div class="references">
33−
34−References
35−==========
36−
37−Doe, John, ‘Article’, *Journal of Generic Studies*, 6 (2006), 33–34.
38−
39−---, *First Book* (Cambridge: Cambridge University Press, 2005).
40−
41−Doe, John, and Jenny Roe, ‘Why Water Is Wet’, in *Third Book*, ed. by Sam Smith (Oxford: Oxford University Press, 2007).
42−
43−‘Nonexistent Not Found!’.
44−
45−</div>
46−
47−[^1]: [CSL BIBLIOGRAPHIC DATA ERROR: reference "nonexistent" not found.].
48−
49−[^2]: [CSL STYLE ERROR: reference with no printed form.].
50−
51−[^3]: *First Book* (Cambridge: Cambridge University Press, 2005).
52−
53−[^4]: *First Book*, p. 30.
54−
55−[^5]: *First Book*, p. 30, with suffix.
56−
57−[^6]: *First Book*; ‘Article’, *Journal of Generic Studies*, 6 (2006), 33–34 (p. 30); see also John Doe and Jenny Roe, ‘Why Water Is Wet’, in *Third Book*, ed. by Sam Smith (Oxford: Oxford University Press, 2007).
58−
59−[^7]: Doe and Roe, p. 12 and a citation without locators Doe and Roe.
60−
61−[^8]: See Doe, *First Book*, chap. 3; also Doe and Roe, pp. 34–35.
62−
63−[^9]: See Doe, *First Book*, pp. 34–35.
64−
65−[^10]: Some citations see Doe, *First Book*, chap. 3; Doe and Roe; Doe, ‘Article’, 33–34.
66−
67−[^11]: Doe, *First Book*, pp. 33, 35–37, and nowhere else.
68−
69−[^12]: Doe, *First Book* and nowhere else.
70−
71−[^13]: Like a citation without author: *First Book*, and now Doe with a locator ‘Article’, 33–34 (p. 44).
72−
73−[^14]: *See* Doe, *First Book*, p. 32.
tests/markdown-citations.nativenew file+17
@@ -0,0 +1,17 @@
1+[Header 1 ("pandoc-with-citeproc-hs",[],[]) [Str "Pandoc",Space,Str "with",Space,Str "citeproc-hs"]
2+,BulletList
3+ [[Para [Cite [Citation {citationId = "nonexistent", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"]]]
4+ ,[Para [Cite [Citation {citationId = "nonexistent", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "???"]]]
5+ ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "???"],Space,Str "says",Space,Str "blah."]]
6+ ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "30"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "???"],Space,Str "says",Space,Str "blah."]]
7+ ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "30,",Space,Str "with",Space,Str "suffix"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "???"],Space,Str "says",Space,Str "blah."]]
8+ ,[Para [Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.",Space,Str "30"], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "see",Space,Str "also"], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Space,Str "says",Space,Str "blah."]]
9+ ,[Para [Str "In",Space,Str "a",Space,Str "note.",Note [Para [Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [Str "p.",Space,Str "12"], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "???"],Space,Str "and",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "locators",Space,Cite [Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]]]
10+ ,[Para [Str "A",Space,Str "citation",Space,Str "group",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.",Space,Str "3"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [Str "also"], citationSuffix = [Space,Str "p.",Space,Str "34-35"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]
11+ ,[Para [Str "Another",Space,Str "one",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "p.",Space,Str "34-35"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]
12+ ,[Para [Str "And",Space,Str "another",Space,Str "one",Space,Str "in",Space,Str "a",Space,Str "note.",Note [Para [Str "Some",Space,Str "citations",Space,Cite [Citation {citationId = "item1", citationPrefix = [Str "see"], citationSuffix = [Space,Str "chap.",Space,Str "3"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "\1087\1091\1085\1082\1090\&3", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0},Citation {citationId = "item2", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]]]
13+ ,[Para [Str "Citation",Space,Str "with",Space,Str "a",Space,Str "suffix",Space,Str "and",Space,Str "locator",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "pp.",Space,Str "33,",Space,Str "35-37,",Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]
14+ ,[Para [Str "Citation",Space,Str "with",Space,Str "suffix",Space,Str "only",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [Space,Str "and",Space,Str "nowhere",Space,Str "else"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]
15+ ,[Para [Str "Now",Space,Str "some",Space,Str "modifiers.",Note [Para [Str "Like",Space,Str "a",Space,Str "citation",Space,Str "without",Space,Str "author:",Space,Cite [Citation {citationId = "item1", citationPrefix = [], citationSuffix = [], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str ",",Space,Str "and",Space,Str "now",Space,Str "Doe",Space,Str "with",Space,Str "a",Space,Str "locator",Space,Cite [Citation {citationId = "item2", citationPrefix = [], citationSuffix = [Space,Str "p.",Space,Str "44"], citationMode = SuppressAuthor, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]]]
16+ ,[Para [Str "With",Space,Str "some",Space,Str "markup",Space,Cite [Citation {citationId = "item1", citationPrefix = [Emph [Str "see"]], citationSuffix = [Space,Str "p.",Space,Strong [Str "32"]], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "???"],Str "."]]]
17+,Header 1 ("references",[],[]) [Str "References"]]
tests/mhra.csldeleted−399
@@ -1,399 +0,0 @@
1−<?xml version="1.0" encoding="utf-8"?>
2−<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0" demote-non-dropping-particle="sort-only">
3− <info>
4− <title>Modern Humanities Research Association (Note with Bibliography)</title>
5− <id>http://www.zotero.org/styles/mhra</id>
6− <link href="http://www.zotero.org/styles/mhra" rel="self"/>
7− <link href="http://www.mhra.org.uk/Publications/Books/StyleGuide/download.shtml" rel="documentation"/>
8− <author>
9− <name>Rintze Zelle</name>
10− <uri>http://twitter.com/rintzezelle</uri>
11− </author>
12− <contributor>
13− <name>Sebastian Karcher</name>
14− </contributor>
15− <summary>MHRA format with full notes and bibliography</summary>
16− <category field="generic-base"/>
17− <category citation-format="note"/>
18− <updated>2011-08-18T16:08:33+00:00</updated>
19− <rights>This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License: http://creativecommons.org/licenses/by-sa/3.0/</rights>
20− </info>
21− <locale xml:lang="en">
22− <terms>
23− <term name="et-al">and others</term>
24− <term name="editor" form="verb-short">ed. by</term>
25− <term name="edition" form="short">edn</term>
26− <term name="translator" form="verb-short">trans. by</term>
27− </terms>
28− </locale>
29− <macro name="author">
30− <names variable="author">
31− <name name-as-sort-order="first" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="always"/>
32− <label form="short" prefix=", " suffix="."/>
33− <substitute>
34− <names variable="editor"/>
35− <names variable="translator"/>
36− <text macro="title-note"/>
37− </substitute>
38− </names>
39− </macro>
40− <macro name="contributors-note">
41− <names variable="author">
42− <name and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="never"/>
43− </names>
44− <text macro="recipient-note"/>
45− </macro>
46− <macro name="title-note">
47− <choose>
48− <if type="bill book graphic legal_case motion_picture report song" match="any">
49− <text variable="title" font-style="italic" text-case="title"/>
50− </if>
51− <else>
52− <text variable="title" prefix="‘" suffix="’" text-case="title"/>
53− </else>
54− </choose>
55− </macro>
56− <macro name="title-short">
57− <choose>
58− <if disambiguate="true">
59− <choose>
60− <if type="bill book graphic legal_case motion_picture report song" match="any">
61− <text variable="title" font-style="italic" text-case="title" form="short"/>
62− </if>
63− <else>
64− <text variable="title" prefix="‘" suffix="’" text-case="title" form="short"/>
65− </else>
66− </choose>
67− </if>
68− </choose>
69− </macro>
70− <macro name="editor-translator">
71− <group delimiter=", ">
72− <names variable="editor" delimiter=", ">
73− <label form="verb-short" text-case="lowercase" suffix=" "/>
74− <name and="text" delimiter=", " delimiter-precedes-last="never"/>
75− </names>
76− <choose>
77− <if variable="author editor" match="any">
78− <names variable="translator" delimiter=", ">
79− <label form="verb-short" text-case="lowercase" suffix=" "/>
80− <name and="text" delimiter=", " delimiter-precedes-last="never"/>
81− </names>
82− </if>
83− </choose>
84− </group>
85− </macro>
86− <macro name="collection-title">
87− <text variable="collection-title" text-case="title"/>
88− <text variable="collection-number" prefix=", "/>
89− </macro>
90− <macro name="locators-note">
91− <choose>
92− <if type="article-journal">
93− <text variable="volume"/>
94− </if>
95− <else-if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
96− <group delimiter=", ">
97− <text macro="edition-note"/>
98− <group>
99− <number variable="number-of-volumes" form="numeric"/>
100− <text term="volume" form="short" prefix=" " plural="true"/>
101− </group>
102− </group>
103− </else-if>
104− </choose>
105− </macro>
106− <macro name="volume">
107− <choose>
108− <if type="article-journal">
109− <text variable="volume"/>
110− </if>
111− <else-if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
112− <group delimiter=", ">
113− <text macro="edition-note"/>
114− <group>
115− <number variable="number-of-volumes" form="numeric"/>
116− <text term="volume" form="short" prefix=" " plural="true"/>
117− </group>
118− </group>
119− </else-if>
120− </choose>
121− </macro>
122− <macro name="issue-note">
123− <choose>
124− <if type="article-journal">
125− <choose>
126− <if variable="volume">
127− <text macro="issued" prefix=" (" suffix=")"/>
128− </if>
129− <else>
130− <text macro="issued" prefix=", "/>
131− </else>
132− </choose>
133− </if>
134− <else-if variable="publisher-place publisher" match="any">
135− <group prefix=" (" suffix=")" delimiter=", ">
136− <group delimiter=" ">
137− <choose>
138− <if variable="title" match="none"/>
139− <else-if type="thesis speech" match="any">
140− <text variable="genre" prefix="unpublished "/>
141− </else-if>
142− </choose>
143− <text macro="event"/>
144− </group>
145− <text macro="publisher"/>
146− <text macro="issued"/>
147− </group>
148− </else-if>
149− <else>
150− <text macro="issued" prefix=", "/>
151− </else>
152− </choose>
153− </macro>
154− <macro name="locators-specific-note">
155− <choose>
156− <if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
157− <choose>
158− <if is-numeric="volume">
159− <number variable="volume" form="roman" font-variant="small-caps"/>
160− </if>
161− </choose>
162− </if>
163− </choose>
164− </macro>
165− <macro name="container-title-note">
166− <choose>
167− <if type="chapter paper-conference" match="any">
168− <text term="in" text-case="lowercase" suffix=" "/>
169− </if>
170− </choose>
171− <text variable="container-title" font-style="italic" text-case="title"/>
172− </macro>
173− <macro name="edition-note">
174− <choose>
175− <if type="bill book graphic legal_case motion_picture report song chapter paper-conference" match="any">
176− <choose>
177− <if is-numeric="edition">
178− <group delimiter=" ">
179− <number variable="edition" form="ordinal"/>
180− <text term="edition" form="short"/>
181− </group>
182− </if>
183− <else>
184− <text variable="edition"/>
185− </else>
186− </choose>
187− </if>
188− </choose>
189− </macro>
190− <macro name="editor-note">
191− <names variable="editor">
192− <name and="text" sort-separator=", " delimiter=", "/>
193− <label form="short" prefix=", " suffix="."/>
194− </names>
195− </macro>
196− <macro name="translator-note">
197− <names variable="translator">
198− <name and="text" sort-separator=", " delimiter=", "/>
199− <label form="verb-short" prefix=", " suffix="."/>
200− </names>
201− </macro>
202− <macro name="recipient-note">
203− <names variable="recipient" delimiter=", ">
204− <label form="verb" prefix=" " text-case="lowercase" suffix=" "/>
205− <name and="text" delimiter=", "/>
206− </names>
207− </macro>
208− <macro name="recipient-short">
209− <names variable="recipient">
210− <label form="verb" prefix=" " text-case="lowercase" suffix=" "/>
211− <name form="short" and="text" delimiter=", "/>
212− </names>
213− </macro>
214− <macro name="contributors-short">
215− <names variable="author">
216− <name form="short" and="text" sort-separator=", " delimiter=", " delimiter-precedes-last="never"/>
217− <substitute>
218− <names variable="editor"/>
219− <names variable="translator"/>
220− </substitute>
221− </names>
222− <text macro="recipient-short"/>
223− </macro>
224− <macro name="interviewer-note">
225− <names variable="interviewer" delimiter=", ">
226− <label form="verb" prefix=" " text-case="lowercase" suffix=" "/>
227− <name and="text" delimiter=", "/>
228− </names>
229− </macro>
230− <macro name="locators-newspaper">
231− <choose>
232− <if type="article-newspaper">
233− <group delimiter=", ">
234− <group>
235− <text variable="edition" suffix=" "/>
236− <text term="edition" prefix=" "/>
237− </group>
238− <group>
239− <text term="section" suffix=" "/>
240− <text variable="section"/>
241− </group>
242− </group>
243− </if>
244− </choose>
245− </macro>
246− <macro name="event">
247− <group>
248− <text term="presented at" suffix=" "/>
249− <text variable="event"/>
250− </group>
251− </macro>
252− <macro name="publisher">
253− <group delimiter=": ">
254− <text variable="publisher-place"/>
255− <text variable="publisher"/>
256− </group>
257− </macro>
258− <macro name="issued">
259− <choose>
260− <if type="graphic report article-newspaper" match="any">
261− <date variable="issued">
262− <date-part name="day" suffix=" "/>
263− <date-part name="month" suffix=" "/>
264− <date-part name="year"/>
265− </date>
266− </if>
267− <else-if type="bill book graphic legal_case motion_picture report song thesis chapter paper-conference" match="any">
268− <date variable="issued">
269− <date-part name="year"/>
270− </date>
271− </else-if>
272− <else>
273− <date variable="issued">
274− <date-part name="year"/>
275− </date>
276− </else>
277− </choose>
278− </macro>
279− <macro name="pages">
280− <choose>
281− <if type="article-journal">
282− <text variable="page" prefix=", "/>
283− </if>
284− <else>
285− <choose>
286− <if variable="volume">
287− <text variable="page" prefix=", "/>
288− </if>
289− <else>
290− <label variable="page" form="short" prefix=", " suffix=" "/>
291− <text variable="page"/>
292− </else>
293− </choose>
294− </else>
295− </choose>
296− </macro>
297− <macro name="point-locators">
298− <text macro="pages"/>
299− <choose>
300− <if variable="page">
301− <group prefix=" (" suffix=")">
302− <label variable="locator" form="short" suffix=" "/>
303− <text variable="locator"/>
304− </group>
305− </if>
306− <else>
307− <label variable="locator" form="short" prefix=", " suffix=" "/>
308− <text variable="locator"/>
309− </else>
310− </choose>
311− </macro>
312− <macro name="archive-note">
313− <group delimiter=", ">
314− <text variable="archive_location"/>
315− <text variable="archive"/>
316− <text variable="archive-place"/>
317− </group>
318− </macro>
319− <macro name="access-note">
320− <group delimiter=", ">
321− <choose>
322− <if type="graphic report" match="any">
323− <text macro="archive-note" prefix=", "/>
324− </if>
325− <else-if type="bill book graphic legal_case motion_picture report song article-journal article-magazine article-newspaper thesis chapter paper-conference" match="none">
326− <text macro="archive-note" prefix=", "/>
327− </else-if>
328− </choose>
329− </group>
330− <choose>
331− <if variable="DOI">
332− <text variable="DOI" prefix=" &lt;doi:" suffix="&gt;"/>
333− </if>
334− <else>
335− <choose>
336− <if variable="URL">
337− <text variable="URL" prefix=" &lt;" suffix="&gt;"/>
338− <group prefix=" [" suffix="]">
339− <text term="accessed" text-case="lowercase"/>
340− <date variable="accessed">
341− <date-part name="day" prefix=" "/>
342− <date-part name="month" prefix=" "/>
343− <date-part name="year" prefix=" "/>
344− </date>
345− </group>
346− </if>
347− </choose>
348− </else>
349− </choose>
350− </macro>
351− <citation et-al-min="4" et-al-use-first="1" et-al-subsequent-min="4" et-al-subsequent-use-first="1" disambiguate-add-names="true" disambiguate-add-givenname="true">
352− <layout prefix="" suffix="." delimiter="; ">
353− <choose>
354− <if position="subsequent">
355− <text macro="contributors-short"/>
356− <text macro="title-short" prefix=", "/>
357− <text macro="locators-specific-note" prefix=", "/>
358− <text macro="point-locators"/>
359− </if>
360− <else>
361− <group delimiter=", ">
362− <text macro="contributors-note"/>
363− <text macro="title-note"/>
364− <text macro="container-title-note"/>
365− <text macro="editor-translator"/>
366− <text macro="collection-title"/>
367− <text macro="locators-note"/>
368− </group>
369− <text macro="issue-note"/>
370− <text macro="locators-specific-note" prefix=", "/>
371− <text macro="locators-newspaper" prefix=", "/>
372− <text macro="point-locators"/>
373− <text macro="access-note"/>
374− </else>
375− </choose>
376− </layout>
377− </citation>
378− <bibliography hanging-indent="true" et-al-min="6" et-al-use-first="6" subsequent-author-substitute="---">
379− <sort>
380− <key macro="author"/>
381− <key variable="title"/>
382− </sort>
383− <layout suffix=".">
384− <group delimiter=", ">
385− <text macro="author"/>
386− <text macro="title-note"/>
387− <text macro="container-title-note"/>
388− <text macro="editor-translator"/>
389− <text macro="collection-title"/>
390− <text macro="volume"/>
391− </group>
392− <text macro="issue-note"/>
393− <text macro="locators-specific-note" prefix=", "/>
394− <text macro="locators-newspaper" prefix=", "/>
395− <text macro="pages"/>
396− <text macro="access-note"/>
397− </layout>
398− </bibliography>
399−</style>
windows/make-windows-installer.bat−1
@@ -2,7 +2,6 @@
2cd ..
2cd ..
3rem cabal update
3rem cabal update
4cabal-dev clean
4cabal-dev clean
5−cabal-dev install --reinstall --force-reinstall --flags="embed_data_files" citeproc-hs
6if %errorlevel% neq 0 exit /b %errorlevel%
5if %errorlevel% neq 0 exit /b %errorlevel%
7cabal-dev install --reinstall --force-reinstall --flags="embed_data_files"
6cabal-dev install --reinstall --force-reinstall --flags="embed_data_files"
8if %errorlevel% neq 0 exit /b %errorlevel%
7if %errorlevel% neq 0 exit /b %errorlevel%