diff options
45 files changed, 1186 insertions, 497 deletions
@@ -14,10 +14,10 @@ Pandoc is a [Haskell] library for converting from one markup format to another, and a command-line tool that uses this library. It can read [markdown] and (subsets of) [Textile], [reStructuredText], [HTML], and [LaTeX]; and it can write plain text, [markdown], [reStructuredText], -[HTML], [LaTeX], [ConTeXt], [RTF], [DocBook XML], [OpenDocument XML], [ODT], -[GNU Texinfo], [MediaWiki markup], [EPUB], [Textile], [groff man] pages, -[Emacs Org-Mode], [AsciiDoc], and [Slidy], [DZSlides], or [S5] HTML -slide shows. +[XHTML], [HTML 5], [LaTeX], [LaTeX beamer], [ConTeXt], [RTF], [DocBook XML], +[OpenDocument XML], [ODT], [GNU Texinfo], [MediaWiki markup], [EPUB], +[Textile], [groff man] pages, [Emacs Org-Mode], [AsciiDoc], and [Slidy], +[DZSlides], or [S5] HTML slide shows. Pandoc's enhanced version of markdown includes syntax for footnotes, tables, flexible ordered lists, definition lists, delimited code blocks, @@ -151,20 +151,19 @@ Options `-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT* : Specify output format. *FORMAT* can be `native` (native Haskell), `json` (JSON version of native AST), `plain` (plain text), - `markdown` (markdown), `rst` (reStructuredText), - `html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man), - `mediawiki` (MediaWiki markup), `textile` (Textile), `org` (Emacs - Org-Mode), `texinfo` (GNU Texinfo), `docbook` (DocBook XML), - `opendocument` (OpenDocument XML), `odt` (OpenOffice text document), - `epub` (EPUB book), `asciidoc` (AsciiDoc), `slidy` (Slidy HTML and - javascript slide show), `dzslides` (HTML5 + javascript slide show), - `s5` (S5 HTML and javascript slide show), or `rtf` (rich text - format). Note that `odt` and `epub` output will not be directed to - *stdout*; an output filename must be specified using the `-o/--output` - option. If `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`, - the output will be rendered as literate Haskell source: - see [Literate Haskell support](#literate-haskell-support), - below. + `markdown` (markdown), `rst` (reStructuredText), `html` (XHTML 1), + `html5` (HTML 5), `latex` (LaTeX), `beamer` (LaTeX beamer), `context` + (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup), `textile` + (Textile), `org` (Emacs Org-Mode), `texinfo` (GNU Texinfo), `docbook` + (DocBook XML), `opendocument` (OpenDocument XML), `odt` (OpenOffice text + document), `epub` (EPUB book), `asciidoc` (AsciiDoc), `slidy` (Slidy HTML + and javascript slide show), `dzslides` (HTML5 + javascript slide show), + `s5` (S5 HTML and javascript slide show), or `rtf` (rich text format). + Note that `odt` and `epub` output will not be directed to *stdout*; + an output filename must be specified using the `-o/--output` option. + If `+lhs` is appended to `markdown`, `rst`, `latex`, `html`, or `html5`, + the output will be rendered as literate Haskell source: see [Literate + Haskell support](#literate-haskell-support), below. `-s`, `--standalone` : Produce output with an appropriate header and footer (e.g. a @@ -215,7 +214,16 @@ Options `-5`, `--html5` : Produce HTML5 instead of HTML4. This option has no effect for writers - other than `html`. + other than `html`. (*Deprecated:* Use the `html5` output format instead.) + +`--no-highlight` +: Disables syntax highlighting for code blocks and inlines, even when + a language attribute is given. + +`--highlight-style`=*STYLE* +: Specifies the coloring style to be used in highlighted source code. + Options are `pygments` (the default), `kate`, `monochrome`, + `espresso`, `haddock`, and `tango`. `-m` [*URL*], `--latexmathml`[=*URL*] : Use the [LaTeXMathML] script to display embedded TeX math in HTML output. @@ -269,11 +277,11 @@ Options images, and videos. The resulting file should be "self-contained," in the sense that it needs no external files and no net access to be displayed properly by a browser. This option works only with HTML output - formats, including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`. - Scripts, images, and stylesheets at absolute URLs will be downloaded; - those at relative URLs will be sought first relative to the working - directory, then relative to the user data directory (see `--data-dir`), - and finally relative to pandoc's default data directory. + formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`, + `slidy`, and `dzslides`. Scripts, images, and stylesheets at absolute URLs + will be downloaded; those at relative URLs will be sought first relative + to the working directory, then relative to the user data directory (see + `--data-dir`), and finally relative to pandoc's default data directory. `--offline` : Deprecated synonym for `--self-contained`. @@ -571,6 +579,14 @@ depending on the output format, but include: `http://www.w3.org/Talks/Tools/Slidy2`) `s5-url` : base URL for S5 documents (defaults to `ui/default`) +`font-size` +: font size (10pt, 11pt, 12pt) for LaTeX and beamer documents +`documentclass` +: document class for LaTeX documents +`theme` +: theme for beamer documents +`colortheme` +: colortheme for beamer documents Variables may be set at the command line using the `-V/--variable` option. This allows users to include custom variables in their @@ -837,15 +853,15 @@ this syntax: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} qsort [] = [] qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ - qsort (filter (>= x) xs) + qsort (filter (>= x) xs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some output formats can use this information to do syntax highlighting. -Currently, the only output format that uses this information is HTML. -If highlighting is supported for your output format and language, then the -code block above will appear highlighted, with numbered lines. (To see -which languages are supported, do `pandoc --version`.) Otherwise, the -code block above will appear as follows: +Currently, the only output formats that uses this information are HTML +and LaTeX. If highlighting is supported for your output format and language, +then the code block above will appear highlighted, with numbered lines. (To +see which languages are supported, do `pandoc --version`.) Otherwise, the code +block above will appear as follows: <pre class="haskell"> <code> @@ -853,6 +869,8 @@ code block above will appear as follows: </code> </pre> +To prevent all highlighting, use the `--no-highlight` flag. +To set the highlighting style, use `--highlight-style`. Lists ----- @@ -1892,12 +1910,14 @@ document with an appropriate header: The bibliography will be inserted after this header. -Producing HTML slide shows with Pandoc -====================================== +Producing slide shows with Pandoc +================================= You can use Pandoc to produce an HTML + javascript slide presentation that can be viewed via a web browser. There are three ways to do this, -using [S5], [DZSlides], or [Slidy]. +using [S5], [DZSlides], or [Slidy]. You can also produce a PDF slide +show using [LaTeX beamer]: just pass the `--beamer` option to +`markdown2pdf`. Here's the markdown source for a simple slide show, `eating.txt`: @@ -1935,6 +1955,7 @@ for DZSlides. A title page is constructed automatically from the document's title block. Each level-one header and horizontal rule begins a new slide. +(If beamer is used, all headers begin a new slide.) For Slidy and S5, the file produced by pandoc with the `-s/--standalone` option embeds a link to javascripts and CSS files, which are assumed to @@ -1973,8 +1994,8 @@ Literate Haskell support ======================== If you append `+lhs` to an appropriate input or output format (`markdown`, -`rst`, or `latex` for input or output; `html` for output only), pandoc -will treat the document as literate Haskell source. This means that +`rst`, or `latex` for input or output; `html` or `html5` for output only), +pandoc will treat the document as literate Haskell source. This means that - In markdown input, "bird track" sections will be parsed as Haskell code rather than block quotations. Text between `\begin{code}` @@ -2031,7 +2052,9 @@ Christopher Sawicki, Kelsey Hightower. [S5]: http://meyerweb.com/eric/tools/s5/ [Slidy]: http://www.w3.org/Talks/Tools/Slidy/ [HTML]: http://www.w3.org/TR/html40/ +[XHTML]: http://www.w3.org/TR/xhtml1/ [LaTeX]: http://www.latex-project.org/ +[LaTeX beamer]: http://www.tex.ac.uk/CTAN/macros/latex/contrib/beamer [ConTeXt]: http://www.pragma-ade.nl/ [RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format [DocBook XML]: http://www.docbook.org/ diff --git a/dzslides/template.html b/dzslides/template.html new file mode 100644 index 000000000..591664f30 --- /dev/null +++ b/dzslides/template.html @@ -0,0 +1,514 @@ +<!DOCTYPE html> + +<meta charset="utf-8"> +<title>The Title Of Your Presentation</title> + +<!-- Your Slides --> +<!-- One section is one slide --> + +<section> + <!-- This is the first slide --> + <h1>My Presentation</h1> + <footer>by John Doe</footer> +</section> + +<section> + <h2>Part one</h2> +</section> + +<section> + <h3>An incremental list</h3> + <ul class="incremental"> + <li>Item 1 + <li>Item 2 + <li>Item 3 + </ul> +</section> + +<section> + <q> + Soothe us with sweet lies. Is that a cooking show? No! I want to + live! There are still too many things I don't own! + </q> +</section> + +<section> + <h2>Part two</h2> +</section> + +<section> + <h3>An image</h3> + <img src="http://placekitten.com/g/800/600"> +</section> + +<section> + <h3>A video</h3> + <video src="http://videos-cdn.mozilla.net/brand/Mozilla_Firefox_Manifesto_v0.2_640.webm" poster="http://www.mozilla.org/images/about/poster.jpg"></video> +</section> + +<section> + <h2>End!</h2> +</section> + +<!-- Your Style --> +<!-- Define the style of your presentation --> + +<!-- Maybe a font from http://www.google.com/webfonts ? --> +<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet'> + +<style> + html { background-color: black; } + body { background-color: white; } + /* A section is a slide. It's size is 800x600, and this will never change */ + section { + /* The font from Google */ + font-family: 'Oswald', arial, serif; + font-size: 40px; + } + h1, h2 { + margin-top: 200px; + text-align: center; + font-size: 80px; + } + h3 { + margin: 100px 0 50px 100px; + } + + ul { + margin: 50px 200px; + } + + q { + display: inline-block; + width: 700px; + height: 600px; + background-color: black; + color: white; + font-size: 60px; + padding: 50px; + } + + img, video { + width: 800px; + height: 600px; + position: absolute; + top: 0; + background-color: black; + z-index: -1; + } + + footer { + position: absolute; + bottom: 10px; + right: 20px; + } + + /* Transition effect */ + /* Feel free to change the transition effect for original + animations. See here: + https://developer.mozilla.org/en/CSS/CSS_transitions + How to use CSS3 Transitions: */ + section { + -moz-transition: left 400ms linear 0s; + -webkit-transition: left 400ms linear 0s; + -ms-transition: left 400ms linear 0s; + transition: left 400ms linear 0s; + } + + /* Before */ + section { left: -150%; } + /* Now */ + section[aria-selected] { left: 0; } + /* After */ + section[aria-selected] ~ section { left: +150%; } + + /* Incremental elements */ + + /* By default, visible */ + .incremental > * { opacity: 1; } + + /* The current item */ + .incremental > *[aria-selected] { color: red; opacity: 1; } + + /* The items to-be-selected */ + .incremental > *[aria-selected] ~ * { opacity: 0.2; } + +</style> + +<!-- {{{{ dzslides core +# +# +# __ __ __ . __ ___ __ +# | \ / /__` | | | \ |__ /__` +# |__/ /_ .__/ |___ | |__/ |___ .__/ core :€ +# +# +# The following block of code is not supposed to be edited. +# But if you want to change the behavior of these slides, +# feel free to hack it! +# +--> + +<!-- Default Style --> +<style> + * { margin: 0; padding: 0; } + details { display: none; } + body { + width: 800px; height: 600px; + margin-left: -400px; margin-top: -300px; + position: absolute; top: 50%; left: 50%; + overflow: hidden; + } + section { + position: absolute; + pointer-events: none; + width: 100%; height: 100%; + } + section[aria-selected] { pointer-events: auto; } + html { overflow: hidden; } + body { display: none; } + body.loaded { display: block; } + .incremental {visibility: hidden; } + .incremental[active] {visibility: visible; } +</style> + +<script> + var Dz = { + remoteWindows: [], + idx: -1, + step: 0, + slides: null, + params: { + autoplay: "1" + } + }; + + Dz.init = function() { + document.body.className = "loaded"; + this.slides = $$("body > section"); + this.setupParams(); + this.onhashchange(); + this.setupTouchEvents(); + this.onresize(); + } + + Dz.setupParams = function() { + var p = window.location.search.substr(1).split('&'); + p.forEach(function(e, i, a) { + var keyVal = e.split('='); + Dz.params[keyVal[0]] = decodeURIComponent(keyVal[1]); + }); + } + + Dz.onkeydown = function(aEvent) { + // Don't intercept keyboard shortcuts + if (aEvent.altKey + || aEvent.ctrlKey + || aEvent.metaKey + || aEvent.shiftKey) { + return; + } + if ( aEvent.keyCode == 37 // left arrow + || aEvent.keyCode == 38 // up arrow + || aEvent.keyCode == 33 // page up + ) { + aEvent.preventDefault(); + this.back(); + } + if ( aEvent.keyCode == 39 // right arrow + || aEvent.keyCode == 40 // down arrow + || aEvent.keyCode == 34 // page down + ) { + aEvent.preventDefault(); + this.forward(); + } + if (aEvent.keyCode == 35) { // end + aEvent.preventDefault(); + this.goEnd(); + } + if (aEvent.keyCode == 36) { // home + aEvent.preventDefault(); + this.goStart(); + } + if (aEvent.keyCode == 32) { // space + aEvent.preventDefault(); + this.toggleContent(); + } + } + + /* Touch Events */ + + Dz.setupTouchEvents = function() { + var orgX, newX; + var tracking = false; + + var db = document.body; + db.addEventListener("touchstart", start.bind(this), false); + db.addEventListener("touchmove", move.bind(this), false); + + function start(aEvent) { + aEvent.preventDefault(); + tracking = true; + orgX = aEvent.changedTouches[0].pageX; + } + + function move(aEvent) { + if (!tracking) return; + newX = aEvent.changedTouches[0].pageX; + if (orgX - newX > 100) { + tracking = false; + this.forward(); + } else { + if (orgX - newX < -100) { + tracking = false; + this.back(); + } + } + } + } + + /* Adapt the size of the slides to the window */ + + Dz.onresize = function() { + var db = document.body; + var sx = db.clientWidth / window.innerWidth; + var sy = db.clientHeight / window.innerHeight; + var transform = "scale(" + (1/Math.max(sx, sy)) + ")"; + + db.style.MozTransform = transform; + db.style.WebkitTransform = transform; + db.style.OTransform = transform; + db.style.msTransform = transform; + db.style.transform = transform; + } + + + Dz.getDetails = function(aIdx) { + var s = $("section:nth-of-type(" + aIdx + ")"); + var d = s.$("details"); + return d ? d.innerHTML : ""; + } + + Dz.onmessage = function(aEvent) { + var argv = aEvent.data.split(" "), argc = argv.length; + argv.forEach(function(e, i, a) { a[i] = decodeURIComponent(e) }); + var win = aEvent.source; + if (argv[0] === "REGISTER" && argc === 1) { + this.remoteWindows.push(win); + this.postMsg(win, "REGISTERED", document.title, this.slides.length); + this.postMsg(win, "CURSOR", this.idx + "." + this.step); + return; + } + if (argv[0] === "BACK" && argc === 1) + this.back(); + if (argv[0] === "FORWARD" && argc === 1) + this.forward(); + if (argv[0] === "START" && argc === 1) + this.goStart(); + if (argv[0] === "END" && argc === 1) + this.goEnd(); + if (argv[0] === "TOGGLE_CONTENT" && argc === 1) + this.toggleContent(); + if (argv[0] === "SET_CURSOR" && argc === 2) + window.location.hash = "#" + argv[1]; + if (argv[0] === "GET_CURSOR" && argc === 1) + this.postMsg(win, "CURSOR", this.idx + "." + this.step); + if (argv[0] === "GET_NOTES" && argc === 1) + this.postMsg(win, "NOTES", this.getDetails(this.idx)); + } + + Dz.toggleContent = function() { + // If a Video is present in this new slide, play it. + // If a Video is present in the previous slide, stop it. + var s = $("section[aria-selected]"); + if (s) { + var video = s.$("video"); + if (video) { + if (video.ended || video.paused) { + video.play(); + } else { + video.pause(); + } + } + } + } + + Dz.setCursor = function(aIdx, aStep) { + // If the user change the slide number in the URL bar, jump + // to this slide. + aStep = (aStep != 0 && typeof aStep !== "undefined") ? "." + aStep : ".0"; + window.location.hash = "#" + aIdx + aStep; + } + + Dz.onhashchange = function() { + var cursor = window.location.hash.split("#"), + newidx = 1, + newstep = 0; + if (cursor.length == 2) { + newidx = ~~cursor[1].split(".")[0]; + newstep = ~~cursor[1].split(".")[1]; + if (newstep > Dz.slides[newidx - 1].$$('.incremental > *').length) { + newstep = 0; + newidx++; + } + } + if (newidx != this.idx) { + this.setSlide(newidx); + } + if (newstep != this.step) { + this.setIncremental(newstep); + } + for (var i = 0; i < this.remoteWindows.length; i++) { + this.postMsg(this.remoteWindows[i], "CURSOR", this.idx + "." + this.step); + } + } + + Dz.back = function() { + if (this.idx == 1 && this.step == 0) { + return; + } + if (this.step == 0) { + this.setCursor(this.idx - 1, + this.slides[this.idx - 2].$$('.incremental > *').length); + } else { + this.setCursor(this.idx, this.step - 1); + } + } + + Dz.forward = function() { + if (this.idx >= this.slides.length && + this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) { + return; + } + if (this.step >= this.slides[this.idx - 1].$$('.incremental > *').length) { + this.setCursor(this.idx + 1, 0); + } else { + this.setCursor(this.idx, this.step + 1); + } + } + + Dz.goStart = function() { + this.setCursor(1, 0); + } + + Dz.goEnd = function() { + var lastIdx = this.slides.length; + var lastStep = this.slides[lastIdx - 1].$$('.incremental > *').length; + this.setCursor(lastIdx, lastStep); + } + + Dz.setSlide = function(aIdx) { + this.idx = aIdx; + var old = $("section[aria-selected]"); + var next = $("section:nth-of-type("+ this.idx +")"); + if (old) { + old.removeAttribute("aria-selected"); + var video = old.$("video"); + if (video) { + video.pause(); + } + } + if (next) { + next.setAttribute("aria-selected", "true"); + var video = next.$("video"); + if (video && !!+this.params.autoplay) { + video.play(); + } + } else { + // That should not happen + this.idx = -1; + // console.warn("Slide doesn't exist."); + } + } + + Dz.setIncremental = function(aStep) { + this.step = aStep; + var old = this.slides[this.idx - 1].$('.incremental > *[aria-selected]'); + if (old) { + old.removeAttribute('aria-selected'); + } + var incrementals = this.slides[this.idx - 1].$$('.incremental'); + if (this.step <= 0) { + incrementals.forEach(function(aNode) { + aNode.removeAttribute('active'); + }); + return; + } + var next = this.slides[this.idx - 1].$$('.incremental > *')[this.step - 1]; + if (next) { + next.setAttribute('aria-selected', true); + next.parentNode.setAttribute('active', true); + var found = false; + incrementals.forEach(function(aNode) { + if (aNode != next.parentNode) + if (found) + aNode.removeAttribute('active'); + else + aNode.setAttribute('active', true); + else + found = true; + }); + } else { + setCursor(this.idx, 0); + } + return next; + } + + Dz.postMsg = function(aWin, aMsg) { // [arg0, [arg1...]] + aMsg = [aMsg]; + for (var i = 2; i < arguments.length; i++) + aMsg.push(encodeURIComponent(arguments[i])); + aWin.postMessage(aMsg.join(" "), "*"); + } + + window.onload = Dz.init.bind(Dz); + window.onkeydown = Dz.onkeydown.bind(Dz); + window.onresize = Dz.onresize.bind(Dz); + window.onhashchange = Dz.onhashchange.bind(Dz); + window.onmessage = Dz.onmessage.bind(Dz); +</script> + + +<script> // Helpers + if (!Function.prototype.bind) { + Function.prototype.bind = function (oThis) { + + // closest thing possible to the ECMAScript 5 internal IsCallable + // function + if (typeof this !== "function") + throw new TypeError( + "Function.prototype.bind - what is trying to be fBound is not callable" + ); + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function () {}, + fBound = function () { + return fToBind.apply( this instanceof fNOP ? this : oThis || window, + aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + }; + } + + var $ = (HTMLElement.prototype.$ = function(aQuery) { + return this.querySelector(aQuery); + }).bind(document); + + var $$ = (HTMLElement.prototype.$$ = function(aQuery) { + return this.querySelectorAll(aQuery); + }).bind(document); + + NodeList.prototype.forEach = function(fun) { + if (typeof fun !== "function") throw new TypeError(); + for (var i = 0; i < this.length; i++) { + fun.call(this, this[i]); + } + } + +</script> +<!-- vim: set fdm=marker: }}} --> diff --git a/pandoc.cabal b/pandoc.cabal index 13e5d2375..d865862a3 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -74,6 +74,8 @@ Data-Files: slidy/graphics/nofold-dim.gif, slidy/graphics/unfold-dim.gif, slidy/graphics/fold-dim.gif, + -- data for dzslides writer + dzslides/template.html, -- data for citeproc default.csl, -- documentation diff --git a/src/Tests/Arbitrary.hs b/src/Tests/Arbitrary.hs index 986e3e4d5..9d65e1f1f 100644 --- a/src/Tests/Arbitrary.hs +++ b/src/Tests/Arbitrary.hs @@ -41,10 +41,6 @@ arbInline :: Int -> Gen Inline arbInline n = frequency $ [ (60, liftM Str realString) , (60, return Space) , (10, liftM2 Code arbAttr realString) - , (5, return EmDash) - , (5, return EnDash) - , (5, return Apostrophe) - , (5, return Ellipses) , (5, elements [ RawInline "html" "<a id=\"eek\">" , RawInline "latex" "\\my{command}" ]) ] ++ [ x | x <- nesters, n > 1] diff --git a/src/Tests/Readers/LaTeX.hs b/src/Tests/Readers/LaTeX.hs index 781867597..7d8aeb3e9 100644 --- a/src/Tests/Readers/LaTeX.hs +++ b/src/Tests/Readers/LaTeX.hs @@ -87,7 +87,7 @@ natbibCitations = testGroup "natbib" , "group" =: "\\citetext{\\citealp[see][p.~34--35]{item1}; \\citealp[also][chap. 3]{item3}}" =?> para (cite [baseCitation{ citationMode = NormalCitation , citationPrefix = [Str "see"] - , citationSuffix = [Str "p.\160\&34",EnDash,Str "35"] } + , citationSuffix = [Str "p.\160\&34",Str "-",Str "35"] } ,baseCitation{ citationMode = NormalCitation , citationId = "item3" , citationPrefix = [Str "also"] @@ -95,7 +95,7 @@ natbibCitations = testGroup "natbib" ] mempty) , "suffix and locator" =: "\\citep[pp.~33, 35--37, and nowhere else]{item1}" =?> para (cite [baseCitation{ citationMode = NormalCitation - , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty) + , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",Str "-",Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty) , "suffix only" =: "\\citep[and nowhere else]{item1}" =?> para (cite [baseCitation{ citationMode = NormalCitation , citationSuffix = toList $ text "and nowhere else" }] mempty) @@ -134,7 +134,7 @@ biblatexCitations = testGroup "biblatex" , "group" =: "\\autocites[see][p.~34--35]{item1}[also][chap. 3]{item3}" =?> para (cite [baseCitation{ citationMode = NormalCitation , citationPrefix = [Str "see"] - , citationSuffix = [Str "p.\160\&34",EnDash,Str "35"] } + , citationSuffix = [Str "p.\160\&34",Str "-",Str "35"] } ,baseCitation{ citationMode = NormalCitation , citationId = "item3" , citationPrefix = [Str "also"] @@ -142,7 +142,7 @@ biblatexCitations = testGroup "biblatex" ] mempty) , "suffix and locator" =: "\\autocite[pp.~33, 35--37, and nowhere else]{item1}" =?> para (cite [baseCitation{ citationMode = NormalCitation - , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",EnDash,Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty) + , citationSuffix = [Str "pp.\160\&33,",Space,Str "35",Str "-",Str "37,",Space,Str "and",Space,Str "nowhere",Space, Str "else"] }] mempty) , "suffix only" =: "\\autocite[and nowhere else]{item1}" =?> para (cite [baseCitation{ citationMode = NormalCitation , citationSuffix = toList $ text "and nowhere else" }] mempty) diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs index 3c0cb9a3a..aa8a312ff 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/src/Tests/Readers/Markdown.hs @@ -60,7 +60,13 @@ tests = [ testGroup "inline code" , testGroup "smart punctuation" [ test markdownSmart "quote before ellipses" ("'...hi'" - =?> para (singleQuoted (singleton Ellipses <> "hi"))) + =?> para (singleQuoted ("…hi"))) + , test markdownSmart "apostrophe before emph" + ("D'oh! A l'*aide*!" + =?> para ("D’oh! A l’" <> emph "aide" <> "!")) + , test markdownSmart "apostrophe in French" + ("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»" + =?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»")) ] , testGroup "mixed emphasis and strong" [ "emph and strong emph alternating" =: diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index eb2a56ba8..e3c029992 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -171,8 +171,13 @@ writers :: [ ( String, WriterOptions -> Pandoc -> String ) ] writers = [("native" , writeNative) ,("json" , \_ -> encodeJSON) ,("html" , writeHtmlString) + ,("html5" , \o -> + writeHtmlString o{ writerHtml5 = True }) ,("html+lhs" , \o -> writeHtmlString o{ writerLiterateHaskell = True }) + ,("html5+lhs" , \o -> + writeHtmlString o{ writerLiterateHaskell = True, + writerHtml5 = True }) ,("s5" , writeHtmlString) ,("slidy" , writeHtmlString) ,("dzslides" , writeHtmlString) @@ -181,6 +186,8 @@ writers = [("native" , writeNative) ,("latex" , writeLaTeX) ,("latex+lhs" , \o -> writeLaTeX o{ writerLiterateHaskell = True }) + ,("beamer" , \o -> + writeLaTeX o{ writerBeamer = True }) ,("context" , writeConTeXt) ,("texinfo" , writeTexinfo) ,("man" , writeMan) diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index c65d23f93..a40bab66a 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -29,57 +29,48 @@ Exports functions for syntax highlighting. -} module Text.Pandoc.Highlighting ( languages - , highlightHtml - , highlightLaTeX - , defaultHighlightingCss - , defaultLaTeXMacros , languagesByExtension + , highlight + , formatLaTeXInline + , formatLaTeXBlock + , styleToLaTeX + , formatHtmlInline + , formatHtmlBlock + , styleToHtml + , pygments + , espresso + , tango + , kate + , monochrome + , haddock + , Style ) where -import Text.Blaze import Text.Pandoc.Definition -import Text.Highlighting.Kate ( SourceLine, languages, highlightAs, formatAsHtml, - TokenType(..), formatAsLaTeX, FormatOption (..), defaultHighlightingCss, - defaultLaTeXMacros, languagesByExtension ) +import Text.Highlighting.Kate import Data.List (find) import Data.Maybe (fromMaybe) import Data.Char (toLower) -import qualified Text.Blaze.Html5.Attributes as A -highlight :: ([FormatOption] -> String -> [SourceLine] -> a) -- ^ Formatter - -> Bool -- ^ True if inline - -> Attr -- ^ Attributes of the Code or CodeBlock - -> String -- ^ Raw contents of the Code or CodeBlock - -> Maybe a -- ^ Maybe the formatted result -highlight formatter inline (_, classes, keyvals) rawCode = +lcLanguages :: [String] +lcLanguages = map (map toLower) languages + +highlight :: (FormatOptions -> [SourceLine] -> a) -- ^ Formatter + -> Attr -- ^ Attributes of the CodeBlock + -> String -- ^ Raw contents of the CodeBlock + -> Maybe a -- ^ Maybe the formatted result +highlight formatter (_, classes, keyvals) rawCode = let firstNum = case reads (fromMaybe "1" $ lookup "startFrom" keyvals) of ((n,_):_) -> n [] -> 1 - fmtOpts = [OptNumberFrom firstNum] ++ - [OptInline | inline] ++ - case find (`elem` ["number","numberLines","number-lines"]) classes of - Nothing -> [] - Just _ -> [OptNumberLines] - addBirdTracks = "literate" `elem` classes - lcLanguages = map (map toLower) languages - in case find (\c -> (map toLower c) `elem` lcLanguages) classes of + fmtOpts = defaultFormatOpts{ + startNumber = firstNum, + numberLines = any (`elem` + ["number","numberLines", "number-lines"]) classes } + lcclasses = map (map toLower) classes + in case find (`elem` lcLanguages) lcclasses of Nothing -> Nothing Just language -> Just - $ formatter fmtOpts language . - (if addBirdTracks - then map ((OtherTok,"> "):) - else id) + $ formatter fmtOpts{ codeClasses = [language], + containerClasses = classes } $ highlightAs language rawCode -highlightHtml :: Bool -- ^ True if inline HTML - -> Attr -- ^ Attributes of the Code or CodeBlock - -> String -- ^ Raw contents of the Code or CodeBlock - -> Maybe Html -- ^ Maybe formatted Html -highlightHtml inline attr@(id',_,_) = fmap addId . highlight formatAsHtml inline attr - where addId = if null id' then id else (! A.id (toValue id')) - -highlightLaTeX :: Bool -- ^ True if inline - -> Attr -- ^ Attributes of the Code or CodeBlock - -> String -- ^ Raw contents of the Code or CodeBlock - -> Maybe String -- ^ Maybe formatted LaTeX -highlightLaTeX = highlight formatAsLaTeX - diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 937deb484..5fa375ca6 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -704,7 +704,7 @@ smartPunctuation inlineParser = do choice [ quoted inlineParser, apostrophe, dash, ellipses ] apostrophe :: GenParser Char ParserState Inline -apostrophe = (char '\'' <|> char '\8217') >> return Apostrophe +apostrophe = (char '\'' <|> char '\8217') >> return (Str "\x2019") quoted :: GenParser Char ParserState Inline -> GenParser Char ParserState Inline @@ -779,22 +779,22 @@ doubleQuoteEnd = do ellipses :: GenParser Char st Inline ellipses = do - try (charOrRef "…\133") <|> try (string "..." >> return '…') - return Ellipses + try (charOrRef "\8230\133") <|> try (string "..." >> return '…') + return (Str "\8230") dash :: GenParser Char st Inline dash = enDash <|> emDash enDash :: GenParser Char st Inline enDash = do - try (charOrRef "–\150") <|> + try (charOrRef "\8211\150") <|> try (char '-' >> lookAhead (satisfy isDigit) >> return '–') - return EnDash + return (Str "\8211") emDash :: GenParser Char st Inline emDash = do - try (charOrRef "—\151") <|> (try $ string "--" >> optional (char '-') >> return '—') - return EmDash + try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-') + return (Str "\8212") -- -- Macros diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 9ad31cba5..708aa58c1 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -771,7 +771,7 @@ subscript = try $ string "\\textsubscript{" >> manyTill inline (char '}') >>= return . Subscript apostrophe :: GenParser Char ParserState Inline -apostrophe = char '\'' >> return Apostrophe +apostrophe = char '\'' >> return (Str "\x2019") quoted :: GenParser Char ParserState Inline quoted = doubleQuoted <|> singleQuoted @@ -802,13 +802,13 @@ ellipses = try $ do optional $ char 'l' string "dots" optional $ try $ string "{}" - return Ellipses + return (Str "…") enDash :: GenParser Char st Inline -enDash = try (string "--") >> return EnDash +enDash = try (string "--") >> return (Str "-") emDash :: GenParser Char st Inline -emDash = try (string "---") >> return EmDash +emDash = try (string "---") >> return (Str "—") hyphen :: GenParser Char st Inline hyphen = char '-' >> return (Str "-") diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index cc9b8a23d..db68df629 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -44,7 +44,7 @@ import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockT isTextTag, isCommentTag ) import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.ParserCombinators.Parsec -import Control.Monad (when, liftM, guard) +import Control.Monad (when, liftM, guard, mzero) import Text.HTML.TagSoup import Text.HTML.TagSoup.Match (tagOpen) @@ -1087,12 +1087,18 @@ nonEndline = satisfy (/='\n') str :: GenParser Char ParserState Inline str = do + smart <- stateSmart `fmap` getState a <- alphaNum - as <- many $ alphaNum <|> (try $ char '_' >>~ lookAhead alphaNum) + as <- many $ alphaNum + <|> (try $ char '_' >>~ lookAhead alphaNum) + <|> if smart + then (try $ satisfy (\c -> c == '\'' || c == '\x2019') >> + lookAhead alphaNum >> return '\x2019') + -- for things like l'aide + else mzero let result = a:as - state <- getState let spacesToNbr = map (\c -> if c == ' ' then '\160' else c) - if stateSmart state + if smart then case likelyAbbrev result of [] -> return $ Str result xs -> choice (map (\x -> diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index fac965b89..ba007f5e4 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -81,6 +81,7 @@ import System.FilePath ( (</>) ) import Data.Generics (Typeable, Data) import qualified Control.Monad.State as S import Paths_pandoc (getDataFileName) +import Text.Pandoc.Highlighting (Style, pygments) -- -- List processing @@ -325,10 +326,6 @@ stringify = queryWith go go (Str x) = x go (Code _ x) = x go (Math _ x) = x - go EmDash = "--" - go EnDash = "-" - go Apostrophe = "'" - go Ellipses = "..." go LineBreak = " " go _ = "" @@ -480,9 +477,11 @@ data WriterOptions = WriterOptions , writerCiteMethod :: CiteMethod -- ^ How to print cites , writerBiblioFiles :: [FilePath] -- ^ Biblio files to use for citations , writerHtml5 :: Bool -- ^ Produce HTML5 + , writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show , writerChapters :: Bool -- ^ Use "chapter" for top-level sects , writerListings :: Bool -- ^ Use listings package for code , writerHighlight :: Bool -- ^ Highlight source code + , writerHighlightStyle :: Style -- ^ Style to use for highlighting } deriving Show {-# DEPRECATED writerXeTeX "writerXeTeX no longer does anything" #-} @@ -514,9 +513,11 @@ defaultWriterOptions = , writerCiteMethod = Citeproc , writerBiblioFiles = [] , writerHtml5 = False + , writerBeamer = False , writerChapters = False , writerListings = False , writerHighlight = False + , writerHighlightStyle = pygments } -- diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index a7e836126..0d627e447 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -85,6 +85,7 @@ getDefaultTemplate _ "native" = return $ Right "" getDefaultTemplate _ "json" = return $ Right "" getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument" getDefaultTemplate user "epub" = getDefaultTemplate user "html" +getDefaultTemplate user "beamer" = getDefaultTemplate user "latex" getDefaultTemplate user writer = do let format = takeWhile (/='+') writer -- strip off "+lhs" if present let fname = "templates" </> "default" <.> format diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index f45c20e9e..1913eb92b 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -321,10 +321,6 @@ inlineToAsciiDoc opts (Quoted SingleQuote lst) = do inlineToAsciiDoc opts (Quoted DoubleQuote lst) = do contents <- inlineListToAsciiDoc opts lst return $ "``" <> contents <> "''" -inlineToAsciiDoc _ EmDash = return "\8212" -inlineToAsciiDoc _ EnDash = return "\8211" -inlineToAsciiDoc _ Apostrophe = return "\8217" -inlineToAsciiDoc _ Ellipses = return "\8230" inlineToAsciiDoc _ (Code _ str) = return $ text "`" <> text (escapeStringUsing (backslashEscapes "`") str) <> "`" inlineToAsciiDoc _ (Str str) = return $ text $ escapeString str diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index b59b71cf0..a6771437d 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -102,6 +102,10 @@ escapeCharForConTeXt ch = ']' -> "{]}" '_' -> "\\letterunderscore{}" '\160' -> "~" + '\x2014' -> "---" + '\x2013' -> "--" + '\x2019' -> "'" + '\x2026' -> "\\ldots{}" x -> [x] -- | Escape string for ConTeXt @@ -258,10 +262,6 @@ inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ "\\quotation" <> braces contents inlineToConTeXt (Cite _ lst) = inlineListToConTeXt lst -inlineToConTeXt Apostrophe = return $ char '\'' -inlineToConTeXt EmDash = return "---" -inlineToConTeXt EnDash = return "--" -inlineToConTeXt Ellipses = return "\\ldots{}" inlineToConTeXt (Str str) = return $ text $ stringToConTeXt str inlineToConTeXt (Math InlineMath str) = return $ char '$' <> text str <> char '$' diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 9f8b921e7..f3ac726a9 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -35,7 +35,7 @@ import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Readers.TeXMath import Data.List ( isPrefixOf, intercalate, isSuffixOf ) import Data.Char ( toLower ) -import Text.Pandoc.Highlighting (languages, languagesByExtension) +import Text.Pandoc.Highlighting ( languages, languagesByExtension ) import Text.Pandoc.Pretty -- | Convert list of authors to a docbook <author> section @@ -248,10 +248,6 @@ inlineToDocbook opts (Quoted _ lst) = inTagsSimple "quote" $ inlinesToDocbook opts lst inlineToDocbook opts (Cite _ lst) = inlinesToDocbook opts lst -inlineToDocbook _ Apostrophe = char '\'' -inlineToDocbook _ Ellipses = text "…" -inlineToDocbook _ EmDash = text "—" -inlineToDocbook _ EnDash = text "–" inlineToDocbook _ (Code _ str) = inTagsSimple "literal" $ text (escapeStringForXML str) inlineToDocbook opts (Math _ str) = inlinesToDocbook opts $ readTeXMath str diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 55da4554d..d139c010c 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -40,7 +40,7 @@ import System.Time import Text.Pandoc.Shared hiding ( Element ) import Text.Pandoc.Definition import Text.Pandoc.Generic -import Control.Monad (liftM) +import Control.Monad.State import Text.XML.Light hiding (ppTopElement) import Text.Pandoc.UUID import Text.Pandoc.Writers.HTML @@ -104,12 +104,16 @@ writeEPUB mbStylesheet opts doc@(Pandoc meta _) = do -- body pages let isH1 (Header 1 _) = True isH1 _ = False - let h1Indices = dropWhile (== 0) $ findIndices isH1 blocks - let chunks = splitByIndices h1Indices blocks + -- internal reference IDs change when we chunk the file, + -- so the next two lines fix that: + let reftable = correlateRefs blocks + let blocks' = replaceRefs reftable blocks + let h1Indices = dropWhile (== 0) $ findIndices isH1 blocks' + let chunks = splitByIndices h1Indices blocks' let titleize (Header 1 xs : ys) = Pandoc meta{docTitle = xs} ys titleize xs = Pandoc meta xs - let chapToHtml = writeHtmlString opts'{ writerTemplate = pageTemplate } let chapters = map titleize chunks + let chapToHtml = writeHtmlString opts'{ writerTemplate = pageTemplate } let chapterToEntry :: Int -> Pandoc -> Entry chapterToEntry num chap = mkEntry ("ch" ++ show num ++ ".xhtml") $ fromString $ chapToHtml chap @@ -271,7 +275,6 @@ transformInlines (MathML _) _ _ (x@(Math _ _) : xs) = do result = if "<math" `isPrefixOf` mathml then inOps else mathml return $ RawInline "html" result : xs transformInlines _ _ _ (RawInline _ _ : xs) = return $ Str "" : xs -transformInlines _ _ _ (Link lab (_,_) : xs) = return $ lab ++ xs transformInlines _ _ _ xs = return xs transformBlock :: Block -> Block @@ -305,3 +308,49 @@ imageTypeOf x = case drop 1 (map toLower (takeExtension x)) of "svg" -> Just "image/svg+xml" _ -> Nothing + +data IdentState = IdentState{ + chapterNumber :: Int, + runningIdents :: [String], + chapterIdents :: [String], + identTable :: [(String,String)] + } deriving (Read, Show) + +-- Go through a block list and construct a table +-- correlating the automatically constructed references +-- that would be used in a normal pandoc document with +-- new URLs to be used in the EPUB. For example, what +-- was "header-1" might turn into "ch6.xhtml#header". +correlateRefs :: [Block] -> [(String,String)] +correlateRefs bs = identTable $ execState (mapM_ go bs) + IdentState{ chapterNumber = 0 + , runningIdents = [] + , chapterIdents = [] + , identTable = [] } + where go :: Block -> State IdentState () + go (Header n ils) = do + when (n == 1) $ + modify $ \s -> s{ chapterNumber = chapterNumber s + 1 + , chapterIdents = [] } + st <- get + let runningid = uniqueIdent ils (runningIdents st) + let chapid = if n == 1 + then Nothing + else Just $ uniqueIdent ils (chapterIdents st) + modify $ \s -> s{ runningIdents = runningid : runningIdents st + , chapterIdents = maybe (chapterIdents st) + (: chapterIdents st) chapid + , identTable = (runningid, "ch" ++ show (chapterNumber st) ++ + ".xhtml" ++ maybe "" ('#':) chapid) : identTable st + } + go _ = return () + +-- Replace internal link references using the table produced +-- by correlateRefs. +replaceRefs :: [(String,String)] -> [Block] -> [Block] +replaceRefs refTable = bottomUp replaceOneRef + where replaceOneRef x@(Link lab ('#':xs,tit)) = + case lookup xs refTable of + Just url -> Link lab (url,tit) + Nothing -> x + replaceOneRef x = x diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index f2208ff4a..8eb5092f9 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -35,7 +35,8 @@ import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.Pandoc.Shared import Text.Pandoc.Templates import Text.Pandoc.Readers.TeXMath -import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss ) +import Text.Pandoc.Highlighting ( highlight, styleToHtml, + formatHtmlInline, formatHtmlBlock ) import Text.Pandoc.XML (stripTags, escapeStringForXML) import Network.HTTP ( urlEncode ) import Numeric ( showHex ) @@ -153,7 +154,8 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n") Nothing -> mempty else mempty - let newvars = [("highlighting-css", defaultHighlightingCss) | + let newvars = [("highlighting-css", renderHtml $ styleToHtml + $ writerHighlightStyle opts) | stHighlighting st] ++ [("math", renderHtml math) | stMath st] return (tit, auths, date, toc, thebody, newvars) @@ -361,18 +363,23 @@ blockToHtml _ (RawBlock "html" str) = return $ preEscapedString str blockToHtml _ (RawBlock _ _) = return mempty blockToHtml _ (HorizontalRule) = return H.hr blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do - let classes' = if writerLiterateHaskell opts - then classes + let tolhs = writerLiterateHaskell opts && + any (\c -> map toLower c == "haskell") classes && + any (\c -> map toLower c == "literate") classes + classes' = if tolhs + then map (\c -> if map toLower c == "haskell" + then "literatehaskell" + else c) classes else filter (/= "literate") classes - case highlightHtml False (id',classes',keyvals) rawCode of + adjCode = if tolhs + then unlines . map ("> " ++) . lines $ rawCode + else rawCode + case highlight formatHtmlBlock (id',classes,keyvals) adjCode of Nothing -> let attrs = attrsToHtml opts (id', classes', keyvals) - addBird = if "literate" `elem` classes' - then unlines . map ("> " ++) . lines - else unlines . lines in return $ foldl (!) H.pre attrs $ H.code - $ toHtml $ addBird rawCode + $ toHtml adjCode Just h -> modify (\st -> st{ stHighlighting = True }) >> - return h + return (foldl (!) h (attrsToHtml opts (id',[],keyvals))) blockToHtml opts (BlockQuote blocks) = -- in S5, treat list in blockquote specially -- if default is incremental, make it nonincremental; @@ -534,17 +541,15 @@ inlineToHtml opts inline = (Str str) -> return $ strToHtml str (Space) -> return $ strToHtml " " (LineBreak) -> return H.br - (EmDash) -> return $ strToHtml "—" - (EnDash) -> return $ strToHtml "–" - (Ellipses) -> return $ strToHtml "…" - (Apostrophe) -> return $ strToHtml "’" (Emph lst) -> inlineListToHtml opts lst >>= return . H.em (Strong lst) -> inlineListToHtml opts lst >>= return . H.strong - (Code attr str) -> case highlightHtml True attr str of + (Code attr str) -> case highlight formatHtmlInline attr str of Nothing -> return $ foldl (!) H.code (attrsToHtml opts attr) $ strToHtml str - Just h -> return h + Just h -> return $ foldl (!) h $ + attrsToHtml opts (id',[],keyvals) + where (id',_,keyvals) = attr (Strikeout lst) -> inlineListToHtml opts lst >>= return . H.del (SmallCaps lst) -> inlineListToHtml opts lst >>= diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index cb7df6b8a..4575c6b14 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -41,7 +41,8 @@ import Data.Char ( toLower, isPunctuation ) import Control.Monad.State import Text.Pandoc.Pretty import System.FilePath (dropExtension) -import Text.Pandoc.Highlighting (highlightLaTeX, defaultLaTeXMacros) +import Text.Pandoc.Highlighting (highlight, styleToLaTeX, + formatLaTeXInline, formatLaTeXBlock) data WriterState = WriterState { stInNote :: Bool -- true if we're in a note @@ -60,7 +61,9 @@ data WriterState = , stLHS :: Bool -- true if document has literate haskell code , stBook :: Bool -- true if document uses book or memoir class , stCsquotes :: Bool -- true if document uses csquotes - , stHighlighting :: Bool -- true if document has highlighted code + , stHighlighting :: Bool -- true if document has highlighted code + , stFirstFrame :: Bool -- true til we've written first beamer frame + , stIncremental :: Bool -- true if beamer lists should be displayed bit by bit } -- | Convert Pandoc to LaTeX. @@ -73,23 +76,24 @@ writeLaTeX options document = stTable = False, stStrikeout = False, stSubscript = False, stUrl = False, stGraphics = False, stLHS = False, stBook = writerChapters options, - stCsquotes = False, stHighlighting = False } + stCsquotes = False, stHighlighting = False, + stFirstFrame = True, stIncremental = writerIncremental options } pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do let template = writerTemplate options + let templateLines = lines template let usesBookClass x = "\\documentclass" `isPrefixOf` x && ("{memoir}" `isSuffixOf` x || "{book}" `isSuffixOf` x || "{report}" `isSuffixOf` x) - when (any usesBookClass (lines template)) $ + when (any usesBookClass templateLines) $ modify $ \s -> s{stBook = True} -- check for \usepackage...{csquotes}; if present, we'll use -- \enquote{...} for smart quotes: when ("{csquotes}" `isInfixOf` template) $ modify $ \s -> s{stCsquotes = True} - opts <- liftM stOptions get - let colwidth = if writerWrapText opts - then Just $ writerColumns opts + let colwidth = if writerWrapText options + then Just $ writerColumns options else Nothing titletext <- liftM (render colwidth) $ inlineListToLaTeX title authorsText <- mapM (liftM (render colwidth) . inlineListToLaTeX) authors @@ -99,7 +103,10 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do else case last blocks of Header 1 il -> (init blocks, il) _ -> (blocks, []) - body <- blockListToLaTeX blocks' + blocks'' <- if writerBeamer options + then toSlides blocks' + else return blocks' + body <- blockListToLaTeX blocks'' biblioTitle <- liftM (render colwidth) $ inlineListToLaTeX lastHeader let main = render colwidth body st <- get @@ -118,7 +125,12 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("toc", if writerTableOfContents options then "yes" else "") , ("body", main) , ("title", titletext) - , ("date", dateText) ] ++ + , ("date", dateText) + , ("documentclass", if writerBeamer options + then "beamer" + else if writerChapters options + then "book" + else "article") ] ++ [ ("author", a) | a <- authorsText ] ++ [ ("verbatim-in-note", "yes") | stVerbInNote st ] ++ [ ("fancy-enums", "yes") | stEnumerate st ] ++ @@ -131,7 +143,9 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("graphics", "yes") | stGraphics st ] ++ [ ("book-class", "yes") | stBook st] ++ [ ("listings", "yes") | writerListings options || stLHS st ] ++ - [ ("highlighting-macros", defaultLaTeXMacros) | stHighlighting st ] ++ + [ ("beamer", "yes") | writerBeamer options ] ++ + [ ("highlighting-macros", styleToLaTeX + $ writerHighlightStyle options ) | stHighlighting st ] ++ citecontext return $ if writerStandalone options then renderTemplate context template @@ -160,12 +174,51 @@ stringToLaTeX isUrl = escapeStringUsing latexEscapes , ('\x2019', "'") , ('\x201C', "``") , ('\x201D', "''") + , ('\x2026', "\\ldots{}") + , ('\x2014', "---") + , ('\x2013', "--") ] -- | Puts contents into LaTeX command. inCmd :: String -> Doc -> Doc inCmd cmd contents = char '\\' <> text cmd <> braces contents +toSlides :: [Block] -> State WriterState [Block] +toSlides (Header n ils : bs) = do + tit <- inlineListToLaTeX ils + firstFrame <- gets stFirstFrame + modify $ \s -> s{ stFirstFrame = False } + -- note: [fragile] is required or verbatim breaks + result <- ((Header n ils :) . + (RawBlock "latex" ("\\begin{frame}[fragile]\n" ++ + "\\frametitle{" ++ render Nothing tit ++ "}") :)) + `fmap` toSlides bs + if firstFrame + then return result + else return $ RawBlock "latex" "\\end{frame}" : result +toSlides (HorizontalRule : Header n ils : bs) = + toSlides (Header n ils : bs) +toSlides (HorizontalRule : bs) = do + firstFrame <- gets stFirstFrame + modify $ \s -> s{ stFirstFrame = False } + result <- (RawBlock "latex" "\\begin{frame}[fragile]" :) + `fmap` toSlides bs + if firstFrame + then return result + else return $ RawBlock "latex" "\\end{frame}" : result +toSlides (b:bs) = (b:) `fmap` toSlides bs +toSlides [] = do + firstFrame <- gets stFirstFrame + if firstFrame + then return [] + else return [RawBlock "latex" "\\end{frame}"] + +isListBlock :: Block -> Bool +isListBlock (BulletList _) = True +isListBlock (OrderedList _ _) = True +isListBlock (DefinitionList _) = True +isListBlock _ = False + -- | Convert Pandoc block element to LaTeX. blockToLaTeX :: Block -- ^ Block to convert -> State WriterState Doc @@ -180,8 +233,17 @@ blockToLaTeX (Para lst) = do result <- inlineListToLaTeX lst return $ result <> blankline blockToLaTeX (BlockQuote lst) = do - contents <- blockListToLaTeX lst - return $ "\\begin{quote}" $$ contents $$ "\\end{quote}" + beamer <- writerBeamer `fmap` gets stOptions + case lst of + [b] | beamer && isListBlock b -> do + oldIncremental <- gets stIncremental + modify $ \s -> s{ stIncremental = True } + result <- blockToLaTeX b + modify $ \s -> s{ stIncremental = oldIncremental } + return result + _ -> do + contents <- blockListToLaTeX lst + return $ "\\begin{quote}" $$ contents $$ "\\end{quote}" blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do opts <- gets stOptions case () of @@ -199,8 +261,8 @@ blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do then modify (\s -> s{ stVerbInNote = True }) >> return "Verbatim" else return "verbatim" - return $ flush (text $ "\\begin{" ++ env ++ "}") $$ text str $$ - text ("\\end{" ++ env ++ "}") $$ cr -- final cr because of notes + return $ flush (text ("\\begin{" ++ env ++ "}") $$ text str $$ + text ("\\end{" ++ env ++ "}")) $$ cr -- final cr because of notes listingsCodeBlock = do st <- get let params = if writerListings (stOptions st) @@ -231,17 +293,20 @@ blockToLaTeX (CodeBlock (_,classes,keyvalAttr) str) = do return $ flush ("\\begin{lstlisting}" <> printParams $$ text str $$ "\\end{lstlisting}") $$ cr highlightedCodeBlock = - case highlightLaTeX False ("",classes,keyvalAttr) str of + case highlight formatLaTeXBlock ("",classes,keyvalAttr) str of Nothing -> rawCodeBlock Just h -> modify (\st -> st{ stHighlighting = True }) >> - return (text h) + return (flush $ text h) blockToLaTeX (RawBlock "latex" x) = return $ text x <> blankline blockToLaTeX (RawBlock _ _) = return empty blockToLaTeX (BulletList lst) = do + incremental <- gets stIncremental + let inc = if incremental then "[<+->]" else "" items <- mapM listItemToLaTeX lst - return $ "\\begin{itemize}" $$ vcat items $$ "\\end{itemize}" + return $ text ("\\begin{itemize}" ++ inc) $$ vcat items $$ "\\end{itemize}" blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do st <- get + let inc = if stIncremental st then "[<+->]" else "" let oldlevel = stOLLevel st put $ st {stOLLevel = oldlevel + 1} items <- mapM listItemToLaTeX lst @@ -258,11 +323,13 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do map toLower (toRomanNumeral oldlevel) ++ "}{" ++ show (start - 1) ++ "}" else empty - return $ "\\begin{enumerate}" <> exemplar $$ resetcounter $$ + return $ text ("\\begin{enumerate}" ++ inc) <> exemplar $$ resetcounter $$ vcat items $$ "\\end{enumerate}" blockToLaTeX (DefinitionList lst) = do + incremental <- gets stIncremental + let inc = if incremental then "[<+->]" else "" items <- mapM defListItemToLaTeX lst - return $ "\\begin{description}" $$ vcat items $$ "\\end{description}" + return $ text ("\\begin{description}" ++ inc) $$ vcat items $$ "\\end{description}" blockToLaTeX HorizontalRule = return $ "\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline blockToLaTeX (Header level lst) = do @@ -363,7 +430,6 @@ inlineListToLaTeX lst = mapM inlineToLaTeX lst >>= return . hcat isQuoted :: Inline -> Bool isQuoted (Quoted _ _) = True -isQuoted Apostrophe = True isQuoted _ = False -- | Convert inline element to LaTeX @@ -407,7 +473,7 @@ inlineToLaTeX (Code (_,classes,_) str) = do let chr = ((enumFromTo '!' '~') \\ str) !! 0 return $ text $ "\\lstinline" ++ [chr] ++ str ++ [chr] highlightCode = do - case highlightLaTeX True ("",classes,[]) str of + case highlight formatLaTeXInline ("",classes,[]) str of Nothing -> rawCode Just h -> modify (\st -> st{ stHighlighting = True }) >> return (text h) @@ -439,10 +505,6 @@ inlineToLaTeX (Quoted DoubleQuote lst) = do then "\\," else empty return $ "``" <> s1 <> contents <> s2 <> "''" -inlineToLaTeX Apostrophe = return $ char '\'' -inlineToLaTeX EmDash = return "---" -inlineToLaTeX EnDash = return "--" -inlineToLaTeX Ellipses = return "\\ldots{}" inlineToLaTeX (Str str) = return $ text $ stringToLaTeX False str inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$' inlineToLaTeX (Math DisplayMath str) = return $ "\\[" <> text str <> "\\]" diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 78b9274d6..d3735efa7 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -98,7 +98,13 @@ noteToMan opts num note = do -- | Association list of characters to escape. manEscapes :: [(Char, String)] -manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes "@\\" +manEscapes = [ ('\160', "\\ ") + , ('\'', "\\[aq]") + , ('’', "'") + , ('\x2014', "\\[em]") + , ('\x2013', "\\[en]") + , ('\x2026', "\\&...") + ] ++ backslashEscapes "@\\" -- | Escape special characters for Man. escapeString :: String -> String @@ -303,10 +309,6 @@ inlineToMan opts (Quoted DoubleQuote lst) = do return $ text "\\[lq]" <> contents <> text "\\[rq]" inlineToMan opts (Cite _ lst) = inlineListToMan opts lst -inlineToMan _ EmDash = return $ text "\\[em]" -inlineToMan _ EnDash = return $ text "\\[en]" -inlineToMan _ Apostrophe = return $ char '\'' -inlineToMan _ Ellipses = return $ text "\\&..." inlineToMan _ (Code _ str) = return $ text $ "\\f[C]" ++ escapeCode str ++ "\\f[]" inlineToMan _ (Str str) = return $ text $ escapeString str diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 70202294f..f0f608432 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -432,10 +432,6 @@ inlineToMarkdown opts (Quoted SingleQuote lst) = do inlineToMarkdown opts (Quoted DoubleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ "“" <> contents <> "”" -inlineToMarkdown _ EmDash = return "\8212" -inlineToMarkdown _ EnDash = return "\8211" -inlineToMarkdown _ Apostrophe = return "\8217" -inlineToMarkdown _ Ellipses = return "\8230" inlineToMarkdown opts (Code attr str) = let tickGroups = filter (\s -> '`' `elem` s) $ group str longest = if null tickGroups diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index a7c7fc482..f31a2c2d1 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -346,22 +346,14 @@ inlineToMediaWiki opts (SmallCaps lst) = inlineListToMediaWiki opts lst inlineToMediaWiki opts (Quoted SingleQuote lst) = do contents <- inlineListToMediaWiki opts lst - return $ "‘" ++ contents ++ "’" + return $ "\8216" ++ contents ++ "\8217" inlineToMediaWiki opts (Quoted DoubleQuote lst) = do contents <- inlineListToMediaWiki opts lst - return $ "“" ++ contents ++ "”" + return $ "\8220" ++ contents ++ "\8221" inlineToMediaWiki opts (Cite _ lst) = inlineListToMediaWiki opts lst -inlineToMediaWiki _ EmDash = return "—" - -inlineToMediaWiki _ EnDash = return "–" - -inlineToMediaWiki _ Apostrophe = return "’" - -inlineToMediaWiki _ Ellipses = return "…" - inlineToMediaWiki _ (Code _ str) = return $ "<tt>" ++ (escapeString str) ++ "</tt>" diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index e675f4e65..23ef2e31d 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -154,8 +154,8 @@ inHeaderTags i d = , ("text:outline-level", show i)] d inQuotes :: QuoteType -> Doc -> Doc -inQuotes SingleQuote s = text "‘" <> s <> text "’" -inQuotes DoubleQuote s = text "“" <> s <> text "”" +inQuotes SingleQuote s = char '\8216' <> s <> char '\8217' +inQuotes DoubleQuote s = char '\8220' <> s <> char '\8221' handleSpaces :: String -> Doc handleSpaces s @@ -361,10 +361,6 @@ inlinesToOpenDocument o l = hcat <$> mapM (inlineToOpenDocument o) l -- | Convert an inline element to OpenDocument. inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc inlineToOpenDocument o ils - | Ellipses <- ils = inTextStyle $ text "…" - | EmDash <- ils = inTextStyle $ text "—" - | EnDash <- ils = inTextStyle $ text "–" - | Apostrophe <- ils = inTextStyle $ text "’" | Space <- ils = inTextStyle space | LineBreak <- ils = return $ selfClosingTag "text:line-break" [] | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 6e0fb98e1..4c77ba7c6 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -95,7 +95,12 @@ noteToOrg num note = do -- | Escape special characters for Org. escapeString :: String -> String -escapeString = escapeStringUsing (backslashEscapes "^_") +escapeString = escapeStringUsing $ + [ ('\x2014',"---") + , ('\x2013',"--") + , ('\x2019',"'") + , ('\x2026',"...") + ] ++ backslashEscapes "^_" titleToOrg :: [Inline] -> State WriterState Doc titleToOrg [] = return empty @@ -249,10 +254,6 @@ inlineToOrg (Quoted DoubleQuote lst) = do contents <- inlineListToOrg lst return $ "\"" <> contents <> "\"" inlineToOrg (Cite _ lst) = inlineListToOrg lst -inlineToOrg EmDash = return "---" -inlineToOrg EnDash = return "--" -inlineToOrg Apostrophe = return "'" -inlineToOrg Ellipses = return "..." inlineToOrg (Code _ str) = return $ "=" <> text str <> "=" inlineToOrg (Str str) = return $ text $ escapeString str inlineToOrg (Math t str) = do diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 0f0479e16..125ed4f13 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -281,10 +281,6 @@ inlineToRST (Quoted DoubleQuote lst) = do return $ "“" <> contents <> "”" inlineToRST (Cite _ lst) = inlineListToRST lst -inlineToRST EmDash = return $ char '\8212' -inlineToRST EnDash = return $ char '\8211' -inlineToRST Apostrophe = return $ char '\8217' -inlineToRST Ellipses = return $ char '\8230' inlineToRST (Code _ str) = return $ "``" <> text str <> "``" inlineToRST (Str str) = return $ text $ escapeString str inlineToRST (Math t str) = do diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs index eb36c1ca6..4e7c2a7cd 100644 --- a/src/Text/Pandoc/Writers/RTF.hs +++ b/src/Text/Pandoc/Writers/RTF.hs @@ -106,7 +106,15 @@ handleUnicode (c:cs) = -- | Escape special characters. escapeSpecial :: String -> String -escapeSpecial = escapeStringUsing (('\t',"\\tab "):(backslashEscapes "{\\}")) +escapeSpecial = escapeStringUsing $ + [ ('\t',"\\tab ") + , ('\8216',"\\u8216'") + , ('\8217',"\\u8217'") + , ('\8220',"\\u8220\"") + , ('\8221',"\\u8221\"") + , ('\8211',"\\u8211-") + , ('\8212',"\\u8212-") + ] ++ backslashEscapes "{\\}" -- | Escape strings as needed for rich text format. stringToRTF :: String -> String @@ -287,10 +295,6 @@ inlineToRTF (Quoted SingleQuote lst) = "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'" inlineToRTF (Quoted DoubleQuote lst) = "\\u8220\"" ++ (inlineListToRTF lst) ++ "\\u8221\"" -inlineToRTF Apostrophe = "\\u8217'" -inlineToRTF Ellipses = "\\u8230?" -inlineToRTF EmDash = "\\u8212-" -inlineToRTF EnDash = "\\u8211-" inlineToRTF (Code _ str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}" inlineToRTF (Str str) = stringToRTF str inlineToRTF (Math _ str) = inlineListToRTF $ readTeXMath str diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs index 4f6645cd5..563ad7044 100644 --- a/src/Text/Pandoc/Writers/Texinfo.hs +++ b/src/Text/Pandoc/Writers/Texinfo.hs @@ -96,6 +96,10 @@ stringToTexinfo = escapeStringUsing texinfoEscapes , ('@', "@@") , (',', "@comma{}") -- only needed in argument lists , ('\160', "@ ") + , ('\x2014', "---") + , ('\x2013', "--") + , ('\x2026', "@dots{}") + , ('\x2019', "'") ] -- | Puts contents into Texinfo command. @@ -387,10 +391,6 @@ inlineToTexinfo (Quoted DoubleQuote lst) = do inlineToTexinfo (Cite _ lst) = inlineListToTexinfo lst -inlineToTexinfo Apostrophe = return $ char '\'' -inlineToTexinfo EmDash = return $ text "---" -inlineToTexinfo EnDash = return $ text "--" -inlineToTexinfo Ellipses = return $ text "@dots{}" inlineToTexinfo (Str str) = return $ text (stringToTexinfo str) inlineToTexinfo (Math _ str) = return $ inCmd "math" $ text str inlineToTexinfo (RawInline f str) | f == "latex" || f == "tex" = diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs index 6614ec28e..26d5ec6d7 100644 --- a/src/Text/Pandoc/Writers/Textile.hs +++ b/src/Text/Pandoc/Writers/Textile.hs @@ -72,15 +72,19 @@ withUseTags action = do -- | Escape one character as needed for Textile. escapeCharForTextile :: Char -> String escapeCharForTextile x = case x of - '&' -> "&" - '<' -> "<" - '>' -> ">" - '"' -> """ - '*' -> "*" - '_' -> "_" - '@' -> "@" - '|' -> "|" - c -> [c] + '&' -> "&" + '<' -> "<" + '>' -> ">" + '"' -> """ + '*' -> "*" + '_' -> "_" + '@' -> "@" + '|' -> "|" + '\x2014' -> " -- " + '\x2013' -> " - " + '\x2019' -> "'" + '\x2026' -> "..." + c -> [c] -- | Escape string as needed for Textile. escapeStringForTextile :: String -> String @@ -370,14 +374,6 @@ inlineToTextile opts (Quoted DoubleQuote lst) = do inlineToTextile opts (Cite _ lst) = inlineListToTextile opts lst -inlineToTextile _ EmDash = return " -- " - -inlineToTextile _ EnDash = return " - " - -inlineToTextile _ Apostrophe = return "'" - -inlineToTextile _ Ellipses = return "..." - inlineToTextile _ (Code _ str) = return $ if '@' `elem` str then "<tt>" ++ escapeStringForXML str ++ "</tt>" diff --git a/src/markdown2pdf.hs b/src/markdown2pdf.hs index 811d5febd..e5afdf1c9 100644 --- a/src/markdown2pdf.hs +++ b/src/markdown2pdf.hs @@ -78,11 +78,11 @@ parsePandocArgs args = do --trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace trim = takeWhile (/='\r') . dropWhile (=='\r') -runPandoc :: [String] -> FilePath -> IO (Either String FilePath) -runPandoc inputsAndArgs output = do +runPandoc :: String -> [String] -> FilePath -> IO (Either String FilePath) +runPandoc outputFormat inputsAndArgs output = do let texFile = addExtension output "tex" result <- run "pandoc" $ - ["-s", "--no-wrap", "-r", "markdown", "-w", "latex"] + ["-s", "--no-wrap", "-r", "markdown", "-w", outputFormat] ++ inputsAndArgs ++ ["-o", texFile] return $ either Left (const $ Right texFile) result @@ -206,14 +206,16 @@ main = withTempDir "pandoc" "--include-before-body","--include-after-body", "--custom-header","--output", "--template", "--variable", - "--csl", "--bibliography", "--data-dir", "--listings"] + "--no-highlight", "--highlight-style", + "--csl", "--bibliography", "--data-dir", "--listings", + "--beamer"] let isOpt ('-':_) = True isOpt _ = False let opts = filter isOpt args -- note that a long option can come in this form: --opt=val let isGoodopt x = x `elem` (goodopts ++ goodoptslong) || any (\o -> (o ++ "=") `isPrefixOf` x) goodoptslong - let markdown2pdfOpts = ["--xetex","--luatex"] + let markdown2pdfOpts = ["--xetex","--luatex", "--beamer"] unless (all isGoodopt opts) $ do (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] "" UTF8.putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:" @@ -230,6 +232,9 @@ main = withTempDir "pandoc" else if "--luatex" `elem` opts then "lualatex" else "pdflatex" + let outputFormat = if "--beamer" `elem` opts + then "beamer" + else "latex" let execs = ["pandoc", latexProgram, "bibtex"] paths <- mapM findExecutable execs let miss = map snd $ filter (isNothing . fst) $ zip paths execs @@ -248,7 +253,7 @@ main = withTempDir "pandoc" -- no need because we'll pass all arguments to pandoc Just (_ ,out) -> return ([], out) -- run pandoc - pandocRes <- runPandoc (input ++ args') $ replaceDirectory output tmp + pandocRes <- runPandoc outputFormat (input ++ args') $ replaceDirectory output tmp case pandocRes of Left err -> exit err Right texFile -> do diff --git a/src/pandoc.hs b/src/pandoc.hs index 3ef82accc..190248a29 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -33,19 +33,20 @@ import Text.Pandoc import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile, headerShift, findDataFile, normalize ) import Text.Pandoc.SelfContained ( makeSelfContained ) -import Text.Pandoc.Highlighting ( languages ) +import Text.Pandoc.Highlighting ( languages, Style, tango, pygments, + espresso, kate, haddock, monochrome ) import System.Environment ( getArgs, getProgName ) import System.Exit ( exitWith, ExitCode (..) ) import System.FilePath import System.Console.GetOpt import Data.Char ( toLower ) -import Data.List ( intercalate, isSuffixOf ) +import Data.List ( intercalate, isSuffixOf, isPrefixOf ) import System.Directory ( getAppUserDataDirectory, doesFileExist ) import System.IO ( stdout, stderr ) import System.IO.Error ( isDoesNotExistError ) import Control.Exception.Extensible ( throwIO ) import qualified Text.Pandoc.UTF8 as UTF8 -import Text.CSL +import qualified Text.CSL as CSL import Text.Pandoc.Biblio import Control.Monad (when, unless, liftM) import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..)) @@ -62,19 +63,20 @@ copyrightMessage = "\nCopyright (C) 2006-2011 John MacFarlane\n" ++ compileInfo :: String compileInfo = - "\nCompiled with citeproc support." ++ - "\nCompiled with syntax highlighting support for:\n" ++ - wrapWords 78 languages + "\nCompiled with citeproc-hs " ++ VERSION_citeproc_hs ++ " and " ++ + "highlighting-kate " ++ VERSION_highlighting_kate ++ + ".\nSyntax highlighting is supported for the following languages:\n " ++ + wrapWords 4 78 languages -- | Converts a list of strings into a single string with the items printed as -- comma separated words in lines with a maximum line length. -wrapWords :: Int -> [String] -> String -wrapWords c = wrap' c c where - wrap' _ _ [] = "" +wrapWords :: Int -> Int -> [String] -> String +wrapWords indent c = wrap' (c - indent) (c - indent) + where wrap' _ _ [] = "" wrap' cols remaining (x:xs) = if remaining == cols then x ++ wrap' cols (remaining - length x) xs else if (length x + 1) > remaining - then ",\n" ++ x ++ wrap' cols (cols - length x) xs + then ",\n" ++ replicate indent ' ' ++ x ++ wrap' cols (cols - length x) xs else ", " ++ x ++ wrap' cols (remaining - (length x + 2)) xs isNonTextOutput :: String -> Bool @@ -100,6 +102,8 @@ data Opt = Opt , optXeTeX :: Bool -- ^ Format latex for xetex , optSmart :: Bool -- ^ Use smart typography , optHtml5 :: Bool -- ^ Produce HTML5 in HTML + , optHighlight :: Bool -- ^ Highlight source code + , optHighlightStyle :: Style -- ^ Style to use for highlighted code , optChapters :: Bool -- ^ Use chapter for top-level sects , optHTMLMathMethod :: HTMLMathMethod -- ^ Method to print HTML math , optReferenceODT :: Maybe FilePath -- ^ Path of reference.odt @@ -144,6 +148,8 @@ defaultOpts = Opt , optXeTeX = False , optSmart = False , optHtml5 = False + , optHighlight = True + , optHighlightStyle = pygments , optChapters = False , optHTMLMathMethod = PlainMath , optReferenceODT = Nothing @@ -239,9 +245,34 @@ options = , Option "5" ["html5"] (NoArg - (\opt -> return opt { optHtml5 = True })) + (\opt -> do + UTF8.hPutStrLn stderr $ "pandoc: --html5 is deprecated. " + ++ "Use the html5 output format instead." + return opt { optHtml5 = True })) "" -- "Produce HTML5 in HTML output" + , Option "" ["no-highlight"] + (NoArg + (\opt -> return opt { optHighlight = False })) + "" -- "Don't highlight source code" + + , Option "" ["highlight-style"] + (ReqArg + (\arg opt -> do + newStyle <- case map toLower arg of + "pygments" -> return pygments + "tango" -> return tango + "espresso" -> return espresso + "kate" -> return kate + "monochrome" -> return monochrome + "haddock" -> return haddock + _ -> UTF8.hPutStrLn stderr + ("Unknown style: " ++ arg) >> + exitWith (ExitFailure 39) + return opt{ optHighlightStyle = newStyle }) + "STYLE") + "" -- "Style for highlighted code" + , Option "m" ["latexmathml", "asciimathml"] (OptArg (\arg opt -> @@ -590,8 +621,8 @@ options = usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String usageMessage programName = usageInfo (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++ - (intercalate ", " $ map fst readers) ++ "\nOutput formats: " ++ - (intercalate ", " $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:") + (wrapWords 16 78 $ map fst readers) ++ "\nOutput formats: " ++ + (wrapWords 16 78 $ map fst writers ++ ["odt","epub"]) ++ "\nOptions:") -- Determine default reader based on source file extensions defaultReaderName :: String -> [FilePath] -> String @@ -691,6 +722,8 @@ main = do , optSelfContained = selfContained , optSmart = smart , optHtml5 = html5 + , optHighlight = highlight + , optHighlightStyle = highlightStyle , optChapters = chapters , optHTMLMathMethod = mathMethod , optReferenceODT = referenceODT @@ -765,6 +798,12 @@ main = do (\_ -> throwIO e) else throwIO e) + let slideVariant = case writerName' of + "s5" -> S5Slides + "slidy" -> SlidySlides + "dzslides" -> DZSlides + _ -> NoSlides + variables' <- case mathMethod of LaTeXMathML Nothing -> do s <- readDataFile datadir $ "data" </> "LaTeXMathML.js" @@ -774,7 +813,15 @@ main = do return $ ("mathml-script", s) : variables _ -> return variables - refs <- mapM (\f -> catch (readBiblioFile f) $ \e -> do + variables'' <- case slideVariant of + DZSlides -> do + dztempl <- readDataFile datadir $ "dzslides" </> "template.html" + let dzcore = unlines $ dropWhile (not . isPrefixOf "<!-- {{{{ dzslides core") + $ lines dztempl + return $ ("dzslides-core", dzcore) : variables' + _ -> return variables' + + refs <- mapM (\f -> catch (CSL.readBiblioFile f) $ \e -> do UTF8.hPutStrLn stderr $ "Error reading bibliography `" ++ f ++ "'" UTF8.hPutStrLn stderr $ show e exitWith (ExitFailure 23)) reffiles >>= \rs -> return $ concat rs @@ -783,30 +830,25 @@ main = do then "." else takeDirectory (head sources) - let slideVariant = case writerName' of - "s5" -> S5Slides - "slidy" -> SlidySlides - "dzslides" -> DZSlides - _ -> NoSlides - let startParserState = defaultParserState { stateParseRaw = parseRaw, stateTabStop = tabStop, stateLiterateHaskell = "+lhs" `isSuffixOf` readerName' || lhsExtension sources, stateStandalone = standalone', - stateCitations = map refId refs, + stateCitations = map CSL.refId refs, stateSmart = smart || writerName' `elem` - ["latex", "context", "latex+lhs", "man"], + ["latex", "context", "latex+lhs", "beamer"], stateColumns = columns, stateStrict = strict, stateIndentedCodeClasses = codeBlockClasses, - stateApplyMacros = writerName' `notElem` ["latex", "latex+lhs"] } + stateApplyMacros = writerName' `notElem` + ["latex", "latex+lhs", "beamer"] } let writerOptions = defaultWriterOptions { writerStandalone = standalone', writerTemplate = templ, - writerVariables = variables', + writerVariables = variables'', writerEPUBMetadata = epubMetadata, writerTabStop = tabStop, writerTableOfContents = toc && @@ -835,7 +877,8 @@ main = do slideVariant == DZSlides, writerChapters = chapters, writerListings = listings, - writerHighlight = True } + writerHighlight = highlight, + writerHighlightStyle = highlightStyle } when (isNonTextOutput writerName' && outputFile == "-") $ do UTF8.hPutStrLn stderr ("Error: Cannot write " ++ writerName' ++ " output to stdout.\n" ++ diff --git a/templates b/templates -Subproject 0d116481c0902181c6b90827a0451570a133de3 +Subproject 88ec0260641e994069fa1b2c1912306c515420f diff --git a/tests/latex-reader.native b/tests/latex-reader.native index a5e14dd8f..c2ac98c56 100644 --- a/tests/latex-reader.native +++ b/tests/latex-reader.native @@ -1,5 +1,5 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]}) -[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite."] +[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Str "\8217",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite."] ,HorizontalRule ,Header 1 [Str "Headers"] ,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")] @@ -14,9 +14,9 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"] ,HorizontalRule ,Header 1 [Str "Paragraphs"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."] ,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."] ,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."] ,HorizontalRule ,Header 1 [Str "Block",Space,Str "Quotes"] @@ -44,11 +44,11 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA [OrderedList (1,Decimal,Period) [[Para [Str "do",Space,Str "laundry"]] ,[Para [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "nested",Space,Str "one:"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "nested",Space,Str "one:"] ,BlockQuote [Para [Str "Joe",Space,Str "said:"] ,BlockQuote - [Para [Str "Don",Apostrophe,Str "t",Space,Str "quote",Space,Str "me."]]] + [Para [Str "Don",Str "\8217",Str "t",Space,Str "quote",Space,Str "me."]]] ,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."] ,HorizontalRule ,Header 1 [Str "Code",Space,Str "Blocks"] @@ -113,7 +113,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Multiple",Space,Str "paragraphs:"] ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."] - ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Apostrophe,Str "s",Space,Str "back."]] + ,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Str "\8217",Str "s",Space,Str "back."]] ,[Para [Str "Item",Space,Str "2."]] ,[Para [Str "Item",Space,Str "3."]]] ,Header 2 [Str "Nested"] @@ -123,7 +123,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA [[Para [Str "Tab"] ,BulletList [[Para [Str "Tab"]]]]]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "another:"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "another:"] ,OrderedList (1,Decimal,Period) [[Para [Str "First"]] ,[Para [Str "Second:"] @@ -217,7 +217,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"] ,Para [Str "foo",Space,Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"] ,Para [Str "foo",Space,Str "bar",Space,Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"] -,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Space,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"],Space,Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "simple",Space,Str "block:"] +,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Space,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"],Space,Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "simple",Space,Str "block:"] ,Para [Str "foo",Space,Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"] ,CodeBlock ("",[],[]) "<div>\n foo\n</div>" ,Para [Str "As",Space,Str "should",Space,Str "this:"] @@ -230,7 +230,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] ,Para [Str "Code:"] ,CodeBlock ("",[],[]) "<hr />" -,Para [Str "Hr",Apostrophe,Str "s:"] +,Para [Str "Hr",Str "\8217",Str "s:"] ,HorizontalRule ,Header 1 [Str "Inline",Space,Str "Markup"] ,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."] @@ -250,11 +250,11 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]] ,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."] ,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]] -,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Apostrophe,Str "s?"] +,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Str "\8217",Str "s?"] ,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."] -,Para [Str "Some",Space,Str "dashes:",Space,Str "one",EmDash,Str "two",EmDash,Str "three",EmDash,Str "four",EmDash,Str "five."] -,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",EnDash,Str "7,",Space,Str "255",EnDash,Str "66,",Space,Str "1987",EnDash,Str "1999."] -,Para [Str "Ellipses",Ellipses,Str "and",Ellipses,Str "and",Ellipses,Str "."] +,Para [Str "Some",Space,Str "dashes:",Space,Str "one",Str "\8212",Str "two",Str "\8212",Str "three",Str "\8212",Str "four",Str "\8212",Str "five."] +,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",Str "-",Str "7,",Space,Str "255",Str "-",Str "66,",Space,Str "1987",Str "-",Str "1999."] +,Para [Str "Ellipses",Str "\8230",Str "and",Str "\8230",Str "and",Str "\8230",Str "."] ,HorizontalRule ,Header 1 [Str "LaTeX"] ,BulletList @@ -266,13 +266,13 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,[Para [Math InlineMath "223"]] ,[Para [Math InlineMath "p",Str "-",Str "Tree"]] ,[Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]] - ,[Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] -,Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] + ,[Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] +,Para [Str "These",Space,Str "shouldn",Str "\8217",Str "t",Space,Str "be",Space,Str "math:"] ,BulletList [[Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]] ,[Para [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]] ,[Para [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"] ,Table [] [AlignLeft,AlignLeft] [0.0,0.0] [[Plain [Str "Animal"]] ,[Plain [Str "Number"]]] @@ -336,10 +336,10 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."] ,Para [Str "Foo",Space,Link [Str "biz"] ("/url/",""),Str "."] ,Header 2 [Str "With",Space,Str "ampersands"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] ,Header 2 [Str "Autolinks"] ,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")] ,BulletList @@ -358,7 +358,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "image"] ("movie.jpg",""),Space,Str "icon."] ,HorizontalRule ,Header 1 [Str "Footnotes"] -,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] +,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here",Str "\8217",Str "s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] ,BlockQuote [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]] ,OrderedList (1,Decimal,Period) diff --git a/tests/lhs-test.html b/tests/lhs-test.html index 268dd9b27..291c374f3 100644 --- a/tests/lhs-test.html +++ b/tests/lhs-test.html @@ -5,35 +5,33 @@ <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="pandoc" /> <title></title> - <style type="text/css"> -/*<![CDATA[*/ -table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre - { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; } -td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; } +<style type="text/css">table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { + margin: 0; padding: 0; vertical-align: baseline; border: none; } +table.sourceCode { } +td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } td.sourceCode { padding-left: 5px; } -code.sourceCode span.kw { color: #007020; font-weight: bold; } -code.sourceCode span.dt { color: #902000; } -code.sourceCode span.dv { color: #40a070; } -code.sourceCode span.bn { color: #40a070; } -code.sourceCode span.fl { color: #40a070; } -code.sourceCode span.ch { color: #4070a0; } -code.sourceCode span.st { color: #4070a0; } -code.sourceCode span.co { color: #60a0b0; font-style: italic; } -code.sourceCode span.ot { color: #007020; } -code.sourceCode span.al { color: red; font-weight: bold; } -code.sourceCode span.fu { color: #06287e; } -code.sourceCode span.re { } -code.sourceCode span.er { color: red; font-weight: bold; } -/*]]>*/ - </style> +code > span.kw { color: #007020; font-weight: bold; } +code > span.dt { color: #902000; } +code > span.dv { color: #40a070; } +code > span.bn { color: #40a070; } +code > span.fl { color: #40a070; } +code > span.ch { color: #4070a0; } +code > span.st { color: #4070a0; } +code > span.co { color: #60a0b0; font-style: italic; } +code > span.ot { color: #007020; } +code > span.al { color: #ff0000; font-weight: bold; } +code > span.fu { color: #06287e; } +code > span.er { color: #ff0000; font-weight: bold; } +</style> </head> <body> <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p> -<pre class="sourceCode"><code class="sourceCode haskell"><span class="ot">unsplit </span><span class="ot">::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d<br />unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span> <br /> <span class="co">-- arr (\op (x,y) -> x `op` y) </span></code></pre> +<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d +unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span> + <span class="co">-- arr (\op (x,y) -> x `op` y) </span></code></pre> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p> -<pre><code>f *** g = first f >>> second g -</code></pre> +<pre><code>f *** g = first f >>> second g</code></pre> <p>Block quote:</p> <blockquote> <p>foo bar</p> diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs index b9413f07a..ff0ebfac5 100644 --- a/tests/lhs-test.html+lhs +++ b/tests/lhs-test.html+lhs @@ -5,35 +5,33 @@ <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="pandoc" /> <title></title> - <style type="text/css"> -/*<![CDATA[*/ -table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre - { margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; } -td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; } +<style type="text/css">table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { + margin: 0; padding: 0; vertical-align: baseline; border: none; } +table.sourceCode { } +td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } td.sourceCode { padding-left: 5px; } -code.sourceCode span.kw { color: #007020; font-weight: bold; } -code.sourceCode span.dt { color: #902000; } -code.sourceCode span.dv { color: #40a070; } -code.sourceCode span.bn { color: #40a070; } -code.sourceCode span.fl { color: #40a070; } -code.sourceCode span.ch { color: #4070a0; } -code.sourceCode span.st { color: #4070a0; } -code.sourceCode span.co { color: #60a0b0; font-style: italic; } -code.sourceCode span.ot { color: #007020; } -code.sourceCode span.al { color: red; font-weight: bold; } -code.sourceCode span.fu { color: #06287e; } -code.sourceCode span.re { } -code.sourceCode span.er { color: red; font-weight: bold; } -/*]]>*/ - </style> +code > span.kw { color: #007020; font-weight: bold; } +code > span.dt { color: #902000; } +code > span.dv { color: #40a070; } +code > span.bn { color: #40a070; } +code > span.fl { color: #40a070; } +code > span.ch { color: #4070a0; } +code > span.st { color: #4070a0; } +code > span.co { color: #60a0b0; font-style: italic; } +code > span.ot { color: #007020; } +code > span.al { color: #ff0000; font-weight: bold; } +code > span.fu { color: #06287e; } +code > span.er { color: #ff0000; font-weight: bold; } +</style> </head> <body> <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p> -<pre class="sourceCode"><code class="sourceCode haskell">> <span class="ot">unsplit </span><span class="ot">::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d<br />> unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span> <br />> <span class="co">-- arr (\op (x,y) -> x `op` y) </span></code></pre> +<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="fu">></span><span class="ot"> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d +<span class="fu">></span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span> +<span class="fu">></span> <span class="co">-- arr (\op (x,y) -> x `op` y) </span></code></pre> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p> -<pre><code>f *** g = first f >>> second g -</code></pre> +<pre><code>f *** g = first f >>> second g</code></pre> <p>Block quote:</p> <blockquote> <p>foo bar</p> diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex index 307fd948f..5bd74a87c 100644 --- a/tests/lhs-test.latex +++ b/tests/lhs-test.latex @@ -1,4 +1,4 @@ -\documentclass{article} +\documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \ifxetex @@ -12,6 +12,26 @@ \usepackage[utf8]{inputenc} \fi \fi +\usepackage{color} +\usepackage{fancyvrb} +\DefineShortVerb[commandchars=\\\{\}]{\|} +\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} +% Add ',fontsize=\small' for more characters per line +\newenvironment{Shaded}{}{} +\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} +\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} +\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} +\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} +\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} +\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} +\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} +\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} +\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} +\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} +\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} +\newcommand{\RegionMarkerTok}[1]{{#1}} +\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} +\newcommand{\NormalTok}[1]{{#1}} \ifxetex \usepackage[setpagesize=false, % page size defined by xetex unicode=false, % unicode breaks when used with xetex @@ -33,11 +53,13 @@ \texttt{unsplit} is an arrow that takes a pair of values and combines them to return a single value: -\begin{verbatim} -unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d -unsplit = arr . uncurry - -- arr (\op (x,y) -> x `op` y) -\end{verbatim} +\begin{Shaded} +\begin{Highlighting}[] +\OtherTok{unsplit ::} \NormalTok{(}\DataTypeTok{Arrow} \NormalTok{a) }\OtherTok{=>} \NormalTok{(b }\OtherTok{->} \NormalTok{c }\OtherTok{->} \NormalTok{d) }\OtherTok{->} \NormalTok{a (b, c) d} +\NormalTok{unsplit }\FunctionTok{=} \NormalTok{arr }\FunctionTok{.} \FunctionTok{uncurry} + \CommentTok{-- arr (\textbackslash{}op (x,y) -> x `op` y) } +\end{Highlighting} +\end{Shaded} \texttt{(***)} combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair). diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs index 4d36dc532..c79087ea7 100644 --- a/tests/lhs-test.latex+lhs +++ b/tests/lhs-test.latex+lhs @@ -1,4 +1,4 @@ -\documentclass{article} +\documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \ifxetex diff --git a/tests/rst-reader.native b/tests/rst-reader.native index 3e521cb7c..612db85bd 100644 --- a/tests/rst-reader.native +++ b/tests/rst-reader.native @@ -3,26 +3,26 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ": [([Str "Revision"], [[Para [Str "3"]]])] ,Header 1 [Str "Level",Space,Str "one",Space,Str "header"] -,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] +,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Str "\8217",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] ,Header 2 [Str "Level",Space,Str "two",Space,Str "header"] ,Header 3 [Str "Level",Space,Str "three"] ,Header 4 [Str "Level",Space,Str "four",Space,Str "with",Space,Emph [Str "emphasis"]] ,Header 5 [Str "Level",Space,Str "five"] ,Header 1 [Str "Paragraphs"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] ,Para [Str "In",Space,Str "Markdown",Space,Str "1",Str ".",Str "0",Str ".",Str "0",Space,Str "and",Space,Str "earlier",Str ".",Space,Str "Version",Space,Str "8",Str ".",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item",Str ".",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item",Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] ,Para [Str "Horizontal",Space,Str "rule",Str ":"] ,HorizontalRule ,Para [Str "Another",Str ":"] ,HorizontalRule ,Header 1 [Str "Block",Space,Str "Quotes"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"] ,BlockQuote [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Str ".",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short",Str "."]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "another,",Space,Str "differently",Space,Str "indented",Str ":"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "another,",Space,Str "differently",Space,Str "indented",Str ":"] ,BlockQuote - [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Str ".",Space,Str "It",Apostrophe,Str "s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab",Str "."] + [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Str ".",Space,Str "It",Str "\8217",Str "s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab",Str "."] ,Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"] ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" ,Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"] @@ -98,7 +98,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ": ,Para [Str "Multiple",Space,Str "paragraphs",Str ":"] ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one",Str "."] - ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Apostrophe,Str "s",Space,Str "back",Str "."]] + ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Str "\8217",Str "s",Space,Str "back",Str "."]] ,[Para [Str "Item",Space,Str "2",Str "."]] ,[Para [Str "Item",Space,Str "3",Str "."]]] ,Para [Str "Nested",Str ":"] @@ -108,7 +108,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ": [[Para [Str "Tab"] ,BulletList [[Plain [Str "Tab"]]]]]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "another",Str ":"] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "another",Str ":"] ,OrderedList (1,Decimal,Period) [[Para [Str "First"]] ,[Para [Str "Second",Str ":"] @@ -165,14 +165,14 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ": ,([Str "city"], [[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]]) ,([Str "phone"], - [[Para [Str "123",EnDash,Str "4567"]]])]] + [[Para [Str "123",Str "\8211",Str "4567"]]])]] ,DefinitionList [([Str "address"], [[Para [Str "61",Space,Str "Main",Space,Str "St",Str "."]]]) ,([Str "city"], [[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]]) ,([Str "phone"], - [[Para [Str "123",EnDash,Str "4567"]]])] + [[Para [Str "123",Str "\8211",Str "4567"]]])] ,Header 1 [Str "HTML",Space,Str "Blocks"] ,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"] ,RawBlock "html" "<div>foo</div>\n" @@ -216,8 +216,8 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ": ,Para [Str "Explicit",Str ":",Space,Str "a",Space,Link [Str "URL"] ("/url/",""),Str "."] ,Para [Str "Two",Space,Str "anonymous",Space,Str "links",Str ":",Space,Link [Str "the",Space,Str "first"] ("/url1/",""),Space,Str "and",Space,Link [Str "the",Space,Str "second"] ("/url2/","")] ,Para [Str "Reference",Space,Str "links",Str ":",Space,Link [Str "link1"] ("/url1/",""),Space,Str "and",Space,Link [Str "link2"] ("/url2/",""),Space,Str "and",Space,Link [Str "link1"] ("/url1/",""),Space,Str "again",Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT&T"] ("/url/",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT&T"] ("/url/",""),Str "."] ,Para [Str "Autolinks",Str ":",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."] ,Para [Str "But",Space,Str "not",Space,Str "here",Str ":"] ,CodeBlock ("",[],[]) "http://example.com/" diff --git a/tests/testsuite.native b/tests/testsuite.native index 879cb24fc..691c4959a 100644 --- a/tests/testsuite.native +++ b/tests/testsuite.native @@ -1,5 +1,5 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17",Str ",",Space,Str "2006"]}) -[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] +[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] ,HorizontalRule ,Header 1 [Str "Headers"] ,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")] @@ -14,9 +14,9 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"] ,HorizontalRule ,Header 1 [Str "Paragraphs"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] ,Para [Str "In",Space,Str "Markdown",Space,Str "1",Str ".",Str "0",Str ".",Str "0",Space,Str "and",Space,Str "earlier",Str ".",Space,Str "Version",Space,Str "8",Str ".",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item",Str ".",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item",Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] +,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] ,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here",Str "."] ,HorizontalRule ,Header 1 [Str "Block",Space,Str "Quotes"] @@ -100,7 +100,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Multiple",Space,Str "paragraphs",Str ":"] ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1",Str ",",Space,Str "graf",Space,Str "one",Str "."] - ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Apostrophe,Str "s",Space,Str "back",Str "."]] + ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",Space,Str "back",Str "."]] ,[Para [Str "Item",Space,Str "2",Str "."]] ,[Para [Str "Item",Space,Str "3",Str "."]]] ,Header 2 [Str "Nested"] @@ -110,7 +110,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA [[Plain [Str "Tab"] ,BulletList [[Plain [Str "Tab"]]]]]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "another",Str ":"] +,Para [Str "Here\8217s",Space,Str "another",Str ":"] ,OrderedList (1,Decimal,Period) [[Plain [Str "First"]] ,[Plain [Str "Second",Str ":"] @@ -243,7 +243,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,RawBlock "html" "</td>\n<td>" ,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]] ,RawBlock "html" "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n" -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"] ,RawBlock "html" "<div>\n " ,Plain [Str "foo"] ,RawBlock "html" "</div>\n" @@ -265,7 +265,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,RawBlock "html" "<!-- foo --> \n" ,Para [Str "Code",Str ":"] ,CodeBlock ("",[],[]) "<hr />" -,Para [Str "Hr",Apostrophe,Str "s",Str ":"] +,Para [Str "Hr\8217s",Str ":"] ,RawBlock "html" "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n" ,HorizontalRule ,Header 1 [Str "Inline",Space,Str "Markup"] @@ -286,11 +286,11 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Quoted DoubleQuote [Str "Hello",Str ","],Space,Str "said",Space,Str "the",Space,Str "spider",Str ".",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name",Str "."]] ,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters",Str "."] ,Para [Quoted SingleQuote [Str "Oak",Str ","],Space,Quoted SingleQuote [Str "elm",Str ","],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]] -,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Apostrophe,Str "s",Str "?"] +,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s",Str "?"] ,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."] -,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",EmDash,Str "two",Space,EmDash,Space,Str "three",EmDash,Str "four",Space,EmDash,Space,Str "five",Str "."] -,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",EnDash,Str "7",Str ",",Space,Str "255",EnDash,Str "66",Str ",",Space,Str "1987",EnDash,Str "1999",Str "."] -,Para [Str "Ellipses",Ellipses,Str "and",Ellipses,Str "and",Ellipses,Str "."] +,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",Str "\8212",Str "two",Space,Str "\8212",Space,Str "three",Str "\8212",Str "four",Space,Str "\8212",Space,Str "five",Str "."] +,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",Str "\8211",Str "7",Str ",",Space,Str "255",Str "\8211",Str "66",Str ",",Space,Str "1987",Str "\8211",Str "1999",Str "."] +,Para [Str "Ellipses",Str "\8230",Str "and",Str "\8230",Str "and",Str "\8230",Str "."] ,HorizontalRule ,Header 1 [Str "LaTeX"] ,BulletList @@ -300,15 +300,15 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]] ,[Plain [Math InlineMath "223"]] ,[Plain [Math InlineMath "p",Str "-",Str "Tree"]] - ,[Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]] - ,[Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] -,Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math",Str ":"] + ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]] + ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] +,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math",Str ":"] ,BulletList [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation",Str ",",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]] ,[Plain [Str "$",Str "22",Str ",",Str "000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34",Str ",",Str "000",Str ".",Space,Str "(",Str "It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]] ,[Plain [Str "Shoes",Space,Str "(",Str "$",Str "20",Str ")",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5",Str ")",Str "."]] ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"] ,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}" ,HorizontalRule ,Header 1 [Str "Special",Space,Str "Characters"] @@ -366,10 +366,10 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."] ,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."] ,Header 2 [Str "With",Space,Str "ampersands"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."] +,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] ,Header 2 [Str "Autolinks"] ,Para [Str "With",Space,Str "an",Space,Str "ampersand",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")] ,BulletList @@ -388,7 +388,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."] ,HorizontalRule ,Header 1 [Str "Footnotes"] -,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] +,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] ,BlockQuote [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]]] ,OrderedList (1,Decimal,Period) diff --git a/tests/textile-reader.native b/tests/textile-reader.native index 5dd6301f1..8e149c33d 100644 --- a/tests/textile-reader.native +++ b/tests/textile-reader.native @@ -1,5 +1,5 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) -[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Space,Str "Textile",Space,Str "Reader",Str ".",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] +[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Space,Str "Textile",Space,Str "Reader",Str ".",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber",Str "\8217",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] ,HorizontalRule ,Header 1 [Str "Headers"] ,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embeded",Space,Str "link"] ("http://www.example.com","")] @@ -8,9 +8,9 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) ,Header 5 [Str "Level",Space,Str "5"] ,Header 6 [Str "Level",Space,Str "6"] ,Header 1 [Str "Paragraphs"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] ,Para [Str "Line",Space,Str "breaks",Space,Str "are",Space,Str "preserved",Space,Str "in",Space,Str "textile",Str ",",Space,Str "so",Space,Str "you",Space,Str "can",Space,Str "not",Space,Str "wrap",Space,Str "your",Space,Str "very",LineBreak,Str "long",Space,Str "paragraph",Space,Str "with",Space,Str "your",Space,Str "favourite",Space,Str "text",Space,Str "editor",Space,Str "and",Space,Str "have",Space,Str "it",Space,Str "rendered",LineBreak,Str "with",Space,Str "no",Space,Str "break",Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str "."] +,Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str "."] ,BulletList [[Plain [Str "criminey",Str "."]]] ,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "paragraph",Space,Str "break",Space,Str "between",Space,Str "here"] @@ -70,9 +70,9 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) ,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str ".",LineBreak,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str ".",LineBreak,Str "A",Space,Link [Strong [Str "strong",Space,Str "link"]] ("http://www.foobar.com",""),Str "."] ,Para [Emph [Strong [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]],LineBreak,Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Space,Str "and",Space,Emph [Strong [Str "that",Space,Str "one"]],Str ".",LineBreak,Strikeout [Str "This",Space,Str "is",Space,Str "strikeout",Space,Str "and",Space,Strong [Str "strong"]]] ,Para [Str "Superscripts",Str ":",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Strong [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str ".",LineBreak,Str "Subscripts",Str ":",Space,Str "H",Subscript [Str "2"],Str "O",Str ",",Space,Str "H",Subscript [Str "23"],Str "O",Str ",",Space,Str "H",Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O",Str "."] -,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,EmDash,Space,Str "automatic",Space,Str "dashes",Str "."] -,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Ellipses,Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more",Str "."] -,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I",Apostrophe,Str "d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example",Str "."] +,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes",Str "."] +,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "\8230",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more",Str "."] +,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I",Str "\8217",Str "d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example",Str "."] ,Header 1 [Str "Links"] ,Header 2 [Str "Explicit"] ,Para [Str "Just",Space,Str "a",Space,Link [Str "url"] ("http://www.url.com","")] @@ -96,7 +96,7 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) ,[[Plain [Str "bella"]] ,[Plain [Str "45"]] ,[Plain [Str "f"]]]] -,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Ellipses] +,Para [Str "and",Space,Str "some",Space,Str "text",Space,Str "following",Space,Str "\8230"] ,Header 2 [Str "With",Space,Str "headers"] ,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0] [[Plain [Str "name"]] @@ -136,7 +136,7 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []}) ,RawBlock "html" "</div>" ,Para [Str "as",Space,Str "well",Str "."] ,BulletList - [[Plain [Str "this",Space,Str "<",Str "div",Str ">",Space,Str "won",Apostrophe,Str "t",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,Str "<",Str "/div",Str ">"]] + [[Plain [Str "this",Space,Str "<",Str "div",Str ">",Space,Str "won",Str "\8217",Str "t",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,Str "<",Str "/div",Str ">"]] ,[Plain [Str "but",Space,Str "this",Space,RawInline "html" "<strong>",Space,Str "will",Space,Str "produce",Space,Str "inline",Space,Str "html",Space,RawInline "html" "</strong>"]]] ,Para [Str "Can",Space,Str "you",Space,Str "prove",Space,Str "that",Space,Str "2",Space,Str "<",Space,Str "3",Space,Str "?"] ,Header 1 [Str "Acronyms",Space,Str "and",Space,Str "marks"] diff --git a/tests/writer.docbook b/tests/writer.docbook index d2b28a28a..d767b6e20 100644 --- a/tests/writer.docbook +++ b/tests/writer.docbook @@ -16,7 +16,7 @@ </articleinfo> <para> This is a set of tests for pandoc. Most of them are adapted from John - Gruber's markdown test suite. + Gruber’s markdown test suite. </para> <section id="headers"> <title>Headers</title> @@ -56,7 +56,7 @@ <section id="paragraphs"> <title>Paragraphs</title> <para> - Here's a regular paragraph. + Here’s a regular paragraph. </para> <para> In Markdown 1.0.0 and earlier. Version 8. This line turns into a list @@ -64,7 +64,7 @@ a list item. </para> <para> - Here's one with a bullet. * criminey. + Here’s one with a bullet. * criminey. </para> <para> There should be a hard line break<literallayout></literallayout>here. @@ -364,7 +364,7 @@ These should not be escaped: \$ \\ \> \[ \{ Item 1, graf one. </para> <para> - Item 1. graf two. The quick brown fox jumped over the lazy dog's + Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. </para> </listitem> @@ -404,7 +404,7 @@ These should not be escaped: \$ \\ \> \[ \{ </listitem> </itemizedlist> <para> - Here's another: + Here’s another: </para> <orderedlist numeration="arabic"> <listitem> @@ -893,7 +893,7 @@ These should not be escaped: \$ \\ \> \[ \{ <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script> <para> - Here's a simple block: + Here’s a simple block: </para> <div> @@ -956,7 +956,7 @@ These should not be escaped: \$ \\ \> \[ \{ <hr /> </programlisting> <para> - Hr's: + Hr’s: </para> <hr> @@ -1041,7 +1041,7 @@ These should not be escaped: \$ \\ \> \[ \{ </para> <para> <quote>He said, <quote>I want to go.</quote></quote> Were you alive in the - 70's? + 70’s? </para> <para> Here is some quoted <quote><literal>code</literal></quote> and a @@ -1092,19 +1092,19 @@ These should not be escaped: \$ \\ \> \[ \{ </listitem> <listitem> <para> - Here's some display math: + Here’s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ </para> </listitem> <listitem> <para> - Here's one that has a line break in it: + Here’s one that has a line break in it: <emphasis>α</emphasis> + <emphasis>ω</emphasis> × <emphasis>x</emphasis><superscript>2</superscript>. </para> </listitem> </itemizedlist> <para> - These shouldn't be math: + These shouldn’t be math: </para> <itemizedlist> <listitem> @@ -1131,7 +1131,7 @@ These should not be escaped: \$ \\ \> \[ \{ </listitem> </itemizedlist> <para> - Here's a LaTeX table: + Here’s a LaTeX table: </para> </section> <section id="special-characters"> @@ -1304,18 +1304,18 @@ These should not be escaped: \$ \\ \> \[ \{ <section id="with-ampersands"> <title>With ampersands</title> <para> - Here's a <ulink url="http://example.com/?foo=1&bar=2">link with an + Here’s a <ulink url="http://example.com/?foo=1&bar=2">link with an ampersand in the URL</ulink>. </para> <para> - Here's a link with an amersand in the link text: + Here’s a link with an amersand in the link text: <ulink url="http://att.com/">AT&T</ulink>. </para> <para> - Here's an <ulink url="/script?foo=1&bar=2">inline link</ulink>. + Here’s an <ulink url="/script?foo=1&bar=2">inline link</ulink>. </para> <para> - Here's an <ulink url="/script?foo=1&bar=2">inline link in pointy + Here’s an <ulink url="/script?foo=1&bar=2">inline link in pointy braces</ulink>. </para> </section> @@ -1392,7 +1392,7 @@ or here: <http://example.com/> </para> </footnote> and another.<footnote> <para> - Here's the long note. This one contains multiple blocks. + Here’s the long note. This one contains multiple blocks. </para> <para> Subsequent blocks are indented to show that they belong to the diff --git a/tests/writer.html b/tests/writer.html index f38ad5079..0aaa6a1b3 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -45,8 +45,7 @@ <p>Code in a block quote:</p> <pre><code>sub status { print "working"; -} -</code></pre> +}</code></pre> <p>A list:</p> <ol style="list-style-type: decimal"> <li>item one</li> @@ -71,13 +70,11 @@ sub status { print "working"; } -this code block is indented by one tab -</code></pre> +this code block is indented by one tab</code></pre> <p>And:</p> <pre><code> this code block is indented by two tabs -These should not be escaped: \$ \\ \> \[ \{ -</code></pre> +These should not be escaped: \$ \\ \> \[ \{</code></pre> <hr /> <h1 id="lists">Lists</h1> <h2 id="unordered">Unordered</h2> @@ -274,8 +271,7 @@ These should not be escaped: \$ \\ \> \[ \{ </dd> <dt><em>orange</em></dt> <dd><p>orange fruit</p> -<pre><code>{ orange code block } -</code></pre> +<pre><code>{ orange code block }</code></pre> <blockquote> <p>orange block quote</p> </blockquote> @@ -358,11 +354,9 @@ foo <p>This should be a code block, though:</p> <pre><code><div> foo -</div> -</code></pre> +</div></code></pre> <p>As should this:</p> -<pre><code><div>foo</div> -</code></pre> +<pre><code><div>foo</div></code></pre> <p>Now, nested:</p> <div> <div> @@ -387,14 +381,12 @@ Blah --> <p>Code block:</p> -<pre><code><!-- Comment --> -</code></pre> +<pre><code><!-- Comment --></code></pre> <p>Just plain comment, with trailing spaces on the line:</p> <!-- foo --> <p>Code:</p> -<pre><code><hr /> -</code></pre> +<pre><code><hr /></code></pre> <p>Hr’s:</p> <hr> @@ -517,8 +509,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>') <p>Indented <a href="/url">twice</a>.</p> <p>Indented <a href="/url">thrice</a>.</p> <p>This should [not][] be a link.</p> -<pre><code>[not]: /url -</code></pre> +<pre><code>[not]: /url</code></pre> <p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> <p>Foo <a href="/url/" title="Title with "quote" inside">biz</a>.</p> <h2 id="with-ampersands">With ampersands</h2> @@ -543,8 +534,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+ <p>Blockquoted: <a href="http://example.com/"><code class="url">http://example.com/</code></a></p> </blockquote> <p>Auto-links should not occur here: <code><http://example.com/></code></p> -<pre><code>or here: <http://example.com/> -</code></pre> +<pre><code>or here: <http://example.com/></code></pre> <hr /> <h1 id="images">Images</h1> <p>From “Voyage dans la Lune” by Georges Melies (1902):</p> @@ -568,8 +558,7 @@ document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+ <li id="fn1"><p>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. <a href="#fnref1" class="footnoteBackLink">↩</a></p></li> <li id="fn2"><p>Here’s the long note. This one contains multiple blocks.</p> <p>Subsequent blocks are indented to show that they belong to the footnote (as with list items).</p> -<pre><code> { <code> } -</code></pre> +<pre><code> { <code> }</code></pre> <p>If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. <a href="#fnref2" class="footnoteBackLink">↩</a></p></li> <li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain <a href="http://google.com">links</a> and <code>]</code> verbatim characters, as well as [bracketed text]. <a href="#fnref3" class="footnoteBackLink">↩</a></p></li> <li id="fn4"><p>In quote. <a href="#fnref4" class="footnoteBackLink">↩</a></p></li> diff --git a/tests/writer.latex b/tests/writer.latex index 5c2594ec7..7c334a5cd 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -1,4 +1,4 @@ -\documentclass{article} +\documentclass[]{article} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \ifxetex diff --git a/tests/writer.mediawiki b/tests/writer.mediawiki index af4f7050c..314e7ab2f 100644 --- a/tests/writer.mediawiki +++ b/tests/writer.mediawiki @@ -1,4 +1,4 @@ -This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite. +This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite. ----- @@ -30,11 +30,11 @@ with no blank line = Paragraphs = -Here’s a regular paragraph. +Here’s a regular paragraph. In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item. -Here’s one with a bullet. * criminey. +Here’s one with a bullet. * criminey. There should be a hard line break<br /> here. @@ -160,7 +160,7 @@ Multiple paragraphs: <ol style="list-style-type: decimal;"> <li><p>Item 1, graf one.</p> -<p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</p></li> +<p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</p></li> <li><p>Item 2.</p></li> <li><p>Item 3.</p></li></ol> @@ -172,7 +172,7 @@ Multiple paragraphs: -Here’s another: +Here’s another: # First # Second: @@ -350,7 +350,7 @@ And this is '''strong''' <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script> -Here’s a simple block: +Here’s a simple block: <div> @@ -401,7 +401,7 @@ Just plain comment, with trailing spaces on the line: Code: <pre><hr /></pre> -Hr’s: +Hr’s: <hr> @@ -455,21 +455,21 @@ These should not be superscripts or subscripts, because of the unescaped spaces: = Smart quotes, ellipses, dashes = -“Hello,” said the spider. “‘Shelob’ is my name.” +“Hello,” said the spider. “‘Shelob’ is my name.” -‘A’, ‘B’, and ‘C’ are letters. +‘A’, ‘B’, and ‘C’ are letters. -‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ +‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ -‘He said, “I want to go.”’ Were you alive in the 70’s? +‘He said, “I want to go.”’ Were you alive in the 70’s? -Here is some quoted ‘<tt>code</tt>’ and a “[http://example.com/?foo=1&bar=2 quoted link]”. +Here is some quoted ‘<tt>code</tt>’ and a “[http://example.com/?foo=1&bar=2 quoted link]”. -Some dashes: one—two — three—four — five. +Some dashes: one—two — three—four — five. -Dashes between numbers: 5–7, 255–66, 1987–1999. +Dashes between numbers: 5–7, 255–66, 1987–1999. -Ellipses…and…and…. +Ellipses…and…and…. ----- @@ -482,17 +482,17 @@ Ellipses…and…and…. * <math>\alpha \wedge \omega</math> * <math>223</math> * <math>p</math>-Tree -* Here’s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math> -* Here’s one that has a line break in it: <math>\alpha + \omega \times x^2</math>. +* Here’s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math> +* Here’s one that has a line break in it: <math>\alpha + \omega \times x^2</math>. -These shouldn’t be math: +These shouldn’t be math: * To get the famous equation, write <tt>$e = mc^2$</tt>. -* $22,000 is a ''lot'' of money. So is $34,000. (It worked if “lot” is emphasized.) +* $22,000 is a ''lot'' of money. So is $34,000. (It worked if “lot” is emphasized.) * Shoes ($20) and socks ($5). * Escaped <tt>$</tt>: $73 ''this should be emphasized'' 23$. -Here’s a LaTeX table: +Here’s a LaTeX table: @@ -602,13 +602,13 @@ Foo [[url/|biz]]. == With ampersands == -Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL]. +Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL]. -Here’s a link with an amersand in the link text: [http://att.com/ AT&T]. +Here’s a link with an amersand in the link text: [http://att.com/ AT&T]. -Here’s an [[script?foo=1&bar=2|inline link]]. +Here’s an [[script?foo=1&bar=2|inline link]]. -Here’s an [[script?foo=1&bar=2|inline link in pointy braces]]. +Here’s an [[script?foo=1&bar=2|inline link in pointy braces]]. == Autolinks == @@ -630,7 +630,7 @@ Auto-links should not occur here: <tt><http://example.com/></tt> = Images = -From “Voyage dans la Lune” by Georges Melies (1902): +From “Voyage dans la Lune” by Georges Melies (1902): [[Image:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]] @@ -642,7 +642,7 @@ Here is a movie [[Image:movie.jpg|movie]] icon. = Footnotes = Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. -</ref> and another.<ref>Here’s the long note. This one contains multiple blocks. +</ref> and another.<ref>Here’s the long note. This one contains multiple blocks. Subsequent blocks are indented to show that they belong to the footnote (as with list items). diff --git a/tests/writer.native b/tests/writer.native index 879cb24fc..691c4959a 100644 --- a/tests/writer.native +++ b/tests/writer.native @@ -1,5 +1,5 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17",Str ",",Space,Str "2006"]}) -[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Apostrophe,Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] +[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."] ,HorizontalRule ,Header 1 [Str "Headers"] ,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")] @@ -14,9 +14,9 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"] ,HorizontalRule ,Header 1 [Str "Paragraphs"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."] ,Para [Str "In",Space,Str "Markdown",Space,Str "1",Str ".",Str "0",Str ".",Str "0",Space,Str "and",Space,Str "earlier",Str ".",Space,Str "Version",Space,Str "8",Str ".",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item",Str ".",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item",Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] +,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."] ,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here",Str "."] ,HorizontalRule ,Header 1 [Str "Block",Space,Str "Quotes"] @@ -100,7 +100,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Multiple",Space,Str "paragraphs",Str ":"] ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1",Str ",",Space,Str "graf",Space,Str "one",Str "."] - ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Apostrophe,Str "s",Space,Str "back",Str "."]] + ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",Space,Str "back",Str "."]] ,[Para [Str "Item",Space,Str "2",Str "."]] ,[Para [Str "Item",Space,Str "3",Str "."]]] ,Header 2 [Str "Nested"] @@ -110,7 +110,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA [[Plain [Str "Tab"] ,BulletList [[Plain [Str "Tab"]]]]]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "another",Str ":"] +,Para [Str "Here\8217s",Space,Str "another",Str ":"] ,OrderedList (1,Decimal,Period) [[Plain [Str "First"]] ,[Plain [Str "Second",Str ":"] @@ -243,7 +243,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,RawBlock "html" "</td>\n<td>" ,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]] ,RawBlock "html" "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n" -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"] ,RawBlock "html" "<div>\n " ,Plain [Str "foo"] ,RawBlock "html" "</div>\n" @@ -265,7 +265,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,RawBlock "html" "<!-- foo --> \n" ,Para [Str "Code",Str ":"] ,CodeBlock ("",[],[]) "<hr />" -,Para [Str "Hr",Apostrophe,Str "s",Str ":"] +,Para [Str "Hr\8217s",Str ":"] ,RawBlock "html" "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n" ,HorizontalRule ,Header 1 [Str "Inline",Space,Str "Markup"] @@ -286,11 +286,11 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Quoted DoubleQuote [Str "Hello",Str ","],Space,Str "said",Space,Str "the",Space,Str "spider",Str ".",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name",Str "."]] ,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters",Str "."] ,Para [Quoted SingleQuote [Str "Oak",Str ","],Space,Quoted SingleQuote [Str "elm",Str ","],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]] -,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Apostrophe,Str "s",Str "?"] +,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s",Str "?"] ,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."] -,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",EmDash,Str "two",Space,EmDash,Space,Str "three",EmDash,Str "four",Space,EmDash,Space,Str "five",Str "."] -,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",EnDash,Str "7",Str ",",Space,Str "255",EnDash,Str "66",Str ",",Space,Str "1987",EnDash,Str "1999",Str "."] -,Para [Str "Ellipses",Ellipses,Str "and",Ellipses,Str "and",Ellipses,Str "."] +,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",Str "\8212",Str "two",Space,Str "\8212",Space,Str "three",Str "\8212",Str "four",Space,Str "\8212",Space,Str "five",Str "."] +,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",Str "\8211",Str "7",Str ",",Space,Str "255",Str "\8211",Str "66",Str ",",Space,Str "1987",Str "\8211",Str "1999",Str "."] +,Para [Str "Ellipses",Str "\8230",Str "and",Str "\8230",Str "and",Str "\8230",Str "."] ,HorizontalRule ,Header 1 [Str "LaTeX"] ,BulletList @@ -300,15 +300,15 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]] ,[Plain [Math InlineMath "223"]] ,[Plain [Math InlineMath "p",Str "-",Str "Tree"]] - ,[Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]] - ,[Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] -,Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math",Str ":"] + ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]] + ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]] +,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math",Str ":"] ,BulletList [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation",Str ",",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]] ,[Plain [Str "$",Str "22",Str ",",Str "000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34",Str ",",Str "000",Str ".",Space,Str "(",Str "It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]] ,[Plain [Str "Shoes",Space,Str "(",Str "$",Str "20",Str ")",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5",Str ")",Str "."]] ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."]]] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"] ,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}" ,HorizontalRule ,Header 1 [Str "Special",Space,Str "Characters"] @@ -366,10 +366,10 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."] ,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."] ,Header 2 [Str "With",Space,Str "ampersands"] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] -,Para [Str "Here",Apostrophe,Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."] +,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."] +,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."] ,Header 2 [Str "Autolinks"] ,Para [Str "With",Space,Str "an",Space,Str "ampersand",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")] ,BulletList @@ -388,7 +388,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."] ,HorizontalRule ,Header 1 [Str "Footnotes"] -,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] +,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] ,BlockQuote [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]]] ,OrderedList (1,Decimal,Period) diff --git a/tests/writer.opendocument b/tests/writer.opendocument index 4e02db650..587c16502 100644 --- a/tests/writer.opendocument +++ b/tests/writer.opendocument @@ -864,7 +864,7 @@ <text:p text:style-name="Author">Anonymous</text:p> <text:p text:style-name="Date">July 17, 2006</text:p> <text:p text:style-name="Text_20_body">This is a set of tests for pandoc. Most -of them are adapted from John Gruber’s markdown test suite.</text:p> +of them are adapted from John Gruber’s markdown test suite.</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Headers</text:h> <text:h text:style-name="Heading_20_2" text:outline-level="2">Level 2 with an @@ -883,12 +883,12 @@ link</text:span></text:a></text:h> <text:p text:style-name="First_20_paragraph">with no blank line</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Paragraphs</text:h> -<text:p text:style-name="First_20_paragraph">Here’s a regular +<text:p text:style-name="First_20_paragraph">Here’s a regular paragraph.</text:p> <text:p text:style-name="Text_20_body">In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</text:p> -<text:p text:style-name="Text_20_body">Here’s one with a bullet. * +<text:p text:style-name="Text_20_body">Here’s one with a bullet. * criminey.</text:p> <text:p text:style-name="Text_20_body">There should be a hard line break<text:line-break />here.</text:p> @@ -1061,7 +1061,7 @@ Blocks</text:h> <text:list-item> <text:p text:style-name="P29">Item 1, graf one.</text:p> <text:p text:style-name="P29">Item 1. graf two. The quick brown fox jumped - over the lazy dog’s back.</text:p> + over the lazy dog’s back.</text:p> </text:list-item> <text:list-item> <text:p text:style-name="P29">Item 2.</text:p> @@ -1084,7 +1084,7 @@ Blocks</text:h> </text:list> </text:list-item> </text:list> -<text:p text:style-name="First_20_paragraph">Here’s another:</text:p> +<text:p text:style-name="First_20_paragraph">Here’s another:</text:p> <text:list text:style-name="L16"> <text:list-item> <text:p text:style-name="P33">First</text:p> @@ -1303,7 +1303,7 @@ table:</text:p> <text:span text:style-name="T5">emphasized</text:span></text:p> <text:p text:style-name="Text_20_body">And this is <text:span text:style-name="T6">strong</text:span></text:p> -<text:p text:style-name="Text_20_body">Here’s a simple block:</text:p> +<text:p text:style-name="Text_20_body">Here’s a simple block:</text:p> <text:p text:style-name="Text_20_body">foo</text:p> <text:p text:style-name="Text_20_body">This should be a code block, though:</text:p> @@ -1323,7 +1323,7 @@ comment:</text:p> spaces on the line:</text:p> <text:p text:style-name="Text_20_body">Code:</text:p> <text:p text:style-name="P50"><hr /></text:p> -<text:p text:style-name="First_20_paragraph">Hr’s:</text:p> +<text:p text:style-name="First_20_paragraph">Hr’s:</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Inline Markup</text:h> @@ -1374,23 +1374,22 @@ subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Smart quotes, ellipses, dashes</text:h> -<text:p text:style-name="First_20_paragraph">“Hello,” said the -spider. “‘Shelob’ is my name.”</text:p> -<text:p text:style-name="Text_20_body">‘A’, ‘B’, and -‘C’ are letters.</text:p> -<text:p text:style-name="Text_20_body">‘Oak,’ ‘elm,’ -and ‘beech’ are names of trees. So is ‘pine.’</text:p> -<text:p text:style-name="Text_20_body">‘He said, “I want to -go.”’ Were you alive in the 70’s?</text:p> +<text:p text:style-name="First_20_paragraph">“Hello,” said the spider. +“‘Shelob’ is my name.”</text:p> +<text:p text:style-name="Text_20_body">‘A’, ‘B’, and ‘C’ are letters.</text:p> +<text:p text:style-name="Text_20_body">‘Oak,’ ‘elm,’ and ‘beech’ are names of +trees. So is ‘pine.’</text:p> +<text:p text:style-name="Text_20_body">‘He said, “I want to go.”’ Were you +alive in the 70’s?</text:p> <text:p text:style-name="Text_20_body">Here is some quoted -‘<text:span text:style-name="Teletype">code</text:span>’ and a -“<text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">quoted -link</text:span></text:a>”.</text:p> -<text:p text:style-name="Text_20_body">Some dashes: one—two — -three—four — five.</text:p> -<text:p text:style-name="Text_20_body">Dashes between numbers: 5–7, -255–66, 1987–1999.</text:p> -<text:p text:style-name="Text_20_body">Ellipses…and…and….</text:p> +‘<text:span text:style-name="Teletype">code</text:span>’ and a +“<text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">quoted +link</text:span></text:a>”.</text:p> +<text:p text:style-name="Text_20_body">Some dashes: one—two — three—four — +five.</text:p> +<text:p text:style-name="Text_20_body">Dashes between numbers: 5–7, 255–66, +1987–1999.</text:p> +<text:p text:style-name="Text_20_body">Ellipses…and…and….</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">LaTeX</text:h> <text:list text:style-name="L26"> @@ -1413,17 +1412,15 @@ three—four — five.</text:p> <text:p text:style-name="P51"><text:span text:style-name="T62">p</text:span>-Tree</text:p> </text:list-item> <text:list-item> - <text:p text:style-name="P51">Here’s some display math: + <text:p text:style-name="P51">Here’s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</text:p> </text:list-item> <text:list-item> - <text:p text:style-name="P51">Here’s one that has a line break in - it: + <text:p text:style-name="P51">Here’s one that has a line break in it: <text:span text:style-name="T63">α</text:span> + <text:span text:style-name="T64">ω</text:span> × <text:span text:style-name="T65">x</text:span><text:span text:style-name="T66">2</text:span>.</text:p> </text:list-item> </text:list> -<text:p text:style-name="First_20_paragraph">These shouldn’t be -math:</text:p> +<text:p text:style-name="First_20_paragraph">These shouldn’t be math:</text:p> <text:list text:style-name="L27"> <text:list-item> <text:p text:style-name="P52">To get the famous equation, write @@ -1432,7 +1429,7 @@ math:</text:p> <text:list-item> <text:p text:style-name="P52">$22,000 is a <text:span text:style-name="T67">lot</text:span> of money. So is $34,000. - (It worked if “lot” is emphasized.)</text:p> + (It worked if “lot” is emphasized.)</text:p> </text:list-item> <text:list-item> <text:p text:style-name="P52">Shoes ($20) and socks ($5).</text:p> @@ -1447,8 +1444,7 @@ math:</text:p> 23$.</text:p> </text:list-item> </text:list> -<text:p text:style-name="First_20_paragraph">Here’s a LaTeX -table:</text:p> +<text:p text:style-name="First_20_paragraph">Here’s a LaTeX table:</text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Special Characters</text:h> @@ -1538,16 +1534,16 @@ by itself should be a link.</text:p> <text:a xlink:type="simple" xlink:href="/url/" office:name="Title with "quote" inside"><text:span text:style-name="Definition">biz</text:span></text:a>.</text:p> <text:h text:style-name="Heading_20_2" text:outline-level="2">With ampersands</text:h> -<text:p text:style-name="First_20_paragraph">Here’s a +<text:p text:style-name="First_20_paragraph">Here’s a <text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">link with an ampersand in the URL</text:span></text:a>.</text:p> -<text:p text:style-name="Text_20_body">Here’s a link with an amersand in -the link text: +<text:p text:style-name="Text_20_body">Here’s a link with an amersand in the +link text: <text:a xlink:type="simple" xlink:href="http://att.com/" office:name="AT&T"><text:span text:style-name="Definition">AT&T</text:span></text:a>.</text:p> -<text:p text:style-name="Text_20_body">Here’s an +<text:p text:style-name="Text_20_body">Here’s an <text:a xlink:type="simple" xlink:href="/script?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">inline link</text:span></text:a>.</text:p> -<text:p text:style-name="Text_20_body">Here’s an +<text:p text:style-name="Text_20_body">Here’s an <text:a xlink:type="simple" xlink:href="/script?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">inline link in pointy braces</text:span></text:a>.</text:p> <text:h text:style-name="Heading_20_2" text:outline-level="2">Autolinks</text:h> @@ -1573,8 +1569,8 @@ link in pointy braces</text:span></text:a>.</text:p> <text:p text:style-name="P57">or here: <http://example.com/></text:p> <text:p text:style-name="Horizontal_20_Line" /> <text:h text:style-name="Heading_20_1" text:outline-level="1">Images</text:h> -<text:p text:style-name="First_20_paragraph">From “Voyage dans la -Lune” by Georges Melies (1902):</text:p> +<text:p text:style-name="First_20_paragraph">From “Voyage dans la Lune” by +Georges Melies (1902):</text:p> <text:p text:style-name="Text_20_body"><draw:frame><draw:image xlink:href="lalune.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame></text:p> <text:p text:style-name="Text_20_body">Here is a movie <draw:frame><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame> @@ -1586,7 +1582,7 @@ reference,<text:note text:id="ftn0" text:note-class="footnote"><text:note-citati is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</text:p></text:note-body></text:note> and -another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here’s +another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body><text:p text:style-name="Footnote">Here’s the long note. This one contains multiple blocks.</text:p><text:p text:style-name="Footnote">Subsequent blocks are indented to show that they belong to the footnote (as with list |
