├── LICENSE ├── README.md ├── example-gallery.md ├── images ├── 2-examples.png ├── pdflatex---pandoc-csl-testing---multiple-sclerosis-journal.png ├── pdflatex---pandoc-csl-testing---rapid-communications-in-mass-spectrometry.png ├── pdflatex---pandoc-csl-testing---rtf-scan.png ├── pdflatex---pandoc-csl-testing---small.png ├── pdflatex---pandoc-csl-testing---stuttgart-media-university.png ├── pdflatex---pandoc-csl-testing---thomson-reuters-legal-tax-and-accounting-australia.png ├── pdflatex---pandoc-csl-testing---universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.png └── pdflatex---pandoc-csl-testing---wissenschaftlicher-industrielogistik-dialog.png ├── markdown ├── de---citations.md └── en---citations.md ├── resources └── my-csl-testing.bib └── scripts ├── create-images.sh └── run-some-csl-tests.sh /LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | 118 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Testing and Using CSL Style Files with Pandoc 2 | 3 | > Scripts and Howtos about using different CSL (Citation Style Language) files with Pandoc. 4 | > 5 | > The scripts have been tested with Pandoc 1.16.0.2 and are known to work in Debian 8 (Jessie) and Mac OS X 10.10.5 (Yosemite). 6 | 7 | Pandoc can insert an automatically generated citation list into documents converted from Markdown (or ASCIIdoc -- but I haven't tested that so far). 8 | This works for output types LaTeX/PDF/Beamer as well as for HTML/EPUB/EPUB3, HTML Slide formats (DZSlide, Slidy, Slideous, S5 and RevealJS), DOCX, ODT and DocBook. 9 | 10 | The following command line parameters are required to run the tests covered by this repository: 11 | 12 | --bibliography=/path/to/my.bib \ 13 | --csl=/path/to/my.csl \ 14 | --filter=/path/to/pandoc-citeproc 15 | 16 | But users are often unsure how to insert the citation Markdown code into their source files. 17 | And frequently they are surprised how the generated output looks in the final document. 18 | 19 | However, often it is the used **[CSL style](http://en.wikipedia.org/wiki/Citation_Style_Language)** file which manipulates the output in a surprising way. 20 | 21 | Users (as well as developers of CSL styles) can use the scripts and example files provided here to check and verify a specific configuration they use, or find an alternative one which they like better. 22 | The CSL file does not only determine the look of the bibliography section of the document. 23 | It exerts its influence in three distinct areas, formatting also the look and feel, and even *the actual text contents* of other parts of the document: 24 | 25 | 1. The footnotes of pages including citations. 26 | 1. The references to the citation. 27 | 1. The bibliography section of the document. 28 | 29 | The following image shows two examples (PDF output) side by side: 30 | 31 | ![Left: "stuttgart-media-university.csl". Right: "rtf-scan.csl"](./images/2-examples.png) 32 | 33 | Both documents were generated by Pandoc from the same Markdown source file. 34 | 35 | See also [the example gallery](example-gallery.md) for a few remarkable examples depicting some results for PDF files. 36 | 37 | # Prerequisites 38 | 39 | On top of a current, working `pandoc` installation (including a working LaTeX installation for PDF output which includes the relevant LaTeX packages), you need to have two more elements: 40 | 41 | 1. **A `.bib` file with the list of used bibliographic resources.** 42 | 1. **A few CSL files you want to test.** 43 | 44 | 45 | # Steps to follow 46 | 47 | Follow these step if you want to test a ***lot*** of different CSL styles. 48 | The script by default will generate PDF, HTML and EPUB3 output, one file per tested CSL style. 49 | 50 | By default, about a dozen CSL styles are tested. 51 | Their selection demonstrates the variety of output that can be caused by the CSL selected. 52 | (So you can see that it is not always an authors' mistake in his input Markdown if the output shows up in an "unexpected" way.) 53 | 54 | You can currently test more than 1200 different styles by commenting in the respective line in the script. 55 | The script works for Linux and Mac OS X users -- Windows users are currently not supported, but may draw some inspiration to create their own solution: 56 | 57 | 1. **Create `.bib` file with the list of used bibliographic resources.** 58 | 59 | This file can be seen as your personal "database of references". 60 | It must be formatted in a specific way. 61 | (There are many tools out there, like **[Zotero](https://www.zotero.org/)** and others, which help you create and maintain your .bib file(s). 62 | But dealing with that is beyond the scope of this project.) 63 | 64 | The `my-csl-testing.bib` provideded here is a .bib file with a few dummy entries. 65 | It can be used as a template to model your own .bib files after. 66 | It is required to run the test script. 67 | (I'm myself by no way an expert in this field: I've created the scripts here first of all for *myself*, in order to find out how things work, and how the different outputs would look like.) 68 | 69 | 1. **Access to all the CSL files you want to test.** 70 | 71 | I recommend to clone the GitHub repo of **[citationstyles.org](http://citationstyles.org)**: 72 | 73 | cd $HOME 74 | mkdir svn-git-stuff 75 | cd svn-git-stuff 76 | git clone https://github.com/citation-style-language/styles.git git.csl-styles 77 | 78 | This repo currently weights about 75 MBytes. 79 | There are more than 9.200 different CSL style files in there! 80 | 81 | 1. **Clone this repository here.** 82 | 83 | cd ~/svn-git-stuff 84 | git clone https://github.com/KurtPfeifle/pandoc-csl-testing.git git.pandoc-csl-testing 85 | 86 | 1. **Run the testscript** 87 | 88 | cd ~/svn-git-stuff/git.pandoc-csl-testing/scripts 89 | bash run-some-csl-tests.sh 90 | 91 | The script `run-some-csl-tests.sh` is designed to run out of the box. 92 | It generates PDF, HTML and EPUB3 output. 93 | Other output formats can be enabled by editing the script. 94 | 95 | The `run-all-csl-tests.sh` script requires you to do some editing first. 96 | You want to enable DOCX or ODT output? 97 | Do you ***really*** want to generate a test output document showing 1100 different citation styles?!? -- 98 | Decide, edit, then run. 99 | 100 | 1. **Modify the testscript** 101 | 102 | The outcome of the testscript can be influenced by commenting in or commenting out different variables (or lines in the script): 103 | 104 | - **`my_markdown`** (lines 8 and 9): The file *de---citations.md* creates output documents in German. 105 | The file *en---citations.md* creates output documents in English. 106 | - **`my_highlight_style`** (lines 15--21): Changes the syntax highlighting style. 107 | Possible values are *espresso* (default), *pygments*, *kate*, *monochrome*, *haddock*, *tango* and *zenburn*. 108 | - **`latex_engine`** (lines 26--28)): Default setting is *pdflatex*; other possible values are *lualatex* or *xelatex*. 109 | - **`my_localizations`** (lines 30/31): Default setting is for English as the main language; may be changed to German. 110 | - **CSL files to test** (lines 65--67): By default only about a dozen selected CSL styles are used (line 67). To test *ALL* available CSL styles, enable line 66 and disable line 67). 111 | 112 | If you read (and understand) the script, you'll find more ways to tune it to your own needs or preferences. 113 | 114 | # Hint 115 | 116 | You will see the following warning in the script output: 117 | 118 | ```bash 119 | pandoc-citeproc: reference nonexistent not found 120 | ``` 121 | 122 | This is intentional. 123 | It is the result of including a non existent reference in the Markdown input document (appropriately called "nonexistent"). 124 | It serves to test the CSL behavior for such cases of errors (which are the document authors' fault, but which are committed regularly). 125 | 126 | # Caveats 127 | 128 | My main personal focus is to test the PDF output -- so I haven't tested EPUB3 or HTML output much either (yet). 129 | This version is a short-term, quick'n'dirty cleaned up modification from my private local resources. 130 | I made it because a friend asked me to get a copy. 131 | Now the whole (Pandoc) world can also. 132 | 133 | Please tell me where I have br0ken things. 134 | Pull requests are accepted if they are generally useful. 135 | 136 | # Roadmap 137 | 138 | I will add DOCX and ODP tests soon. 139 | 140 | # Credits 141 | 142 | Thank you, John McFarlane, for this wonderful tool Pandoc is today! 143 | The initial Markdown file used in these tests was inspired by one provided by John McFarlane somewhere on the 'Net. 144 | 145 | -------------------------------------------------------------------------------- /example-gallery.md: -------------------------------------------------------------------------------- 1 | # Example Gallery 2 | 3 | 4 | The following pictures show three parts each: 5 | 6 | 1. **Left** (identical for each picture) : the Markdown source code of the document. 7 | 1. **Center** : the formatting and contents of the document page parts containing citation references. 8 | 1. **Right** : the formatting and contents of the footnote area of the document page containing citation references. 9 | 10 | These pictures clearly show what you can expect. 11 | 12 | 1. Some CSL-Styles do not create a bibligraphy section at all. 13 | Instead, they put all citation information into the page footnotes. 14 | Example: `thomson-reuters-legal-tax-and-accounting-australia.csl` 15 | 1. Some CSL-Styles insert snippets from the *.bib file into the document text too. 16 | Each CSL-Style doing so does it differently. 17 | 1. Each CSL-Style formats the bibliography section differently, and puts different parts from the *.bib file into it. 18 | 19 | So if you see something un-expected in your document when using CSL-formatted bibliographies with it, chances are: *"It's not a bug, it's a feature."* 20 | 21 | 22 | 23 | ---- 24 | 25 | ![**multiple-sclerosis-journal.csl**](./images/pdflatex---pandoc-csl-testing---multiple-sclerosis-journal.png "multiple-sclerosis-journal.CSL") 26 | 27 | ---- 28 | 29 | ![**rapid-communications-in-mass-spectrometry.csl**](./images/pdflatex---pandoc-csl-testing---rapid-communications-in-mass-spectrometry.png "rapid-communications-in-mass-spectrometry.CSL") 30 | 31 | ---- 32 | 33 | ![**rtf-scan.csl**](./images/pdflatex---pandoc-csl-testing---rtf-scan.png "rtf-scan.CSL") 34 | 35 | ---- 36 | 37 | ![**small.csl**](./images/pdflatex---pandoc-csl-testing---small.png "small.CSL") 38 | 39 | ---- 40 | 41 | ![**stuttgart-media-university.csl**](./images/pdflatex---pandoc-csl-testing---stuttgart-media-university.png "stuttgart-media-university.CSL") 42 | 43 | ---- 44 | 45 | ![**thomson-reuters-legal-tax-and-accounting-australia.csl**](./images/pdflatex---pandoc-csl-testing---thomson-reuters-legal-tax-and-accounting-australia.png "thomson-reuters-legal-tax-and-accounting-australia.CSL") 46 | 47 | ---- 48 | 49 | ![**universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.csl**](./images/pdflatex---pandoc-csl-testing---universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.png "universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.CSL") 50 | 51 | ---- 52 | 53 | ![**wissenschaftlicher-industrielogistik-dialog.csl**](./images/pdflatex---pandoc-csl-testing---wissenschaftlicher-industrielogistik-dialog.png "wissenschaftlicher-industrielogistik-dialog.CSL") 54 | 55 | ---- 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /images/2-examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/2-examples.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---multiple-sclerosis-journal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---multiple-sclerosis-journal.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---rapid-communications-in-mass-spectrometry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---rapid-communications-in-mass-spectrometry.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---rtf-scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---rtf-scan.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---small.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---stuttgart-media-university.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---stuttgart-media-university.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---thomson-reuters-legal-tax-and-accounting-australia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---thomson-reuters-legal-tax-and-accounting-australia.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---universidade-de-sao-paulo-instituto-de-matematica-e-estatistica.png -------------------------------------------------------------------------------- /images/pdflatex---pandoc-csl-testing---wissenschaftlicher-industrielogistik-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pdfkungfoo/pandoc-csl-testing/55644be9c5c6b55f50832a43d8c2fe59fc73cb20/images/pdflatex---pandoc-csl-testing---wissenschaftlicher-industrielogistik-dialog.png -------------------------------------------------------------------------------- /markdown/de---citations.md: -------------------------------------------------------------------------------- 1 | # `pandoc`: Testreihe zu automatisch erzeugten Literaturverzeichnissen mit unterschiedlichen CSL-Dateien von [citationstyles.org](http://citationstyles.org/styles/) 2 | #                         *hier mit:* `___csl_style___` 3 | 4 | ## Markdown-Quellcode des relevanten Teils dieser Seite 5 | 6 | ``` {.markdown} 7 | i. [@nonexistent] 8 | i. @nonexistent 9 | i. @z1 sagt blah. 10 | i. @z1 [p. 30] sagt blubb. 11 | i. @z1 [p. 30, mit Suffix] sagt blahblah. 12 | i. @z1 [-@z2 p. 30; siehe auch @z3] sagt blah-blubb. 13 | i. In einer Fußnote.[^1] 14 | i. Eine Zitat-Gruppe [siehe @z1 p. 34-35; ebenfalls @z3 chap. 3]. 15 | i. Noch eine [siehe @z1 p. 34-35]. 16 | i. Und noch eine, in einer Fußnote.[^2] 17 | i. Zitat mit einem *Suffix* und einem *Locator* [@z1 pp. 33, 35-37, und sonst nirgends]. 18 | i. Zitat nur mit einem Locator [@z1 und sonst nirgends]. 19 | i. Jetzt ein paar *Modifiers*[^3]... 20 | i. Mit etwas extra Markup [*siehe* @z1 p. **32**]. 21 | i. Jane Doz mag mich nicht [***siehe*** **@z4**]. 22 | 23 | [^1]: Ein Zitat ohne Locators [@z3]. 24 | 25 | [^2]: Mehrere Zitate [siehe @z2 chap. 3; @z3; @z1]. 26 | 27 | [^3]: ...wie z.B. ein Zitat ohne Autor: [-@z1]. Und jetzt noch OStR Oster mit einem Locator [-@z2 p. 44]. 28 | ``` 29 | 30 | 31 | 39 | 40 | 73 | 74 | ## Pandoc-Kommando zum Erzeugen dieser Seite 75 | 76 | ``` {.noweb} 77 | csl=___csl_style___ 78 | pandoc -V geometry="paperwidth=21cm, paperheight=42cm, margin=0.5cm -V language=de-DE -V lang=ngerman \ 79 | --highlight-style=espresso --filter=pandoc-citeproc --biblio=my-biblio.bib de---citations.mmd \ 80 | -o de---git.citation-styles.trunk---${csl}.pdf --csl ___csl_style___ 81 | ``` 82 | 83 | 84 | ## PDF-Ergebnis des Markdown-Codes 85 | 86 | i. [@nonexistent] 87 | i. @nonexistent 88 | i. @z1 sagt blah. 89 | i. @z1 [p. 30] sagt blubb. 90 | i. @z1 [p. 30, mit Suffix] sagt blahblah. 91 | i. @z1 [-@z2 p. 30; siehe auch @z3] sagt blah-blubb. 92 | i. In einer Fußnote.[^1] 93 | i. Eine Zitat-Gruppe [siehe @z1 p. 34-35; ebenfalls @z3 chap. 3]. 94 | i. Noch eine [siehe @z1 p. 34-35]. 95 | i. Und noch eine, in einer Fußnote.[^2] 96 | i. Zitat mit einem *Suffix* und einem *Locator* [@z1 pp. 33, 35-37, und sonst nirgends]. 97 | i. Zitat nur mit einem Locator [@z1 und sonst nirgends]. 98 | i. Jetzt ein paar *Modifiers*[^3]... 99 | i. Mit etwas extra Markup [*siehe* @z1 p. **32**]. 100 | i. Jane Doz doesnt like me [***siehe*** **@z4**]. 101 | 102 | [^1]: Ein Zitat ohne Locators [@z3]. 103 | 104 | [^2]: Mehrere Zitate [siehe @z2 chap. 3; @z3; @z1]. 105 | 106 | [^3]: ...wie z.B. ein Zitat ohne Autor: [-@z1]. Und jetzt noch OStR Oster mit einem Locator [-@z2 p. 44]. 107 | 108 | $x^2 + y^2 = 1$ @z1 109 | 110 | 111 | # Literaturverzeichnis 112 | 113 | -------------------------------------------------------------------------------- /markdown/en---citations.md: -------------------------------------------------------------------------------- 1 | # `pandoc`: Test Series for automatically generated bibliographies using different CSL files from [citationstyles.org](http://citationstyles.org/styles/) 2 | #                         *here using:* `___csl_style___` 3 | 4 | ## Markdown source code for relevant port of this page 5 | 6 | ``` {.markdown} 7 | i. [@nonexistent] 8 | i. @nonexistent 9 | i. @z1 says fooo. 10 | i. @z1 [p. 30] says baaar. 11 | i. @z1 [p. 30, with suffix] says blahblah. 12 | i. @z1 [-@z2 p. 30; see also @z3] says blah-blubb. 13 | i. In a footnote.[^1] 14 | i. A citation group [see @z1 p. 34-35; also @z3 chap. 3]. 15 | i. Another one [see @z1 p. 34-35]. 16 | i. And still another, in a footnote.[^2] 17 | i. Quote with a *suffix* and a *locator* [@z1 pp. 33, 35-37, and nothing else]. 18 | i. Quote with only one locator [@z1 and nowhere else]. 19 | i. Now a few *modifiers*[^3]... 20 | i. With some extra Markup [*see* @z1 p. **32**]. 21 | i. Jane Doz doesnt like me [***see*** **@z4**]. 22 | 23 | [^1]: A citation without locators [@z3]. 24 | 25 | [^2]: Multiple citations [siehe @z2 chap. 3; @z3; @z1]. 26 | 27 | [^3]: ...like a quote without author: [-@z1]. And now OStR Oster with a locator [-@z2 p. 44]. 28 | 29 | $x^2 + y^2 = 1$ @z1 30 | ``` 31 | 32 | 65 | 66 | ## Pandoc command to generate this document 67 | 68 | ``` {.noweb} 69 | csl=___csl_style___ 70 | pandoc -V geometry="paperwidth=21cm, paperheight=42cm, margin=0.5cm -V language=de-DE -V lang=ngerman \ 71 | --highlight-style=espresso --filter=pandoc-citeproc --biblio=my-biblio.bib de---citations.mmd \ 72 | -o de---git.citation-styles.trunk---${csl}.pdf --csl ___csl_style___ 73 | ``` 74 | 75 | 76 | ## Document output of Markdown code 77 | 78 | i. [@nonexistent] 79 | i. @nonexistent 80 | i. @z1 says fooo. 81 | i. @z1 [p. 30] says baaar. 82 | i. @z1 [p. 30, with suffix] says blahblah. 83 | i. @z1 [-@z2 p. 30; see also @z3] says blah-blubb. 84 | i. In a footnote.[^1] 85 | i. A citation group [see @z1 p. 34-35; also @z3 chap. 3]. 86 | i. Another one [see @z1 p. 34-35]. 87 | i. And still another, in a footnote.[^2] 88 | i. Quote with a *suffix* and a *locator* [@z1 pp. 33, 35-37, and nothing else]. 89 | i. Quote with only one locator [@z1 and nowhere else]. 90 | i. Now a few *modifiers*[^3]... 91 | i. With some extra Markup [*see* @z1 p. **32**]. 92 | i. Jane Doz doesnt like me [***see*** **@z4**]. 93 | 94 | [^1]: A citation without locators [@z3]. 95 | 96 | [^2]: Multiple citations [siehe @z2 chap. 3; @z3; @z1]. 97 | 98 | [^3]: ...like a quote without author: [-@z1]. And now OStR Oster with a locator [-@z2 p. 44]. 99 | 100 | $x^2 + y^2 = 1$ @z1 101 | 102 | 103 | # Bibliography 104 | 105 | -------------------------------------------------------------------------------- /resources/my-csl-testing.bib: -------------------------------------------------------------------------------- 1 | @Book{z1, 2 | author="Thales von Milet", 3 | title="Doppelwinkel-Funktionen", 4 | url="http://de.wikipedia.org/wiki/Formelsammlung_Trigonometrie#Doppelwinkelfunktionen", 5 | year="600 v.Chr.", 6 | address="Milet, Kleinasien", 7 | publisher="Wikipedia" 8 | } 9 | 10 | @Article{z2, 11 | author="OStR Dr. math.nat. Oster", 12 | title="Unterrichtsmaterialen für Klasse 9 (Mittelstufe)", 13 | year="1969", 14 | journal="Journal of Generic Studies", 15 | volume="9", 16 | pages="33-34" 17 | } 18 | 19 | @InCollection{z3, 20 | author="Elvis Presley, Madonna and Pink Floyd", 21 | title="Kombinatorik Hypergeometrischer Verteilungen", 22 | booktitle="Wiederholungslose Auswahlprobleme", 23 | editor="Cleopatra, Königin von Ägypten", 24 | publisher="Steintafeln Moses GmbH & Co. KG", 25 | address="Gizeh", 26 | year="30 v.Chr." 27 | } 28 | 29 | @Article{z4, 30 | author="Jane Doz", 31 | title="Why All Men Suck", 32 | year="2006", 33 | journal="Journal of Gender Studies", 34 | volume="6", 35 | pages="33-34" 36 | } 37 | 38 | @Book{ref1, 39 | author="Thales von Milet", 40 | title="Doppelwinkel-Funktionen", 41 | url="http://de.wikipedia.org/wiki/Formelsammlung_Trigonometrie#Doppelwinkelfunktionen", 42 | year="600 v.Chr.", 43 | address="Milet, Kleinasien", 44 | publisher="Wikipedia" 45 | } 46 | 47 | @Article{ref2, 48 | author="OStR Dr. math.nat. Oster", 49 | title="Unterrichtsmaterialen für Klasse 9 (Mittelstufe)", 50 | year="1969", 51 | journal="Journal of Generic Studies", 52 | volume="9", 53 | pages="33-34" 54 | } 55 | 56 | @InCollection{ref3, 57 | author="Elvis Presley, Madonna and Pink Floyd", 58 | title="Kombinatorik Hypergeometrischer Verteilungen", 59 | booktitle="Wiederholungslose Auswahlprobleme", 60 | editor="Cleopatra, Königin von Ägypten", 61 | publisher="Steintafeln Moses GmbH & Co. KG", 62 | address="Gizeh", 63 | year="30 v.Chr." 64 | } 65 | 66 | @Book{ref4, 67 | author="Joe Doe", 68 | title="First Book", 69 | year="2005", 70 | address="Cambridge", 71 | publisher="Cambridge University Press" 72 | } 73 | 74 | @InCollection{ref5, 75 | author="John Doe and Jenny Roe", 76 | title="Why Water Is Wet", 77 | booktitle="Third Book", 78 | editor="Sam Smith", 79 | publisher="Oxford University Press", 80 | address="Oxford", 81 | year="2007" 82 | } 83 | -------------------------------------------------------------------------------- /scripts/create-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # (c) 2015 Kurt Pfeifle 4 | # 5 | # 6 | 7 | mkdir ../images 2>/dev/null 8 | 9 | for img in ../output/*latex---pandoc-csl-testing---*.pdf ; do 10 | csl=${img/pdflatex---pandoc-csl-testing---/} 11 | csl=${csl/pdflatex---pandoc-csl-testing---/} 12 | csl=${csl/lualatex---pandoc-csl-testing---/} 13 | csl=${csl/.pdf/.csl} 14 | convert \ 15 | ${img}[0] \ 16 | -background '#0000' \ 17 | -frame 1 \ 18 | -alpha on \ 19 | +write mpr:a -delete 0 \ 20 | \( \ 21 | mpr:a[530x350+0+083] \ 22 | mpr:a[595x280+0+527] \ 23 | mpr:a[595x380+0+804] \ 24 | +append \ 25 | \) \ 26 | +repage \ 27 | \( \ 28 | -size 560x80 \ 29 | -background '#0008' \ 30 | -fill white \ 31 | -gravity center \ 32 | caption:" CSL style file: $(basename ${csl/.pdf/.csl}) " \ 33 | \) \ 34 | -gravity south \ 35 | -geometry -32+10 \ 36 | -composite \ 37 | ${img/.pdf/.png} 38 | mv ${img/.pdf/.png} ../images/ 39 | done 40 | 41 | open ../images/*.png 42 | -------------------------------------------------------------------------------- /scripts/run-some-csl-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # (C) 2015, Kurt Pfeifle 4 | # 5 | # Skript to run CSL tests for documents generated by Pandoc from Markdown 6 | 7 | my_biblio="../resources/my-csl-testing.bib" 8 | #my_markdown="../markdown/de---citations.md" 9 | my_markdown="../markdown/en---citations.md" 10 | my_output="../output" 11 | my_logdir="../logdir" 12 | 13 | mkdir ${my_output} ${my_logdir} 2>/dev/null 14 | 15 | #my_highlight_style="zenburn" 16 | #my_highlight_style="tango" 17 | #my_highlight_style="haddock" 18 | #my_highlight_style="monochrome" 19 | #my_highlight_style="kate" 20 | #my_highlight_style="pygments" 21 | my_highlight_style="espresso" 22 | 23 | authormeta='John McFarlane and Kurt Pfeifle' 24 | titlemeta='Testing CSL-Styles with pandoc' 25 | 26 | #latex_engine="xelatex" 27 | #latex_engine="lualatex" 28 | latex_engine="pdflatex" 29 | 30 | my_localizations="-V lang=en-US -V otherlangs=de-DE" 31 | #my_localizations="-V lang=de-DE -V otherlangs=en-US" 32 | 33 | my_pandoc_options=" \ 34 | -V geometry=paperwidth=21cm \ 35 | -V geometry:paperheight=42cm \ 36 | -V geometry:margin=0.5cm \ 37 | ${my_localizations} \ 38 | --highlight-style=${my_highlight_style} \ 39 | --filter=pandoc-citeproc \ 40 | --standalone \ 41 | --self-contained \ 42 | --webtex \ 43 | --latex-engine=${latex_engine} \ 44 | --biblio=${my_biblio}" 45 | 46 | #-V hypersetup:author-meta=\"${authormeta}\" \ 47 | #-V hypersetup:title-meta=\"${titlemeta}\" \ 48 | #-H ../resources/usepackagefontspec.tex \ 49 | 50 | PATH=$HOME/.cabal/bin:$PATH 51 | 52 | # The following is required because `stat` has different syntax on Mac and on Linux. 53 | # Also, `open` does not work on Linux, it needs `xdg-open`. 54 | case "$(uname)" in 55 | Darwin) 56 | my_stat_command="stat -f %z " 57 | my_open=open 58 | ;; 59 | Linux) 60 | my_stat_command="stat -c %s " 61 | my_open=xdg-open 62 | ;; 63 | esac 64 | 65 | #time for csl in ~/svn-git-stuff/git.csl-styles/{stuttgart-media-university,small}*.csl; do 66 | #time for csl in ~/svn-git-stuff/git.csl-styles/*.csl; do 67 | time for csl in ~/svn-git-stuff/git.csl-styles/{kritische-ausgabe,thomson-reuters-legal-tax,triangle,universidade-de-sao-paulo-instituto,wissenschaftlicher-industrielogistik-dialog,stuttgart-media-university,thieme-e-journals-vancover,rapid-communications-in-mass-spectrometry,rtf-scan,small,multiple-sclerosis-journal,norma-portuguesa-405,lluelles-lexisnexis}*.csl; do 68 | cslname=$(basename "${csl}") 69 | 70 | # There are some "small" .csl files in this repo which do no work; 71 | # I dunno if they are only "stubs" and not meant to work at all; 72 | # filter them out by running a stupid file size comparison: 73 | #if [ $(${my_stat_command} "${csl}") -gt 2000 ]; then 74 | if [ $(${my_stat_command} "${csl}") -gt 2000 ]; then 75 | ######## LaTeX/PDF... ########################################################## 76 | # Echo the command to the terminal first, so I know what's currently going on... 77 | echo "cat ${my_markdown} \ 78 | | sed 's#___csl_style___#'"${cslname}"'#' \ 79 | | pandoc ${my_pandoc_options} \ 80 | --csl ${csl} \ 81 | -o ${my_output}/${latex_engine}---pandoc-csl-testing---${cslname/.csl/.pdf} \ 82 | - 83 | " | sed 's# *# #g' 84 | 85 | # Nor run the thing... 86 | cat ${my_markdown} \ 87 | | sed 's#___csl_style___#'"${cslname}"'#' \ 88 | | pandoc ${my_pandoc_options} \ 89 | --csl ${csl} \ 90 | -o ${my_output}/${latex_engine}---pandoc-csl-testing---${cslname/.csl/.pdf} \ 91 | - 92 | 93 | return_value=$? 94 | touch ${my_logdir}/${latex_engine}---git.pandoc-csl-testing.log 95 | if [ "x${return_value}" != "x0" ]; then 96 | echo -n " $(date) : ERROR processing source Markdown file ${my_markdown} with ${latex_engine} + style file ${cslname}" \ 97 | | tee -a ${my_logdir}/${latex_engine}---git.pandoc-csl-testing.log 98 | echo | tee -a ${my_logdir}/${latex_engine}---git.pandoc-csl-testing.log 99 | fi 100 | 101 | ######## HTML... ############################################################### 102 | # Echo the command to the terminal first, so I know what's currently going on... 103 | echo "cat ${my_markdown} \ 104 | | sed 's#___csl_style___#'"${cslname}"'#' \ 105 | | pandoc ${my_pandoc_options} \ 106 | --csl ${csl} \ 107 | --standalone \ 108 | -o ${my_output}/html---pandoc-csl-testing---${cslname/.csl/.html} \ 109 | - 110 | " | sed 's# *# #g' 111 | 112 | # Nor run the thing... 113 | cat ${my_markdown} \ 114 | | sed 's#___csl_style___#'"${cslname}"'#' \ 115 | | pandoc ${my_pandoc_options} \ 116 | --csl ${csl} \ 117 | --standalone \ 118 | -o ${my_output}/html---pandoc-csl-testing---${cslname/.csl/.html} \ 119 | - 120 | 121 | return_value=$? 122 | touch ${my_logdir}/html---git.pandoc-csl-testing.log 123 | if [ "x${return_value}" != "x0" ]; then 124 | echo -n " $(date) : ERROR converting source Markdown file ${my_markdown} + style file ${cslname} to HTML" \ 125 | | tee -a ${my_logdir}/html---git.pandoc-csl-testing.log 126 | echo | tee -a ${my_logdir}/html---git.pandoc-csl-testing.log 127 | fi 128 | 129 | ######## EPUB3... ############################################################## 130 | # Echo the command to the terminal first, so I know what's currently going on... 131 | echo "cat ${my_markdown} \ 132 | | sed 's#___csl_style___#'"${cslname}"'#' \ 133 | | pandoc ${my_pandoc_options} \ 134 | --csl ${csl} \ 135 | --standalone \ 136 | --to=epub3 \ 137 | -o ${my_output}/epub3-pandoc-csl-testing---${cslname/.csl/.epub} \ 138 | - 139 | " | sed 's# *# #g' 140 | 141 | # Nor run the thing... 142 | cat ${my_markdown} \ 143 | | sed 's#___csl_style___#'"${cslname}"'#' \ 144 | | pandoc ${my_pandoc_options} \ 145 | --csl ${csl} \ 146 | --standalone \ 147 | --to=epub3 \ 148 | -o ${my_output}/epub3-pandoc-csl-testing---${cslname/.csl/.epub} \ 149 | - 150 | 151 | return_value=$? 152 | touch ${my_logdir}/epub3---git.pandoc-csl-testing.log 153 | if [ "x${return_value}" != "x0" ]; then 154 | echo -n " $(date) : ERROR converting source Markdown file ${my_markdown} + style file ${cslname} to EPUB3" \ 155 | | tee -a ${my_logdir}/epub3---git.pandoc-csl-testing.log 156 | echo | tee -a ${my_logdir}/epub3---git.pandoc-csl-testing.log 157 | fi 158 | 159 | else 160 | #echo "${csl} is not a decent CSL style file: filesize is only $(${my_stat_command} "${csl}") Bytes." \ 161 | echo "${csl} is not a decent CSL style file: filesize is only $(stat -c "%s" "${csl}") Bytes." \ 162 | | tee -a ${my_logdir}/epub3---git.pandoc-csl-testing.log 163 | echo | tee -a ${my_logdir}/epub3---git.pandoc-csl-testing.log 164 | fi 165 | 166 | done 167 | 168 | echo 169 | echo "ERRORS for EPUB3 output:" 170 | grep ERROR ${my_logdir}/epub3---git.pandoc-csl-testing.log 171 | echo 172 | 173 | echo "ERRORS for HTML output:" 174 | grep ERROR ${my_logdir}/html---git.pandoc-csl-testing.log 175 | echo 176 | 177 | echo "ERRORS for PDF output:" 178 | grep ERROR ${my_logdir}/*latex---git.pandoc-csl-testing.log 179 | echo 180 | 181 | ## Now look at the actual files generated by above commands; 182 | ## Linux users have to use `xdg-open` instead of `open`: 183 | #for i in ${my_output}/epub3---pandoc-csl-testing---*.epub; do ${my_open} "${i}"; done 184 | #for i in ${my_output}/html---pandoc-csl-testing---*.html; do ${my_open} "${i}"; done 185 | for i in ${my_output}/*latex---pandoc-csl-testing---*.pdf; do ${my_open} "${i}"; done 186 | 187 | 188 | --------------------------------------------------------------------------------