aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Interact.hs4
-rw-r--r--README100
-rw-r--r--RELEASE-CHECKLIST4
-rw-r--r--changelog180
-rw-r--r--data/reference.docxbin9782 -> 9797 bytes
-rw-r--r--data/reference.odtbin10595 -> 10890 bytes
-rw-r--r--data/sample.lua4
m---------data/templates13
-rwxr-xr-x[-rw-r--r--]github-upload.sh8
-rwxr-xr-xgooglecode-upload.sh2
-rwxr-xr-xmake_osx_package.sh25
-rw-r--r--pandoc.cabal50
-rw-r--r--pandoc.hs38
-rw-r--r--src/Text/Pandoc.hs8
-rw-r--r--src/Text/Pandoc/ImageSize.hs233
-rw-r--r--src/Text/Pandoc/MIME.hs2
-rw-r--r--src/Text/Pandoc/Options.hs2
-rw-r--r--src/Text/Pandoc/PDF.hs10
-rw-r--r--src/Text/Pandoc/Parsing.hs45
-rw-r--r--src/Text/Pandoc/Pretty.hs14
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs11
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs24
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs11
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs123
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs30
-rw-r--r--src/Text/Pandoc/Readers/Org.hs552
-rw-r--r--src/Text/Pandoc/Readers/RST.hs116
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs2
-rw-r--r--src/Text/Pandoc/Shared.hs30
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs47
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs55
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs6
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs34
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs84
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs29
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs2
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs53
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs16
-rw-r--r--src/Text/Pandoc/Writers/Org.hs2
-rw-r--r--src/Text/Pandoc/Writers/RST.hs2
-rw-r--r--src/Text/Pandoc/Writers/Shared.hs30
-rw-r--r--src/Text/Pandoc/Writers/Texinfo.hs6
-rw-r--r--src/Text/Pandoc/Writers/Textile.hs2
-rwxr-xr-xtests/MarkdownTest_1.0.3/MarkdownTest.pl176
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html17
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text21
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Auto links.html18
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Auto links.text13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html118
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text120
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text11
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Blocks.html18
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Blocks.text14
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Spans.html6
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Spans.text6
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html71
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text67
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html72
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text69
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, inline style.html11
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, inline style.text12
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, reference style.html52
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, reference style.text71
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html9
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text20
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html3
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html314
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text306
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html942
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text888
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html9
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text5
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html148
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text131
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Strong and em together.html7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Strong and em together.text7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tabs.html25
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tabs.text21
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tidyness.html8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tidyness.text5
-rw-r--r--tests/Tests/Readers/LaTeX.hs2
-rw-r--r--tests/Tests/Readers/Markdown.hs4
-rw-r--r--tests/Tests/Readers/Org.hs533
-rw-r--r--tests/Tests/Walk.hs4
-rw-r--r--tests/html-reader.native20
-rw-r--r--tests/lhs-test.latex2
-rw-r--r--tests/lhs-test.latex+lhs2
-rw-r--r--tests/lhs-test.markdown4
-rw-r--r--tests/markdown-reader-more.native2
-rw-r--r--tests/mediawiki-reader.wiki4
-rw-r--r--tests/rst-reader.native10
-rw-r--r--tests/rst-reader.rst24
-rw-r--r--tests/tables.latex90
-rw-r--r--tests/test-pandoc.hs2
-rw-r--r--tests/writer.latex2
-rw-r--r--windows/make-windows-installer.bat1
-rw-r--r--windows/pandoc.wxs2
105 files changed, 2275 insertions, 4347 deletions
diff --git a/Interact.hs b/Interact.hs
index 80b5a34f5..4d24904c5 100644
--- a/Interact.hs
+++ b/Interact.hs
@@ -9,6 +9,10 @@
-- You must have first done a 'cabal configure' or 'cabal install'
+-- Note: Interact.hs doesn't work with Cabal >= 1.18. I recommend
+-- using cabal sandboxes and the new 'cabal repl' command if you are
+-- using a recent version.
+
import System.Process
import Distribution.Simple.LocalBuildInfo
import Distribution.Package
diff --git a/README b/README
index 2a5ecc6ad..527d63a1a 100644
--- a/README
+++ b/README
@@ -13,14 +13,15 @@ Description
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],
-[LaTeX], [MediaWiki markup], [Haddock markup], [OPML], and [DocBook]; and
-it can write plain text, [markdown], [reStructuredText], [XHTML], [HTML 5],
-[LaTeX] (including [beamer] slide shows), [ConTeXt], [RTF], [OPML], [DocBook],
-[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
-[EPUB] (v2 or v3), [FictionBook2], [Textile], [groff man] pages, [Emacs
-Org-Mode], [AsciiDoc], and [Slidy], [Slideous], [DZSlides], [reveal.js]
-or [S5] HTML slide shows. It can also produce [PDF] output on systems
-where LaTeX is installed.
+[LaTeX], [MediaWiki markup], [Haddock markup], [OPML], [Emacs Org-mode]
+and [DocBook]; and it can write plain text, [markdown],
+[reStructuredText], [XHTML], [HTML 5], [LaTeX] (including [beamer] slide
+shows), [ConTeXt], [RTF], [OPML], [DocBook], [OpenDocument], [ODT],
+[Word docx], [GNU Texinfo], [MediaWiki markup], [EPUB] (v2 or v3),
+[FictionBook2], [Textile], [groff man] pages, [Emacs Org-Mode],
+[AsciiDoc], and [Slidy], [Slideous], [DZSlides], [reveal.js] or [S5]
+HTML slide shows. It can also produce [PDF] output on systems where
+LaTeX is installed.
Pandoc's enhanced version of markdown includes syntax for footnotes,
tables, flexible ordered lists, definition lists, fenced code blocks,
@@ -108,7 +109,7 @@ to PDF:
Production of a PDF requires that a LaTeX engine be installed (see
`--latex-engine`, below), and assumes that the following LaTeX packages are
available: `amssymb`, `amsmath`, `ifxetex`, `ifluatex`, `listings` (if the
-`--listings` option is used), `fancyvrb`, `longtable`, `url`,
+`--listings` option is used), `fancyvrb`, `longtable`, `booktabs`, `url`,
`graphicx`, `hyperref`, `ulem`, `babel` (if the `lang` variable is set),
`fontspec` (if `xelatex` or `lualatex` is used as the LaTeX engine), `xltxtra`
and `xunicode` (if `xelatex` is used).
@@ -143,14 +144,14 @@ General options
`markdown_phpextra` (PHP Markdown Extra extended markdown),
`markdown_github` (github extended markdown),
`textile` (Textile), `rst` (reStructuredText), `html` (HTML),
- `docbook` (DocBook), `opml` (OPML), `mediawiki` (MediaWiki markup),
- `haddock` (Haddock markup), or `latex` (LaTeX).
- If `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`,
- the input will be treated as literate Haskell source:
- see [Literate Haskell support](#literate-haskell-support), below.
- Markdown syntax extensions can be individually enabled or disabled
- by appending `+EXTENSION` or `-EXTENSION` to the format name.
- So, for example, `markdown_strict+footnotes+definition_lists`
+ `docbook` (DocBook), `opml` (OPML), `org` (Emacs Org-mode),
+ `mediawiki` (MediaWiki markup), `haddock` (Haddock markup), or
+ latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`,
+ `latex`, or `html`, the input will be treated as literate Haskell
+ source: see [Literate Haskell support](#literate-haskell-support),
+ below. Markdown syntax extensions can be individually enabled or
+ disabled by appending `+EXTENSION` or `-EXTENSION` to the format
+ name. So, for example, `markdown_strict+footnotes+definition_lists`
is strict markdown with footnotes and definition lists enabled,
and `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
without pipe tables and with hard line breaks. See [Pandoc's
@@ -434,8 +435,8 @@ Options affecting specific writers
`--chapters`
: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
output. When the LaTeX template uses the report, book, or
- memoir class, this option is implied. If `--beamer` is used,
- top-level headers will become `\part{..}`.
+ memoir class, this option is implied. If `beamer` is the output
+ format, top-level headers will become `\part{..}`.
`-N`, `--number-sections`
: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
@@ -801,6 +802,8 @@ as `title`, `author`, and `date`) as well as the following:
: causes links to be printed as footnotes in LaTeX documents
`biblio-style`
: bibliography style in LaTeX, when used with `--natbib`
+`biblio-files`
+: bibliography files to use in LaTeX, with `--natbib` or `--biblatex`
`section`
: section number in man pages
`header`
@@ -894,6 +897,9 @@ If you need a hard line break, put two or more spaces at the end of a line.
**Extension: `escaped_line_breaks`**
A backslash followed by a newline is also a hard line break.
+Note: in multiline and grid table cells, this is the only way
+to create a hard line break, since trailing spaces in the cells
+are ignored.
Headers
-------
@@ -1277,7 +1283,7 @@ one tab:
+ pears
+ peaches
* vegetables
- + brocolli
+ + broccoli
+ chard
As noted above, markdown allows you to write list items "lazily," instead of
@@ -1843,6 +1849,18 @@ equivalent of the markdown in the `abstract` field:
<p>This is the abstract.</p>
<p>It consists of two paragraphs.</p>
+Note: The `author` variable in the default templates expects a simple list or
+string. To use the structured authors in the example, you would need a
+custom template. For example:
+
+ $for(author)$
+ $if(author.name)$
+ $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
+ $else$
+ $author$
+ $endif$
+ $endfor$
+
Backslash escapes
-----------------
@@ -2091,7 +2109,7 @@ Raw HTML
Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
(except verbatim contexts, where `<`, `>`, and `&` are interpreted
-literally). (Techncially this is not an extension, since standard
+literally). (Technically this is not an extension, since standard
markdown allows it, but it has been made an extension so that it can
be disabled if desired.)
@@ -2456,6 +2474,21 @@ document with an appropriate header:
The bibliography will be inserted after this header.
+If you want to include items in the bibliography without actually
+citing them in the body text, you can define a dummy `nocite` metadata
+field and put the citations there:
+
+ ---
+ nocite:
+ | @item1, @item2
+ ...
+
+ @item3
+
+In this example, the document will contain a citation for `item3`
+only, but the bibliography will contain entries for `item1`, `item2`, and
+`item3`.
+
Non-pandoc extensions
---------------------
@@ -2504,10 +2537,9 @@ the document, for example:
Comment: This is a sample mmd title block, with
a field spanning multiple lines.
-See the MultiMarkdown documentation for details. Note that only title,
-author, and date are recognized; other fields are simply ignored by
-pandoc. If `pandoc_title_block` or `yaml_metadata_block` is enabled,
-it will take precedence over `mmd_title_block`.
+See the MultiMarkdown documentation for details. If `pandoc_title_block` or
+`yaml_metadata_block` is enabled, it will take precedence over
+`mmd_title_block`.
[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
@@ -2565,6 +2597,20 @@ variants are supported:
`markdown_strict` (Markdown.pl)
: `raw_html`
+Extensions with formats other than markdown
+-------------------------------------------
+
+Some of the extensions discussed above can be used with formats
+other than markdown:
+
+* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
+ and `textile` input (and is used by default).
+
+* `tex_math_dollars`, `tex_math_single_backslash`, and
+ `tex_math_double_backslash` can be used with `html` input.
+ (This is handy for reading web pages formatted using MathJax,
+ for example.)
+
Producing slide shows with Pandoc
=================================
@@ -2822,12 +2868,14 @@ The following fields are recognized:
~ A string value.
`cover-image`
~ A string value (path to cover image).
+`stylesheet`
+ ~ A string value (path to CSS stylesheet).
Literate Haskell support
========================
If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
-format (`markdown`, `mardkown_strict`, `rst`, or `latex` for input or output;
+format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
`beamer`, `html` or `html5` for output only), pandoc will treat the document as
literate Haskell source. This means that
diff --git a/RELEASE-CHECKLIST b/RELEASE-CHECKLIST
index d3b1a7fc9..af0102622 100644
--- a/RELEASE-CHECKLIST
+++ b/RELEASE-CHECKLIST
@@ -16,9 +16,7 @@ _ Upload to Google Code (googlecode-upload.sh)
_ Go to Google code and deprecate the old versions
-- Add release on github (github-upload.sh + manual)
-
-_ Add release on sourceforge
+- Add release on github (and upload files)
_ Upload to HackageDB
diff --git a/changelog b/changelog
index 8bb15052b..90a34c2e4 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,143 @@
+pandoc (1.12.3.3)
+
+ * To changes to source; recompiled tarball with latest alex and
+ happy, so they will work with GHC 7.8.
+
+pandoc (1.12.3.2)
+
+ * Bumped version bounds for blaze-html, blaze-markup.
+
+ * ImageSize: Avoid use of lookAhead, which is not in binary >= 0.6
+ (#1124).
+
+ * Fixed mediawiki ordered list parsing (#1122).
+
+ * HTML reader: Fixed bug reading inline math with `$$` (#225).
+
+ * Added support for LaTeX style literate Haskell code blocks in rST
+ (Merijn Verstraaten).
+
+pandoc (1.12.3.1)
+
+ * Relaxed version constraint on binary, allowing the use of binary 0.5.
+
+pandoc (1.12.3)
+
+ * The `--bibliography` option now sets the `biblio-files` variable.
+ So, if you're using `--natbib` or `--biblatex`, you can just use
+ `--bibliography=foo.bib` instead of `-V bibliofiles=foo`.
+
+ * Don't run pandoc-citeproc filter if `--bibliography` is
+ used together with `--natbib` or `--biblatex` (Florian Eitel).
+
+ * Template changes:
+
+ + Updated beamer template to include booktabs.
+ + Added `abstract` variable to LaTeX template.
+ + Put `header-includes` after `title` in LaTeX template (#908).
+ + Allow use of `\includegraphics[size]` in beamer.
+ This just required porting a macro definition from the default
+ LaTeX template to the default beamer template.
+
+ * `reference.docx`: Include `FootnoteText` style.
+ Otherwise Word ignores the style, even when specified in the `pPr`.
+ (#901)
+
+ * `reference.odt`: Tidied `styles.xml`.
+
+ * Relaxed version bounds for dependencies.
+
+ * Added `withSocketsDo` around http conduit code in `openURL`,
+ so it works on Windows (#1080).
+
+ * Added `Cite` function to `sample.lua`.
+
+ * Markdown reader:
+
+ + Fixed regression in title blocks (#1089).
+ If author field was empty, date was being ignored.
+ + Allow backslash-newline hard line breaks in grid and
+ multiline table cells.
+ + Citation keys may now start with underscores, and may contain
+ underscores adjacent to internal punctuation.
+
+ * LaTeX reader:
+
+ + Add support for `Verb` macro (jrnold) (#1090).
+ + Support babel-style quoting: `` "`..."' ``.
+
+ * Properly handle script blocks in strict mode. (That is,
+ `markdown-markdown_in_html_blocks`.) Previously a spurious
+ `<p>` tag was being added (#1093).
+
+ * Docbook reader: Avoid failure if `tbody` contains no `tr` or `row`
+ elements.
+
+ * LaTeX writer:
+
+ + Factored out function for table cell creation.
+ + Better treatment of footnotes in tables.
+ Notes now appear in the regular sequence, rather than in the
+ table cell. (This was a regression in 1.10.)
+
+ * HTML reader: Parse name/content pairs from meta tags as metadata.
+ Closes #1106.
+
+ * Moved `fixDisplayMath` from Docx writer to `Writer.Shared`.
+
+ * OpenDocument writer: Fixed `RawInline`, `RawBlock` so they don't escape.
+
+ * ODT writer: Use mathml for proper rendering of formulas.
+ Note: LibreOffice's support for this seems a bit buggy. But
+ it should be better than what we had before.
+
+ * RST writer: Ensure no blank line after def in definition list (#992).
+
+ * Markdown writer: Don't use tilde code blocks with braced attributes in
+ `markdown_github` output. A consequence of this change is that the
+ backtick form will be preferred in general if both are enabled. That
+ is good, as it is much more widespread than the tilde form. (#1084)
+
+ * Docx writer: Fixed problem with some modified reference docx files.
+ Include `word/_rels/settings.xml.rels` if it exists, as well as other
+ `rels` files besides the ones pandoc generates explicitly.
+
+ * HTML writer:
+
+ + With `--toc`, headers no longer link to themselves (#1081).
+ + Omit footnotes from TOC entries. Otherwise we get doubled
+ footnotes when headers have notes!
+
+ * EPUB writer:
+
+ + Avoid duplicate notes when headings contain notes.
+ This arose because the headings are copied into the metadata
+ "title" field, and the note gets rendered twice. We strip the
+ note now before putting the heading in "title".
+ + Strip out footnotes from toc entries.
+ + Fixed bug with `--epub-stylesheet`. Now the contents of
+ `writerEpubStylesheet` (set by `--epub-stylesheet`)
+ should again work, and take precedence over a stylesheet specified
+ in the metadata.
+
+ * `Text.Pandoc.Pretty`: Added `nestle`. API change.
+
+ * `Text.Pandoc.MIME`: Added `wmf`, `emf`.
+
+ * `Text.Pandoc.Shared`: `fetchItem` now handles image URLs beginning
+ with `//`.
+
+ * `Text.Pandoc.ImageSize`: Parse EXIF format JPEGs. Previously
+ we could only get size information for JFIF format, which led
+ to squished images in Word documents. Closes #976.
+
+ * Removed old `MarkdownTest_1.0.3` directory (#1104).
+
+pandoc (1.12.2.1)
+
+ * Markdown reader: Fixed regression in list parser, involving
+ continuation lines containing raw HTML (or even verbatim raw HTML).
+
pandoc (1.12.2)
* Metadata may now be included in YAML blocks in a markdown document.
@@ -40,6 +180,8 @@ pandoc (1.12.2)
if the spine has `linear="no"`. Apparently this is best practice
for other converters as well:
<http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.6>.
+ + Allow `stylesheet` in metadata. The value is a path to the stylesheet.
+ + Allow partial dates: `YYYY`, `YYYY-MM`.
* Markdown writer: Fix rendering of tight sublists (#1050).
Previously a spurious blank line was included after a tight sublist.
@@ -87,6 +229,7 @@ pandoc (1.12.2)
This fix puts braces around a term that contains an internal
link, to avoid problems with square brackets.
+ Properly escape pdftitle, pdfauthor (#1059).
+ + Use booktabs package for tables (thanks to Jose Luis Duran).
* Updated beamer template. Now references should work properly
(in a slide) when `--biblatex` or `--natbib` is used.
@@ -107,31 +250,40 @@ pandoc (1.12.2)
+ Use pandoc `Div` and `Span` for raw `<div>`, `<span>` when
`--parse-raw`.
+ Recognize `svg` tags as block level content (thanks to MinRK).
+ + Parse LaTeX math if appropriate options are set.
* Markdown reader:
+ Yaml block must start immediately after `---`. If there's a blank
line after `---`, we interpreted it as a horizontal rule.
+ Correctly handle empty bullet list items.
+ + Stop parsing "list lines" when we hit a block tag.
+ This fixes exponential slowdown in certain input, e.g.
+ a series of lists followed by `</div>`.
* Slides: Preserve `<div class="references">` in references slide.
- * `Text.Pandoc.Writer.Shared`: fixed bug in `tagWithAttrs`.
- A space was omitted before key-value attributes, leading
- to invalid HTML.
+ * `Text.Pandoc.Writer.Shared`:
+
+ + Fixed bug in `tagWithAttrs`. A space was omitted before key-value
+ attributes, leading to invalid HTML.
+ + `normalizeDate`: Allow dates with year only (thanks to Shaun Attfield).
+ + Fixed bug in `openURL` with `data:` URIs. Previously the base-64
+ encoded bytestring was returned. We now decode it so it's a proper
+ image!
* DocBook reader: Handle numerical attributes starting with decimal.
Also use `safeRead` instead of `read`.
- * `Text.Pandoc.Parsing`: Generalized type of `registerHeader`,
- using new type classes `HasReadeOptions`, `HasIdentifierList`,
- `HasHeaderMap`. These allow certain common functions to be reused
- even in parsers that use custom state (instead of `ParserState`),
- such as the MediaWiki reader.
+ * `Text.Pandoc.Parsing`:
- * `Text.Pandoc.Shared`: Fixed bug in `openURL` with `data:` URIs.
- Previously the base-64 encoded bytestring was returned.
- We now decode it so it's a proper image!
+ + Generalized type of `registerHeader`, using new type classes
+ `HasReadeOptions`, `HasIdentifierList`, `HasHeaderMap`.
+ These allow certain common functions to be reused
+ even in parsers that use custom state (instead of `ParserState`),
+ such as the MediaWiki reader.
+ + Moved inlineMath, displayMath from Markdown reader to Parsing.
+ Generalize their types and export them from Parsing. (API change.)
* `Text.Pandoc.Readers.TexMath`: Export `readTeXMath'`, which attends
to display/inline. Deprecate `readTeXMath`, and use `readTeXMath'`
@@ -151,11 +303,15 @@ pandoc (1.12.2)
over the values using `$for(foo)$`. This has the result that you can
override earlier settings using `-V` by putting new values later on the
command line, which is useful for many purposes.
+
+ * `Text.Pandoc`: Don't default to `pandocExtensions` for all writers.
* Allow "epub2" as synonym for "epub", "html4" for "html".
* Don't look for slidy files in data files with `--self-contained`.
+ * Allow `https:` command line arguments to be downloaded.
+
* Fixed `make_osx_package.sh` so data files embedded in `pandoc-citeproc`.
pandoc (1.12.1)
@@ -3700,7 +3856,7 @@ pandoc (1.5.1.1)
[ John MacFarlane ]
- * Fixed uniqueIdent in Shared so that header identifiers work as
+ * Fixed uniqueIdent in Shared so that header identifiers work as
advertized in the README and are are valid XHTML names.
pandoc (1.5.1)
diff --git a/data/reference.docx b/data/reference.docx
index 42c14a906..a9c268b9f 100644
--- a/data/reference.docx
+++ b/data/reference.docx
Binary files differ
diff --git a/data/reference.odt b/data/reference.odt
index 08385dd4c..c01345612 100644
--- a/data/reference.odt
+++ b/data/reference.odt
Binary files differ
diff --git a/data/sample.lua b/data/sample.lua
index a7e9d6337..a0c3c29a2 100644
--- a/data/sample.lua
+++ b/data/sample.lua
@@ -181,6 +181,10 @@ function Span(s, attr)
return "<span" .. attributes(attr) .. ">" .. s .. "</span>"
end
+function Cite(s)
+ return "<span class=\"cite\">" .. s .. "</span>"
+end
+
function Plain(s)
return s
end
diff --git a/data/templates b/data/templates
-Subproject 713a8f63d5589ab9313869e47b03cf7f49e00e9
+Subproject 3a0ed995ca45648029a445302a16a92b8dfe6c8
diff --git a/github-upload.sh b/github-upload.sh
index 2a5f6534d..875d51831 100644..100755
--- a/github-upload.sh
+++ b/github-upload.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
VERSION=$1
FULLNAME=pandoc-$VERSION
@@ -7,12 +7,12 @@ read -s -p "Token (https://github.com/settings/applications): " TOKEN
curl -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/x-apple-diskimage" \
- --data-binary @$FULLNAME.dmg \
- "https://uploads.github.com/repos/jgm/pandoc/releases/$FULLNAME/assets?name=$FULLNAME.dmg"
+ --data-binary @$FULLNAME.pkg.zip \
+ "https://uploads.github.com/repos/jgm/pandoc/releases/$VERSION/assets?name=$FULLNAME.pkg.zip"
curl -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.manifold-preview" \
-H "Content-Type: application/x-msi" \
--data-binary @$FULLNAME.msi \
- "https://uploads.github.com/repos/jgm/pandoc/releases/$FULLNAME/assets?name=$FULLNAME.msi"
+ "https://uploads.github.com/repos/jgm/pandoc/releases/$VERSION/assets?name=$FULLNAME.msi"
diff --git a/googlecode-upload.sh b/googlecode-upload.sh
index 19975ca91..40fba78e2 100755
--- a/googlecode-upload.sh
+++ b/googlecode-upload.sh
@@ -2,4 +2,4 @@
VERSION=$1
googlecode_upload.py -s "Source tarball" -p pandoc -u fiddlosopher --labels=Featured,Type-Source,OpSys-All dist/pandoc-$VERSION.tar.gz
googlecode_upload.py -s "Windows installer" -p pandoc -u fiddlosopher --labels=Featured,Type-Installer,OpSys-Windows pandoc-$VERSION.msi
-googlecode_upload.py -s "Mac OS X installer" -p pandoc -u fiddlosopher --labels=Featured,Type-Installer,OpSys-OSX pandoc-$VERSION.dmg
+googlecode_upload.py -s "Mac OS X installer" -p pandoc -u fiddlosopher --labels=Featured,Type-Installer,OpSys-OSX pandoc-$VERSION.pkg.zip
diff --git a/make_osx_package.sh b/make_osx_package.sh
index a4eb404f0..6c943c84a 100755
--- a/make_osx_package.sh
+++ b/make_osx_package.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
DIST=`pwd`/osx_package
SANDBOX=`pwd`/.cabal-sandbox
@@ -8,10 +8,13 @@ ROOT=$DIST/pandoc
DEST=$ROOT/usr/local
SCRIPTS=osx-resources
BASE=pandoc-$VERSION
-ME=jgm
+ME=$(whoami)
CODESIGNID="Developer ID Application: John Macfarlane"
PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
-EXES="pandoc pandoc-citeproc biblio2yaml"
+EXES="pandoc pandoc-citeproc"
+
+read -s -p "sudo password: " PASSWORD
+echo $PASSWORD | sudo -S echo "Password valid, continuing."
echo Removing old files...
rm -rf $DIST
@@ -50,6 +53,8 @@ codesign --force --sign "$CODESIGNID" $DEST/bin/pandoc
spctl --assess --type execute $DEST/bin/pandoc
echo Creating OSX package...
+# remove old package first
+echo $PASSWORD | sudo -S rm -rf $BASE.pkg $BASE.dmg
sudo $PACKAGEMAKER \
--root $ROOT \
@@ -67,11 +72,13 @@ sudo codesign --force --sign "$CODESIGNID" $BASE.pkg
# make sure it's valid...
spctl --assess --type install $BASE.pkg
-echo Creating disk image...
+echo Creating zip...
+zip -9 -r $BASE.pkg.zip $BASE.pkg
-sudo hdiutil create "$BASE.dmg" \
- -format UDZO -ov \
- -volname "pandoc $VERSION" \
- -srcfolder $BASE.pkg
-sudo hdiutil internet-enable "$BASE.dmg"
+# echo Creating disk image...
+# sudo hdiutil create "$BASE.dmg" \
+# -format UDZO -ov \
+# -volname "pandoc $VERSION" \
+# -srcfolder $BASE.pkg
+# sudo hdiutil internet-enable "$BASE.dmg"
diff --git a/pandoc.cabal b/pandoc.cabal
index e279a2cc9..0570c1072 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
Name: pandoc
-Version: 1.12.2
+Version: 1.12.3.3
Cabal-Version: >= 1.10
Build-Type: Custom
License: GPL
@@ -17,8 +17,8 @@ Description: 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) HTML,
reStructuredText, LaTeX, DocBook, MediaWiki markup, Haddock
- markup, OPML, and Textile, and it can write markdown,
- reStructuredText, HTML, LaTeX, ConTeXt, Docbook, OPML,
+ markup, OPML, Emacs Org-Mode, and Textile, and it can write
+ markdown, reStructuredText, HTML, LaTeX, ConTeXt, Docbook, OPML,
OpenDocument, ODT, Word docx, RTF, MediaWiki, Textile,
groff man pages, plain text, Emacs Org-Mode, AsciiDoc,
EPUB (v2 and v3), FictionBook2, and several kinds of
@@ -202,46 +202,49 @@ Library
syb >= 0.1 && < 0.5,
containers >= 0.1 && < 0.6,
unordered-containers >= 0.2 && < 0.3,
- array >= 0.3 && < 0.5,
+ array >= 0.3 && < 0.6,
parsec >= 3.1 && < 3.2,
mtl >= 1.1 && < 2.2,
network >= 2 && < 2.5,
filepath >= 1.1 && < 1.4,
- process >= 1 && < 1.2,
+ process >= 1 && < 1.3,
directory >= 1 && < 1.3,
bytestring >= 0.9 && < 0.11,
- text >= 0.11 && < 0.12,
- zip-archive >= 0.1.3.3 && < 0.2,
+ text >= 0.11 && < 1.2,
+ zip-archive >= 0.1.3.3 && < 0.3,
old-locale >= 1 && < 1.1,
time >= 1.2 && < 1.5,
HTTP >= 4000.0.5 && < 4000.3,
- texmath >= 0.6.5.2 && < 0.7,
+ texmath >= 0.6.6 && < 0.7,
xml >= 1.3.12 && < 1.4,
random >= 1 && < 1.1,
extensible-exceptions >= 0.1 && < 0.2,
pandoc-types >= 1.12.3 && < 1.13,
- aeson >= 0.6 && < 0.7,
+ aeson >= 0.6 && < 0.8,
tagsoup >= 0.12.5 && < 0.14,
base64-bytestring >= 0.1 && < 1.1,
zlib >= 0.5 && < 0.6,
- highlighting-kate >= 0.5.5 && < 0.6,
+ highlighting-kate >= 0.5.6 && < 0.6,
data-default >= 0.4 && < 0.6,
- temporary >= 1.1 && < 1.2,
- blaze-html >= 0.5 && < 0.7,
- blaze-markup >= 0.5.1 && < 0.6,
- attoparsec >= 0.10 && < 0.11,
+ temporary >= 1.1 && < 1.3,
+ blaze-html >= 0.5 && < 0.8,
+ blaze-markup >= 0.5.1 && < 0.7,
+ attoparsec >= 0.10 && < 0.12,
yaml >= 0.8.3 && < 0.9,
vector >= 0.10 && < 0.11,
- hslua >= 0.3 && < 0.4
+ hslua >= 0.3 && < 0.4,
+ binary >= 0.5 && < 0.8
Build-Tools: alex, happy
if flag(http-conduit)
- Build-Depends: http-conduit >= 1.9 && < 1.10,
+ Build-Depends: http-conduit >= 1.9 && < 2.1,
http-types >= 0.8 && < 0.9
cpp-options: -DHTTP_CONDUIT
if flag(embed_data_files)
cpp-options: -DEMBED_DATA_FILES
-- Build-Tools: hsb2hs -- not yet recognized by cabal
other-modules: Text.Pandoc.Data
+ if os(windows)
+ Cpp-options: -D_WINDOWS
Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind
Ghc-Prof-Options: -auto-all -caf-all -rtsopts
Default-Language: Haskell98
@@ -260,6 +263,7 @@ Library
Text.Pandoc.Readers.Markdown,
Text.Pandoc.Readers.MediaWiki,
Text.Pandoc.Readers.RST,
+ Text.Pandoc.Readers.Org,
Text.Pandoc.Readers.DocBook,
Text.Pandoc.Readers.OPML,
Text.Pandoc.Readers.TeXMath,
@@ -317,12 +321,11 @@ Executable pandoc
directory >= 1 && < 1.3,
filepath >= 1.1 && < 1.4,
network >= 2 && < 2.5,
- text >= 0.11 && < 0.12,
+ text >= 0.11 && < 1.2,
bytestring >= 0.9 && < 0.11,
extensible-exceptions >= 0.1 && < 0.2,
- highlighting-kate >= 0.5.5 && < 0.6,
- aeson >= 0.6 && < 0.7,
- text >= 0.11 && < 0.12,
+ highlighting-kate >= 0.5.6 && < 0.6,
+ aeson >= 0.6 && < 0.8,
yaml >= 0.8.3 && < 0.9,
containers >= 0.1 && < 0.6,
HTTP >= 4000.0.5 && < 4000.3
@@ -360,11 +363,11 @@ Test-Suite test-pandoc
pandoc,
pandoc-types >= 1.12.3 && < 1.13,
bytestring >= 0.9 && < 0.11,
- text >= 0.11 && < 0.12,
+ text >= 0.11 && < 1.2,
directory >= 1 && < 1.3,
filepath >= 1.1 && < 1.4,
- process >= 1 && < 1.2,
- highlighting-kate >= 0.5.5 && < 0.6,
+ process >= 1 && < 1.3,
+ highlighting-kate >= 0.5.6 && < 0.6,
Diff >= 0.2 && < 0.4,
test-framework >= 0.3 && < 0.9,
test-framework-hunit >= 0.2 && < 0.4,
@@ -380,6 +383,7 @@ Test-Suite test-pandoc
Tests.Walk
Tests.Readers.LaTeX
Tests.Readers.Markdown
+ Tests.Readers.Org
Tests.Readers.RST
Tests.Writers.Native
Tests.Writers.ConTeXt
diff --git a/pandoc.hs b/pandoc.hs
index 8c196c01d..709b5a777 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -35,7 +35,8 @@ import Text.Pandoc.Builder (setMeta)
import Text.Pandoc.PDF (makePDF)
import Text.Pandoc.Readers.LaTeX (handleIncludes)
import Text.Pandoc.Shared ( tabFilter, readDataFileUTF8, readDataFile,
- safeRead, headerShift, normalize, err, warn )
+ safeRead, headerShift, normalize, err, warn,
+ openURL )
import Text.Pandoc.XML ( toEntities )
import Text.Pandoc.SelfContained ( makeSelfContained )
import Text.Pandoc.Process (pipeProcess)
@@ -55,7 +56,6 @@ import Control.Exception.Extensible ( throwIO )
import qualified Text.Pandoc.UTF8 as UTF8
import Control.Monad (when, unless, liftM)
import Data.Foldable (foldrM)
-import Network.HTTP (simpleHTTP, mkRequest, getResponseBody, RequestMethod(..))
import Network.URI (parseURI, isURI, URI(..))
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString as BS
@@ -162,6 +162,7 @@ data Opt = Opt
, optAscii :: Bool -- ^ Use ascii characters only in html
, optTeXLigatures :: Bool -- ^ Use TeX ligatures for quotes/dashes
, optDefaultImageExtension :: String -- ^ Default image extension
+ , optTrace :: Bool -- ^ Print debug information
}
-- | Defaults for command-line options.
@@ -217,6 +218,7 @@ defaultOpts = Opt
, optAscii = False
, optTeXLigatures = True
, optDefaultImageExtension = ""
+ , optTrace = False
}
-- | A list of functions, each transforming the options data structure
@@ -656,7 +658,7 @@ options =
(ReqArg
(\arg opt -> do
let b = takeBaseName arg
- if (b == "pdflatex" || b == "lualatex" || b == "xelatex")
+ if b `elem` ["pdflatex", "lualatex", "xelatex"]
then return opt { optLaTeXEngine = arg }
else err 45 "latex-engine must be pdflatex, lualatex, or xelatex.")
"PROGRAM")
@@ -667,6 +669,9 @@ options =
(\arg opt -> return opt{ optMetadata = addMetadata
"bibliography" (readMetaValue arg)
$ optMetadata opt
+ , optVariables =
+ ("biblio-files", dropExtension arg) :
+ optVariables opt
})
"FILE")
""
@@ -755,6 +760,11 @@ options =
(\opt -> return opt { optHTMLMathMethod = GladTeX }))
"" -- "Use gladtex for HTML math"
+ , Option "" ["trace"]
+ (NoArg
+ (\opt -> return opt { optTrace = True }))
+ "" -- "Turn on diagnostic tracing in readers."
+
, Option "" ["dump-args"]
(NoArg
(\opt -> return opt { optDumpArgs = True }))
@@ -824,6 +834,7 @@ defaultReaderName fallback (x:xs) =
".latex" -> "latex"
".ltx" -> "latex"
".rst" -> "rst"
+ ".org" -> "org"
".lhs" -> "markdown+lhs"
".db" -> "docbook"
".opml" -> "opml"
@@ -949,6 +960,7 @@ main = do
, optAscii = ascii
, optTeXLigatures = texLigatures
, optDefaultImageExtension = defaultImageExtension
+ , optTrace = trace
} = opts
when dumpArgs $
@@ -958,7 +970,9 @@ main = do
-- --bibliography implies -F pandoc-citeproc for backwards compatibility:
let filters' = case M.lookup "bibliography" metadata of
- Just _ | all (\f -> takeBaseName f /= "pandoc-citeproc")
+ Just _ | optCiteMethod opts /= Natbib &&
+ optCiteMethod opts /= Biblatex &&
+ all (\f -> takeBaseName f /= "pandoc-citeproc")
filters -> "pandoc-citeproc" : filters
_ -> filters
let plugins = map externalFilter filters'
@@ -1034,12 +1048,10 @@ main = do
variables' <- case mathMethod of
LaTeXMathML Nothing -> do
- s <- readDataFileUTF8 datadir
- ("LaTeXMathML.js")
+ s <- readDataFileUTF8 datadir "LaTeXMathML.js"
return $ ("mathml-script", s) : variables
MathML Nothing -> do
- s <- readDataFileUTF8 datadir
- ("MathMLinHTML.js")
+ s <- readDataFileUTF8 datadir "MathMLinHTML.js"
return $ ("mathml-script", s) : variables
_ -> return variables
@@ -1071,6 +1083,7 @@ main = do
, readerIndentedCodeClasses = codeBlockClasses
, readerApplyMacros = not laTeXOutput
, readerDefaultImageExtension = defaultImageExtension
+ , readerTrace = trace
}
let writerOptions = def { writerStandalone = standalone',
@@ -1120,10 +1133,13 @@ main = do
readSource "-" = UTF8.getContents
readSource src = case parseURI src of
Just u | uriScheme u `elem` ["http:","https:"] ->
- readURI u
+ readURI src
_ -> UTF8.readFile src
- readURI uri = simpleHTTP (mkRequest GET uri) >>= getResponseBody >>=
- return . UTF8.toStringLazy -- treat all as UTF8
+ readURI src = do
+ res <- openURL src
+ case res of
+ Left e -> throwIO e
+ Right (bs,_) -> return $ UTF8.toString bs
let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 2c90fd09b..66b0e49c0 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -65,6 +65,7 @@ module Text.Pandoc
, readMarkdown
, readMediaWiki
, readRST
+ , readOrg
, readLaTeX
, readHtml
, readTextile
@@ -116,6 +117,7 @@ import Text.Pandoc.JSON
import Text.Pandoc.Readers.Markdown
import Text.Pandoc.Readers.MediaWiki
import Text.Pandoc.Readers.RST
+import Text.Pandoc.Readers.Org
import Text.Pandoc.Readers.DocBook
import Text.Pandoc.Readers.OPML
import Text.Pandoc.Readers.LaTeX
@@ -203,6 +205,7 @@ readers = [ ("native" , \_ s -> return $ readNative s)
,("mediawiki" , \o s -> return $ readMediaWiki o s)
,("docbook" , \o s -> return $ readDocBook o s)
,("opml" , \o s -> return $ readOPML o s)
+ ,("org" , \o s -> return $ readOrg o s)
,("textile" , \o s -> return $ readTextile o s) -- TODO : textile+lhs
,("html" , \o s -> return $ readHtml o s)
,("latex" , \o s -> return $ readLaTeX o s)
@@ -270,7 +273,10 @@ getDefaultExtensions "markdown_strict" = strictExtensions
getDefaultExtensions "markdown_phpextra" = phpMarkdownExtraExtensions
getDefaultExtensions "markdown_mmd" = multimarkdownExtensions
getDefaultExtensions "markdown_github" = githubMarkdownExtensions
-getDefaultExtensions _ = pandocExtensions
+getDefaultExtensions "markdown" = pandocExtensions
+getDefaultExtensions "plain" = pandocExtensions
+getDefaultExtensions "textile" = Set.fromList [Ext_auto_identifiers, Ext_raw_tex]
+getDefaultExtensions _ = Set.fromList [Ext_auto_identifiers]
-- | Retrieve reader based on formatSpec (format+extensions).
getReader :: String -> Either String (ReaderOptions -> String -> IO Pandoc)
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index 9b0850efb..3c9623b3c 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -32,9 +32,14 @@ module Text.Pandoc.ImageSize ( ImageType(..), imageType, imageSize,
sizeInPixels, sizeInPoints ) where
import Data.ByteString (ByteString, unpack)
import qualified Data.ByteString.Char8 as B
+import qualified Data.ByteString.Lazy as BL
+import Control.Applicative
import Control.Monad
import Data.Bits
+import Data.Binary
+import Data.Binary.Get
import Text.Pandoc.Shared (safeRead)
+import qualified Data.Map as M
-- quick and dirty functions to get image sizes
-- algorithms borrowed from wwwis.pl
@@ -53,7 +58,8 @@ imageType :: ByteString -> Maybe ImageType
imageType img = case B.take 4 img of
"\x89\x50\x4e\x47" -> return Png
"\x47\x49\x46\x38" -> return Gif
- "\xff\xd8\xff\xe0" -> return Jpeg
+ "\xff\xd8\xff\xe0" -> return Jpeg -- JFIF
+ "\xff\xd8\xff\xe1" -> return Jpeg -- Exif
"%PDF" -> return Pdf
"%!PS"
| (B.take 4 $ B.drop 1 $ B.dropWhile (/=' ') img) == "EPSF"
@@ -139,8 +145,14 @@ gifSize img = do
jpegSize :: ByteString -> Maybe ImageSize
jpegSize img = do
let (hdr, rest) = B.splitAt 4 img
- guard $ hdr == "\xff\xd8\xff\xe0"
guard $ B.length rest >= 14
+ case hdr of
+ "\xff\xd8\xff\xe0" -> jfifSize rest
+ "\xff\xd8\xff\xe1" -> exifSize $ B.takeWhile (/= '\xff') rest
+ _ -> mzero
+
+jfifSize :: ByteString -> Maybe ImageSize
+jfifSize rest = do
let [dpiDensity,dpix1,dpix2,dpiy1,dpiy2] = map fromIntegral
$ unpack $ B.take 5 $ B.drop 9 $ rest
let factor = case dpiDensity of
@@ -149,11 +161,11 @@ jpegSize img = do
_ -> const 72
let dpix = factor (shift dpix1 8 + dpix2)
let dpiy = factor (shift dpiy1 8 + dpiy2)
- (w,h) <- findJpegSize rest
+ (w,h) <- findJfifSize rest
return $ ImageSize { pxX = w, pxY = h, dpiX = dpix, dpiY = dpiy }
-findJpegSize :: ByteString -> Maybe (Integer,Integer)
-findJpegSize bs = do
+findJfifSize :: ByteString -> Maybe (Integer,Integer)
+findJfifSize bs = do
let bs' = B.dropWhile (=='\xff') $ B.dropWhile (/='\xff') bs
case B.uncons bs' of
Just (c,bs'') | c >= '\xc0' && c <= '\xc3' -> do
@@ -165,8 +177,217 @@ findJpegSize bs = do
[c1,c2] -> do
let len = shift c1 8 + c2
-- skip variables
- findJpegSize $ B.drop len bs''
+ findJfifSize $ B.drop len bs''
_ -> fail "JPEG parse error"
Nothing -> fail "Did not find length record"
+exifSize :: ByteString -> Maybe ImageSize
+exifSize bs = runGet (Just <$> exifHeader bl) bl
+ where bl = BL.fromChunks [bs]
+-- NOTE: It would be nicer to do
+-- runGet ((Just <$> exifHeader) <|> return Nothing)
+-- which would prevent pandoc from raising an error when an exif header can't
+-- be parsed. But we only get an Alternative instance for Get in binary 0.6,
+-- and binary 0.5 ships with ghc 7.6.
+
+exifHeader :: BL.ByteString -> Get ImageSize
+exifHeader hdr = do
+ _app1DataSize <- getWord16be
+ exifHdr <- getWord32be
+ unless (exifHdr == 0x45786966) $ fail "Did not find exif header"
+ zeros <- getWord16be
+ unless (zeros == 0) $ fail "Expected zeros after exif header"
+ -- beginning of tiff header -- we read whole thing to use
+ -- in getting data from offsets:
+ let tiffHeader = BL.drop 8 hdr
+ byteAlign <- getWord16be
+ let bigEndian = byteAlign == 0x4d4d
+ let (getWord16, getWord32, getWord64) =
+ if bigEndian
+ then (getWord16be, getWord32be, getWord64be)
+ else (getWord16le, getWord32le, getWord64le)
+ let getRational = do
+ num <- getWord32
+ den <- getWord32
+ return $ fromIntegral num / fromIntegral den
+ tagmark <- getWord16
+ unless (tagmark == 0x002a) $ fail "Failed alignment sanity check"
+ ifdOffset <- getWord32
+ skip (fromIntegral ifdOffset - 8) -- skip to IDF
+ numentries <- getWord16
+ let ifdEntry = do
+ tag <- getWord16 >>= \t ->
+ maybe (fail $ "Unknown tag type " ++ show t) return
+ (M.lookup t tagTypeTable)
+ dataFormat <- getWord16
+ numComponents <- getWord32
+ (fmt, bytesPerComponent) <-
+ case dataFormat of
+ 1 -> return (UnsignedByte . runGet getWord8, 1)
+ 2 -> return (AsciiString, 1)
+ 3 -> return (UnsignedShort . runGet getWord16, 2)
+ 4 -> return (UnsignedLong . runGet getWord32, 4)
+ 5 -> return (UnsignedRational . runGet getRational, 8)
+ 6 -> return (SignedByte . runGet getWord8, 1)
+ 7 -> return (Undefined . runGet getWord8, 1)
+ 8 -> return (SignedShort . runGet getWord16, 2)
+ 9 -> return (SignedLong . runGet getWord32, 4)
+ 10 -> return (SignedRational . runGet getRational, 8)
+ 11 -> return (SingleFloat . runGet getWord32 {- TODO -}, 4)
+ 12 -> return (DoubleFloat . runGet getWord64 {- TODO -}, 8)
+ _ -> fail $ "Unknown data format " ++ show dataFormat
+ let totalBytes = fromIntegral $ numComponents * bytesPerComponent
+ payload <- if totalBytes <= 4 -- data is right here
+ then fmt <$>
+ (getLazyByteString (fromIntegral totalBytes) <*
+ skip (4 - totalBytes))
+ else do -- get data from offset
+ offs <- getWord32
+ return $ fmt $ BL.take (fromIntegral totalBytes) $
+ BL.drop (fromIntegral offs) tiffHeader
+ return (tag, payload)
+ entries <- sequence $ replicate (fromIntegral numentries) ifdEntry
+ subentries <- case lookup ExifOffset entries of
+ Just (UnsignedLong offset) -> do
+ pos <- bytesRead
+ skip (fromIntegral offset - (fromIntegral pos - 8))
+ numsubentries <- getWord16
+ sequence $
+ replicate (fromIntegral numsubentries) ifdEntry
+ _ -> return []
+ let allentries = entries ++ subentries
+ (width, height) <- case (lookup ExifImageWidth allentries,
+ lookup ExifImageHeight allentries) of
+ (Just (UnsignedLong w), Just (UnsignedLong h)) ->
+ return (fromIntegral w, fromIntegral h)
+ _ -> fail "Could not determine image width, height"
+ let resfactor = case lookup ResolutionUnit allentries of
+ Just (UnsignedShort 1) -> (100 / 254)
+ _ -> 1
+ let xres = maybe 72 (\(UnsignedRational x) -> floor $ x * resfactor)
+ $ lookup XResolution allentries
+ let yres = maybe 72 (\(UnsignedRational x) -> floor $ x * resfactor)
+ $ lookup YResolution allentries
+ return $ ImageSize{
+ pxX = width
+ , pxY = height
+ , dpiX = xres
+ , dpiY = yres }
+
+data DataFormat = UnsignedByte Word8
+ | AsciiString BL.ByteString
+ | UnsignedShort Word16
+ | UnsignedLong Word32
+ | UnsignedRational Rational
+ | SignedByte Word8
+ | Undefined Word8
+ | SignedShort Word16
+ | SignedLong Word32
+ | SignedRational Rational
+ | SingleFloat Word32
+ | DoubleFloat Word64
+ deriving (Show)
+
+data TagType = ImageDescription
+ | Make
+ | Model
+ | Orientation
+ | XResolution
+ | YResolution
+ | ResolutionUnit
+ | Software
+ | DateTime
+ | WhitePoint
+ | PrimaryChromaticities
+ | YCbCrCoefficients
+ | YCbCrPositioning
+ | ReferenceBlackWhite
+ | Copyright
+ | ExifOffset
+ | ExposureTime
+ | FNumber
+ | ExposureProgram
+ | ISOSpeedRatings
+ | ExifVersion
+ | DateTimeOriginal
+ | DateTimeDigitized
+ | ComponentConfiguration
+ | CompressedBitsPerPixel
+ | ShutterSpeedValue
+ | ApertureValue
+ | BrightnessValue
+ | ExposureBiasValue
+ | MaxApertureValue
+ | SubjectDistance
+ | MeteringMode
+ | LightSource
+ | Flash
+ | FocalLength
+ | MakerNote
+ | UserComment
+ | FlashPixVersion
+ | ColorSpace
+ | ExifImageWidth
+ | ExifImageHeight
+ | RelatedSoundFile
+ | ExifInteroperabilityOffset
+ | FocalPlaneXResolution
+ | FocalPlaneYResolution
+ | FocalPlaneResolutionUnit
+ | SensingMethod
+ | FileSource
+ | SceneType
+ deriving (Show, Eq, Ord)
+tagTypeTable :: M.Map Word16 TagType
+tagTypeTable = M.fromList
+ [ (0x010e, ImageDescription)
+ , (0x010f, Make)
+ , (0x0110, Model)
+ , (0x0112, Orientation)
+ , (0x011a, XResolution)
+ , (0x011b, YResolution)
+ , (0x0128, ResolutionUnit)
+ , (0x0131, Software)
+ , (0x0132, DateTime)
+ , (0x013e, WhitePoint)
+ , (0x013f, PrimaryChromaticities)
+ , (0x0211, YCbCrCoefficients)
+ , (0x0213, YCbCrPositioning)
+ , (0x0214, ReferenceBlackWhite)
+ , (0x8298, Copyright)
+ , (0x8769, ExifOffset)
+ , (0x829a, ExposureTime)
+ , (0x829d, FNumber)
+ , (0x8822, ExposureProgram)
+ , (0x8827, ISOSpeedRatings)
+ , (0x9000, ExifVersion)
+ , (0x9003, DateTimeOriginal)
+ , (0x9004, DateTimeDigitized)
+ , (0x9101, ComponentConfiguration)
+ , (0x9102, CompressedBitsPerPixel)
+ , (0x9201, ShutterSpeedValue)
+ , (0x9202, ApertureValue)
+ , (0x9203, BrightnessValue)
+ , (0x9204, ExposureBiasValue)
+ , (0x9205, MaxApertureValue)
+ , (0x9206, SubjectDistance)
+ , (0x9207, MeteringMode)
+ , (0x9208, LightSource)
+ , (0x9209, Flash)
+ , (0x920a, FocalLength)
+ , (0x927c, MakerNote)
+ , (0x9286, UserComment)
+ , (0xa000, FlashPixVersion)
+ , (0xa001, ColorSpace)
+ , (0xa002, ExifImageWidth)
+ , (0xa003, ExifImageHeight)
+ , (0xa004, RelatedSoundFile)
+ , (0xa005, ExifInteroperabilityOffset)
+ , (0xa20e, FocalPlaneXResolution)
+ , (0xa20f, FocalPlaneYResolution)
+ , (0xa210, FocalPlaneResolutionUnit)
+ , (0xa217, SensingMethod)
+ , (0xa300, FileSource)
+ , (0xa301, SceneType)
+ ]
diff --git a/src/Text/Pandoc/MIME.hs b/src/Text/Pandoc/MIME.hs
index f41aa98bb..44989ee94 100644
--- a/src/Text/Pandoc/MIME.hs
+++ b/src/Text/Pandoc/MIME.hs
@@ -147,6 +147,7 @@ mimeTypesList = -- List borrowed from happstack-server.
,("dxr","application/x-director")
,("emb","chemical/x-embl-dl-nucleotide")
,("embl","chemical/x-embl-dl-nucleotide")
+ ,("emf","image/x-emf")
,("eml","message/rfc822")
,("ent","chemical/x-ncbi-asn1-ascii")
,("eot","application/vnd.ms-fontobject")
@@ -465,6 +466,7 @@ mimeTypesList = -- List borrowed from happstack-server.
,("wm","video/x-ms-wm")
,("wma","audio/x-ms-wma")
,("wmd","application/x-ms-wmd")
+ ,("wmf","image/x-wmf")
,("wml","text/vnd.wap.wml")
,("wmlc","application/vnd.wap.wmlc")
,("wmls","text/vnd.wap.wmlscript")
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 5f65abdde..38220f542 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -210,6 +210,7 @@ data ReaderOptions = ReaderOptions{
, readerIndentedCodeClasses :: [String] -- ^ Default classes for
-- indented code blocks
, readerDefaultImageExtension :: String -- ^ Default extension for images
+ , readerTrace :: Bool -- ^ Print debugging info
} deriving (Show, Read)
instance Default ReaderOptions
@@ -225,6 +226,7 @@ instance Default ReaderOptions
, readerApplyMacros = True
, readerIndentedCodeClasses = []
, readerDefaultImageExtension = ""
+ , readerTrace = False
}
--
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index e8683b98f..39442854d 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -41,6 +41,7 @@ import System.Directory
import System.Environment
import Control.Monad (unless)
import Data.List (isInfixOf)
+import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Base64 as B64
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Definition
@@ -87,7 +88,7 @@ handleImage' baseURL tmpdir (Image ils (src,tit)) = do
res <- fetchItem baseURL src
case res of
Right (contents, Just mime) -> do
- let ext = maybe (takeExtension src) id $
+ let ext = fromMaybe (takeExtension src) $
extensionFromMimeType mime
let basename = UTF8.toString $ B64.encode $ UTF8.fromString src
let fname = tmpdir </> basename <.> ext
@@ -148,7 +149,12 @@ runTeXProgram program runsLeft tmpDir source = do
let programArgs = ["-halt-on-error", "-interaction", "nonstopmode",
"-output-directory", tmpDir, file]
env' <- getEnvironment
- let texinputs = maybe (tmpDir ++ ":") ((tmpDir ++ ":") ++)
+#ifdef _WINDOWS
+ let sep = ";"
+#else
+ let sep = ":"
+#endif
+ let texinputs = maybe (tmpDir ++ sep) ((tmpDir ++ sep) ++)
$ lookup "TEXINPUTS" env'
let env'' = ("TEXINPUTS", texinputs) :
[(k,v) | (k,v) <- env', k /= "TEXINPUTS"]
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 9687d7712..2bc351db3 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -48,6 +48,8 @@ module Text.Pandoc.Parsing ( (>>~),
romanNumeral,
emailAddress,
uri,
+ mathInline,
+ mathDisplay,
withHorizDisplacement,
withRaw,
escaped,
@@ -269,7 +271,7 @@ spaceChar = satisfy $ \c -> c == ' ' || c == '\t'
-- | Parses a nonspace, nonnewline character.
nonspaceChar :: Parser [Char] st Char
-nonspaceChar = satisfy $ \x -> x /= '\t' && x /= '\n' && x /= ' ' && x /= '\r'
+nonspaceChar = satisfy $ flip notElem ['\t', '\n', ' ', '\r']
-- | Skips zero or more spaces or tabs.
skipSpaces :: Parser [Char] st ()
@@ -455,6 +457,39 @@ uri = try $ do
let uri' = scheme ++ ":" ++ fromEntities str'
return (uri', escapeURI uri')
+mathInlineWith :: String -> String -> Parser [Char] st String
+mathInlineWith op cl = try $ do
+ string op
+ notFollowedBy space
+ words' <- many1Till (count 1 (noneOf "\n\\")
+ <|> (char '\\' >> anyChar >>= \c -> return ['\\',c])
+ <|> count 1 newline <* notFollowedBy' blankline
+ *> return " ")
+ (try $ string cl)
+ notFollowedBy digit -- to prevent capture of $5
+ return $ concat words'
+
+mathDisplayWith :: String -> String -> Parser [Char] st String
+mathDisplayWith op cl = try $ do
+ string op
+ many1Till (noneOf "\n" <|> (newline >>~ notFollowedBy' blankline)) (try $ string cl)
+
+mathDisplay :: Parser [Char] ParserState String
+mathDisplay =
+ (guardEnabled Ext_tex_math_dollars >> mathDisplayWith "$$" "$$")
+ <|> (guardEnabled Ext_tex_math_single_backslash >>
+ mathDisplayWith "\\[" "\\]")
+ <|> (guardEnabled Ext_tex_math_double_backslash >>
+ mathDisplayWith "\\\\[" "\\\\]")
+
+mathInline :: Parser [Char] ParserState String
+mathInline =
+ (guardEnabled Ext_tex_math_dollars >> mathInlineWith "$" "$")
+ <|> (guardEnabled Ext_tex_math_single_backslash >>
+ mathInlineWith "\\(" "\\)")
+ <|> (guardEnabled Ext_tex_math_double_backslash >>
+ mathInlineWith "\\\\(" "\\\\)")
+
-- | Applies a parser, returns tuple of its results and its horizontal
-- displacement (the difference between the source column at the end
-- and the source column at the beginning). Vertical displacement
@@ -818,6 +853,11 @@ data ParserState = ParserState
stateHasChapters :: Bool, -- ^ True if \chapter encountered
stateMacros :: [Macro], -- ^ List of macros defined so far
stateRstDefaultRole :: String, -- ^ Current rST default interpreted text role
+ stateRstCustomRoles :: M.Map String (String, Maybe String, Attr -> (String, Attr)), -- ^ Current rST custom text roles
+ -- Triple represents: 1) Base role, 2) Optional format (only for :raw:
+ -- roles), 3) Source language annotation for code (could be used to
+ -- annotate role classes too).
+
stateWarnings :: [String] -- ^ Warnings generated by the parser
}
@@ -880,6 +920,7 @@ defaultParserState =
stateHasChapters = False,
stateMacros = [],
stateRstDefaultRole = "title-reference",
+ stateRstCustomRoles = M.empty,
stateWarnings = []}
getOption :: (ReaderOptions -> a) -> Parser s ParserState a
@@ -1027,7 +1068,7 @@ doubleQuoteStart :: Parser [Char] ParserState ()
doubleQuoteStart = do
failIfInQuoteContext InDoubleQuote
try $ do charOrRef "\"\8220\147"
- notFollowedBy (satisfy (\c -> c == ' ' || c == '\t' || c == '\n'))
+ notFollowedBy . satisfy $ flip elem [' ', '\t', '\n']
doubleQuoteEnd :: Parser [Char] st ()
doubleQuoteEnd = do
diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs
index faf2a6797..5331587ce 100644
--- a/src/Text/Pandoc/Pretty.hs
+++ b/src/Text/Pandoc/Pretty.hs
@@ -60,6 +60,7 @@ module Text.Pandoc.Pretty (
, hsep
, vcat
, vsep
+ , nestle
, chomp
, inside
, braces
@@ -72,7 +73,7 @@ module Text.Pandoc.Pretty (
)
where
-import Data.Sequence (Seq, fromList, (<|), singleton, mapWithIndex)
+import Data.Sequence (Seq, fromList, (<|), singleton, mapWithIndex, viewl, ViewL(..))
import Data.Foldable (toList)
import Data.List (intercalate)
import Data.Monoid
@@ -80,8 +81,7 @@ import Data.String
import Control.Monad.State
import Data.Char (isSpace)
-data Monoid a =>
- RenderState a = RenderState{
+data RenderState a = RenderState{
output :: [a] -- ^ In reverse order
, prefix :: String
, usePrefix :: Bool
@@ -186,6 +186,14 @@ vcat = foldr ($$) empty
vsep :: [Doc] -> Doc
vsep = foldr ($+$) empty
+-- | Removes leading blank lines from a 'Doc'.
+nestle :: Doc -> Doc
+nestle (Doc d) = Doc $ go d
+ where go x = case viewl x of
+ (BlankLine :< rest) -> go rest
+ (NewLine :< rest) -> go rest
+ _ -> x
+
-- | Chomps trailing blank space off of a 'Doc'.
chomp :: Doc -> Doc
chomp d = Doc (fromList dl')
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index fc29988d5..56cb16b20 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -12,6 +12,7 @@ import Data.Char (isSpace)
import Control.Monad.State
import Control.Applicative ((<$>))
import Data.List (intersperse)
+import Data.Maybe (fromMaybe)
{-
@@ -683,7 +684,7 @@ parseBlock (Elem e) =
"lowerroman" -> LowerRoman
"upperroman" -> UpperRoman
_ -> Decimal
- let start = maybe 1 id $
+ let start = fromMaybe 1 $
(attrValue "override" <$> filterElement (named "listitem") e)
>>= safeRead
orderedListWith (start,listStyle,DefaultDelim)
@@ -779,7 +780,7 @@ parseBlock (Elem e) =
caption <- case filterChild isCaption e of
Just t -> getInlines t
Nothing -> return mempty
- let e' = maybe e id $ filterChild (named "tgroup") e
+ let e' = fromMaybe e $ filterChild (named "tgroup") e
let isColspec x = named "colspec" x || named "col" x
let colspecs = case filterChild (named "colgroup") e' of
Just c -> filterChildren isColspec c
@@ -801,12 +802,14 @@ parseBlock (Elem e) =
Just "center" -> AlignCenter
_ -> AlignDefault
let toWidth c = case findAttr (unqual "colwidth") c of
- Just w -> maybe 0 id
+ Just w -> fromMaybe 0
$ safeRead $ '0': filter (\x ->
(x >= '0' && x <= '9')
|| x == '.') w
Nothing -> 0 :: Double
- let numrows = maximum $ map length bodyrows
+ let numrows = case bodyrows of
+ [] -> 0
+ xs -> maximum $ map length xs
let aligns = case colspecs of
[] -> replicate numrows AlignDefault
cs -> map toAlignment cs
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index d691c9878..d1e4d0024 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -76,9 +76,18 @@ pBody :: TagParser [Block]
pBody = pInTags "body" block
pHead :: TagParser [Block]
-pHead = pInTags "head" $ pTitle <|> ([] <$ pAnyTag)
+pHead = pInTags "head" $ pTitle <|> pMetaTag <|> ([] <$ pAnyTag)
where pTitle = pInTags "title" inline >>= setTitle . normalizeSpaces
setTitle t = [] <$ (updateState $ B.setMeta "title" (B.fromList t))
+ pMetaTag = do
+ mt <- pSatisfy (~== TagOpen "meta" [])
+ let name = fromAttrib "name" mt
+ if null name
+ then return []
+ else do
+ let content = fromAttrib "content" mt
+ updateState $ B.setMeta name (B.text content)
+ return []
block :: TagParser [Block]
block = choice
@@ -207,7 +216,7 @@ pHeader = try $ do
let bodyTitle = TagOpen tagtype attr ~== TagOpen "h1" [("class","title")]
let level = read (drop 1 tagtype)
contents <- liftM concat $ manyTill inline (pCloses tagtype <|> eof)
- let ident = maybe "" id $ lookup "id" attr
+ let ident = fromMaybe "" $ lookup "id" attr
let classes = maybe [] words $ lookup "class" attr
let keyvals = [(k,v) | (k,v) <- attr, k /= "class", k /= "id"]
return $ if bodyTitle
@@ -257,7 +266,7 @@ pCol = try $ do
skipMany pBlank
return $ case lookup "width" attribs of
Just x | not (null x) && last x == '%' ->
- maybe 0.0 id $ safeRead ('0':'.':init x)
+ fromMaybe 0.0 $ safeRead ('0':'.':init x)
_ -> 0.0
pColgroup :: TagParser [Double]
@@ -467,7 +476,13 @@ pBlank = try $ do
pTagContents :: Parser [Char] ParserState Inline
pTagContents =
- pStr <|> pSpace <|> smartPunctuation pTagContents <|> pSymbol <|> pBad
+ Math DisplayMath `fmap` mathDisplay
+ <|> Math InlineMath `fmap` mathInline
+ <|> pStr
+ <|> pSpace
+ <|> smartPunctuation pTagContents
+ <|> pSymbol
+ <|> pBad
pStr :: Parser [Char] ParserState Inline
pStr = do
@@ -482,6 +497,7 @@ isSpecial '"' = True
isSpecial '\'' = True
isSpecial '.' = True
isSpecial '-' = True
+isSpecial '$' = True
isSpecial '\8216' = True
isSpecial '\8217' = True
isSpecial '\8220' = True
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 75e29ebb9..51271edc5 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -38,7 +38,8 @@ import Text.Pandoc.Definition
import Text.Pandoc.Walk
import Text.Pandoc.Shared
import Text.Pandoc.Options
-import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
+import Text.Pandoc.Parsing hiding ((<|>), many, optional, space,
+ mathDisplay, mathInline)
import qualified Text.Pandoc.UTF8 as UTF8
import Data.Char ( chr, ord )
import Control.Monad
@@ -172,6 +173,8 @@ double_quote :: LP Inlines
double_quote =
( quoted' doubleQuoted (try $ string "``") (void $ try $ string "''")
<|> quoted' doubleQuoted (string "“") (void $ char '”')
+ -- the following is used by babel for localized quotes:
+ <|> quoted' doubleQuoted (try $ string "\"`") (void $ try $ string "\"'")
<|> quoted' doubleQuoted (string "\"") (void $ char '"')
)
@@ -454,6 +457,7 @@ inlineCommands = M.fromList $
, ("footnote", (note . mconcat) <$> (char '{' *> manyTill block (char '}')))
, ("verb", doverb)
, ("lstinline", doverb)
+ , ("Verb", doverb)
, ("texttt", (code . stringify . toList) <$> tok)
, ("url", (unescapeURL <$> braced) >>= \url ->
pure (link url "" (str url)))
@@ -870,9 +874,8 @@ verbatimEnv = do
(_,r) <- withRaw $ do
controlSeq "begin"
name <- braced
- guard $ name == "verbatim" || name == "Verbatim" ||
- name == "lstlisting" || name == "minted" ||
- name == "alltt"
+ guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
+ "minted", "alltt"]
verbEnv name
rest <- getInput
return (r,rest)
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 33d1a9620..0ea7f9ac5 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -60,6 +60,8 @@ import System.FilePath (takeExtension, addExtension)
import Text.HTML.TagSoup
import Text.HTML.TagSoup.Match (tagOpen)
import qualified Data.Set as Set
+import Text.Printf (printf)
+import Debug.Trace (trace)
type MarkdownParser = Parser [Char] ParserState
@@ -215,10 +217,10 @@ pandocTitleBlock = try $ do
author' <- author
date' <- date
return $
- ( if B.isNull title' then id else B.setMeta "title" title'
- . if null author' then id else B.setMeta "author" author'
- . if B.isNull date' then id else B.setMeta "date" date' )
- nullMeta
+ (if B.isNull title' then id else B.setMeta "title" title')
+ . (if null author' then id else B.setMeta "author" author')
+ . (if B.isNull date' then id else B.setMeta "date" date')
+ $ nullMeta
updateState $ \st -> st{ stateMeta' = stateMeta' st <> meta' }
yamlMetaBlock :: MarkdownParser (F Blocks)
@@ -354,7 +356,7 @@ referenceKey = try $ do
tit <- option "" referenceTitle
-- currently we just ignore MMD-style link/image attributes
_kvs <- option [] $ guardEnabled Ext_link_attributes
- >> many (spnl >> keyValAttr)
+ >> many (try $ spnl >> keyValAttr)
blanklines
let target = (escapeURI $ trimr src, tit)
st <- getState
@@ -440,7 +442,10 @@ parseBlocks :: MarkdownParser (F Blocks)
parseBlocks = mconcat <$> manyTill block eof
block :: MarkdownParser (F Blocks)
-block = choice [ mempty <$ blanklines
+block = do
+ tr <- getOption readerTrace
+ pos <- getPosition
+ res <- choice [ mempty <$ blanklines
, codeBlockFenced
, yamlMetaBlock
, guardEnabled Ext_latex_macros *> (macro >>= return . return)
@@ -465,6 +470,11 @@ block = choice [ mempty <$ blanklines
, para
, plain
] <?> "block"
+ when tr $ do
+ st <- getState
+ trace (printf "line %d: %s" (sourceLine pos)
+ (take 60 $ show $ B.toList $ runF res st)) (return ())
+ return res
--
-- header blocks
@@ -730,9 +740,14 @@ listStart = bulletListStart <|> (anyOrderedListStart >> return ())
listLine :: MarkdownParser String
listLine = try $ do
notFollowedBy' (do indentSpaces
- many (spaceChar)
+ many spaceChar
listStart)
- chunks <- manyTill (liftM snd (htmlTag isCommentTag) <|> count 1 anyChar) newline
+ notFollowedBy' $ htmlTag (~== TagClose "div")
+ chunks <- manyTill
+ ( many1 (satisfy $ \c -> c /= '\n' && c /= '<')
+ <|> liftM snd (htmlTag isCommentTag)
+ <|> count 1 anyChar
+ ) newline
return $ concat chunks
-- parse raw text for one list item, excluding start marker and continuations
@@ -759,6 +774,7 @@ listContinuationLine :: MarkdownParser String
listContinuationLine = try $ do
notFollowedBy blankline
notFollowedBy' listStart
+ notFollowedBy' $ htmlTag (~== TagClose "div")
optional indentSpaces
result <- anyLine
return $ result ++ "\n"
@@ -783,8 +799,8 @@ listItem start = try $ do
orderedList :: MarkdownParser (F Blocks)
orderedList = try $ do
(start, style, delim) <- lookAhead anyOrderedListStart
- unless ((style == DefaultStyle || style == Decimal || style == Example) &&
- (delim == DefaultDelim || delim == Period)) $
+ unless (style `elem` [DefaultStyle, Decimal, Example] &&
+ delim `elem` [DefaultDelim, Period]) $
guardEnabled Ext_fancy_lists
when (style == Example) $ guardEnabled Ext_example_lists
items <- fmap sequence $ many1 $ listItem
@@ -896,7 +912,9 @@ plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline
--
htmlElement :: MarkdownParser String
-htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
+htmlElement = rawVerbatimBlock
+ <|> strictHtmlBlock
+ <|> liftM snd (htmlTag isBlockTag)
htmlBlock :: MarkdownParser (F Blocks)
htmlBlock = do
@@ -917,8 +935,8 @@ strictHtmlBlock = htmlInBalanced (not . isInlineTag)
rawVerbatimBlock :: MarkdownParser String
rawVerbatimBlock = try $ do
- (TagOpen tag _, open) <- htmlTag (tagOpen (\t ->
- t == "pre" || t == "style" || t == "script")
+ (TagOpen tag _, open) <- htmlTag (tagOpen (flip elem
+ ["pre", "style", "script"])
(const True))
contents <- manyTill anyChar (htmlTag (~== TagClose tag))
return $ open ++ contents ++ renderTags [TagClose tag]
@@ -936,6 +954,8 @@ rawHtmlBlocks = do
htmlBlocks <- many1 $ try $ do
s <- rawVerbatimBlock <|> try (
do (t,raw) <- htmlTag isBlockTag
+ guard $ t ~/= TagOpen "div" [] &&
+ t ~/= TagClose "div"
exts <- getOption readerExtensions
-- if open tag, need markdown="1" if
-- markdown_attributes extension is set
@@ -1118,12 +1138,12 @@ multilineTableHeader headless = try $ do
then liftM (map (:[]) . tail .
splitStringByIndices (init indices)) $ lookAhead anyLine
else return $ transpose $ map
- (\ln -> tail $ splitStringByIndices (init indices) ln)
+ (tail . splitStringByIndices (init indices))
rawContent
let aligns = zipWith alignType rawHeadsList lengths
let rawHeads = if headless
then replicate (length dashes) ""
- else map unwords rawHeadsList
+ else map (unlines . map trim) rawHeadsList
heads <- fmap sequence $
mapM (parseFromString (mconcat <$> many plain)) $
map trim rawHeads
@@ -1180,7 +1200,7 @@ gridTableHeader headless = try $ do
-- RST does not have a notion of alignments
let rawHeads = if headless
then replicate (length dashes) ""
- else map unwords $ transpose
+ else map (unlines . map trim) $ transpose
$ map (gridTableSplitLine indices) rawContent
heads <- fmap sequence $ mapM (parseFromString parseBlocks . trim) rawHeads
return (heads, aligns, indices)
@@ -1366,7 +1386,7 @@ ltSign :: MarkdownParser (F Inlines)
ltSign = do
guardDisabled Ext_raw_html
<|> guardDisabled Ext_markdown_in_html_blocks
- <|> (notFollowedBy' rawHtmlBlocks >> return ())
+ <|> (notFollowedBy' (htmlTag isBlockTag) >> return ())
char '<'
return $ return $ B.str "<"
@@ -1406,39 +1426,6 @@ math :: MarkdownParser (F Inlines)
math = (return . B.displayMath <$> (mathDisplay >>= applyMacros'))
<|> (return . B.math <$> (mathInline >>= applyMacros'))
-mathDisplay :: MarkdownParser String
-mathDisplay =
- (guardEnabled Ext_tex_math_dollars >> mathDisplayWith "$$" "$$")
- <|> (guardEnabled Ext_tex_math_single_backslash >>
- mathDisplayWith "\\[" "\\]")
- <|> (guardEnabled Ext_tex_math_double_backslash >>
- mathDisplayWith "\\\\[" "\\\\]")
-
-mathDisplayWith :: String -> String -> MarkdownParser String
-mathDisplayWith op cl = try $ do
- string op
- many1Till (noneOf "\n" <|> (newline >>~ notFollowedBy' blankline)) (try $ string cl)
-
-mathInline :: MarkdownParser String
-mathInline =
- (guardEnabled Ext_tex_math_dollars >> mathInlineWith "$" "$")
- <|> (guardEnabled Ext_tex_math_single_backslash >>
- mathInlineWith "\\(" "\\)")
- <|> (guardEnabled Ext_tex_math_double_backslash >>
- mathInlineWith "\\\\(" "\\\\)")
-
-mathInlineWith :: String -> String -> MarkdownParser String
-mathInlineWith op cl = try $ do
- string op
- notFollowedBy space
- words' <- many1Till (count 1 (noneOf "\n\\")
- <|> (char '\\' >> anyChar >>= \c -> return ['\\',c])
- <|> count 1 newline <* notFollowedBy' blankline
- *> return " ")
- (try $ string cl)
- notFollowedBy digit -- to prevent capture of $5
- return $ concat words'
-
-- Parses material enclosed in *s, **s, _s, or __s.
-- Designed to avoid backtracking.
enclosure :: Char
@@ -1565,16 +1552,14 @@ endline :: MarkdownParser (F Inlines)
endline = try $ do
newline
notFollowedBy blankline
+ -- parse potential list-starts differently if in a list:
+ st <- getState
+ when (stateParserContext st == ListItemState) $ notFollowedBy listStart
guardDisabled Ext_lists_without_preceding_blankline <|> notFollowedBy listStart
guardEnabled Ext_blank_before_blockquote <|> notFollowedBy emailBlockQuoteStart
guardEnabled Ext_blank_before_header <|> notFollowedBy (char '#') -- atx header
guardEnabled Ext_backtick_code_blocks >>
notFollowedBy (() <$ (lookAhead (char '`') >> codeBlockFenced))
- -- parse potential list-starts differently if in a list:
- st <- getState
- when (stateParserContext st == ListItemState) $ do
- notFollowedBy' bulletListStart
- notFollowedBy' anyOrderedListStart
(guardEnabled Ext_hard_line_breaks >> return (return B.linebreak))
<|> (guardEnabled Ext_ignore_line_breaks >> return mempty)
<|> (return $ return B.space)
@@ -1747,7 +1732,7 @@ spanHtml = try $ do
guardEnabled Ext_markdown_in_html_blocks
(TagOpen _ attrs, _) <- htmlTag (~== TagOpen "span" [])
contents <- mconcat <$> manyTill inline (htmlTag (~== TagClose "span"))
- let ident = maybe "" id $ lookup "id" attrs
+ let ident = fromMaybe "" $ lookup "id" attrs
let classes = maybe [] words $ lookup "class" attrs
let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
return $ B.spanWith (ident, classes, keyvals) <$> contents
@@ -1755,12 +1740,19 @@ spanHtml = try $ do
divHtml :: MarkdownParser (F Blocks)
divHtml = try $ do
guardEnabled Ext_markdown_in_html_blocks
- (TagOpen _ attrs, _) <- htmlTag (~== TagOpen "div" [])
- contents <- mconcat <$> manyTill block (htmlTag (~== TagClose "div"))
- let ident = maybe "" id $ lookup "id" attrs
- let classes = maybe [] words $ lookup "class" attrs
- let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
- return $ B.divWith (ident, classes, keyvals) <$> contents
+ (TagOpen _ attrs, rawtag) <- htmlTag (~== TagOpen "div" [])
+ bls <- option "" (blankline >> option "" blanklines)
+ contents <- mconcat <$>
+ many (notFollowedBy' (htmlTag (~== TagClose "div")) >> block)
+ closed <- option False (True <$ htmlTag (~== TagClose "div"))
+ if closed
+ then do
+ let ident = fromMaybe "" $ lookup "id" attrs
+ let classes = maybe [] words $ lookup "class" attrs
+ let keyvals = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
+ return $ B.divWith (ident, classes, keyvals) <$> contents
+ else -- avoid backtracing
+ return $ return (B.rawBlock "html" (rawtag <> bls)) <> contents
rawHtmlInline :: MarkdownParser (F Inlines)
rawHtmlInline = do
@@ -1836,9 +1828,10 @@ citeKey = try $ do
guard $ lastStrPos /= Just pos
suppress_author <- option False (char '-' >> return True)
char '@'
- first <- letter
- let internal p = try $ p >>~ lookAhead (letter <|> digit)
- rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_+?<>~/")
+ first <- letter <|> char '_'
+ let regchar = satisfy (\c -> isAlphaNum c || c == '_')
+ let internal p = try $ p >>~ lookAhead regchar
+ rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/")
let key = first:rest
return (suppress_author, key)
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 1c074e3de..794890eb6 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -54,6 +54,7 @@ import Data.Sequence (viewl, ViewL(..), (<|))
import qualified Data.Foldable as F
import qualified Data.Map as M
import Data.Char (isDigit, isSpace)
+import Data.Maybe (fromMaybe)
-- | Read mediawiki from an input string and return a Pandoc document.
readMediaWiki :: ReaderOptions -- ^ Reader options
@@ -148,9 +149,16 @@ inlinesInTags tag = try $ do
blocksInTags :: String -> MWParser Blocks
blocksInTags tag = try $ do
(_,raw) <- htmlTag (~== TagOpen tag [])
+ let closer = if tag == "li"
+ then htmlTag (~== TagClose "li")
+ <|> lookAhead (
+ htmlTag (~== TagOpen "li" [])
+ <|> htmlTag (~== TagClose "ol")
+ <|> htmlTag (~== TagClose "ul"))
+ else htmlTag (~== TagClose tag)
if '/' `elem` raw -- self-closing tag
then return mempty
- else mconcat <$> manyTill block (htmlTag (~== TagClose tag))
+ else mconcat <$> manyTill block closer
charsInTags :: String -> MWParser [Char]
charsInTags tag = try $ do
@@ -204,7 +212,7 @@ table = do
tableStart
styles <- option [] parseAttrs <* blankline
let tableWidth = case lookup "width" styles of
- Just w -> maybe 1.0 id $ parseWidth w
+ Just w -> fromMaybe 1.0 $ parseWidth w
Nothing -> 1.0
caption <- option mempty tableCaption
optional rowsep
@@ -285,7 +293,7 @@ tableCell = try $ do
Just "center" -> AlignCenter
_ -> AlignDefault
let width = case lookup "width" attrs of
- Just xs -> maybe 0.0 id $ parseWidth xs
+ Just xs -> fromMaybe 0.0 $ parseWidth xs
Nothing -> 0.0
return ((align, width), bs)
@@ -380,15 +388,13 @@ bulletList = B.bulletList <$>
orderedList :: MWParser Blocks
orderedList =
(B.orderedList <$> many1 (listItem '#'))
- <|> (B.orderedList <$> (htmlTag (~== TagOpen "ul" []) *> spaces *>
- many (listItem '#' <|> li) <*
- optional (htmlTag (~== TagClose "ul"))))
- <|> do (tag,_) <- htmlTag (~== TagOpen "ol" [])
- spaces
- items <- many (listItem '#' <|> li)
- optional (htmlTag (~== TagClose "ol"))
- let start = maybe 1 id $ safeRead $ fromAttrib "start" tag
- return $ B.orderedListWith (start, DefaultStyle, DefaultDelim) items
+ <|> try
+ (do (tag,_) <- htmlTag (~== TagOpen "ol" [])
+ spaces
+ items <- many (listItem '#' <|> li)
+ optional (htmlTag (~== TagClose "ol"))
+ let start = fromMaybe 1 $ safeRead $ fromAttrib "start" tag
+ return $ B.orderedListWith (start, DefaultStyle, DefaultDelim) items)
definitionList :: MWParser Blocks
definitionList = B.definitionList <$> many1 defListItem
diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs
new file mode 100644
index 000000000..5dc250f04
--- /dev/null
+++ b/src/Text/Pandoc/Readers/Org.hs
@@ -0,0 +1,552 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-
+Copyright (C) 2014 Albert Krewinkel <tarleb@moltkeplatz.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- |
+ Module : Text.Pandoc.Readers.Org
+ Copyright : Copyright (C) 2014 Albert Krewinkel
+ License : GNU GPL, version 2 or above
+
+ Maintainer : Albert Krewinkel <tarleb@moltkeplatz.de>
+
+Conversion of Org-Mode to 'Pandoc' document.
+-}
+module Text.Pandoc.Readers.Org ( readOrg ) where
+
+import qualified Text.Pandoc.Builder as B
+import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>))
+import Text.Pandoc.Definition
+import Text.Pandoc.Options
+import Text.Pandoc.Parsing hiding (orderedListMarker)
+import Text.Pandoc.Shared (compactify')
+
+import Control.Applicative (pure, (<$>), (<$), (<*>), (<*), (*>), (<**>))
+import Control.Monad (guard, mzero)
+import Data.Char (toLower)
+import Data.List (foldl')
+import Data.Maybe (listToMaybe, fromMaybe)
+import Data.Monoid (mconcat, mempty, mappend)
+
+-- | Parse org-mode string and return a Pandoc document.
+readOrg :: ReaderOptions -- ^ Reader options
+ -> String -- ^ String to parse (assuming @'\n'@ line endings)
+ -> Pandoc
+readOrg opts s = (readWith parseOrg) def{ stateOptions = opts } (s ++ "\n\n")
+
+type OrgParser = Parser [Char] ParserState
+
+parseOrg:: OrgParser Pandoc
+parseOrg = do
+ blocks' <- B.toList <$> parseBlocks
+ st <- getState
+ let meta = stateMeta st
+ return $ Pandoc meta $ filter (/= Null) blocks'
+
+--
+-- parsing blocks
+--
+
+parseBlocks :: OrgParser Blocks
+parseBlocks = mconcat <$> manyTill block eof
+
+block :: OrgParser Blocks
+block = choice [ mempty <$ blanklines
+ , orgBlock
+ , example
+ , drawer
+ , specialLine
+ , header
+ , hline
+ , list
+ , table
+ , paraOrPlain
+ ] <?> "block"
+
+--
+-- Org Blocks (#+BEGIN_... / #+END_...)
+--
+
+orgBlock :: OrgParser Blocks
+orgBlock = try $ do
+ (indent, blockType, args) <- blockHeader
+ blockStr <- rawBlockContent indent blockType
+ let classArgs = [ translateLang . fromMaybe [] $ listToMaybe args ]
+ case blockType of
+ "comment" -> return mempty
+ "src" -> return $ B.codeBlockWith ("", classArgs, []) blockStr
+ _ -> B.divWith ("", [blockType], [])
+ <$> (parseFromString parseBlocks blockStr)
+
+blockHeader :: OrgParser (Int, String, [String])
+blockHeader = (,,) <$> blockIndent
+ <*> blockType
+ <*> (skipSpaces *> blockArgs)
+ where blockIndent = length <$> many spaceChar
+ blockType = map toLower <$> (stringAnyCase "#+begin_" *> many letter)
+ blockArgs = manyTill (many nonspaceChar <* skipSpaces) newline
+
+rawBlockContent :: Int -> String -> OrgParser String
+rawBlockContent indent blockType =
+ unlines . map commaEscaped <$> manyTill indentedLine blockEnder
+ where
+ indentedLine = try $ choice [ blankline *> pure "\n"
+ , indentWith indent *> anyLine
+ ]
+ blockEnder = try $ indentWith indent *> stringAnyCase ("#+end_" <> blockType)
+
+-- indent by specified number of spaces (or equiv. tabs)
+indentWith :: Int -> OrgParser String
+indentWith num = do
+ tabStop <- getOption readerTabStop
+ if (num < tabStop)
+ then count num (char ' ')
+ else choice [ try (count num (char ' '))
+ , try (char '\t' >> count (num - tabStop) (char ' ')) ]
+
+translateLang :: String -> String
+translateLang "sh" = "bash"
+translateLang cs = cs
+
+commaEscaped :: String -> String
+commaEscaped (',':cs@('*':_)) = cs
+commaEscaped (',':cs@('#':'+':_)) = cs
+commaEscaped cs = cs
+
+example :: OrgParser Blocks
+example = try $
+ B.codeBlockWith ("", ["example"], []) . unlines <$> many1 exampleLine
+
+exampleLine :: OrgParser String
+exampleLine = try $ string ": " *> anyLine
+
+-- Drawers for properties or a logbook
+drawer :: OrgParser Blocks
+drawer = try $ do
+ drawerStart
+ manyTill drawerLine (try drawerEnd)
+ return mempty
+
+drawerStart :: OrgParser String
+drawerStart = try $
+ skipSpaces *> drawerName <* skipSpaces <* newline
+ where drawerName = try $ char ':' *> validDrawerName <* char ':'
+ validDrawerName = stringAnyCase "PROPERTIES"
+ <|> stringAnyCase "LOGBOOK"
+
+drawerLine :: OrgParser String
+drawerLine = try $ anyLine
+
+drawerEnd :: OrgParser String
+drawerEnd = try $
+ skipSpaces *> stringAnyCase ":END:" <* skipSpaces <* newline
+
+
+-- Comments, Options and Metadata
+specialLine :: OrgParser Blocks
+specialLine = try $ metaLine <|> commentLine
+
+metaLine :: OrgParser Blocks
+metaLine = try $ metaLineStart *> declarationLine
+
+commentLine :: OrgParser Blocks
+commentLine = try $ commentLineStart *> anyLine *> pure mempty
+
+-- The order, in which blocks are tried, makes sure that we're not looking at
+-- the beginning of a block, so we don't need to check for it
+metaLineStart :: OrgParser String
+metaLineStart = try $ mappend <$> many spaceChar <*> string "#+"
+
+commentLineStart :: OrgParser String
+commentLineStart = try $ mappend <$> many spaceChar <*> string "# "
+
+declarationLine :: OrgParser Blocks
+declarationLine = try $ do
+ meta' <- B.setMeta <$> metaKey <*> metaValue <*> pure nullMeta
+ updateState $ \st -> st { stateMeta = stateMeta st <> meta' }
+ return mempty
+
+metaValue :: OrgParser MetaValue
+metaValue = MetaInlines . B.toList . trimInlines <$> restOfLine
+
+metaKey :: OrgParser [Char]
+metaKey = map toLower <$> many1 (noneOf ": \n\r")
+ <* char ':'
+ <* skipSpaces
+
+-- | Headers
+header :: OrgParser Blocks
+header = try $
+ B.header <$> headerStart
+ <*> (trimInlines <$> restOfLine)
+
+headerStart :: OrgParser Int
+headerStart = try $
+ (length <$> many1 (char '*')) <* many1 (char ' ')
+
+-- Horizontal Line (five dashes or more)
+hline :: OrgParser Blocks
+hline = try $ do
+ skipSpaces
+ string "-----"
+ many (char '-')
+ skipSpaces
+ newline
+ return B.horizontalRule
+
+--
+-- Tables
+--
+
+data OrgTableRow = OrgContentRow [Blocks]
+ | OrgAlignRow [Alignment]
+ | OrgHlineRow
+ deriving (Eq, Show)
+
+type OrgTableContent = (Int, [Alignment], [Double], [Blocks], [[Blocks]])
+
+table :: OrgParser Blocks
+table = try $ do
+ lookAhead tableStart
+ (_, aligns, widths, heads, lns) <- normalizeTable . tableContent <$> tableRows
+ return $ B.table "" (zip aligns widths) heads lns
+
+tableStart :: OrgParser Char
+tableStart = try $ skipSpaces *> char '|'
+
+tableRows :: OrgParser [OrgTableRow]
+tableRows = try $ many (tableAlignRow <|> tableHline <|> tableContentRow)
+
+tableContentRow :: OrgParser OrgTableRow
+tableContentRow = try $
+ OrgContentRow <$> (tableStart *> manyTill tableContentCell newline)
+
+tableContentCell :: OrgParser Blocks
+tableContentCell = try $
+ B.plain . trimInlines . mconcat <$> many1Till inline (try endOfCell)
+
+endOfCell :: OrgParser Char
+-- endOfCell = char '|' <|> newline
+endOfCell = try $ char '|' <|> lookAhead newline
+
+tableAlignRow :: OrgParser OrgTableRow
+tableAlignRow = try $
+ OrgAlignRow <$> (tableStart *> manyTill tableAlignCell newline)
+
+tableAlignCell :: OrgParser Alignment
+tableAlignCell =
+ choice [ try $ emptyCell *> return (AlignDefault)
+ , try $ skipSpaces
+ *> char '<'
+ *> tableAlignFromChar
+ <* many digit
+ <* char '>'
+ <* emptyCell
+ ] <?> "alignment info"
+ where emptyCell = try $ skipSpaces *> endOfCell
+
+tableAlignFromChar :: OrgParser Alignment
+tableAlignFromChar = try $ choice [ char 'l' *> return AlignLeft
+ , char 'c' *> return AlignCenter
+ , char 'r' *> return AlignRight
+ ]
+
+tableHline :: OrgParser OrgTableRow
+tableHline = try $
+ OrgHlineRow <$ (tableStart *> char '-' *> anyLine)
+
+tableContent :: [OrgTableRow]
+ -> OrgTableContent
+tableContent = foldl' (flip rowToContent) (0, mempty, repeat 0, mempty, mempty)
+
+normalizeTable :: OrgTableContent
+ -> OrgTableContent
+normalizeTable (cols, aligns, widths, heads, lns) =
+ let aligns' = fillColumns aligns AlignDefault
+ widths' = fillColumns widths 0.0
+ heads' = if heads == mempty
+ then heads
+ else fillColumns heads (B.plain mempty)
+ lns' = map (flip fillColumns (B.plain mempty)) lns
+ fillColumns base padding = take cols $ base ++ repeat padding
+ in (cols, aligns', widths', heads', lns')
+
+
+-- One or more horizontal rules after the first content line mark the previous
+-- line as a header. All other horizontal lines are discarded.
+rowToContent :: OrgTableRow
+ -> OrgTableContent
+ -> OrgTableContent
+rowToContent OrgHlineRow = maybeBodyToHeader
+rowToContent (OrgContentRow rs) = setLongestRow rs . appendToBody rs
+rowToContent (OrgAlignRow as) = setLongestRow as . setAligns as
+
+setLongestRow :: [a]
+ -> OrgTableContent
+ -> OrgTableContent
+setLongestRow r (cols, aligns, widths, heads, lns) =
+ (max cols (length r), aligns, widths, heads, lns)
+
+maybeBodyToHeader :: OrgTableContent
+ -> OrgTableContent
+maybeBodyToHeader (cols, aligns, widths, [], b:[]) = (cols, aligns, widths, b, [])
+maybeBodyToHeader content = content
+
+appendToBody :: [Blocks]
+ -> OrgTableContent
+ -> OrgTableContent
+appendToBody r (cols, aligns, widths, heads, lns) =
+ (cols, aligns, widths, heads, lns ++ [r])
+
+setAligns :: [Alignment]
+ -> OrgTableContent
+ -> OrgTableContent
+setAligns aligns (cols, _, widths, heads, lns) =
+ (cols, aligns, widths, heads, lns)
+
+-- Paragraphs or Plain text
+paraOrPlain :: OrgParser Blocks
+paraOrPlain = try $
+ trimInlines . mconcat
+ <$> many1 inline
+ <**> option B.plain
+ (try $ newline *> pure B.para)
+
+restOfLine :: OrgParser Inlines
+restOfLine = mconcat <$> manyTill inline newline
+
+
+--
+-- list blocks
+--
+
+list :: OrgParser Blocks
+list = choice [ bulletList, orderedList ] <?> "list"
+
+bulletList :: OrgParser Blocks
+bulletList = B.bulletList . compactify' <$> many1 (listItem bulletListStart)
+
+orderedList :: OrgParser Blocks
+orderedList = B.orderedList . compactify' <$> many1 (listItem orderedListStart)
+
+genericListStart :: OrgParser String
+ -> OrgParser Int
+genericListStart listMarker = try $
+ (+) <$> (length <$> many spaceChar)
+ <*> (length <$> listMarker <* many1 spaceChar)
+
+-- parses bullet list start and returns its length (excl. following whitespace)
+bulletListStart :: OrgParser Int
+bulletListStart = genericListStart bulletListMarker
+ where bulletListMarker = pure <$> oneOf "*-+"
+
+orderedListStart :: OrgParser Int
+orderedListStart = genericListStart orderedListMarker
+ -- Ordered list markers allowed in org-mode
+ where orderedListMarker = mappend <$> many1 digit <*> (pure <$> oneOf ".)")
+
+listItem :: OrgParser Int
+ -> OrgParser Blocks
+listItem start = try $ do
+ (markerLength, first) <- try (start >>= rawListItem)
+ rest <- many (listContinuation markerLength)
+ parseFromString parseBlocks $ concat (first:rest)
+
+-- parse raw text for one list item, excluding start marker and continuations
+rawListItem :: Int
+ -> OrgParser (Int, String)
+rawListItem markerLength = try $ do
+ firstLine <- anyLine
+ restLines <- many (listLine markerLength)
+ return (markerLength, (firstLine ++ "\n" ++ (concat restLines)))
+
+-- continuation of a list item - indented and separated by blankline or endline.
+-- Note: nested lists are parsed as continuations.
+listContinuation :: Int
+ -> OrgParser String
+listContinuation markerLength = try $
+ mappend <$> many blankline
+ <*> (concat <$> many1 (listLine markerLength))
+
+-- parse a line of a list item
+listLine :: Int
+ -> OrgParser String
+listLine markerLength = try $
+ indentWith markerLength *> anyLine
+ <**> pure (++ "\n")
+
+
+--
+-- inline
+--
+
+inline :: OrgParser Inlines
+inline = choice inlineParsers <?> "inline"
+ where inlineParsers = [ whitespace
+ , link
+ , str
+ , endline
+ , emph
+ , strong
+ , strikeout
+ , underline
+ , code
+ , verbatim
+ , subscript
+ , superscript
+ , symbol
+ ]
+
+-- treat these as potentially non-text when parsing inline:
+specialChars :: [Char]
+specialChars = "\"$'()*+-./:<=>[\\]^_{|}~"
+
+
+whitespace :: OrgParser Inlines
+whitespace = B.space <$ skipMany1 spaceChar <?> "whitespace"
+
+str :: OrgParser Inlines
+str = B.str <$> many1 (noneOf $ specialChars ++ "\n\r ")
+ <* updateLastStrPos
+
+-- an endline character that can be treated as a space, not a structural break
+endline :: OrgParser Inlines
+endline = try $ do
+ newline
+ notFollowedBy blankline
+ notFollowedBy' exampleLine
+ notFollowedBy' hline
+ notFollowedBy' tableStart
+ notFollowedBy' drawerStart
+ notFollowedBy' headerStart
+ notFollowedBy' metaLineStart
+ notFollowedBy' commentLineStart
+ notFollowedBy' bulletListStart
+ notFollowedBy' orderedListStart
+ return B.space
+
+link :: OrgParser Inlines
+link = explicitLink <|> selfLink <?> "link"
+
+explicitLink :: OrgParser Inlines
+explicitLink = try $ do
+ char '['
+ src <- enclosedRaw (char '[') (char ']')
+ title <- enclosedInlines (char '[') (char ']')
+ char ']'
+ return $ B.link src "" title
+
+selfLink :: OrgParser Inlines
+selfLink = try $ do
+ src <- enclosedRaw (string "[[") (string "]]")
+ return $ B.link src "" (B.str src)
+
+emph :: OrgParser Inlines
+emph = B.emph <$> inlinesEnclosedBy '/'
+
+strong :: OrgParser Inlines
+strong = B.strong <$> inlinesEnclosedBy '*'
+
+strikeout :: OrgParser Inlines
+strikeout = B.strikeout <$> inlinesEnclosedBy '+'
+
+-- There is no underline, so we use strong instead.
+underline :: OrgParser Inlines
+underline = B.strong <$> inlinesEnclosedBy '_'
+
+code :: OrgParser Inlines
+code = B.code <$> rawEnclosedBy '='
+
+verbatim :: OrgParser Inlines
+verbatim = B.rawInline "" <$> rawEnclosedBy '~'
+
+subscript :: OrgParser Inlines
+subscript = B.subscript <$> (try $ char '_' *> maybeGroupedByBraces)
+
+superscript :: OrgParser Inlines
+superscript = B.superscript <$> (try $ char '^' *> maybeGroupedByBraces)
+
+maybeGroupedByBraces :: OrgParser Inlines
+maybeGroupedByBraces = try $
+ choice [ try $ enclosedInlines (char '{') (char '}')
+ , B.str . (:"") <$> anyChar
+ ]
+
+symbol :: OrgParser Inlines
+symbol = B.str . (: "") <$> oneOf specialChars
+
+enclosedInlines :: OrgParser a
+ -> OrgParser b
+ -> OrgParser Inlines
+enclosedInlines start end = try $
+ trimInlines . mconcat <$> enclosed start end inline
+
+-- FIXME: This is a hack
+inlinesEnclosedBy :: Char
+ -> OrgParser Inlines
+inlinesEnclosedBy c = enclosedInlines (atStart (char c) <* endsOnThisOrNextLine c)
+ (atEnd $ char c)
+
+enclosedRaw :: OrgParser a
+ -> OrgParser b
+ -> OrgParser String
+enclosedRaw start end = try $
+ start *> (onSingleLine <|> spanningTwoLines)
+ where onSingleLine = try $ many1Till (noneOf "\n\r") end
+ spanningTwoLines = try $
+ anyLine >>= \f -> mappend (f <> " ") <$> onSingleLine
+
+rawEnclosedBy :: Char
+ -> OrgParser String
+rawEnclosedBy c = enclosedRaw (atStart $ char c) (atEnd $ char c)
+
+-- succeeds only if we're not right after a str (ie. in middle of word)
+atStart :: OrgParser a -> OrgParser a
+atStart p = do
+ pos <- getPosition
+ st <- getState
+ guard $ stateLastStrPos st /= Just pos
+ p
+
+-- | succeeds only if we're at the end of a word
+atEnd :: OrgParser a -> OrgParser a
+atEnd p = try $ p <* lookingAtEndOfWord
+ where lookingAtEndOfWord = lookAhead . oneOf $ postWordChars
+
+postWordChars :: [Char]
+postWordChars = "\t\n\r !\"'),-.:?}"
+
+-- FIXME: These functions are hacks and should be replaced
+endsOnThisOrNextLine :: Char
+ -> OrgParser ()
+endsOnThisOrNextLine c = do
+ inp <- getInput
+ let doOtherwise = \rest -> endsOnThisLine rest c (const mzero)
+ endsOnThisLine inp c doOtherwise
+
+endsOnThisLine :: [Char]
+ -> Char
+ -> ([Char] -> OrgParser ())
+ -> OrgParser ()
+endsOnThisLine input c doOnOtherLines = do
+ case break (`elem` c:"\n") input of
+ (_,'\n':rest) -> doOnOtherLines rest
+ (_,_:rest@(n:_)) -> if n `elem` postWordChars
+ then return ()
+ else endsOnThisLine rest c doOnOtherLines
+ _ -> mzero
+
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 32893128a..127eae167 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -36,12 +36,13 @@ import Text.Pandoc.Builder (setMeta, fromList)
import Text.Pandoc.Shared
import Text.Pandoc.Parsing
import Text.Pandoc.Options
-import Control.Monad ( when, liftM, guard, mzero )
+import Control.Monad ( when, liftM, guard, mzero, mplus )
import Data.List ( findIndex, intersperse, intercalate,
transpose, sort, deleteFirstsBy, isSuffixOf )
+import Data.Maybe (fromMaybe)
import qualified Data.Map as M
import Text.Printf ( printf )
-import Control.Applicative ((<$>), (<$), (<*), (*>))
+import Control.Applicative ((<$>), (<$), (<*), (*>), (<*>))
import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>))
import qualified Text.Pandoc.Builder as B
import Data.Monoid (mconcat, mempty)
@@ -347,14 +348,25 @@ lhsCodeBlock = try $ do
getPosition >>= guard . (==1) . sourceColumn
guardEnabled Ext_literate_haskell
optional codeBlockStart
- lns <- many1 birdTrackLine
- -- if (as is normal) there is always a space after >, drop it
- let lns' = if all (\ln -> null ln || take 1 ln == " ") lns
- then map (drop 1) lns
- else lns
+ lns <- latexCodeBlock <|> birdCodeBlock
blanklines
return $ B.codeBlockWith ("", ["sourceCode", "literate", "haskell"], [])
- $ intercalate "\n" lns'
+ $ intercalate "\n" lns
+
+latexCodeBlock :: Parser [Char] st [[Char]]
+latexCodeBlock = try $ do
+ try (latexBlockLine "\\begin{code}")
+ many1Till anyLine (try $ latexBlockLine "\\end{code}")
+ where
+ latexBlockLine s = skipMany spaceChar >> string s >> blankline
+
+birdCodeBlock :: Parser [Char] st [[Char]]
+birdCodeBlock = filterSpace <$> many1 birdTrackLine
+ where filterSpace lns =
+ -- if (as is normal) there is always a space after >, drop it
+ if all (\ln -> null ln || take 1 ln == " ") lns
+ then map (drop 1) lns
+ else lns
birdTrackLine :: Parser [Char] st [Char]
birdTrackLine = char '>' >> anyLine
@@ -519,7 +531,7 @@ directive' = do
let body' = body ++ "\n\n"
case label of
"raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
- "role" -> return mempty
+ "role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
"container" -> parseFromString parseBlocks body'
"replace" -> B.para <$> -- consumed by substKey
parseFromString (trimInlines . mconcat <$> many inline)
@@ -569,7 +581,7 @@ directive' = do
"figure" -> do
(caption, legend) <- parseFromString extractCaption body'
let src = escapeURI $ trim top
- return $ B.para (B.image src "" caption) <> legend
+ return $ B.para (B.image src "fig:" caption) <> legend
"image" -> do
let src = escapeURI $ trim top
let alt = B.str $ maybe "image" trim $ lookup "alt" fields
@@ -580,7 +592,38 @@ directive' = do
Nothing -> B.image src "" alt
_ -> return mempty
--- Can contain haracter codes as decimal numbers or
+-- TODO:
+-- - Silently ignores illegal fields
+-- - Silently drops classes
+-- - Only supports :format: fields with a single format for :raw: roles,
+-- change Text.Pandoc.Definition.Format to fix
+addNewRole :: String -> [(String, String)] -> RSTParser Blocks
+addNewRole roleString fields = do
+ (role, parentRole) <- parseFromString inheritedRole roleString
+ customRoles <- stateRstCustomRoles <$> getState
+ baseRole <- case M.lookup parentRole customRoles of
+ Just (base, _, _) -> return base
+ Nothing -> return parentRole
+
+ let fmt = if baseRole == "raw" then lookup "format" fields else Nothing
+ annotate = maybe id addLanguage $
+ if baseRole == "code"
+ then lookup "language" fields
+ else Nothing
+
+ updateState $ \s -> s {
+ stateRstCustomRoles =
+ M.insert role (baseRole, fmt, (,) parentRole . annotate) customRoles
+ }
+
+ return $ B.singleton Null
+ where
+ addLanguage lang (ident, classes, keyValues) =
+ (ident, "sourceCode" : lang : classes, keyValues)
+ inheritedRole =
+ (,) <$> roleNameEndingIn (char '(') <*> roleNameEndingIn (char ')')
+
+-- Can contain character codes as decimal numbers or
-- hexadecimal numbers, prefixed by 0x, x, \x, U+, u, or \u
-- or as XML-style hexadecimal character entities, e.g. &#x1a2b;
-- or text, which is used as-is. Comments start with ..
@@ -919,17 +962,56 @@ strong = B.strong . trimInlines . mconcat <$>
-- Note, this doesn't precisely implement the complex rule in
-- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules
-- but it should be good enough for most purposes
+--
+-- TODO:
+-- - Classes are silently discarded in addNewRole
+-- - Lacks sensible implementation for title-reference (which is the default)
+-- - Allows direct use of the :raw: role, rST only allows inherited use.
interpretedRole :: RSTParser Inlines
interpretedRole = try $ do
(role, contents) <- roleBefore <|> roleAfter
- case role of
- "sup" -> return $ B.superscript $ B.str contents
- "sub" -> return $ B.subscript $ B.str contents
- "math" -> return $ B.math contents
- _ -> return $ B.str contents --unknown
+ renderRole contents Nothing role nullAttr
+
+renderRole :: String -> Maybe String -> String -> Attr -> RSTParser Inlines
+renderRole contents fmt role attr = case role of
+ "sup" -> return $ B.superscript $ B.str contents
+ "superscript" -> return $ B.superscript $ B.str contents
+ "sub" -> return $ B.subscript $ B.str contents
+ "subscript" -> return $ B.subscript $ B.str contents
+ "emphasis" -> return $ B.emph $ B.str contents
+ "strong" -> return $ B.strong $ B.str contents
+ "rfc-reference" -> return $ rfcLink contents
+ "RFC" -> return $ rfcLink contents
+ "pep-reference" -> return $ pepLink contents
+ "PEP" -> return $ pepLink contents
+ "literal" -> return $ B.str contents
+ "math" -> return $ B.math contents
+ "title-reference" -> titleRef contents
+ "title" -> titleRef contents
+ "t" -> titleRef contents
+ "code" -> return $ B.codeWith attr contents
+ "raw" -> return $ B.rawInline (fromMaybe "" fmt) contents
+ custom -> do
+ customRole <- stateRstCustomRoles <$> getState
+ case M.lookup custom customRole of
+ Just (_, newFmt, inherit) -> let
+ fmtStr = fmt `mplus` newFmt
+ (newRole, newAttr) = inherit attr
+ in renderRole contents fmtStr newRole newAttr
+ Nothing -> return $ B.str contents -- Undefined role
+ where
+ titleRef ref = return $ B.str ref -- FIXME: Not a sensible behaviour
+ rfcLink rfcNo = B.link rfcUrl ("RFC " ++ rfcNo) $ B.str ("RFC " ++ rfcNo)
+ where rfcUrl = "http://www.faqs.org/rfcs/rfc" ++ rfcNo ++ ".html"
+ pepLink pepNo = B.link pepUrl ("PEP " ++ pepNo) $ B.str ("PEP " ++ pepNo)
+ where padNo = replicate (4 - length pepNo) '0' ++ pepNo
+ pepUrl = "http://http://www.python.org/dev/peps/pep-" ++ padNo ++ "/"
+
+roleNameEndingIn :: RSTParser Char -> RSTParser String
+roleNameEndingIn end = many1Till (letter <|> char '-') end
roleMarker :: RSTParser String
-roleMarker = char ':' *> many1Till (letter <|> char '-') (char ':')
+roleMarker = char ':' *> roleNameEndingIn (char ':')
roleBefore :: RSTParser (String,String)
roleBefore = try $ do
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 23e07f621..93658cdea 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -594,7 +594,7 @@ surrounded border = enclosed (border *> notFollowedBy (oneOf " \t\n\r")) (try bo
simpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
-> ([Inline] -> Inline) -- ^ Inline constructor
-> Parser [Char] ParserState Inline -- ^ content parser (to be used repeatedly)
-simpleInline border construct = surrounded border (inlineWithAttribute) >>=
+simpleInline border construct = surrounded border inlineWithAttribute >>=
return . construct . normalizeSpaces
where inlineWithAttribute = (try $ optional attributes) >> inline
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 7592b7659..714402e42 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -91,7 +91,8 @@ import Data.Char ( toLower, isLower, isUpper, isAlpha,
isLetter, isDigit, isSpace )
import Data.List ( find, isPrefixOf, intercalate )
import qualified Data.Map as M
-import Network.URI ( escapeURIString, isURI, unEscapeString )
+import Network.URI ( escapeURIString, isURI, nonStrictRelativeTo,
+ unEscapeString, parseURIReference )
import System.Directory
import Text.Pandoc.MIME (getMimeType)
import System.FilePath ( (</>), takeExtension, dropExtension )
@@ -121,6 +122,7 @@ import Data.ByteString.Lazy (toChunks)
import Network.HTTP.Conduit (httpLbs, parseUrl, withManager,
responseBody, responseHeaders)
import Network.HTTP.Types.Header ( hContentType)
+import Network (withSocketsDo)
#else
import Network.URI (parseURI)
import Network.HTTP (findHeader, rspBody,
@@ -531,7 +533,7 @@ headerShift n = walk shift
-- | Detect if a list is tight.
isTightList :: [[Block]] -> Bool
-isTightList = and . map firstIsPlain
+isTightList = all firstIsPlain
where firstIsPlain (Plain _ : _) = True
firstIsPlain _ = False
@@ -563,14 +565,10 @@ makeMeta title authors date =
-- | Render HTML tags.
renderTags' :: [Tag String] -> String
renderTags' = renderTagsOptions
- renderOptions{ optMinimize = \x ->
- let y = map toLower x
- in y == "hr" || y == "br" ||
- y == "img" || y == "meta" ||
- y == "link"
- , optRawTag = \x ->
- let y = map toLower x
- in y == "script" || y == "style" }
+ renderOptions{ optMinimize = matchTags ["hr", "br", "img",
+ "meta", "link"]
+ , optRawTag = matchTags ["script", "style"] }
+ where matchTags = \tags -> flip elem tags . map toLower
--
-- File handling
@@ -626,9 +624,13 @@ fetchItem :: Maybe String -> String
-> IO (Either E.SomeException (BS.ByteString, Maybe String))
fetchItem sourceURL s
| isURI s = openURL s
- | otherwise = case sourceURL of
- Just u -> openURL (u ++ "/" ++ s)
- Nothing -> E.try readLocalFile
+ | otherwise =
+ case sourceURL >>= parseURIReference of
+ Just u -> case parseURIReference s of
+ Just s' -> openURL $ show $
+ s' `nonStrictRelativeTo` u
+ Nothing -> openURL $ show u ++ "/" ++ s
+ Nothing -> E.try readLocalFile
where readLocalFile = do
let mime = case takeExtension s of
".gz" -> getMimeType $ dropExtension s
@@ -644,7 +646,7 @@ openURL u
contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
in return $ Right (decodeLenient contents, Just mime)
#ifdef HTTP_CONDUIT
- | otherwise = E.try $ do
+ | otherwise = withSocketsDo $ E.try $ do
req <- parseUrl u
resp <- withManager $ httpLbs req
return (BS.concat $ toChunks $ responseBody resp,
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 5c7341b69..2a834c2da 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -29,7 +29,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Conversion of 'Pandoc' documents to docx.
-}
module Text.Pandoc.Writers.Docx ( writeDocx ) where
-import Data.List ( intercalate, groupBy )
+import Data.Maybe (fromMaybe)
+import Data.List ( intercalate, isPrefixOf, isSuffixOf )
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BL8
@@ -42,6 +43,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Generic
import Text.Pandoc.ImageSize
import Text.Pandoc.Shared hiding (Element)
+import Text.Pandoc.Writers.Shared (fixDisplayMath)
import Text.Pandoc.Options
import Text.Pandoc.Readers.TeXMath
import Text.Pandoc.Highlighting ( highlight )
@@ -130,7 +132,8 @@ writeDocx opts doc@(Pandoc meta _) = do
let mkOverrideNode (part', contentType') = mknode "Override"
[("PartName",part'),("ContentType",contentType')] ()
let mkImageOverride (_, imgpath, mbMimeType, _, _) =
- mkOverrideNode ("/word/" ++ imgpath, maybe "application/octet-stream" id mbMimeType)
+ mkOverrideNode ("/word/" ++ imgpath,
+ fromMaybe "application/octet-stream" mbMimeType)
let overrides = map mkOverrideNode
[("/word/webSettings.xml",
"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml")
@@ -260,6 +263,12 @@ writeDocx opts doc@(Pandoc meta _) = do
fontTableEntry <- entryFromArchive "word/fontTable.xml"
settingsEntry <- entryFromArchive "word/settings.xml"
webSettingsEntry <- entryFromArchive "word/webSettings.xml"
+ let miscRels = [ f | f <- filesInArchive refArchive
+ , "word/_rels/" `isPrefixOf` f
+ , ".xml.rels" `isSuffixOf` f
+ , f /= "word/_rels/document.xml.rels"
+ , f /= "word/_rels/footnotes.xml.rels" ]
+ miscRelEntries <- mapM entryFromArchive miscRels
-- Create archive
let archive = foldr addEntryToArchive emptyArchive $
@@ -267,7 +276,7 @@ writeDocx opts doc@(Pandoc meta _) = do
footnoteRelEntry : numEntry : styleEntry : footnotesEntry :
docPropsEntry : docPropsAppEntry : themeEntry :
fontTableEntry : settingsEntry : webSettingsEntry :
- imageEntries
+ imageEntries ++ miscRelEntries
return $ fromArchive archive
styleToOpenXml :: Style -> [Element]
@@ -322,7 +331,7 @@ mkNum markers marker numid =
NumberMarker _ _ start ->
map (\lvl -> mknode "w:lvlOverride" [("w:ilvl",show (lvl :: Int))]
$ mknode "w:startOverride" [("w:val",show start)] ()) [0..6]
- where absnumid = maybe 0 id $ M.lookup marker markers
+ where absnumid = fromMaybe 0 $ M.lookup marker markers
mkAbstractNum :: (ListMarker,Int) -> IO Element
mkAbstractNum (marker,numid) = do
@@ -807,30 +816,8 @@ br = mknode "w:r" [] [mknode "w:br" [("w:type","textWrapping")] () ]
parseXml :: Archive -> String -> IO Element
parseXml refArchive relpath =
- case (findEntryByPath relpath refArchive >>= parseXMLDoc . UTF8.toStringLazy . fromEntry) of
- Just d -> return d
+ case findEntryByPath relpath refArchive of
+ Just e -> case parseXMLDoc $ UTF8.toStringLazy $ fromEntry e of
+ Just d -> return d
+ Nothing -> fail $ relpath ++ " corrupt in reference docx"
Nothing -> fail $ relpath ++ " missing in reference docx"
-
-isDisplayMath :: Inline -> Bool
-isDisplayMath (Math DisplayMath _) = True
-isDisplayMath _ = False
-
-stripLeadingTrailingSpace :: [Inline] -> [Inline]
-stripLeadingTrailingSpace = go . reverse . go . reverse
- where go (Space:xs) = xs
- go xs = xs
-
-fixDisplayMath :: Block -> Block
-fixDisplayMath (Plain lst)
- | any isDisplayMath lst && not (all isDisplayMath lst) =
- -- chop into several paragraphs so each displaymath is its own
- Div ("",["math"],[]) $ map (Plain . stripLeadingTrailingSpace) $
- groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
- not (isDisplayMath x || isDisplayMath y)) lst
-fixDisplayMath (Para lst)
- | any isDisplayMath lst && not (all isDisplayMath lst) =
- -- chop into several paragraphs so each displaymath is its own
- Div ("",["math"],[]) $ map (Para . stripLeadingTrailingSpace) $
- groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
- not (isDisplayMath x || isDisplayMath y)) lst
-fixDisplayMath x = x
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 59c90b16d..a48300939 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -38,7 +38,7 @@ import Text.Printf (printf)
import System.FilePath ( (</>), takeBaseName, takeExtension, takeFileName )
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as B8
-import Text.Pandoc.UTF8 ( fromStringLazy, toString )
+import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.SelfContained ( makeSelfContained )
import Codec.Archive.Zip
import Control.Applicative ((<$>))
@@ -89,8 +89,13 @@ data EPUBMetadata = EPUBMetadata{
, epubCoverage :: Maybe String
, epubRights :: Maybe String
, epubCoverImage :: Maybe String
+ , epubStylesheet :: Maybe Stylesheet
} deriving Show
+data Stylesheet = StylesheetPath FilePath
+ | StylesheetContents String
+ deriving Show
+
data Creator = Creator{
creatorText :: String
, creatorRole :: Maybe String
@@ -119,7 +124,12 @@ opfName n = QName n Nothing (Just "opf")
plainify :: [Inline] -> String
plainify t =
- trimr $ writePlain def{ writerStandalone = False } $ Pandoc nullMeta [Plain t]
+ trimr $ writePlain def{ writerStandalone = False }
+ $ Pandoc nullMeta [Plain $ walk removeNote t]
+
+removeNote :: Inline -> Inline
+removeNote (Note _) = Str ""
+removeNote x = x
getEPUBMetadata :: WriterOptions -> Meta -> IO EPUBMetadata
getEPUBMetadata opts meta = do
@@ -171,8 +181,8 @@ addMetadataFromXML e@(Element (QName name _ (Just "dc")) attrs _ _) md
, titleFileAs = getAttr "file-as"
, titleType = getAttr "type"
} : epubTitle md }
- | name == "date" = md{ epubDate = maybe "" id $ normalizeDate'
- $ strContent e }
+ | name == "date" = md{ epubDate = fromMaybe "" $ normalizeDate'
+ $ strContent e }
| name == "language" = md{ epubLanguage = strContent e }
| name == "creator" = md{ epubCreator =
Creator{ creatorText = strContent e
@@ -262,10 +272,11 @@ metadataFromMeta opts meta = EPUBMetadata{
, epubCoverage = coverage
, epubRights = rights
, epubCoverImage = coverImage
+ , epubStylesheet = stylesheet
}
where identifiers = getIdentifier meta
titles = getTitle meta
- date = maybe "" id $
+ date = fromMaybe "" $
(metaValueToString <$> lookupMeta "date" meta) >>= normalizeDate'
language = maybe "" metaValueToString $
lookupMeta "language" meta `mplus` lookupMeta "lang" meta
@@ -282,13 +293,16 @@ metadataFromMeta opts meta = EPUBMetadata{
rights = metaValueToString <$> lookupMeta "rights" meta
coverImage = lookup "epub-cover-image" (writerVariables opts) `mplus`
(metaValueToString <$> lookupMeta "cover-image" meta)
+ stylesheet = (StylesheetContents <$> writerEpubStylesheet opts) `mplus`
+ ((StylesheetPath . metaValueToString) <$>
+ lookupMeta "stylesheet" meta)
-- | Produce an EPUB file from a Pandoc document.
writeEPUB :: WriterOptions -- ^ Writer options
-> Pandoc -- ^ Document to convert
-> IO B.ByteString
writeEPUB opts doc@(Pandoc meta _) = do
- let version = maybe EPUB2 id (writerEpubVersion opts)
+ let version = fromMaybe EPUB2 (writerEpubVersion opts)
let epub3 = version == EPUB3
epochtime <- floor `fmap` getPOSIXTime
let mkEntry path content = toEntry path epochtime content
@@ -392,10 +406,12 @@ writeEPUB opts doc@(Pandoc meta _) = do
chapToEntry num (Chapter mbnum bs) = mkEntry (showChapter num)
$ renderHtml
$ writeHtml opts'{ writerNumberOffset =
- maybe [] id mbnum }
+ fromMaybe [] mbnum }
$ case bs of
(Header _ _ xs : _) ->
- Pandoc (setMeta "title" (fromList xs) nullMeta) bs
+ -- remove notes or we get doubled footnotes
+ Pandoc (setMeta "title" (walk removeNote $ fromList xs)
+ nullMeta) bs
_ ->
Pandoc nullMeta bs
@@ -427,7 +443,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
let fontNode ent = unode "item" !
[("id", takeBaseName $ eRelativePath ent),
("href", eRelativePath ent),
- ("media-type", maybe "" id $ getMimeType $ eRelativePath ent)] $ ()
+ ("media-type", fromMaybe "" $ getMimeType $ eRelativePath ent)] $ ()
let plainTitle = case docTitle meta of
[] -> case epubTitle metadata of
[] -> "UNTITLED"
@@ -437,7 +453,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
(x:_) -> identifierText x -- use first identifier as UUID
[] -> error "epubIdentifier is null" -- shouldn't happen
currentTime <- getCurrentTime
- let contentsData = fromStringLazy $ ppTopElement $
+ let contentsData = UTF8.fromStringLazy $ ppTopElement $
unode "package" ! [("version", case version of
EPUB2 -> "2.0"
EPUB3 -> "3.0")
@@ -525,7 +541,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
[ unode "navLabel" $ unode "text" (plainify $ docTitle meta)
, unode "content" ! [("src","title_page.xhtml")] $ () ]
- let tocData = fromStringLazy $ ppTopElement $
+ let tocData = UTF8.fromStringLazy $ ppTopElement $
unode "ncx" ! [("version","2005-1")
,("xmlns","http://www.daisy.org/z3986/2005/ncx/")] $
[ unode "head" $
@@ -557,7 +573,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
(_:_) -> [unode "ol" ! [("class","toc")] $ subs]
let navtag = if epub3 then "nav" else "div"
- let navData = fromStringLazy $ ppTopElement $
+ let navData = UTF8.fromStringLazy $ ppTopElement $
unode "html" ! [("xmlns","http://www.w3.org/1999/xhtml")
,("xmlns:epub","http://www.idpf.org/2007/ops")] $
[ unode "head" $
@@ -571,10 +587,10 @@ writeEPUB opts doc@(Pandoc meta _) = do
let navEntry = mkEntry "nav.xhtml" navData
-- mimetype
- let mimetypeEntry = mkEntry "mimetype" $ fromStringLazy "application/epub+zip"
+ let mimetypeEntry = mkEntry "mimetype" $ UTF8.fromStringLazy "application/epub+zip"
-- container.xml
- let containerData = fromStringLazy $ ppTopElement $
+ let containerData = UTF8.fromStringLazy $ ppTopElement $
unode "container" ! [("version","1.0")
,("xmlns","urn:oasis:names:tc:opendocument:xmlns:container")] $
unode "rootfiles" $
@@ -583,18 +599,19 @@ writeEPUB opts doc@(Pandoc meta _) = do
let containerEntry = mkEntry "META-INF/container.xml" containerData
-- com.apple.ibooks.display-options.xml
- let apple = fromStringLazy $ ppTopElement $
+ let apple = UTF8.fromStringLazy $ ppTopElement $
unode "display_options" $
unode "platform" ! [("name","*")] $
unode "option" ! [("name","specified-fonts")] $ "true"
let appleEntry = mkEntry "META-INF/com.apple.ibooks.display-options.xml" apple
-- stylesheet
- stylesheet <- case writerEpubStylesheet opts of
- Just s -> return s
- Nothing -> toString `fmap`
+ stylesheet <- case epubStylesheet metadata of
+ Just (StylesheetPath fp) -> UTF8.readFile fp
+ Just (StylesheetContents s) -> return s
+ Nothing -> UTF8.toString `fmap`
readDataFile (writerUserDataDir opts) "epub.css"
- let stylesheetEntry = mkEntry "stylesheet.css" $ fromStringLazy stylesheet
+ let stylesheetEntry = mkEntry "stylesheet.css" $ UTF8.fromStringLazy stylesheet
-- construct archive
let archive = foldr addEntryToArchive emptyArchive
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index adbe948be..803617f95 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -44,7 +44,7 @@ import qualified Text.XML.Light.Cursor as XC
import Text.Pandoc.Definition
import Text.Pandoc.Options (WriterOptions(..), HTMLMathMethod(..), def)
-import Text.Pandoc.Shared (orderedListMarkers)
+import Text.Pandoc.Shared (orderedListMarkers, isHeaderBlock)
import Text.Pandoc.Walk
-- | Data to be written at the end of the document:
@@ -157,9 +157,7 @@ renderSection level (ttl, body) = do
else cMapM blockToXml body
return $ el "section" (title ++ content)
where
- hasSubsections = any isHeader
- isHeader (Header _ _ _) = True
- isHeader _ = False
+ hasSubsections = any isHeaderBlock
-- | Only <p> and <empty-line> are allowed within <title> in FB2.
formatTitle :: [Inline] -> [Content]
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 641652276..3ac2a836f 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -45,7 +45,7 @@ import Numeric ( showHex )
import Data.Char ( ord, toLower )
import Data.List ( isPrefixOf, intersperse )
import Data.String ( fromString )
-import Data.Maybe ( catMaybes )
+import Data.Maybe ( catMaybes, fromMaybe )
import Control.Monad.State
import Text.Blaze.Html hiding(contents)
import Text.Blaze.Internal(preEscapedString)
@@ -118,7 +118,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
let stringifyHTML = escapeStringForXML . stringify
let authsMeta = map stringifyHTML $ docAuthors meta
let dateMeta = stringifyHTML $ docDate meta
- let slideLevel = maybe (getSlideLevel blocks) id $ writerSlideLevel opts
+ let slideLevel = fromMaybe (getSlideLevel blocks) $ writerSlideLevel opts
let sects = hierarchicalize $
if writerSlideVariant opts == NoSlides
then blocks
@@ -475,28 +475,22 @@ blockToHtml opts (BlockQuote blocks) =
else do
contents <- blockListToHtml opts blocks
return $ H.blockquote $ nl opts >> contents >> nl opts
-blockToHtml opts (Header level (ident,_,_) lst) = do
+blockToHtml opts (Header level (_,classes,_) lst) = do
contents <- inlineListToHtml opts lst
secnum <- liftM stSecNum get
let contents' = if writerNumberSections opts && not (null secnum)
+ && "unnumbered" `notElem` classes
then (H.span ! A.class_ "header-section-number" $ toHtml
$ showSecNum secnum) >> strToHtml " " >> contents
else contents
- let revealSlash = ['/' | writerSlideVariant opts == RevealJsSlides]
- let contents'' = if writerTableOfContents opts && not (null ident)
- then H.a ! A.href (toValue $
- '#' : revealSlash ++
- writerIdentifierPrefix opts ++
- ident) $ contents'
- else contents'
return $ case level of
- 1 -> H.h1 contents''
- 2 -> H.h2 contents''
- 3 -> H.h3 contents''
- 4 -> H.h4 contents''
- 5 -> H.h5 contents''
- 6 -> H.h6 contents''
- _ -> H.p contents''
+ 1 -> H.h1 contents'
+ 2 -> H.h2 contents'
+ 3 -> H.h3 contents'
+ 4 -> H.h4 contents'
+ 5 -> H.h5 contents'
+ 6 -> H.h6 contents'
+ _ -> H.p contents'
blockToHtml opts (BulletList lst) = do
contents <- mapM (blockListToHtml opts) lst
return $ unordList opts contents
@@ -524,7 +518,7 @@ blockToHtml opts (DefinitionList lst) = do
contents <- mapM (\(term, defs) ->
do term' <- if null term
then return mempty
- else liftM (H.dt) $ inlineListToHtml opts term
+ else liftM H.dt $ inlineListToHtml opts term
defs' <- mapM ((liftM (\x -> H.dd $ (x >> nl opts))) .
blockListToHtml opts) defs
return $ mconcat $ nl opts : term' : nl opts :
@@ -756,7 +750,9 @@ inlineToHtml opts inline =
else [A.title $ toValue tit])
return $ foldl (!) H5.embed attributes
-- note: null title included, as in Markdown.pl
- (Note contents) -> do
+ (Note contents)
+ | writerIgnoreNotes opts -> return mempty
+ | otherwise -> do
st <- get
let notes = stNotes st
let number = (length notes) + 1
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index f3cbcf19f..b2eff4490 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -40,6 +40,7 @@ import Network.URI ( isURI, unEscapeString )
import Data.List ( (\\), isSuffixOf, isInfixOf,
isPrefixOf, intercalate, intersperse )
import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord )
+import Data.Maybe ( fromMaybe )
import Control.Applicative ((<|>))
import Control.Monad.State
import Text.Pandoc.Pretty
@@ -50,6 +51,8 @@ import Text.Pandoc.Highlighting (highlight, styleToLaTeX,
data WriterState =
WriterState { stInNote :: Bool -- true if we're in a note
+ , stInMinipage :: Bool -- true if in minipage
+ , stNotes :: [Doc] -- notes in a minipage
, stOLLevel :: Int -- level of ordered list nesting
, stOptions :: WriterOptions -- writer options, so they don't have to be parameter
, stVerbInNote :: Bool -- true if document has verbatim text in note
@@ -70,7 +73,7 @@ data WriterState =
writeLaTeX :: WriterOptions -> Pandoc -> String
writeLaTeX options document =
evalState (pandocToLaTeX options document) $
- WriterState { stInNote = False,
+ WriterState { stInNote = False, stInMinipage = False, stNotes = [],
stOLLevel = 1, stOptions = options,
stVerbInNote = False,
stTable = False, stStrikeout = False,
@@ -188,7 +191,7 @@ stringToLaTeX _ [] = return ""
stringToLaTeX ctx (x:xs) = do
opts <- gets stOptions
rest <- stringToLaTeX ctx xs
- let ligatures = writerTeXLigatures opts && not (ctx == CodeString)
+ let ligatures = writerTeXLigatures opts && (ctx /= CodeString)
let isUrl = ctx == URLString
when (x == '€') $
modify $ \st -> st{ stUsesEuro = True }
@@ -203,7 +206,7 @@ stringToLaTeX ctx (x:xs) = do
'_' | not isUrl -> "\\_" ++ rest
'#' -> "\\#" ++ rest
'-' -> case xs of -- prevent adjacent hyphens from forming ligatures
- ('-':_) -> "-{}" ++ rest
+ ('-':_) -> "-\\/" ++ rest
_ -> '-' : rest
'~' | not isUrl -> "\\textasciitilde{}" ++ rest
'^' -> "\\^{}" ++ rest
@@ -238,7 +241,7 @@ inCmd cmd contents = char '\\' <> text cmd <> braces contents
toSlides :: [Block] -> State WriterState [Block]
toSlides bs = do
opts <- gets stOptions
- let slideLevel = maybe (getSlideLevel bs) id $ writerSlideLevel opts
+ let slideLevel = fromMaybe (getSlideLevel bs) $ writerSlideLevel opts
let bs' = prepSlides slideLevel bs
concat `fmap` (mapM (elementToBeamer slideLevel) $ hierarchicalize bs')
@@ -441,7 +444,7 @@ blockToLaTeX (DefinitionList lst) = do
incremental <- gets stIncremental
let inc = if incremental then "[<+->]" else ""
items <- mapM defListItemToLaTeX lst
- let spacing = if and $ map isTightList (map snd lst)
+ let spacing = if all isTightList (map snd lst)
then text "\\itemsep1pt\\parskip0pt\\parsep0pt"
else empty
return $ text ("\\begin{description}" ++ inc) $$ spacing $$ vcat items $$
@@ -453,12 +456,12 @@ blockToLaTeX (Header level (id',classes,_) lst) =
blockToLaTeX (Table caption aligns widths heads rows) = do
headers <- if all null heads
then return empty
- else ($$ "\\hline\\noalign{\\medskip}") `fmap`
+ else ($$ "\\midrule\\endhead") `fmap`
(tableRowToLaTeX True aligns widths) heads
captionText <- inlineListToLaTeX caption
let capt = if isEmpty captionText
then empty
- else text "\\noalign{\\medskip}"
+ else text "\\addlinespace"
$$ text "\\caption" <> braces captionText
rows' <- mapM (tableRowToLaTeX False aligns widths) rows
let colDescriptors = text $ concat $ map toColDescriptor aligns
@@ -466,10 +469,10 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
return $ "\\begin{longtable}[c]" <>
braces ("@{}" <> colDescriptors <> "@{}")
-- the @{} removes extra space at beginning and end
- $$ "\\hline\\noalign{\\medskip}"
+ $$ "\\toprule\\addlinespace"
$$ headers
$$ vcat rows'
- $$ "\\hline"
+ $$ "\\bottomrule"
$$ capt
$$ "\\end{longtable}"
@@ -490,23 +493,42 @@ tableRowToLaTeX :: Bool
-> [[Block]]
-> State WriterState Doc
tableRowToLaTeX header aligns widths cols = do
- renderedCells <- mapM blockListToLaTeX cols
- let valign = text $ if header then "[b]" else "[t]"
- let halign x = case x of
- AlignLeft -> "\\raggedright"
- AlignRight -> "\\raggedleft"
- AlignCenter -> "\\centering"
- AlignDefault -> "\\raggedright"
-- scale factor compensates for extra space between columns
-- so the whole table isn't larger than columnwidth
let scaleFactor = 0.97 ** fromIntegral (length aligns)
- let toCell 0 _ c = c
- toCell w a c = "\\begin{minipage}" <> valign <>
- braces (text (printf "%.2f\\columnwidth"
- (w * scaleFactor))) <>
- (halign a <> cr <> c <> cr) <> "\\end{minipage}"
- let cells = zipWith3 toCell widths aligns renderedCells
- return $ hsep (intersperse "&" cells) $$ "\\\\\\noalign{\\medskip}"
+ let widths' = map (scaleFactor *) widths
+ cells <- mapM (tableCellToLaTeX header) $ zip3 widths' aligns cols
+ return $ hsep (intersperse "&" cells) $$ "\\\\\\addlinespace"
+
+tableCellToLaTeX :: Bool -> (Double, Alignment, [Block])
+ -> State WriterState Doc
+tableCellToLaTeX _ (0, _, blocks) = blockListToLaTeX blocks
+tableCellToLaTeX header (width, align, blocks) = do
+ modify $ \st -> st{ stInMinipage = True, stNotes = [] }
+ cellContents <- blockListToLaTeX blocks
+ notes <- gets stNotes
+ modify $ \st -> st{ stInMinipage = False, stNotes = [] }
+ let valign = text $ if header then "[b]" else "[t]"
+ let halign = case align of
+ AlignLeft -> "\\raggedright"
+ AlignRight -> "\\raggedleft"
+ AlignCenter -> "\\centering"
+ AlignDefault -> "\\raggedright"
+ return $ ("\\begin{minipage}" <> valign <>
+ braces (text (printf "%.2f\\columnwidth" width)) <>
+ (halign <> cr <> cellContents <> cr) <> "\\end{minipage}")
+ $$ case notes of
+ [] -> empty
+ ns -> (case length ns of
+ n | n > 1 -> "\\addtocounter" <>
+ braces "footnote" <>
+ braces (text $ show $ 1 - n)
+ | otherwise -> empty)
+ $$
+ vcat (intersperse
+ ("\\addtocounter" <> braces "footnote" <> braces "1")
+ $ map (\x -> "\\footnotetext" <> braces x)
+ $ reverse ns)
listItemToLaTeX :: [Block] -> State WriterState Doc
listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
@@ -709,14 +731,20 @@ inlineToLaTeX (Image _ (source, _)) = do
source'' <- stringToLaTeX URLString source'
return $ "\\includegraphics" <> braces (text source'')
inlineToLaTeX (Note contents) = do
+ inMinipage <- gets stInMinipage
modify (\s -> s{stInNote = True})
contents' <- blockListToLaTeX contents
modify (\s -> s {stInNote = False})
let optnl = case reverse contents of
(CodeBlock _ _ : _) -> cr
_ -> empty
- return $ "\\footnote" <> braces (nest 2 contents' <> optnl)
- -- note: a \n before } needed when note ends with a Verbatim environment
+ let noteContents = nest 2 contents' <> optnl
+ modify $ \st -> st{ stNotes = noteContents : stNotes st }
+ return $
+ if inMinipage
+ then "\\footnotemark{}"
+ -- note: a \n before } needed when note ends with a Verbatim environment
+ else "\\footnote" <> braces noteContents
citationsToNatbib :: [Citation] -> State WriterState Doc
citationsToNatbib (one:[])
@@ -737,9 +765,9 @@ citationsToNatbib cits
| noPrefix (tail cits) && noSuffix (init cits) && ismode NormalCitation cits
= citeCommand "citep" p s ks
where
- noPrefix = and . map (null . citationPrefix)
- noSuffix = and . map (null . citationSuffix)
- ismode m = and . map (((==) m) . citationMode)
+ noPrefix = all (null . citationPrefix)
+ noSuffix = all (null . citationSuffix)
+ ismode m = all (((==) m) . citationMode)
p = citationPrefix $ head $ cits
s = citationSuffix $ last $ cits
ks = intercalate ", " $ map citationId cits
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 60d474263..278e5cc9d 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -338,7 +338,7 @@ blockToMarkdown opts (RawBlock f str)
else return $ if isEnabled Ext_markdown_attribute opts
then text (addMarkdownAttribute str) <> text "\n"
else text str <> text "\n"
- | f == "latex" || f == "tex" || f == "markdown" = do
+ | f `elem` ["latex", "tex", "markdown"] = do
st <- get
if stPlain st
then return empty
@@ -381,13 +381,11 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str)
isEnabled Ext_literate_haskell opts =
return $ prefixed "> " (text str) <> blankline
blockToMarkdown opts (CodeBlock attribs str) = return $
- case attribs of
- x | x /= nullAttr && isEnabled Ext_fenced_code_blocks opts ->
- tildes <> " " <> attrs <> cr <> text str <>
- cr <> tildes <> blankline
- (_,(cls:_),_) | isEnabled Ext_backtick_code_blocks opts ->
- backticks <> " " <> text cls <> cr <> text str <>
- cr <> backticks <> blankline
+ case attribs == nullAttr of
+ False | isEnabled Ext_backtick_code_blocks opts ->
+ backticks <> attrs <> cr <> text str <> cr <> backticks <> blankline
+ | isEnabled Ext_fenced_code_blocks opts ->
+ tildes <> attrs <> cr <> text str <> cr <> tildes <> blankline
_ -> nest (writerTabStop opts) (text str) <> blankline
where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of
[] -> "~~~~"
@@ -396,8 +394,10 @@ blockToMarkdown opts (CodeBlock attribs str) = return $
| otherwise -> replicate (n+1) '~'
backticks = text "```"
attrs = if isEnabled Ext_fenced_code_attributes opts
- then nowrap $ attrsToMarkdown attribs
- else empty
+ then nowrap $ " " <> attrsToMarkdown attribs
+ else case attribs of
+ (_,[cls],_) -> " " <> text cls
+ _ -> empty
blockToMarkdown opts (BlockQuote blocks) = do
st <- get
-- if we're writing literate haskell, put a space before the bird tracks
@@ -628,10 +628,11 @@ getReference label (src, tit) = do
Nothing -> do
let label' = case find ((== label) . fst) (stRefs st) of
Just _ -> -- label is used; generate numerical label
- case find (\n -> not (any (== [Str (show n)])
- (map fst (stRefs st)))) [1..(10000 :: Integer)] of
- Just x -> [Str (show x)]
- Nothing -> error "no unique label"
+ case find (\n -> notElem [Str (show n)]
+ (map fst (stRefs st)))
+ [1..(10000 :: Integer)] of
+ Just x -> [Str (show x)]
+ Nothing -> error "no unique label"
Nothing -> label
modify (\s -> s{ stRefs = (label', (src,tit)) : stRefs st })
return label'
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 61741a61e..83fefaa29 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -51,7 +51,7 @@ data WriterState = WriterState {
writeMediaWiki :: WriterOptions -> Pandoc -> String
writeMediaWiki opts document =
evalState (pandocToMediaWiki opts document)
- (WriterState { stNotes = False, stListLevel = [], stUseTags = False })
+ WriterState { stNotes = False, stListLevel = [], stUseTags = False }
-- | Return MediaWiki representation of document.
pandocToMediaWiki :: WriterOptions -> Pandoc -> State WriterState String
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index cc0a06243..c3652d65d 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -30,7 +30,10 @@ Conversion of 'Pandoc' documents to ODT.
-}
module Text.Pandoc.Writers.ODT ( writeODT ) where
import Data.IORef
-import Data.List ( isPrefixOf )
+import Data.List ( isPrefixOf, isSuffixOf )
+import Data.Maybe ( fromMaybe )
+import Text.XML.Light.Output
+import Text.TeXMath
import qualified Data.ByteString.Lazy as B
import Text.Pandoc.UTF8 ( fromStringLazy )
import Codec.Archive.Zip
@@ -40,13 +43,14 @@ import Text.Pandoc.ImageSize ( imageSize, sizeInPoints )
import Text.Pandoc.MIME ( getMimeType )
import Text.Pandoc.Definition
import Text.Pandoc.Walk
+import Text.Pandoc.Writers.Shared ( fixDisplayMath )
import Text.Pandoc.Writers.OpenDocument ( writeOpenDocument )
import Control.Monad (liftM)
import Text.Pandoc.XML
import Text.Pandoc.Pretty
import qualified Control.Exception as E
import Data.Time.Clock.POSIX ( getPOSIXTime )
-import System.FilePath ( takeExtension )
+import System.FilePath ( takeExtension, takeDirectory )
-- | Produce an ODT file from a Pandoc document.
writeODT :: WriterOptions -- ^ Writer options
@@ -60,9 +64,9 @@ writeODT opts doc@(Pandoc meta _) = do
Just f -> B.readFile f
Nothing -> (B.fromChunks . (:[])) `fmap`
readDataFile datadir "reference.odt"
- -- handle pictures
+ -- handle formulas and pictures
picEntriesRef <- newIORef ([] :: [Entry])
- doc' <- walkM (transformPic opts picEntriesRef) doc
+ doc' <- walkM (transformPicMath opts picEntriesRef) $ walk fixDisplayMath doc
let newContents = writeOpenDocument opts{writerWrapText = False} doc'
epochtime <- floor `fmap` getPOSIXTime
let contentEntry = toEntry "content.xml" epochtime
@@ -72,7 +76,11 @@ writeODT opts doc@(Pandoc meta _) = do
$ contentEntry : picEntries
-- construct META-INF/manifest.xml based on archive
let toFileEntry fp = case getMimeType fp of
- Nothing -> empty
+ Nothing -> if "Formula-" `isPrefixOf` fp && "/" `isSuffixOf` fp
+ then selfClosingTag "manifest:file-entry"
+ [("manifest:media-type","application/vnd.oasis.opendocument.formula")
+ ,("manifest:full-path",fp)]
+ else empty
Just m -> selfClosingTag "manifest:file-entry"
[("manifest:media-type", m)
,("manifest:full-path", fp)
@@ -80,6 +88,8 @@ writeODT opts doc@(Pandoc meta _) = do
]
let files = [ ent | ent <- filesInArchive archive,
not ("META-INF" `isPrefixOf` ent) ]
+ let formulas = [ takeDirectory ent ++ "/" | ent <- filesInArchive archive,
+ "Formula-" `isPrefixOf` ent, takeExtension ent == ".xml" ]
let manifestEntry = toEntry "META-INF/manifest.xml" epochtime
$ fromStringLazy $ render Nothing
$ text "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
@@ -91,6 +101,7 @@ writeODT opts doc@(Pandoc meta _) = do
[("manifest:media-type","application/vnd.oasis.opendocument.text")
,("manifest:full-path","/")]
$$ vcat ( map toFileEntry $ files )
+ $$ vcat ( map toFileEntry $ formulas )
)
)
let archive' = addEntryToArchive manifestEntry archive
@@ -118,8 +129,8 @@ writeODT opts doc@(Pandoc meta _) = do
$ addEntryToArchive metaEntry archive'
return $ fromArchive archive''
-transformPic :: WriterOptions -> IORef [Entry] -> Inline -> IO Inline
-transformPic opts entriesRef (Image lab (src,_)) = do
+transformPicMath :: WriterOptions -> IORef [Entry] -> Inline -> IO Inline
+transformPicMath opts entriesRef (Image lab (src,_)) = do
res <- fetchItem (writerSourceURL opts) src
case res of
Left (_ :: E.SomeException) -> do
@@ -127,7 +138,7 @@ transformPic opts entriesRef (Image lab (src,_)) = do
return $ Emph lab
Right (img, _) -> do
let size = imageSize img
- let (w,h) = maybe (0,0) id $ sizeInPoints `fmap` size
+ let (w,h) = fromMaybe (0,0) $ sizeInPoints `fmap` size
let tit' = show w ++ "x" ++ show h
entries <- readIORef entriesRef
let newsrc = "Pictures/" ++ show (length entries) ++ takeExtension src
@@ -136,5 +147,29 @@ transformPic opts entriesRef (Image lab (src,_)) = do
let entry = toEntry newsrc epochtime $ toLazy img
modifyIORef entriesRef (entry:)
return $ Image lab (newsrc, tit')
-transformPic _ _ x = return x
+transformPicMath _ entriesRef (Math t math) = do
+ entries <- readIORef entriesRef
+ let dt = if t == InlineMath then DisplayInline else DisplayBlock
+ case texMathToMathML dt math of
+ Left _ -> return $ Math t math
+ Right r -> do
+ let conf = useShortEmptyTags (const False) defaultConfigPP
+ let mathml = ppcTopElement conf r
+ epochtime <- floor `fmap` getPOSIXTime
+ let dirname = "Formula-" ++ show (length entries) ++ "/"
+ let fname = dirname ++ "content.xml"
+ let entry = toEntry fname epochtime (fromStringLazy mathml)
+ modifyIORef entriesRef (entry:)
+ return $ RawInline (Format "opendocument") $ render Nothing $
+ inTags False "draw:frame" [("text:anchor-type",
+ if t == DisplayMath
+ then "paragraph"
+ else "as-char")
+ ,("style:vertical-pos", "middle")
+ ,("style:vertical-rel", "text")] $
+ selfClosingTag "draw:object" [("xlink:href", dirname)
+ , ("xlink:type", "simple")
+ , ("xlink:show", "embed")
+ , ("xlink:actuate", "onLoad")]
+transformPicMath _ _ x = return x
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index 4ddfd7166..0029c3296 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -285,8 +285,12 @@ blocksToOpenDocument o b = vcat <$> mapM (blockToOpenDocument o) b
-- | Convert a Pandoc block element to OpenDocument.
blockToOpenDocument :: WriterOptions -> Block -> State WriterState Doc
blockToOpenDocument o bs
- | Plain b <- bs = inParagraphTags =<< inlinesToOpenDocument o b
- | Para b <- bs = inParagraphTags =<< inlinesToOpenDocument o b
+ | Plain b <- bs = if null b
+ then return empty
+ else inParagraphTags =<< inlinesToOpenDocument o b
+ | Para b <- bs = if null b
+ then return empty
+ else inParagraphTags =<< inlinesToOpenDocument o b
| Div _ xs <- bs = blocksToOpenDocument o xs
| Header i _ b <- bs = setFirstPara >>
(inHeaderTags i =<< inlinesToOpenDocument o b)
@@ -298,8 +302,8 @@ blockToOpenDocument o bs
| Table c a w h r <- bs = setFirstPara >> table c a w h r
| HorizontalRule <- bs = setFirstPara >> return (selfClosingTag "text:p"
[ ("text:style-name", "Horizontal_20_Line") ])
- | RawBlock f s <- bs = if f == "opendocument"
- then preformatted s
+ | RawBlock f s <- bs = if f == Format "opendocument"
+ then return $ text s
else return empty
| Null <- bs = return empty
| otherwise = return empty
@@ -378,8 +382,8 @@ inlineToOpenDocument o ils
| Code _ s <- ils = withTextStyle Pre $ inTextStyle $ preformatted s
| Math t s <- ils = inlinesToOpenDocument o (readTeXMath' t s)
| Cite _ l <- ils = inlinesToOpenDocument o l
- | RawInline f s <- ils = if f == "opendocument"
- then return $ preformatted s
+ | RawInline f s <- ils = if f == Format "opendocument"
+ then return $ text s
else return empty
| Link l (s,t) <- ils = mkLink s t <$> inlinesToOpenDocument o l
| Image _ (s,t) <- ils = mkImg s t
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 51083f52b..d318c5f6a 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -129,7 +129,7 @@ blockToOrg (Para inlines) = do
blockToOrg (RawBlock "html" str) =
return $ blankline $$ "#+BEGIN_HTML" $$
nest 2 (text str) $$ "#+END_HTML" $$ blankline
-blockToOrg (RawBlock f str) | f == "org" || f == "latex" || f == "tex" =
+blockToOrg (RawBlock f str) | f `elem` ["org", "latex", "tex"] =
return $ text str
blockToOrg (RawBlock _ _) = return empty
blockToOrg HorizontalRule = return $ blankline $$ "--------------" $$ blankline
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 1a62f7250..37bb66632 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -287,7 +287,7 @@ definitionListItemToRST (label, defs) = do
label' <- inlineListToRST label
contents <- liftM vcat $ mapM blockListToRST defs
tabstop <- get >>= (return . writerTabStop . stOptions)
- return $ label' $$ nest tabstop (contents <> cr)
+ return $ label' $$ nest tabstop (nestle contents <> cr)
-- | Convert list of Pandoc block elements to RST.
blockListToRST :: [Block] -- ^ List of block elements
diff --git a/src/Text/Pandoc/Writers/Shared.hs b/src/Text/Pandoc/Writers/Shared.hs
index 9cb08803c..604aac1c9 100644
--- a/src/Text/Pandoc/Writers/Shared.hs
+++ b/src/Text/Pandoc/Writers/Shared.hs
@@ -34,6 +34,7 @@ module Text.Pandoc.Writers.Shared (
, setField
, defField
, tagWithAttrs
+ , fixDisplayMath
)
where
import Text.Pandoc.Definition
@@ -46,6 +47,7 @@ import qualified Data.Map as M
import qualified Data.Text as T
import Data.Aeson (FromJSON(..), fromJSON, ToJSON (..), Value(Object), Result(..))
import qualified Data.Traversable as Traversable
+import Data.List ( groupBy )
-- | Create JSON value for template from a 'Meta' and an association list
-- of variables, specified at the command line or in the writer.
@@ -65,8 +67,7 @@ metaToJSON opts blockWriter inlineWriter (Meta metamap)
renderedMap <- Traversable.mapM
(metaValueToJSON blockWriter inlineWriter)
metamap
- return $ M.foldWithKey (\key val obj -> defField key val obj)
- baseContext renderedMap
+ return $ M.foldWithKey defField baseContext renderedMap
| otherwise = return (Object H.empty)
metaValueToJSON :: Monad m
@@ -137,3 +138,28 @@ tagWithAttrs tag (ident,classes,kvs) = hsep
,hsep (map (\(k,v) -> text k <> "=" <>
doubleQuotes (text (escapeStringForXML v))) kvs)
] <> ">"
+
+isDisplayMath :: Inline -> Bool
+isDisplayMath (Math DisplayMath _) = True
+isDisplayMath _ = False
+
+stripLeadingTrailingSpace :: [Inline] -> [Inline]
+stripLeadingTrailingSpace = go . reverse . go . reverse
+ where go (Space:xs) = xs
+ go xs = xs
+
+-- Put display math in its own block (for ODT/DOCX).
+fixDisplayMath :: Block -> Block
+fixDisplayMath (Plain lst)
+ | any isDisplayMath lst && not (all isDisplayMath lst) =
+ -- chop into several paragraphs so each displaymath is its own
+ Div ("",["math"],[]) $ map (Plain . stripLeadingTrailingSpace) $
+ groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
+ not (isDisplayMath x || isDisplayMath y)) lst
+fixDisplayMath (Para lst)
+ | any isDisplayMath lst && not (all isDisplayMath lst) =
+ -- chop into several paragraphs so each displaymath is its own
+ Div ("",["math"],[]) $ map (Para . stripLeadingTrailingSpace) $
+ groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
+ not (isDisplayMath x || isDisplayMath y)) lst
+fixDisplayMath x = x
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
index d62e50880..bf3df8035 100644
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -293,7 +293,7 @@ blockListToTexinfo (x:xs) = do
case x of
Header level _ _ -> do
-- We need need to insert a menu for this node.
- let (before, after) = break isHeader xs
+ let (before, after) = break isHeaderBlock xs
before' <- blockListToTexinfo before
let menu = if level < 4
then collectNodes (level + 1) after
@@ -315,10 +315,6 @@ blockListToTexinfo (x:xs) = do
xs' <- blockListToTexinfo xs
return $ x' $$ xs'
-isHeader :: Block -> Bool
-isHeader (Header _ _ _) = True
-isHeader _ = False
-
collectNodes :: Int -> [Block] -> [Block]
collectNodes _ [] = []
collectNodes level (x:xs) =
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index 7c102cc86..95aedf780 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -51,7 +51,7 @@ data WriterState = WriterState {
writeTextile :: WriterOptions -> Pandoc -> String
writeTextile opts document =
evalState (pandocToTextile opts document)
- (WriterState { stNotes = [], stListLevel = [], stUseTags = False })
+ WriterState { stNotes = [], stListLevel = [], stUseTags = False }
-- | Return Textile representation of document.
pandocToTextile :: WriterOptions -> Pandoc -> State WriterState String
diff --git a/tests/MarkdownTest_1.0.3/MarkdownTest.pl b/tests/MarkdownTest_1.0.3/MarkdownTest.pl
deleted file mode 100755
index 55553d09c..000000000
--- a/tests/MarkdownTest_1.0.3/MarkdownTest.pl
+++ /dev/null
@@ -1,176 +0,0 @@
-#!/usr/bin/perl
-
-#
-# MarkdownTester -- Run tests for Markdown implementations
-#
-# Copyright (c) 2004-2005 John Gruber
-# <http://daringfireball.net/projects/markdown/>
-#
-
-use strict;
-use warnings;
-use Getopt::Long;
-use Benchmark;
-
-our $VERSION = '1.0.2';
-# Sat 24 Dec 2005
-
-my $time_start = new Benchmark;
-my $test_dir = "Tests";
-my $script = "./Markdown.pl";
-my $use_tidy = 0;
-my ($flag_version);
-
-GetOptions (
- "script=s" => \$script,
- "testdir=s" => \$test_dir,
- "tidy" => \$use_tidy,
- "version" => \$flag_version,
- );
-
-if($flag_version) {
- my $progname = $0;
- $progname =~ s{.*/}{};
- die "$progname version $VERSION\n";
-}
-
-unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
-unless (-f $script) { die "$script does not exist.\n"; }
-unless (-x $script) { die "$script is not executable.\n"; }
-
-my $tests_passed = 0;
-my $tests_failed = 0;
-
-TEST:
-foreach my $testfile (glob "$test_dir/*.text") {
- my $testname = $testfile;
- $testname =~ s{.*/(.+)\.text$}{$1}i;
- print "$testname ... ";
-
- # Look for a corresponding .html file for each .text file:
- my $resultfile = $testfile;
- $resultfile =~ s{\.text$}{\.html}i;
- unless (-f $resultfile) {
- print "'$resultfile' does not exist.\n\n";
- next TEST;
- }
-
- # open(TEST, $testfile) || die("Can't open testfile: $!");
- open(RESULT, $resultfile) || die("Can't open resultfile: $!");
- undef $/;
- # my $t_input = <TEST>;
- my $t_result = <RESULT>;
-
- my $t_output = `'$script' '$testfile'`;
-
- # Normalize the output and expected result strings:
- $t_result =~ s/\s+\z//; # trim trailing whitespace
- $t_output =~ s/\s+\z//; # trim trailing whitespace
- if ($use_tidy) {
- # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
- $t_result =~ s{'}{'\\''}g; # escape ' chars for shell
- $t_output =~ s{'}{'\\''}g;
- $t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
- $t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
- }
-
- if ($t_output eq $t_result) {
- print "OK\n";
- $tests_passed++;
- }
- else {
- print "FAILED\n\n";
-# This part added by JM to print diffs
- open(OUT, '>tmp1') or die $!;
- print OUT $t_output or die $!;
- open(RES, '>tmp2') or die $!;
- print RES $t_result or die $!;
- print `diff tmp1 tmp2`;
- close RES;
- close OUT;
- print "\n";
- `rm tmp?`;
-# End of added part
- $tests_failed++;
- }
-}
-
-print "\n\n";
-print "$tests_passed passed; $tests_failed failed.\n";
-
-my $time_end = new Benchmark;
-my $time_diff = timediff($time_end, $time_start);
-print "Benchmark: ", timestr($time_diff), "\n";
-
-
-__END__
-
-=pod
-
-=head1 NAME
-
-B<MarkdownTest>
-
-
-=head1 SYNOPSIS
-
-B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]
-
-
-=head1 DESCRIPTION
-
-
-=head1 OPTIONS
-
-Use "--" to end switch parsing. For example, to open a file named "-z", use:
-
- MarkdownTest.pl -- -z
-
-=over 4
-
-=item B<--script>
-
-Specify the path to the Markdown script to test. Defaults to
-"./Markdown.pl". Example:
-
- ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
-
-=item B<--testdir>
-
-Specify the path to a directory containing test data. Defaults to "Tests".
-
-=item B<--tidy>
-
-Flag to turn on using the command line 'tidy' tool to normalize HTML
-output before comparing script output to the expected test result.
-Assumes that the 'tidy' command is available in your PATH. Defaults to
-off.
-
-=back
-
-
-
-=head1 BUGS
-
-
-
-=head1 VERSION HISTORY
-
-1.0 Mon 13 Dec 2004-2005
-
-1.0.1 Mon 19 Sep 2005
-
- + Better handling of case when foo.text exists, but foo.html doesn't.
- It now prints a message and moves on, rather than dying.
-
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2004-2005 John Gruber
-<http://daringfireball.net/>
-All rights reserved.
-
-This is free software; you may redistribute it and/or modify it under
-the same terms as Perl itself.
-
-=cut
diff --git a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
deleted file mode 100644
index 9606860b6..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<p>AT&amp;T has an ampersand in their name.</p>
-
-<p>AT&amp;T is another way to write it.</p>
-
-<p>This &amp; that.</p>
-
-<p>4 &lt; 5.</p>
-
-<p>6 > 5.</p>
-
-<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link</a> with an ampersand in the URL.</p>
-
-<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T">AT&amp;T</a>.</p>
-
-<p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
-
-<p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
deleted file mode 100644
index 0e9527f93..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
+++ /dev/null
@@ -1,21 +0,0 @@
-AT&T has an ampersand in their name.
-
-AT&amp;T is another way to write it.
-
-This & that.
-
-4 < 5.
-
-6 > 5.
-
-Here's a [link] [1] with an ampersand in the URL.
-
-Here's a link with an amersand in the link text: [AT&T] [2].
-
-Here's an inline [link](/script?foo=1&bar=2).
-
-Here's an inline [link](</script?foo=1&bar=2>).
-
-
-[1]: http://example.com/?foo=1&bar=2
-[2]: http://att.com/ "AT&T" \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Auto links.html b/tests/MarkdownTest_1.0.3/Tests/Auto links.html
deleted file mode 100644
index f8df9852c..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Auto links.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
-
-<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
-
-<ul>
-<li>In a list?</li>
-<li><a href="http://example.com/">http://example.com/</a></li>
-<li>It should.</li>
-</ul>
-
-<blockquote>
- <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
-</blockquote>
-
-<p>Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code></p>
-
-<pre><code>or here: &lt;http://example.com/&gt;
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Auto links.text b/tests/MarkdownTest_1.0.3/Tests/Auto links.text
deleted file mode 100644
index abbc48869..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Auto links.text
+++ /dev/null
@@ -1,13 +0,0 @@
-Link: <http://example.com/>.
-
-With an ampersand: <http://example.com/?foo=1&bar=2>
-
-* In a list?
-* <http://example.com/>
-* It should.
-
-> Blockquoted: <http://example.com/>
-
-Auto-links should not occur here: `<http://example.com/>`
-
- or here: <http://example.com/> \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html
deleted file mode 100644
index 29870dac5..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<p>These should all get escaped:</p>
-
-<p>Backslash: \</p>
-
-<p>Backtick: `</p>
-
-<p>Asterisk: *</p>
-
-<p>Underscore: _</p>
-
-<p>Left brace: {</p>
-
-<p>Right brace: }</p>
-
-<p>Left bracket: [</p>
-
-<p>Right bracket: ]</p>
-
-<p>Left paren: (</p>
-
-<p>Right paren: )</p>
-
-<p>Greater-than: ></p>
-
-<p>Hash: #</p>
-
-<p>Period: .</p>
-
-<p>Bang: !</p>
-
-<p>Plus: +</p>
-
-<p>Minus: -</p>
-
-<p>These should not, because they occur within a code block:</p>
-
-<pre><code>Backslash: \\
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \&gt;
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-</code></pre>
-
-<p>Nor should these, which occur in code spans:</p>
-
-<p>Backslash: <code>\\</code></p>
-
-<p>Backtick: <code>\`</code></p>
-
-<p>Asterisk: <code>\*</code></p>
-
-<p>Underscore: <code>\_</code></p>
-
-<p>Left brace: <code>\{</code></p>
-
-<p>Right brace: <code>\}</code></p>
-
-<p>Left bracket: <code>\[</code></p>
-
-<p>Right bracket: <code>\]</code></p>
-
-<p>Left paren: <code>\(</code></p>
-
-<p>Right paren: <code>\)</code></p>
-
-<p>Greater-than: <code>\&gt;</code></p>
-
-<p>Hash: <code>\#</code></p>
-
-<p>Period: <code>\.</code></p>
-
-<p>Bang: <code>\!</code></p>
-
-<p>Plus: <code>\+</code></p>
-
-<p>Minus: <code>\-</code></p>
-
-
-<p>These should get escaped, even though they're matching pairs for
-other Markdown constructs:</p>
-
-<p>*asterisks*</p>
-
-<p>_underscores_</p>
-
-<p>`backticks`</p>
-
-<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
-
-<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
-
-<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text
deleted file mode 100644
index 5b014cb33..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text
+++ /dev/null
@@ -1,120 +0,0 @@
-These should all get escaped:
-
-Backslash: \\
-
-Backtick: \`
-
-Asterisk: \*
-
-Underscore: \_
-
-Left brace: \{
-
-Right brace: \}
-
-Left bracket: \[
-
-Right bracket: \]
-
-Left paren: \(
-
-Right paren: \)
-
-Greater-than: \>
-
-Hash: \#
-
-Period: \.
-
-Bang: \!
-
-Plus: \+
-
-Minus: \-
-
-
-
-These should not, because they occur within a code block:
-
- Backslash: \\
-
- Backtick: \`
-
- Asterisk: \*
-
- Underscore: \_
-
- Left brace: \{
-
- Right brace: \}
-
- Left bracket: \[
-
- Right bracket: \]
-
- Left paren: \(
-
- Right paren: \)
-
- Greater-than: \>
-
- Hash: \#
-
- Period: \.
-
- Bang: \!
-
- Plus: \+
-
- Minus: \-
-
-
-Nor should these, which occur in code spans:
-
-Backslash: `\\`
-
-Backtick: `` \` ``
-
-Asterisk: `\*`
-
-Underscore: `\_`
-
-Left brace: `\{`
-
-Right brace: `\}`
-
-Left bracket: `\[`
-
-Right bracket: `\]`
-
-Left paren: `\(`
-
-Right paren: `\)`
-
-Greater-than: `\>`
-
-Hash: `\#`
-
-Period: `\.`
-
-Bang: `\!`
-
-Plus: `\+`
-
-Minus: `\-`
-
-
-These should get escaped, even though they're matching pairs for
-other Markdown constructs:
-
-\*asterisks\*
-
-\_underscores\_
-
-\`backticks\`
-
-This is a code span with a literal backslash-backtick sequence: `` \` ``
-
-This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.
-
-This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
deleted file mode 100644
index 990202a1b..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<blockquote>
- <p>Example:</p>
-
-<pre><code>sub status {
- print "working";
-}
-</code></pre>
-
- <p>Or:</p>
-
-<pre><code>sub status {
- return "working";
-}
-</code></pre>
-</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
deleted file mode 100644
index c31d17104..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
+++ /dev/null
@@ -1,11 +0,0 @@
-> Example:
->
-> sub status {
-> print "working";
-> }
->
-> Or:
->
-> sub status {
-> return "working";
-> }
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html
deleted file mode 100644
index 32703f5cb..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<pre><code>code block on the first line
-</code></pre>
-
-<p>Regular text.</p>
-
-<pre><code>code block indented by spaces
-</code></pre>
-
-<p>Regular text.</p>
-
-<pre><code>the lines in this block
-all contain trailing spaces
-</code></pre>
-
-<p>Regular Text.</p>
-
-<pre><code>code block on the last line
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text
deleted file mode 100644
index b54b09285..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text
+++ /dev/null
@@ -1,14 +0,0 @@
- code block on the first line
-
-Regular text.
-
- code block indented by spaces
-
-Regular text.
-
- the lines in this block
- all contain trailing spaces
-
-Regular Text.
-
- code block on the last line \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Spans.html b/tests/MarkdownTest_1.0.3/Tests/Code Spans.html
deleted file mode 100644
index 4b8afbb70..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Code Spans.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<p><code>&lt;test a="</code> content of attribute <code>"&gt;</code></p>
-
-<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p>
-
-<p>Here's how you put <code>`backticks`</code> in a code span.</p>
-
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Spans.text b/tests/MarkdownTest_1.0.3/Tests/Code Spans.text
deleted file mode 100644
index 750a1973d..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Code Spans.text
+++ /dev/null
@@ -1,6 +0,0 @@
-`<test a="` content of attribute `">`
-
-Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span>
-
-Here's how you put `` `backticks` `` in a code span.
-
diff --git a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
deleted file mode 100644
index e21ac79a2..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<p>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.</p>
-
-<p>Here's one with a bullet.
-* criminey.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
deleted file mode 100644
index f8a5b27bf..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
+++ /dev/null
@@ -1,8 +0,0 @@
-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.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html
deleted file mode 100644
index 2dc2ab656..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<p>Dashes:</p>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>---
-</code></pre>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>- - -
-</code></pre>
-
-<p>Asterisks:</p>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>***
-</code></pre>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>* * *
-</code></pre>
-
-<p>Underscores:</p>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>___
-</code></pre>
-
-<hr />
-
-<hr />
-
-<hr />
-
-<hr />
-
-<pre><code>_ _ _
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text
deleted file mode 100644
index 1594bda27..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text
+++ /dev/null
@@ -1,67 +0,0 @@
-Dashes:
-
----
-
- ---
-
- ---
-
- ---
-
- ---
-
-- - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
-
-Asterisks:
-
-***
-
- ***
-
- ***
-
- ***
-
- ***
-
-* * *
-
- * * *
-
- * * *
-
- * * *
-
- * * *
-
-
-Underscores:
-
-___
-
- ___
-
- ___
-
- ___
-
- ___
-
-_ _ _
-
- _ _ _
-
- _ _ _
-
- _ _ _
-
- _ _ _
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
deleted file mode 100644
index 3af9cafb1..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
+++ /dev/null
@@ -1,15 +0,0 @@
-<p>Simple block on one line:</p>
-
-<div>foo</div>
-
-<p>And nested without indentation:</p>
-
-<div>
-<div>
-<div>
-foo
-</div>
-<div style=">"/>
-</div>
-<div>bar</div>
-</div>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
deleted file mode 100644
index 86b7206d2..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
+++ /dev/null
@@ -1,15 +0,0 @@
-Simple block on one line:
-
-<div>foo</div>
-
-And nested without indentation:
-
-<div>
-<div>
-<div>
-foo
-</div>
-<div style=">"/>
-</div>
-<div>bar</div>
-</div>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
deleted file mode 100644
index 6bf78f8fc..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
+++ /dev/null
@@ -1,72 +0,0 @@
-<p>Here's a simple block:</p>
-
-<div>
- foo
-</div>
-
-<p>This should be a code block, though:</p>
-
-<pre><code>&lt;div&gt;
- foo
-&lt;/div&gt;
-</code></pre>
-
-<p>As should this:</p>
-
-<pre><code>&lt;div&gt;foo&lt;/div&gt;
-</code></pre>
-
-<p>Now, nested:</p>
-
-<div>
- <div>
- <div>
- foo
- </div>
- </div>
-</div>
-
-<p>This should just be an HTML comment:</p>
-
-<!-- Comment -->
-
-<p>Multiline:</p>
-
-<!--
-Blah
-Blah
--->
-
-<p>Code block:</p>
-
-<pre><code>&lt;!-- Comment --&gt;
-</code></pre>
-
-<p>Just plain comment, with trailing spaces on the line:</p>
-
-<!-- foo -->
-
-<p>Code:</p>
-
-<pre><code>&lt;hr /&gt;
-</code></pre>
-
-<p>Hr's:</p>
-
-<hr>
-
-<hr/>
-
-<hr />
-
-<hr>
-
-<hr/>
-
-<hr />
-
-<hr class="foo" id="bar" />
-
-<hr class="foo" id="bar"/>
-
-<hr class="foo" id="bar" >
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
deleted file mode 100644
index 14aa2dc27..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
+++ /dev/null
@@ -1,69 +0,0 @@
-Here's a simple block:
-
-<div>
- foo
-</div>
-
-This should be a code block, though:
-
- <div>
- foo
- </div>
-
-As should this:
-
- <div>foo</div>
-
-Now, nested:
-
-<div>
- <div>
- <div>
- foo
- </div>
- </div>
-</div>
-
-This should just be an HTML comment:
-
-<!-- Comment -->
-
-Multiline:
-
-<!--
-Blah
-Blah
--->
-
-Code block:
-
- <!-- Comment -->
-
-Just plain comment, with trailing spaces on the line:
-
-<!-- foo -->
-
-Code:
-
- <hr />
-
-Hr's:
-
-<hr>
-
-<hr/>
-
-<hr />
-
-<hr>
-
-<hr/>
-
-<hr />
-
-<hr class="foo" id="bar" />
-
-<hr class="foo" id="bar"/>
-
-<hr class="foo" id="bar" >
-
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
deleted file mode 100644
index 3f167a161..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<p>Paragraph one.</p>
-
-<!-- This is a simple comment -->
-
-<!--
- This is another comment.
--->
-
-<p>Paragraph two.</p>
-
-<!-- one comment block -- -- with two comments -->
-
-<p>The end.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
deleted file mode 100644
index 41d830d03..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
+++ /dev/null
@@ -1,13 +0,0 @@
-Paragraph one.
-
-<!-- This is a simple comment -->
-
-<!--
- This is another comment.
--->
-
-Paragraph two.
-
-<!-- one comment block -- -- with two comments -->
-
-The end.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html
deleted file mode 100644
index f36607ddd..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<p>Just a <a href="/url/">URL</a>.</p>
-
-<p><a href="/url/" title="title">URL and title</a>.</p>
-
-<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>
-
-<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
-
-<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>
-
-<p><a href="">Empty</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text
deleted file mode 100644
index 09017a90c..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text
+++ /dev/null
@@ -1,12 +0,0 @@
-Just a [URL](/url/).
-
-[URL and title](/url/ "title").
-
-[URL and title](/url/ "title preceded by two spaces").
-
-[URL and title](/url/ "title preceded by a tab").
-
-[URL and title](/url/ "title has spaces afterward" ).
-
-
-[Empty]().
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html
deleted file mode 100644
index 8e70c32f4..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<p>Foo <a href="/url/" title="Title">bar</a>.</p>
-
-<p>Foo <a href="/url/" title="Title">bar</a>.</p>
-
-<p>Foo <a href="/url/" title="Title">bar</a>.</p>
-
-<p>With <a href="/url/">embedded [brackets]</a>.</p>
-
-<p>Indented <a href="/url">once</a>.</p>
-
-<p>Indented <a href="/url">twice</a>.</p>
-
-<p>Indented <a href="/url">thrice</a>.</p>
-
-<p>Indented [four][] times.</p>
-
-<pre><code>[four]: /url
-</code></pre>
-
-<hr />
-
-<p><a href="foo">this</a> should work</p>
-
-<p>So should <a href="foo">this</a>.</p>
-
-<p>And <a href="foo">this</a>.</p>
-
-<p>And <a href="foo">this</a>.</p>
-
-<p>And <a href="foo">this</a>.</p>
-
-<p>But not [that] [].</p>
-
-<p>Nor [that][].</p>
-
-<p>Nor [that].</p>
-
-<p>[Something in brackets like <a href="foo">this</a> should work]</p>
-
-<p>[Same with <a href="foo">this</a>.]</p>
-
-<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>
-
-<p>Backslashing should suppress [this] and [this].</p>
-
-<hr />
-
-<p>Here's one where the <a href="/url/">link
-breaks</a> across lines.</p>
-
-<p>Here's another where the <a href="/url/">link
-breaks</a> across lines, but with a line-ending space.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text
deleted file mode 100644
index 341ec88e3..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text
+++ /dev/null
@@ -1,71 +0,0 @@
-Foo [bar] [1].
-
-Foo [bar][1].
-
-Foo [bar]
-[1].
-
-[1]: /url/ "Title"
-
-
-With [embedded [brackets]] [b].
-
-
-Indented [once][].
-
-Indented [twice][].
-
-Indented [thrice][].
-
-Indented [four][] times.
-
- [once]: /url
-
- [twice]: /url
-
- [thrice]: /url
-
- [four]: /url
-
-
-[b]: /url/
-
-* * *
-
-[this] [this] should work
-
-So should [this][this].
-
-And [this] [].
-
-And [this][].
-
-And [this].
-
-But not [that] [].
-
-Nor [that][].
-
-Nor [that].
-
-[Something in brackets like [this][] should work]
-
-[Same with [this].]
-
-In this case, [this](/somethingelse/) points to something else.
-
-Backslashing should suppress \[this] and [this\].
-
-[this]: foo
-
-
-* * *
-
-Here's one where the [link
-breaks] across lines.
-
-Here's another where the [link
-breaks] across lines, but with a line-ending space.
-
-
-[link breaks]: /url/
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
deleted file mode 100644
index bf81e939f..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<p>This is the <a href="/simple">simple case</a>.</p>
-
-<p>This one has a <a href="/foo">line
-break</a>.</p>
-
-<p>This one has a <a href="/foo">line
-break</a> with a line-ending space.</p>
-
-<p><a href="/that">this</a> and the <a href="/other">other</a></p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
deleted file mode 100644
index 8c44c98fe..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
+++ /dev/null
@@ -1,20 +0,0 @@
-This is the [simple case].
-
-[simple case]: /simple
-
-
-
-This one has a [line
-break].
-
-This one has a [line
-break] with a line-ending space.
-
-[line break]: /foo
-
-
-[this] [that] and the [other]
-
-[this]: /this
-[that]: /that
-[other]: /other
diff --git a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
deleted file mode 100644
index 611c1ac61..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
-
-<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
deleted file mode 100644
index 29d0e4235..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
+++ /dev/null
@@ -1,7 +0,0 @@
-Foo [bar][].
-
-Foo [bar](/url/ "Title with "quotes" inside").
-
-
- [bar]: /url/ "Title with "quotes" inside"
-
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
deleted file mode 100644
index d5bdbb29a..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
+++ /dev/null
@@ -1,314 +0,0 @@
-<h1>Markdown: Basics</h1>
-
-<ul id="ProjectSubmenu">
- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
- <li><a class="selected" title="Markdown Basics">Basics</a></li>
- <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul>
-
-<h2>Getting the Gist of Markdown's Formatting Syntax</h2>
-
-<p>This page offers a brief overview of what it's like to use Markdown.
-The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for
-every feature, but Markdown should be very easy to pick up simply by
-looking at a few examples of it in action. The examples on this page
-are written in a before/after style, showing example syntax and the
-HTML output produced by Markdown.</p>
-
-<p>It's also helpful to simply try Markdown out; the <a href="/projects/markdown/dingus" title="Markdown Dingus">Dingus</a> is a
-web application that allows you type your own Markdown-formatted text
-and translate it to XHTML.</p>
-
-<p><strong>Note:</strong> This document is itself written using Markdown; you
-can <a href="/projects/markdown/basics.text">see the source for it by adding '.text' to the URL</a>.</p>
-
-<h2>Paragraphs, Headers, Blockquotes</h2>
-
-<p>A paragraph is simply one or more consecutive lines of text, separated
-by one or more blank lines. (A blank line is any line that looks like a
-blank line -- a line containing nothing spaces or tabs is considered
-blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
-
-<p>Markdown offers two styles of headers: <em>Setext</em> and <em>atx</em>.
-Setext-style headers for <code>&lt;h1&gt;</code> and <code>&lt;h2&gt;</code> are created by
-"underlining" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively.
-To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the
-beginning of the line -- the number of hashes equals the resulting
-HTML header level.</p>
-
-<p>Blockquotes are indicated using email-style '<code>&gt;</code>' angle brackets.</p>
-
-<p>Markdown:</p>
-
-<pre><code>A First Level Header
-====================
-
-A Second Level Header
----------------------
-
-Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.
-
-The quick brown fox jumped over the lazy
-dog's back.
-
-### Header 3
-
-&gt; This is a blockquote.
-&gt;
-&gt; This is the second paragraph in the blockquote.
-&gt;
-&gt; ## This is an H2 in a blockquote
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;h1&gt;A First Level Header&lt;/h1&gt;
-
-&lt;h2&gt;A Second Level Header&lt;/h2&gt;
-
-&lt;p&gt;Now is the time for all good men to come to
-the aid of their country. This is just a
-regular paragraph.&lt;/p&gt;
-
-&lt;p&gt;The quick brown fox jumped over the lazy
-dog's back.&lt;/p&gt;
-
-&lt;h3&gt;Header 3&lt;/h3&gt;
-
-&lt;blockquote&gt;
- &lt;p&gt;This is a blockquote.&lt;/p&gt;
-
- &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
-
- &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
-&lt;/blockquote&gt;
-</code></pre>
-
-<h3>Phrase Emphasis</h3>
-
-<p>Markdown uses asterisks and underscores to indicate spans of emphasis.</p>
-
-<p>Markdown:</p>
-
-<pre><code>Some of these words *are emphasized*.
-Some of these words _are emphasized also_.
-
-Use two asterisks for **strong emphasis**.
-Or, if you prefer, __use two underscores instead__.
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
-Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
-
-&lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
-Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
-</code></pre>
-
-<h2>Lists</h2>
-
-<p>Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,
-<code>+</code>, and <code>-</code>) as list markers. These three markers are
-interchangable; this:</p>
-
-<pre><code>* Candy.
-* Gum.
-* Booze.
-</code></pre>
-
-<p>this:</p>
-
-<pre><code>+ Candy.
-+ Gum.
-+ Booze.
-</code></pre>
-
-<p>and this:</p>
-
-<pre><code>- Candy.
-- Gum.
-- Booze.
-</code></pre>
-
-<p>all produce the same output:</p>
-
-<pre><code>&lt;ul&gt;
-&lt;li&gt;Candy.&lt;/li&gt;
-&lt;li&gt;Gum.&lt;/li&gt;
-&lt;li&gt;Booze.&lt;/li&gt;
-&lt;/ul&gt;
-</code></pre>
-
-<p>Ordered (numbered) lists use regular numbers, followed by periods, as
-list markers:</p>
-
-<pre><code>1. Red
-2. Green
-3. Blue
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;ol&gt;
-&lt;li&gt;Red&lt;/li&gt;
-&lt;li&gt;Green&lt;/li&gt;
-&lt;li&gt;Blue&lt;/li&gt;
-&lt;/ol&gt;
-</code></pre>
-
-<p>If you put blank lines between items, you'll get <code>&lt;p&gt;</code> tags for the
-list item text. You can create multi-paragraph list items by indenting
-the paragraphs by 4 spaces or 1 tab:</p>
-
-<pre><code>* A list item.
-
- With multiple paragraphs.
-
-* Another item in the list.
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;ul&gt;
-&lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
-&lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
-&lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
-&lt;/ul&gt;
-</code></pre>
-
-<h3>Links</h3>
-
-<p>Markdown supports two styles for creating links: <em>inline</em> and
-<em>reference</em>. With both styles, you use square brackets to delimit the
-text you want to turn into a link.</p>
-
-<p>Inline-style links use parentheses immediately after the link text.
-For example:</p>
-
-<pre><code>This is an [example link](http://example.com/).
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
-example link&lt;/a&gt;.&lt;/p&gt;
-</code></pre>
-
-<p>Optionally, you may include a title attribute in the parentheses:</p>
-
-<pre><code>This is an [example link](http://example.com/ "With a Title").
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
-example link&lt;/a&gt;.&lt;/p&gt;
-</code></pre>
-
-<p>Reference-style links allow you to refer to your links by names, which
-you define elsewhere in your document:</p>
-
-<pre><code>I get 10 times more traffic from [Google][1] than from
-[Yahoo][2] or [MSN][3].
-
-[1]: http://google.com/ "Google"
-[2]: http://search.yahoo.com/ "Yahoo Search"
-[3]: http://search.msn.com/ "MSN Search"
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
-title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
-title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
-title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
-</code></pre>
-
-<p>The title attribute is optional. Link names may contain letters,
-numbers and spaces, but are <em>not</em> case sensitive:</p>
-
-<pre><code>I start my morning with a cup of coffee and
-[The New York Times][NY Times].
-
-[ny times]: http://www.nytimes.com/
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;I start my morning with a cup of coffee and
-&lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
-</code></pre>
-
-<h3>Images</h3>
-
-<p>Image syntax is very much like link syntax.</p>
-
-<p>Inline (titles are optional):</p>
-
-<pre><code>![alt text](/path/to/img.jpg "Title")
-</code></pre>
-
-<p>Reference-style:</p>
-
-<pre><code>![alt text][id]
-
-[id]: /path/to/img.jpg "Title"
-</code></pre>
-
-<p>Both of the above examples produce the same output:</p>
-
-<pre><code>&lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
-</code></pre>
-
-<h3>Code</h3>
-
-<p>In a regular paragraph, you can create code span by wrapping text in
-backtick quotes. Any ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> or
-<code>&gt;</code>) will automatically be translated into HTML entities. This makes
-it easy to use Markdown to write about HTML example code:</p>
-
-<pre><code>I strongly recommend against using any `&lt;blink&gt;` tags.
-
-I wish SmartyPants used named entities like `&amp;mdash;`
-instead of decimal-encoded entites like `&amp;#8212;`.
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;I strongly recommend against using any
-&lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
-
-&lt;p&gt;I wish SmartyPants used named entities like
-&lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
-entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
-</code></pre>
-
-<p>To specify an entire block of pre-formatted code, indent every line of
-the block by 4 spaces or 1 tab. Just like with code spans, <code>&amp;</code>, <code>&lt;</code>,
-and <code>&gt;</code> characters will be escaped automatically.</p>
-
-<p>Markdown:</p>
-
-<pre><code>If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:
-
- &lt;blockquote&gt;
- &lt;p&gt;For example.&lt;/p&gt;
- &lt;/blockquote&gt;
-</code></pre>
-
-<p>Output:</p>
-
-<pre><code>&lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
-you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
-
-&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
- &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
-&amp;lt;/blockquote&amp;gt;
-&lt;/code&gt;&lt;/pre&gt;
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
deleted file mode 100644
index 486055ca7..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
+++ /dev/null
@@ -1,306 +0,0 @@
-Markdown: Basics
-================
-
-<ul id="ProjectSubmenu">
- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
- <li><a class="selected" title="Markdown Basics">Basics</a></li>
- <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul>
-
-
-Getting the Gist of Markdown's Formatting Syntax
-------------------------------------------------
-
-This page offers a brief overview of what it's like to use Markdown.
-The [syntax page] [s] provides complete, detailed documentation for
-every feature, but Markdown should be very easy to pick up simply by
-looking at a few examples of it in action. The examples on this page
-are written in a before/after style, showing example syntax and the
-HTML output produced by Markdown.
-
-It's also helpful to simply try Markdown out; the [Dingus] [d] is a
-web application that allows you type your own Markdown-formatted text
-and translate it to XHTML.
-
-**Note:** This document is itself written using Markdown; you
-can [see the source for it by adding '.text' to the URL] [src].
-
- [s]: /projects/markdown/syntax "Markdown Syntax"
- [d]: /projects/markdown/dingus "Markdown Dingus"
- [src]: /projects/markdown/basics.text
-
-
-## Paragraphs, Headers, Blockquotes ##
-
-A paragraph is simply one or more consecutive lines of text, separated
-by one or more blank lines. (A blank line is any line that looks like a
-blank line -- a line containing nothing spaces or tabs is considered
-blank.) Normal paragraphs should not be intended with spaces or tabs.
-
-Markdown offers two styles of headers: *Setext* and *atx*.
-Setext-style headers for `<h1>` and `<h2>` are created by
-"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
-To create an atx-style header, you put 1-6 hash marks (`#`) at the
-beginning of the line -- the number of hashes equals the resulting
-HTML header level.
-
-Blockquotes are indicated using email-style '`>`' angle brackets.
-
-Markdown:
-
- A First Level Header
- ====================
-
- A Second Level Header
- ---------------------
-
- Now is the time for all good men to come to
- the aid of their country. This is just a
- regular paragraph.
-
- The quick brown fox jumped over the lazy
- dog's back.
-
- ### Header 3
-
- > This is a blockquote.
- >
- > This is the second paragraph in the blockquote.
- >
- > ## This is an H2 in a blockquote
-
-
-Output:
-
- <h1>A First Level Header</h1>
-
- <h2>A Second Level Header</h2>
-
- <p>Now is the time for all good men to come to
- the aid of their country. This is just a
- regular paragraph.</p>
-
- <p>The quick brown fox jumped over the lazy
- dog's back.</p>
-
- <h3>Header 3</h3>
-
- <blockquote>
- <p>This is a blockquote.</p>
-
- <p>This is the second paragraph in the blockquote.</p>
-
- <h2>This is an H2 in a blockquote</h2>
- </blockquote>
-
-
-
-### Phrase Emphasis ###
-
-Markdown uses asterisks and underscores to indicate spans of emphasis.
-
-Markdown:
-
- Some of these words *are emphasized*.
- Some of these words _are emphasized also_.
-
- Use two asterisks for **strong emphasis**.
- Or, if you prefer, __use two underscores instead__.
-
-Output:
-
- <p>Some of these words <em>are emphasized</em>.
- Some of these words <em>are emphasized also</em>.</p>
-
- <p>Use two asterisks for <strong>strong emphasis</strong>.
- Or, if you prefer, <strong>use two underscores instead</strong>.</p>
-
-
-
-## Lists ##
-
-Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
-`+`, and `-`) as list markers. These three markers are
-interchangable; this:
-
- * Candy.
- * Gum.
- * Booze.
-
-this:
-
- + Candy.
- + Gum.
- + Booze.
-
-and this:
-
- - Candy.
- - Gum.
- - Booze.
-
-all produce the same output:
-
- <ul>
- <li>Candy.</li>
- <li>Gum.</li>
- <li>Booze.</li>
- </ul>
-
-Ordered (numbered) lists use regular numbers, followed by periods, as
-list markers:
-
- 1. Red
- 2. Green
- 3. Blue
-
-Output:
-
- <ol>
- <li>Red</li>
- <li>Green</li>
- <li>Blue</li>
- </ol>
-
-If you put blank lines between items, you'll get `<p>` tags for the
-list item text. You can create multi-paragraph list items by indenting
-the paragraphs by 4 spaces or 1 tab:
-
- * A list item.
-
- With multiple paragraphs.
-
- * Another item in the list.
-
-Output:
-
- <ul>
- <li><p>A list item.</p>
- <p>With multiple paragraphs.</p></li>
- <li><p>Another item in the list.</p></li>
- </ul>
-
-
-
-### Links ###
-
-Markdown supports two styles for creating links: *inline* and
-*reference*. With both styles, you use square brackets to delimit the
-text you want to turn into a link.
-
-Inline-style links use parentheses immediately after the link text.
-For example:
-
- This is an [example link](http://example.com/).
-
-Output:
-
- <p>This is an <a href="http://example.com/">
- example link</a>.</p>
-
-Optionally, you may include a title attribute in the parentheses:
-
- This is an [example link](http://example.com/ "With a Title").
-
-Output:
-
- <p>This is an <a href="http://example.com/" title="With a Title">
- example link</a>.</p>
-
-Reference-style links allow you to refer to your links by names, which
-you define elsewhere in your document:
-
- I get 10 times more traffic from [Google][1] than from
- [Yahoo][2] or [MSN][3].
-
- [1]: http://google.com/ "Google"
- [2]: http://search.yahoo.com/ "Yahoo Search"
- [3]: http://search.msn.com/ "MSN Search"
-
-Output:
-
- <p>I get 10 times more traffic from <a href="http://google.com/"
- title="Google">Google</a> than from <a href="http://search.yahoo.com/"
- title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
- title="MSN Search">MSN</a>.</p>
-
-The title attribute is optional. Link names may contain letters,
-numbers and spaces, but are *not* case sensitive:
-
- I start my morning with a cup of coffee and
- [The New York Times][NY Times].
-
- [ny times]: http://www.nytimes.com/
-
-Output:
-
- <p>I start my morning with a cup of coffee and
- <a href="http://www.nytimes.com/">The New York Times</a>.</p>
-
-
-### Images ###
-
-Image syntax is very much like link syntax.
-
-Inline (titles are optional):
-
- ![alt text](/path/to/img.jpg "Title")
-
-Reference-style:
-
- ![alt text][id]
-
- [id]: /path/to/img.jpg "Title"
-
-Both of the above examples produce the same output:
-
- <img src="/path/to/img.jpg" alt="alt text" title="Title" />
-
-
-
-### Code ###
-
-In a regular paragraph, you can create code span by wrapping text in
-backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
-`>`) will automatically be translated into HTML entities. This makes
-it easy to use Markdown to write about HTML example code:
-
- I strongly recommend against using any `<blink>` tags.
-
- I wish SmartyPants used named entities like `&mdash;`
- instead of decimal-encoded entites like `&#8212;`.
-
-Output:
-
- <p>I strongly recommend against using any
- <code>&lt;blink&gt;</code> tags.</p>
-
- <p>I wish SmartyPants used named entities like
- <code>&amp;mdash;</code> instead of decimal-encoded
- entites like <code>&amp;#8212;</code>.</p>
-
-
-To specify an entire block of pre-formatted code, indent every line of
-the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
-and `>` characters will be escaped automatically.
-
-Markdown:
-
- If you want your page to validate under XHTML 1.0 Strict,
- you've got to put paragraph tags in your blockquotes:
-
- <blockquote>
- <p>For example.</p>
- </blockquote>
-
-Output:
-
- <p>If you want your page to validate under XHTML 1.0 Strict,
- you've got to put paragraph tags in your blockquotes:</p>
-
- <pre><code>&lt;blockquote&gt;
- &lt;p&gt;For example.&lt;/p&gt;
- &lt;/blockquote&gt;
- </code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
deleted file mode 100644
index 5c01306cc..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
+++ /dev/null
@@ -1,942 +0,0 @@
-<h1>Markdown: Syntax</h1>
-
-<ul id="ProjectSubmenu">
- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
- <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
- <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul>
-
-<ul>
-<li><a href="#overview">Overview</a>
-<ul>
-<li><a href="#philosophy">Philosophy</a></li>
-<li><a href="#html">Inline HTML</a></li>
-<li><a href="#autoescape">Automatic Escaping for Special Characters</a></li>
-</ul></li>
-<li><a href="#block">Block Elements</a>
-<ul>
-<li><a href="#p">Paragraphs and Line Breaks</a></li>
-<li><a href="#header">Headers</a></li>
-<li><a href="#blockquote">Blockquotes</a></li>
-<li><a href="#list">Lists</a></li>
-<li><a href="#precode">Code Blocks</a></li>
-<li><a href="#hr">Horizontal Rules</a></li>
-</ul></li>
-<li><a href="#span">Span Elements</a>
-<ul>
-<li><a href="#link">Links</a></li>
-<li><a href="#em">Emphasis</a></li>
-<li><a href="#code">Code</a></li>
-<li><a href="#img">Images</a></li>
-</ul></li>
-<li><a href="#misc">Miscellaneous</a>
-<ul>
-<li><a href="#backslash">Backslash Escapes</a></li>
-<li><a href="#autolink">Automatic Links</a></li>
-</ul></li>
-</ul>
-
-<p><strong>Note:</strong> This document is itself written using Markdown; you
-can <a href="/projects/markdown/syntax.text">see the source for it by adding '.text' to the URL</a>.</p>
-
-<hr />
-
-<h2 id="overview">Overview</h2>
-
-<h3 id="philosophy">Philosophy</h3>
-
-<p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>
-
-<p>Readability, however, is emphasized above all else. A Markdown-formatted
-document should be publishable as-is, as plain text, without looking
-like it's been marked up with tags or formatting instructions. While
-Markdown's syntax has been influenced by several existing text-to-HTML
-filters -- including <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a>, <a href="http://www.aaronsw.com/2002/atx/">atx</a>, <a href="http://textism.com/tools/textile/">Textile</a>, <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>,
-<a href="http://www.triptico.com/software/grutatxt.html">Grutatext</a>, and <a href="http://ettext.taint.org/doc/">EtText</a> -- the single biggest source of
-inspiration for Markdown's syntax is the format of plain text email.</p>
-
-<p>To this end, Markdown's syntax is comprised entirely of punctuation
-characters, which punctuation characters have been carefully chosen so
-as to look like what they mean. E.g., asterisks around a word actually
-look like *emphasis*. Markdown lists look like, well, lists. Even
-blockquotes look like quoted passages of text, assuming you've ever
-used email.</p>
-
-<h3 id="html">Inline HTML</h3>
-
-<p>Markdown's syntax is intended for one purpose: to be used as a
-format for <em>writing</em> for the web.</p>
-
-<p>Markdown is not a replacement for HTML, or even close to it. Its
-syntax is very small, corresponding only to a very small subset of
-HTML tags. The idea is <em>not</em> to create a syntax that makes it easier
-to insert HTML tags. In my opinion, HTML tags are already easy to
-insert. The idea for Markdown is to make it easy to read, write, and
-edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em>
-format. Thus, Markdown's formatting syntax only addresses issues that
-can be conveyed in plain text.</p>
-
-<p>For any markup that is not covered by Markdown's syntax, you simply
-use HTML itself. There's no need to preface it or delimit it to
-indicate that you're switching from Markdown to HTML; you just use
-the tags.</p>
-
-<p>The only restrictions are that block-level HTML elements -- e.g. <code>&lt;div&gt;</code>,
-<code>&lt;table&gt;</code>, <code>&lt;pre&gt;</code>, <code>&lt;p&gt;</code>, etc. -- must be separated from surrounding
-content by blank lines, and the start and end tags of the block should
-not be indented with tabs or spaces. Markdown is smart enough not
-to add extra (unwanted) <code>&lt;p&gt;</code> tags around HTML block-level tags.</p>
-
-<p>For example, to add an HTML table to a Markdown article:</p>
-
-<pre><code>This is a regular paragraph.
-
-&lt;table&gt;
- &lt;tr&gt;
- &lt;td&gt;Foo&lt;/td&gt;
- &lt;/tr&gt;
-&lt;/table&gt;
-
-This is another regular paragraph.
-</code></pre>
-
-<p>Note that Markdown formatting syntax is not processed within block-level
-HTML tags. E.g., you can't use Markdown-style <code>*emphasis*</code> inside an
-HTML block.</p>
-
-<p>Span-level HTML tags -- e.g. <code>&lt;span&gt;</code>, <code>&lt;cite&gt;</code>, or <code>&lt;del&gt;</code> -- can be
-used anywhere in a Markdown paragraph, list item, or header. If you
-want, you can even use HTML tags instead of Markdown formatting; e.g. if
-you'd prefer to use HTML <code>&lt;a&gt;</code> or <code>&lt;img&gt;</code> tags instead of Markdown's
-link or image syntax, go right ahead.</p>
-
-<p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within
-span-level tags.</p>
-
-<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
-
-<p>In HTML, there are two characters that demand special treatment: <code>&lt;</code>
-and <code>&amp;</code>. Left angle brackets are used to start tags; ampersands are
-used to denote HTML entities. If you want to use them as literal
-characters, you must escape them as entities, e.g. <code>&amp;lt;</code>, and
-<code>&amp;amp;</code>.</p>
-
-<p>Ampersands in particular are bedeviling for web writers. If you want to
-write about 'AT&amp;T', you need to write '<code>AT&amp;amp;T</code>'. You even need to
-escape ampersands within URLs. Thus, if you want to link to:</p>
-
-<pre><code>http://images.google.com/images?num=30&amp;q=larry+bird
-</code></pre>
-
-<p>you need to encode the URL as:</p>
-
-<pre><code>http://images.google.com/images?num=30&amp;amp;q=larry+bird
-</code></pre>
-
-<p>in your anchor tag <code>href</code> attribute. Needless to say, this is easy to
-forget, and is probably the single most common source of HTML validation
-errors in otherwise well-marked-up web sites.</p>
-
-<p>Markdown allows you to use these characters naturally, taking care of
-all the necessary escaping for you. If you use an ampersand as part of
-an HTML entity, it remains unchanged; otherwise it will be translated
-into <code>&amp;amp;</code>.</p>
-
-<p>So, if you want to include a copyright symbol in your article, you can write:</p>
-
-<pre><code>&amp;copy;
-</code></pre>
-
-<p>and Markdown will leave it alone. But if you write:</p>
-
-<pre><code>AT&amp;T
-</code></pre>
-
-<p>Markdown will translate it to:</p>
-
-<pre><code>AT&amp;amp;T
-</code></pre>
-
-<p>Similarly, because Markdown supports <a href="#html">inline HTML</a>, if you use
-angle brackets as delimiters for HTML tags, Markdown will treat them as
-such. But if you write:</p>
-
-<pre><code>4 &lt; 5
-</code></pre>
-
-<p>Markdown will translate it to:</p>
-
-<pre><code>4 &amp;lt; 5
-</code></pre>
-
-<p>However, inside Markdown code spans and blocks, angle brackets and
-ampersands are <em>always</em> encoded automatically. This makes it easy to use
-Markdown to write about HTML code. (As opposed to raw HTML, which is a
-terrible format for writing about HTML syntax, because every single <code>&lt;</code>
-and <code>&amp;</code> in your example code needs to be escaped.)</p>
-
-<hr />
-
-<h2 id="block">Block Elements</h2>
-
-<h3 id="p">Paragraphs and Line Breaks</h3>
-
-<p>A paragraph is simply one or more consecutive lines of text, separated
-by one or more blank lines. (A blank line is any line that looks like a
-blank line -- a line containing nothing but spaces or tabs is considered
-blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
-
-<p>The implication of the "one or more consecutive lines of text" rule is
-that Markdown supports "hard-wrapped" text paragraphs. This differs
-significantly from most other text-to-HTML formatters (including Movable
-Type's "Convert Line Breaks" option) which translate every line break
-character in a paragraph into a <code>&lt;br /&gt;</code> tag.</p>
-
-<p>When you <em>do</em> want to insert a <code>&lt;br /&gt;</code> break tag using Markdown, you
-end a line with two or more spaces, then type return.</p>
-
-<p>Yes, this takes a tad more effort to create a <code>&lt;br /&gt;</code>, but a simplistic
-"every line break is a <code>&lt;br /&gt;</code>" rule wouldn't work for Markdown.
-Markdown's email-style <a href="#blockquote">blockquoting</a> and multi-paragraph <a href="#list">list items</a>
-work best -- and look better -- when you format them with hard breaks.</p>
-
-<h3 id="header">Headers</h3>
-
-<p>Markdown supports two styles of headers, <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a> and <a href="http://www.aaronsw.com/2002/atx/">atx</a>.</p>
-
-<p>Setext-style headers are "underlined" using equal signs (for first-level
-headers) and dashes (for second-level headers). For example:</p>
-
-<pre><code>This is an H1
-=============
-
-This is an H2
--------------
-</code></pre>
-
-<p>Any number of underlining <code>=</code>'s or <code>-</code>'s will work.</p>
-
-<p>Atx-style headers use 1-6 hash characters at the start of the line,
-corresponding to header levels 1-6. For example:</p>
-
-<pre><code># This is an H1
-
-## This is an H2
-
-###### This is an H6
-</code></pre>
-
-<p>Optionally, you may "close" atx-style headers. This is purely
-cosmetic -- you can use this if you think it looks better. The
-closing hashes don't even need to match the number of hashes
-used to open the header. (The number of opening hashes
-determines the header level.) :</p>
-
-<pre><code># This is an H1 #
-
-## This is an H2 ##
-
-### This is an H3 ######
-</code></pre>
-
-<h3 id="blockquote">Blockquotes</h3>
-
-<p>Markdown uses email-style <code>&gt;</code> characters for blockquoting. If you're
-familiar with quoting passages of text in an email message, then you
-know how to create a blockquote in Markdown. It looks best if you hard
-wrap the text and put a <code>&gt;</code> before every line:</p>
-
-<pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-&gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-&gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-&gt;
-&gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-&gt; id sem consectetuer libero luctus adipiscing.
-</code></pre>
-
-<p>Markdown allows you to be lazy and only put the <code>&gt;</code> before the first
-line of a hard-wrapped paragraph:</p>
-
-<pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
-&gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
-id sem consectetuer libero luctus adipiscing.
-</code></pre>
-
-<p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
-adding additional levels of <code>&gt;</code>:</p>
-
-<pre><code>&gt; This is the first level of quoting.
-&gt;
-&gt; &gt; This is nested blockquote.
-&gt;
-&gt; Back to the first level.
-</code></pre>
-
-<p>Blockquotes can contain other Markdown elements, including headers, lists,
-and code blocks:</p>
-
-<pre><code>&gt; ## This is a header.
-&gt;
-&gt; 1. This is the first list item.
-&gt; 2. This is the second list item.
-&gt;
-&gt; Here's some example code:
-&gt;
-&gt; return shell_exec("echo $input | $markdown_script");
-</code></pre>
-
-<p>Any decent text editor should make email-style quoting easy. For
-example, with BBEdit, you can make a selection and choose Increase
-Quote Level from the Text menu.</p>
-
-<h3 id="list">Lists</h3>
-
-<p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>
-
-<p>Unordered lists use asterisks, pluses, and hyphens -- interchangably
--- as list markers:</p>
-
-<pre><code>* Red
-* Green
-* Blue
-</code></pre>
-
-<p>is equivalent to:</p>
-
-<pre><code>+ Red
-+ Green
-+ Blue
-</code></pre>
-
-<p>and:</p>
-
-<pre><code>- Red
-- Green
-- Blue
-</code></pre>
-
-<p>Ordered lists use numbers followed by periods:</p>
-
-<pre><code>1. Bird
-2. McHale
-3. Parish
-</code></pre>
-
-<p>It's important to note that the actual numbers you use to mark the
-list have no effect on the HTML output Markdown produces. The HTML
-Markdown produces from the above list is:</p>
-
-<pre><code>&lt;ol&gt;
-&lt;li&gt;Bird&lt;/li&gt;
-&lt;li&gt;McHale&lt;/li&gt;
-&lt;li&gt;Parish&lt;/li&gt;
-&lt;/ol&gt;
-</code></pre>
-
-<p>If you instead wrote the list in Markdown like this:</p>
-
-<pre><code>1. Bird
-1. McHale
-1. Parish
-</code></pre>
-
-<p>or even:</p>
-
-<pre><code>3. Bird
-1. McHale
-8. Parish
-</code></pre>
-
-<p>you'd get the exact same HTML output. The point is, if you want to,
-you can use ordinal numbers in your ordered Markdown lists, so that
-the numbers in your source match the numbers in your published HTML.
-But if you want to be lazy, you don't have to.</p>
-
-<p>If you do use lazy list numbering, however, you should still start the
-list with the number 1. At some point in the future, Markdown may support
-starting ordered lists at an arbitrary number.</p>
-
-<p>List markers typically start at the left margin, but may be indented by
-up to three spaces. List markers must be followed by one or more spaces
-or a tab.</p>
-
-<p>To make lists look nice, you can wrap items with hanging indents:</p>
-
-<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
- viverra nec, fringilla in, laoreet vitae, risus.
-* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
- Suspendisse id sem consectetuer libero luctus adipiscing.
-</code></pre>
-
-<p>But if you want to be lazy, you don't have to:</p>
-
-<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
-viverra nec, fringilla in, laoreet vitae, risus.
-* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
-Suspendisse id sem consectetuer libero luctus adipiscing.
-</code></pre>
-
-<p>If list items are separated by blank lines, Markdown will wrap the
-items in <code>&lt;p&gt;</code> tags in the HTML output. For example, this input:</p>
-
-<pre><code>* Bird
-* Magic
-</code></pre>
-
-<p>will turn into:</p>
-
-<pre><code>&lt;ul&gt;
-&lt;li&gt;Bird&lt;/li&gt;
-&lt;li&gt;Magic&lt;/li&gt;
-&lt;/ul&gt;
-</code></pre>
-
-<p>But this:</p>
-
-<pre><code>* Bird
-
-* Magic
-</code></pre>
-
-<p>will turn into:</p>
-
-<pre><code>&lt;ul&gt;
-&lt;li&gt;&lt;p&gt;Bird&lt;/p&gt;&lt;/li&gt;
-&lt;li&gt;&lt;p&gt;Magic&lt;/p&gt;&lt;/li&gt;
-&lt;/ul&gt;
-</code></pre>
-
-<p>List items may consist of multiple paragraphs. Each subsequent
-paragraph in a list item must be intended by either 4 spaces
-or one tab:</p>
-
-<pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor
- sit amet, consectetuer adipiscing elit. Aliquam hendrerit
- mi posuere lectus.
-
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet
- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
- sit amet velit.
-
-2. Suspendisse id sem consectetuer libero luctus adipiscing.
-</code></pre>
-
-<p>It looks nice if you indent every line of the subsequent
-paragraphs, but here again, Markdown will allow you to be
-lazy:</p>
-
-<pre><code>* This is a list item with two paragraphs.
-
- This is the second paragraph in the list item. You're
-only required to indent the first line. Lorem ipsum dolor
-sit amet, consectetuer adipiscing elit.
-
-* Another item in the same list.
-</code></pre>
-
-<p>To put a blockquote within a list item, the blockquote's <code>&gt;</code>
-delimiters need to be indented:</p>
-
-<pre><code>* A list item with a blockquote:
-
- &gt; This is a blockquote
- &gt; inside a list item.
-</code></pre>
-
-<p>To put a code block within a list item, the code block needs
-to be indented <em>twice</em> -- 8 spaces or two tabs:</p>
-
-<pre><code>* A list item with a code block:
-
- &lt;code goes here&gt;
-</code></pre>
-
-<p>It's worth noting that it's possible to trigger an ordered list by
-accident, by writing something like this:</p>
-
-<pre><code>1986. What a great season.
-</code></pre>
-
-<p>In other words, a <em>number-period-space</em> sequence at the beginning of a
-line. To avoid this, you can backslash-escape the period:</p>
-
-<pre><code>1986\. What a great season.
-</code></pre>
-
-<h3 id="precode">Code Blocks</h3>
-
-<p>Pre-formatted code blocks are used for writing about programming or
-markup source code. Rather than forming normal paragraphs, the lines
-of a code block are interpreted literally. Markdown wraps a code block
-in both <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code> tags.</p>
-
-<p>To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:</p>
-
-<pre><code>This is a normal paragraph:
-
- This is a code block.
-</code></pre>
-
-<p>Markdown will generate:</p>
-
-<pre><code>&lt;p&gt;This is a normal paragraph:&lt;/p&gt;
-
-&lt;pre&gt;&lt;code&gt;This is a code block.
-&lt;/code&gt;&lt;/pre&gt;
-</code></pre>
-
-<p>One level of indentation -- 4 spaces or 1 tab -- is removed from each
-line of the code block. For example, this:</p>
-
-<pre><code>Here is an example of AppleScript:
-
- tell application "Foo"
- beep
- end tell
-</code></pre>
-
-<p>will turn into:</p>
-
-<pre><code>&lt;p&gt;Here is an example of AppleScript:&lt;/p&gt;
-
-&lt;pre&gt;&lt;code&gt;tell application "Foo"
- beep
-end tell
-&lt;/code&gt;&lt;/pre&gt;
-</code></pre>
-
-<p>A code block continues until it reaches a line that is not indented
-(or the end of the article).</p>
-
-<p>Within a code block, ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> and <code>&gt;</code>)
-are automatically converted into HTML entities. This makes it very
-easy to include example HTML source code using Markdown -- just paste
-it and indent it, and Markdown will handle the hassle of encoding the
-ampersands and angle brackets. For example, this:</p>
-
-<pre><code> &lt;div class="footer"&gt;
- &amp;copy; 2004 Foo Corporation
- &lt;/div&gt;
-</code></pre>
-
-<p>will turn into:</p>
-
-<pre><code>&lt;pre&gt;&lt;code&gt;&amp;lt;div class="footer"&amp;gt;
- &amp;amp;copy; 2004 Foo Corporation
-&amp;lt;/div&amp;gt;
-&lt;/code&gt;&lt;/pre&gt;
-</code></pre>
-
-<p>Regular Markdown syntax is not processed within code blocks. E.g.,
-asterisks are just literal asterisks within a code block. This means
-it's also easy to use Markdown to write about Markdown's own syntax.</p>
-
-<h3 id="hr">Horizontal Rules</h3>
-
-<p>You can produce a horizontal rule tag (<code>&lt;hr /&gt;</code>) by placing three or
-more hyphens, asterisks, or underscores on a line by themselves. If you
-wish, you may use spaces between the hyphens or asterisks. Each of the
-following lines will produce a horizontal rule:</p>
-
-<pre><code>* * *
-
-***
-
-*****
-
-- - -
-
----------------------------------------
-
-_ _ _
-</code></pre>
-
-<hr />
-
-<h2 id="span">Span Elements</h2>
-
-<h3 id="link">Links</h3>
-
-<p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>
-
-<p>In both styles, the link text is delimited by [square brackets].</p>
-
-<p>To create an inline link, use a set of regular parentheses immediately
-after the link text's closing square bracket. Inside the parentheses,
-put the URL where you want the link to point, along with an <em>optional</em>
-title for the link, surrounded in quotes. For example:</p>
-
-<pre><code>This is [an example](http://example.com/ "Title") inline link.
-
-[This link](http://example.net/) has no title attribute.
-</code></pre>
-
-<p>Will produce:</p>
-
-<pre><code>&lt;p&gt;This is &lt;a href="http://example.com/" title="Title"&gt;
-an example&lt;/a&gt; inline link.&lt;/p&gt;
-
-&lt;p&gt;&lt;a href="http://example.net/"&gt;This link&lt;/a&gt; has no
-title attribute.&lt;/p&gt;
-</code></pre>
-
-<p>If you're referring to a local resource on the same server, you can
-use relative paths:</p>
-
-<pre><code>See my [About](/about/) page for details.
-</code></pre>
-
-<p>Reference-style links use a second set of square brackets, inside
-which you place a label of your choosing to identify the link:</p>
-
-<pre><code>This is [an example][id] reference-style link.
-</code></pre>
-
-<p>You can optionally use a space to separate the sets of brackets:</p>
-
-<pre><code>This is [an example] [id] reference-style link.
-</code></pre>
-
-<p>Then, anywhere in the document, you define your link label like this,
-on a line by itself:</p>
-
-<pre><code>[id]: http://example.com/ "Optional Title Here"
-</code></pre>
-
-<p>That is:</p>
-
-<ul>
-<li>Square brackets containing the link identifier (optionally
-indented from the left margin using up to three spaces);</li>
-<li>followed by a colon;</li>
-<li>followed by one or more spaces (or tabs);</li>
-<li>followed by the URL for the link;</li>
-<li>optionally followed by a title attribute for the link, enclosed
-in double or single quotes.</li>
-</ul>
-
-<p>The link URL may, optionally, be surrounded by angle brackets:</p>
-
-<pre><code>[id]: &lt;http://example.com/&gt; "Optional Title Here"
-</code></pre>
-
-<p>You can put the title attribute on the next line and use extra spaces
-or tabs for padding, which tends to look better with longer URLs:</p>
-
-<pre><code>[id]: http://example.com/longish/path/to/resource/here
- "Optional Title Here"
-</code></pre>
-
-<p>Link definitions are only used for creating links during Markdown
-processing, and are stripped from your document in the HTML output.</p>
-
-<p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p>
-
-<pre><code>[link text][a]
-[link text][A]
-</code></pre>
-
-<p>are equivalent.</p>
-
-<p>The <em>implicit link name</em> shortcut allows you to omit the name of the
-link, in which case the link text itself is used as the name.
-Just use an empty set of square brackets -- e.g., to link the word
-"Google" to the google.com web site, you could simply write:</p>
-
-<pre><code>[Google][]
-</code></pre>
-
-<p>And then define the link:</p>
-
-<pre><code>[Google]: http://google.com/
-</code></pre>
-
-<p>Because link names may contain spaces, this shortcut even works for
-multiple words in the link text:</p>
-
-<pre><code>Visit [Daring Fireball][] for more information.
-</code></pre>
-
-<p>And then define the link:</p>
-
-<pre><code>[Daring Fireball]: http://daringfireball.net/
-</code></pre>
-
-<p>Link definitions can be placed anywhere in your Markdown document. I
-tend to put them immediately after each paragraph in which they're
-used, but if you want, you can put them all at the end of your
-document, sort of like footnotes.</p>
-
-<p>Here's an example of reference links in action:</p>
-
-<pre><code>I get 10 times more traffic from [Google] [1] than from
-[Yahoo] [2] or [MSN] [3].
-
- [1]: http://google.com/ "Google"
- [2]: http://search.yahoo.com/ "Yahoo Search"
- [3]: http://search.msn.com/ "MSN Search"
-</code></pre>
-
-<p>Using the implicit link name shortcut, you could instead write:</p>
-
-<pre><code>I get 10 times more traffic from [Google][] than from
-[Yahoo][] or [MSN][].
-
- [google]: http://google.com/ "Google"
- [yahoo]: http://search.yahoo.com/ "Yahoo Search"
- [msn]: http://search.msn.com/ "MSN Search"
-</code></pre>
-
-<p>Both of the above examples will produce the following HTML output:</p>
-
-<pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
-title="Google"&gt;Google&lt;/a&gt; than from
-&lt;a href="http://search.yahoo.com/" title="Yahoo Search"&gt;Yahoo&lt;/a&gt;
-or &lt;a href="http://search.msn.com/" title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
-</code></pre>
-
-<p>For comparison, here is the same paragraph written using
-Markdown's inline link style:</p>
-
-<pre><code>I get 10 times more traffic from [Google](http://google.com/ "Google")
-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
-[MSN](http://search.msn.com/ "MSN Search").
-</code></pre>
-
-<p>The point of reference-style links is not that they're easier to
-write. The point is that with reference-style links, your document
-source is vastly more readable. Compare the above examples: using
-reference-style links, the paragraph itself is only 81 characters
-long; with inline-style links, it's 176 characters; and as raw HTML,
-it's 234 characters. In the raw HTML, there's more markup than there
-is text.</p>
-
-<p>With Markdown's reference-style links, a source document much more
-closely resembles the final output, as rendered in a browser. By
-allowing you to move the markup-related metadata out of the paragraph,
-you can add links without interrupting the narrative flow of your
-prose.</p>
-
-<h3 id="em">Emphasis</h3>
-
-<p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of
-emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an
-HTML <code>&lt;em&gt;</code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML
-<code>&lt;strong&gt;</code> tag. E.g., this input:</p>
-
-<pre><code>*single asterisks*
-
-_single underscores_
-
-**double asterisks**
-
-__double underscores__
-</code></pre>
-
-<p>will produce:</p>
-
-<pre><code>&lt;em&gt;single asterisks&lt;/em&gt;
-
-&lt;em&gt;single underscores&lt;/em&gt;
-
-&lt;strong&gt;double asterisks&lt;/strong&gt;
-
-&lt;strong&gt;double underscores&lt;/strong&gt;
-</code></pre>
-
-<p>You can use whichever style you prefer; the lone restriction is that
-the same character must be used to open and close an emphasis span.</p>
-
-<p>Emphasis can be used in the middle of a word:</p>
-
-<pre><code>un*fucking*believable
-</code></pre>
-
-<p>But if you surround an <code>*</code> or <code>_</code> with spaces, it'll be treated as a
-literal asterisk or underscore.</p>
-
-<p>To produce a literal asterisk or underscore at a position where it
-would otherwise be used as an emphasis delimiter, you can backslash
-escape it:</p>
-
-<pre><code>\*this text is surrounded by literal asterisks\*
-</code></pre>
-
-<h3 id="code">Code</h3>
-
-<p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>).
-Unlike a pre-formatted code block, a code span indicates code within a
-normal paragraph. For example:</p>
-
-<pre><code>Use the `printf()` function.
-</code></pre>
-
-<p>will produce:</p>
-
-<pre><code>&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
-</code></pre>
-
-<p>To include a literal backtick character within a code span, you can use
-multiple backticks as the opening and closing delimiters:</p>
-
-<pre><code>``There is a literal backtick (`) here.``
-</code></pre>
-
-<p>which will produce this:</p>
-
-<pre><code>&lt;p&gt;&lt;code&gt;There is a literal backtick (`) here.&lt;/code&gt;&lt;/p&gt;
-</code></pre>
-
-<p>The backtick delimiters surrounding a code span may include spaces --
-one after the opening, one before the closing. This allows you to place
-literal backtick characters at the beginning or end of a code span:</p>
-
-<pre><code>A single backtick in a code span: `` ` ``
-
-A backtick-delimited string in a code span: `` `foo` ``
-</code></pre>
-
-<p>will produce:</p>
-
-<pre><code>&lt;p&gt;A single backtick in a code span: &lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
-
-&lt;p&gt;A backtick-delimited string in a code span: &lt;code&gt;`foo`&lt;/code&gt;&lt;/p&gt;
-</code></pre>
-
-<p>With a code span, ampersands and angle brackets are encoded as HTML
-entities automatically, which makes it easy to include example HTML
-tags. Markdown will turn this:</p>
-
-<pre><code>Please don't use any `&lt;blink&gt;` tags.
-</code></pre>
-
-<p>into:</p>
-
-<pre><code>&lt;p&gt;Please don't use any &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
-</code></pre>
-
-<p>You can write this:</p>
-
-<pre><code>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.
-</code></pre>
-
-<p>to produce:</p>
-
-<pre><code>&lt;p&gt;&lt;code&gt;&amp;amp;#8212;&lt;/code&gt; is the decimal-encoded
-equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;
-</code></pre>
-
-<h3 id="img">Images</h3>
-
-<p>Admittedly, it's fairly difficult to devise a "natural" syntax for
-placing images into a plain text document format.</p>
-
-<p>Markdown uses an image syntax that is intended to resemble the syntax
-for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p>
-
-<p>Inline image syntax looks like this:</p>
-
-<pre><code>![Alt text](/path/to/img.jpg)
-
-![Alt text](/path/to/img.jpg "Optional title")
-</code></pre>
-
-<p>That is:</p>
-
-<ul>
-<li>An exclamation mark: <code>!</code>;</li>
-<li>followed by a set of square brackets, containing the <code>alt</code>
-attribute text for the image;</li>
-<li>followed by a set of parentheses, containing the URL or path to
-the image, and an optional <code>title</code> attribute enclosed in double
-or single quotes.</li>
-</ul>
-
-<p>Reference-style image syntax looks like this:</p>
-
-<pre><code>![Alt text][id]
-</code></pre>
-
-<p>Where "id" is the name of a defined image reference. Image references
-are defined using syntax identical to link references:</p>
-
-<pre><code>[id]: url/to/image "Optional title attribute"
-</code></pre>
-
-<p>As of this writing, Markdown has no syntax for specifying the
-dimensions of an image; if this is important to you, you can simply
-use regular HTML <code>&lt;img&gt;</code> tags.</p>
-
-<hr />
-
-<h2 id="misc">Miscellaneous</h2>
-
-<h3 id="autolink">Automatic Links</h3>
-
-<p>Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p>
-
-<pre><code>&lt;http://example.com/&gt;
-</code></pre>
-
-<p>Markdown will turn this into:</p>
-
-<pre><code>&lt;a href="http://example.com/"&gt;http://example.com/&lt;/a&gt;
-</code></pre>
-
-<p>Automatic links for email addresses work similarly, except that
-Markdown will also perform a bit of randomized decimal and hex
-entity-encoding to help obscure your address from address-harvesting
-spambots. For example, Markdown will turn this:</p>
-
-<pre><code>&lt;address@example.com&gt;
-</code></pre>
-
-<p>into something like this:</p>
-
-<pre><code>&lt;a href="&amp;#x6D;&amp;#x61;i&amp;#x6C;&amp;#x74;&amp;#x6F;:&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;
-&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;
-&amp;#109;"&gt;&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;
-&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;
-</code></pre>
-
-<p>which will render in a browser as a clickable link to "address@example.com".</p>
-
-<p>(This sort of entity-encoding trick will indeed fool many, if not
-most, address-harvesting bots, but it definitely won't fool all of
-them. It's better than nothing, but an address published in this way
-will probably eventually start receiving spam.)</p>
-
-<h3 id="backslash">Backslash Escapes</h3>
-
-<p>Markdown allows you to use backslash escapes to generate literal
-characters which would otherwise have special meaning in Markdown's
-formatting syntax. For example, if you wanted to surround a word with
-literal asterisks (instead of an HTML <code>&lt;em&gt;</code> tag), you can backslashes
-before the asterisks, like this:</p>
-
-<pre><code>\*literal asterisks\*
-</code></pre>
-
-<p>Markdown provides backslash escapes for the following characters:</p>
-
-<pre><code>\ backslash
-` backtick
-* asterisk
-_ underscore
-{} curly braces
-[] square brackets
-() parentheses
-# hash mark
-+ plus sign
-- minus sign (hyphen)
-. dot
-! exclamation mark
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
deleted file mode 100644
index 57360a16c..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
+++ /dev/null
@@ -1,888 +0,0 @@
-Markdown: Syntax
-================
-
-<ul id="ProjectSubmenu">
- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
- <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
- <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
-</ul>
-
-
-* [Overview](#overview)
- * [Philosophy](#philosophy)
- * [Inline HTML](#html)
- * [Automatic Escaping for Special Characters](#autoescape)
-* [Block Elements](#block)
- * [Paragraphs and Line Breaks](#p)
- * [Headers](#header)
- * [Blockquotes](#blockquote)
- * [Lists](#list)
- * [Code Blocks](#precode)
- * [Horizontal Rules](#hr)
-* [Span Elements](#span)
- * [Links](#link)
- * [Emphasis](#em)
- * [Code](#code)
- * [Images](#img)
-* [Miscellaneous](#misc)
- * [Backslash Escapes](#backslash)
- * [Automatic Links](#autolink)
-
-
-**Note:** This document is itself written using Markdown; you
-can [see the source for it by adding '.text' to the URL][src].
-
- [src]: /projects/markdown/syntax.text
-
-* * *
-
-<h2 id="overview">Overview</h2>
-
-<h3 id="philosophy">Philosophy</h3>
-
-Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
-
-Readability, however, is emphasized above all else. A Markdown-formatted
-document should be publishable as-is, as plain text, without looking
-like it's been marked up with tags or formatting instructions. While
-Markdown's syntax has been influenced by several existing text-to-HTML
-filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
-[Grutatext] [5], and [EtText] [6] -- the single biggest source of
-inspiration for Markdown's syntax is the format of plain text email.
-
- [1]: http://docutils.sourceforge.net/mirror/setext.html
- [2]: http://www.aaronsw.com/2002/atx/
- [3]: http://textism.com/tools/textile/
- [4]: http://docutils.sourceforge.net/rst.html
- [5]: http://www.triptico.com/software/grutatxt.html
- [6]: http://ettext.taint.org/doc/
-
-To this end, Markdown's syntax is comprised entirely of punctuation
-characters, which punctuation characters have been carefully chosen so
-as to look like what they mean. E.g., asterisks around a word actually
-look like \*emphasis\*. Markdown lists look like, well, lists. Even
-blockquotes look like quoted passages of text, assuming you've ever
-used email.
-
-
-
-<h3 id="html">Inline HTML</h3>
-
-Markdown's syntax is intended for one purpose: to be used as a
-format for *writing* for the web.
-
-Markdown is not a replacement for HTML, or even close to it. Its
-syntax is very small, corresponding only to a very small subset of
-HTML tags. The idea is *not* to create a syntax that makes it easier
-to insert HTML tags. In my opinion, HTML tags are already easy to
-insert. The idea for Markdown is to make it easy to read, write, and
-edit prose. HTML is a *publishing* format; Markdown is a *writing*
-format. Thus, Markdown's formatting syntax only addresses issues that
-can be conveyed in plain text.
-
-For any markup that is not covered by Markdown's syntax, you simply
-use HTML itself. There's no need to preface it or delimit it to
-indicate that you're switching from Markdown to HTML; you just use
-the tags.
-
-The only restrictions are that block-level HTML elements -- e.g. `<div>`,
-`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
-content by blank lines, and the start and end tags of the block should
-not be indented with tabs or spaces. Markdown is smart enough not
-to add extra (unwanted) `<p>` tags around HTML block-level tags.
-
-For example, to add an HTML table to a Markdown article:
-
- This is a regular paragraph.
-
- <table>
- <tr>
- <td>Foo</td>
- </tr>
- </table>
-
- This is another regular paragraph.
-
-Note that Markdown formatting syntax is not processed within block-level
-HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
-HTML block.
-
-Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
-used anywhere in a Markdown paragraph, list item, or header. If you
-want, you can even use HTML tags instead of Markdown formatting; e.g. if
-you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
-link or image syntax, go right ahead.
-
-Unlike block-level HTML tags, Markdown syntax *is* processed within
-span-level tags.
-
-
-<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
-
-In HTML, there are two characters that demand special treatment: `<`
-and `&`. Left angle brackets are used to start tags; ampersands are
-used to denote HTML entities. If you want to use them as literal
-characters, you must escape them as entities, e.g. `&lt;`, and
-`&amp;`.
-
-Ampersands in particular are bedeviling for web writers. If you want to
-write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
-escape ampersands within URLs. Thus, if you want to link to:
-
- http://images.google.com/images?num=30&q=larry+bird
-
-you need to encode the URL as:
-
- http://images.google.com/images?num=30&amp;q=larry+bird
-
-in your anchor tag `href` attribute. Needless to say, this is easy to
-forget, and is probably the single most common source of HTML validation
-errors in otherwise well-marked-up web sites.
-
-Markdown allows you to use these characters naturally, taking care of
-all the necessary escaping for you. If you use an ampersand as part of
-an HTML entity, it remains unchanged; otherwise it will be translated
-into `&amp;`.
-
-So, if you want to include a copyright symbol in your article, you can write:
-
- &copy;
-
-and Markdown will leave it alone. But if you write:
-
- AT&T
-
-Markdown will translate it to:
-
- AT&amp;T
-
-Similarly, because Markdown supports [inline HTML](#html), if you use
-angle brackets as delimiters for HTML tags, Markdown will treat them as
-such. But if you write:
-
- 4 < 5
-
-Markdown will translate it to:
-
- 4 &lt; 5
-
-However, inside Markdown code spans and blocks, angle brackets and
-ampersands are *always* encoded automatically. This makes it easy to use
-Markdown to write about HTML code. (As opposed to raw HTML, which is a
-terrible format for writing about HTML syntax, because every single `<`
-and `&` in your example code needs to be escaped.)
-
-
-* * *
-
-
-<h2 id="block">Block Elements</h2>
-
-
-<h3 id="p">Paragraphs and Line Breaks</h3>
-
-A paragraph is simply one or more consecutive lines of text, separated
-by one or more blank lines. (A blank line is any line that looks like a
-blank line -- a line containing nothing but spaces or tabs is considered
-blank.) Normal paragraphs should not be intended with spaces or tabs.
-
-The implication of the "one or more consecutive lines of text" rule is
-that Markdown supports "hard-wrapped" text paragraphs. This differs
-significantly from most other text-to-HTML formatters (including Movable
-Type's "Convert Line Breaks" option) which translate every line break
-character in a paragraph into a `<br />` tag.
-
-When you *do* want to insert a `<br />` break tag using Markdown, you
-end a line with two or more spaces, then type return.
-
-Yes, this takes a tad more effort to create a `<br />`, but a simplistic
-"every line break is a `<br />`" rule wouldn't work for Markdown.
-Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
-work best -- and look better -- when you format them with hard breaks.
-
- [bq]: #blockquote
- [l]: #list
-
-
-
-<h3 id="header">Headers</h3>
-
-Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
-
-Setext-style headers are "underlined" using equal signs (for first-level
-headers) and dashes (for second-level headers). For example:
-
- This is an H1
- =============
-
- This is an H2
- -------------
-
-Any number of underlining `=`'s or `-`'s will work.
-
-Atx-style headers use 1-6 hash characters at the start of the line,
-corresponding to header levels 1-6. For example:
-
- # This is an H1
-
- ## This is an H2
-
- ###### This is an H6
-
-Optionally, you may "close" atx-style headers. This is purely
-cosmetic -- you can use this if you think it looks better. The
-closing hashes don't even need to match the number of hashes
-used to open the header. (The number of opening hashes
-determines the header level.) :
-
- # This is an H1 #
-
- ## This is an H2 ##
-
- ### This is an H3 ######
-
-
-<h3 id="blockquote">Blockquotes</h3>
-
-Markdown uses email-style `>` characters for blockquoting. If you're
-familiar with quoting passages of text in an email message, then you
-know how to create a blockquote in Markdown. It looks best if you hard
-wrap the text and put a `>` before every line:
-
- > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
- > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
- > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
- >
- > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
- > id sem consectetuer libero luctus adipiscing.
-
-Markdown allows you to be lazy and only put the `>` before the first
-line of a hard-wrapped paragraph:
-
- > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
- consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
-
- > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
- id sem consectetuer libero luctus adipiscing.
-
-Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
-adding additional levels of `>`:
-
- > This is the first level of quoting.
- >
- > > This is nested blockquote.
- >
- > Back to the first level.
-
-Blockquotes can contain other Markdown elements, including headers, lists,
-and code blocks:
-
- > ## This is a header.
- >
- > 1. This is the first list item.
- > 2. This is the second list item.
- >
- > Here's some example code:
- >
- > return shell_exec("echo $input | $markdown_script");
-
-Any decent text editor should make email-style quoting easy. For
-example, with BBEdit, you can make a selection and choose Increase
-Quote Level from the Text menu.
-
-
-<h3 id="list">Lists</h3>
-
-Markdown supports ordered (numbered) and unordered (bulleted) lists.
-
-Unordered lists use asterisks, pluses, and hyphens -- interchangably
--- as list markers:
-
- * Red
- * Green
- * Blue
-
-is equivalent to:
-
- + Red
- + Green
- + Blue
-
-and:
-
- - Red
- - Green
- - Blue
-
-Ordered lists use numbers followed by periods:
-
- 1. Bird
- 2. McHale
- 3. Parish
-
-It's important to note that the actual numbers you use to mark the
-list have no effect on the HTML output Markdown produces. The HTML
-Markdown produces from the above list is:
-
- <ol>
- <li>Bird</li>
- <li>McHale</li>
- <li>Parish</li>
- </ol>
-
-If you instead wrote the list in Markdown like this:
-
- 1. Bird
- 1. McHale
- 1. Parish
-
-or even:
-
- 3. Bird
- 1. McHale
- 8. Parish
-
-you'd get the exact same HTML output. The point is, if you want to,
-you can use ordinal numbers in your ordered Markdown lists, so that
-the numbers in your source match the numbers in your published HTML.
-But if you want to be lazy, you don't have to.
-
-If you do use lazy list numbering, however, you should still start the
-list with the number 1. At some point in the future, Markdown may support
-starting ordered lists at an arbitrary number.
-
-List markers typically start at the left margin, but may be indented by
-up to three spaces. List markers must be followed by one or more spaces
-or a tab.
-
-To make lists look nice, you can wrap items with hanging indents:
-
- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
- viverra nec, fringilla in, laoreet vitae, risus.
- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
- Suspendisse id sem consectetuer libero luctus adipiscing.
-
-But if you want to be lazy, you don't have to:
-
- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
- viverra nec, fringilla in, laoreet vitae, risus.
- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
- Suspendisse id sem consectetuer libero luctus adipiscing.
-
-If list items are separated by blank lines, Markdown will wrap the
-items in `<p>` tags in the HTML output. For example, this input:
-
- * Bird
- * Magic
-
-will turn into:
-
- <ul>
- <li>Bird</li>
- <li>Magic</li>
- </ul>
-
-But this:
-
- * Bird
-
- * Magic
-
-will turn into:
-
- <ul>
- <li><p>Bird</p></li>
- <li><p>Magic</p></li>
- </ul>
-
-List items may consist of multiple paragraphs. Each subsequent
-paragraph in a list item must be intended by either 4 spaces
-or one tab:
-
- 1. This is a list item with two paragraphs. Lorem ipsum dolor
- sit amet, consectetuer adipiscing elit. Aliquam hendrerit
- mi posuere lectus.
-
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet
- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
- sit amet velit.
-
- 2. Suspendisse id sem consectetuer libero luctus adipiscing.
-
-It looks nice if you indent every line of the subsequent
-paragraphs, but here again, Markdown will allow you to be
-lazy:
-
- * This is a list item with two paragraphs.
-
- This is the second paragraph in the list item. You're
- only required to indent the first line. Lorem ipsum dolor
- sit amet, consectetuer adipiscing elit.
-
- * Another item in the same list.
-
-To put a blockquote within a list item, the blockquote's `>`
-delimiters need to be indented:
-
- * A list item with a blockquote:
-
- > This is a blockquote
- > inside a list item.
-
-To put a code block within a list item, the code block needs
-to be indented *twice* -- 8 spaces or two tabs:
-
- * A list item with a code block:
-
- <code goes here>
-
-
-It's worth noting that it's possible to trigger an ordered list by
-accident, by writing something like this:
-
- 1986. What a great season.
-
-In other words, a *number-period-space* sequence at the beginning of a
-line. To avoid this, you can backslash-escape the period:
-
- 1986\. What a great season.
-
-
-
-<h3 id="precode">Code Blocks</h3>
-
-Pre-formatted code blocks are used for writing about programming or
-markup source code. Rather than forming normal paragraphs, the lines
-of a code block are interpreted literally. Markdown wraps a code block
-in both `<pre>` and `<code>` tags.
-
-To produce a code block in Markdown, simply indent every line of the
-block by at least 4 spaces or 1 tab. For example, given this input:
-
- This is a normal paragraph:
-
- This is a code block.
-
-Markdown will generate:
-
- <p>This is a normal paragraph:</p>
-
- <pre><code>This is a code block.
- </code></pre>
-
-One level of indentation -- 4 spaces or 1 tab -- is removed from each
-line of the code block. For example, this:
-
- Here is an example of AppleScript:
-
- tell application "Foo"
- beep
- end tell
-
-will turn into:
-
- <p>Here is an example of AppleScript:</p>
-
- <pre><code>tell application "Foo"
- beep
- end tell
- </code></pre>
-
-A code block continues until it reaches a line that is not indented
-(or the end of the article).
-
-Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
-are automatically converted into HTML entities. This makes it very
-easy to include example HTML source code using Markdown -- just paste
-it and indent it, and Markdown will handle the hassle of encoding the
-ampersands and angle brackets. For example, this:
-
- <div class="footer">
- &copy; 2004 Foo Corporation
- </div>
-
-will turn into:
-
- <pre><code>&lt;div class="footer"&gt;
- &amp;copy; 2004 Foo Corporation
- &lt;/div&gt;
- </code></pre>
-
-Regular Markdown syntax is not processed within code blocks. E.g.,
-asterisks are just literal asterisks within a code block. This means
-it's also easy to use Markdown to write about Markdown's own syntax.
-
-
-
-<h3 id="hr">Horizontal Rules</h3>
-
-You can produce a horizontal rule tag (`<hr />`) by placing three or
-more hyphens, asterisks, or underscores on a line by themselves. If you
-wish, you may use spaces between the hyphens or asterisks. Each of the
-following lines will produce a horizontal rule:
-
- * * *
-
- ***
-
- *****
-
- - - -
-
- ---------------------------------------
-
- _ _ _
-
-
-* * *
-
-<h2 id="span">Span Elements</h2>
-
-<h3 id="link">Links</h3>
-
-Markdown supports two style of links: *inline* and *reference*.
-
-In both styles, the link text is delimited by [square brackets].
-
-To create an inline link, use a set of regular parentheses immediately
-after the link text's closing square bracket. Inside the parentheses,
-put the URL where you want the link to point, along with an *optional*
-title for the link, surrounded in quotes. For example:
-
- This is [an example](http://example.com/ "Title") inline link.
-
- [This link](http://example.net/) has no title attribute.
-
-Will produce:
-
- <p>This is <a href="http://example.com/" title="Title">
- an example</a> inline link.</p>
-
- <p><a href="http://example.net/">This link</a> has no
- title attribute.</p>
-
-If you're referring to a local resource on the same server, you can
-use relative paths:
-
- See my [About](/about/) page for details.
-
-Reference-style links use a second set of square brackets, inside
-which you place a label of your choosing to identify the link:
-
- This is [an example][id] reference-style link.
-
-You can optionally use a space to separate the sets of brackets:
-
- This is [an example] [id] reference-style link.
-
-Then, anywhere in the document, you define your link label like this,
-on a line by itself:
-
- [id]: http://example.com/ "Optional Title Here"
-
-That is:
-
-* Square brackets containing the link identifier (optionally
- indented from the left margin using up to three spaces);
-* followed by a colon;
-* followed by one or more spaces (or tabs);
-* followed by the URL for the link;
-* optionally followed by a title attribute for the link, enclosed
- in double or single quotes.
-
-The link URL may, optionally, be surrounded by angle brackets:
-
- [id]: <http://example.com/> "Optional Title Here"
-
-You can put the title attribute on the next line and use extra spaces
-or tabs for padding, which tends to look better with longer URLs:
-
- [id]: http://example.com/longish/path/to/resource/here
- "Optional Title Here"
-
-Link definitions are only used for creating links during Markdown
-processing, and are stripped from your document in the HTML output.
-
-Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
-
- [link text][a]
- [link text][A]
-
-are equivalent.
-
-The *implicit link name* shortcut allows you to omit the name of the
-link, in which case the link text itself is used as the name.
-Just use an empty set of square brackets -- e.g., to link the word
-"Google" to the google.com web site, you could simply write:
-
- [Google][]
-
-And then define the link:
-
- [Google]: http://google.com/
-
-Because link names may contain spaces, this shortcut even works for
-multiple words in the link text:
-
- Visit [Daring Fireball][] for more information.
-
-And then define the link:
-
- [Daring Fireball]: http://daringfireball.net/
-
-Link definitions can be placed anywhere in your Markdown document. I
-tend to put them immediately after each paragraph in which they're
-used, but if you want, you can put them all at the end of your
-document, sort of like footnotes.
-
-Here's an example of reference links in action:
-
- I get 10 times more traffic from [Google] [1] than from
- [Yahoo] [2] or [MSN] [3].
-
- [1]: http://google.com/ "Google"
- [2]: http://search.yahoo.com/ "Yahoo Search"
- [3]: http://search.msn.com/ "MSN Search"
-
-Using the implicit link name shortcut, you could instead write:
-
- I get 10 times more traffic from [Google][] than from
- [Yahoo][] or [MSN][].
-
- [google]: http://google.com/ "Google"
- [yahoo]: http://search.yahoo.com/ "Yahoo Search"
- [msn]: http://search.msn.com/ "MSN Search"
-
-Both of the above examples will produce the following HTML output:
-
- <p>I get 10 times more traffic from <a href="http://google.com/"
- title="Google">Google</a> than from
- <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
- or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
-
-For comparison, here is the same paragraph written using
-Markdown's inline link style:
-
- I get 10 times more traffic from [Google](http://google.com/ "Google")
- than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
- [MSN](http://search.msn.com/ "MSN Search").
-
-The point of reference-style links is not that they're easier to
-write. The point is that with reference-style links, your document
-source is vastly more readable. Compare the above examples: using
-reference-style links, the paragraph itself is only 81 characters
-long; with inline-style links, it's 176 characters; and as raw HTML,
-it's 234 characters. In the raw HTML, there's more markup than there
-is text.
-
-With Markdown's reference-style links, a source document much more
-closely resembles the final output, as rendered in a browser. By
-allowing you to move the markup-related metadata out of the paragraph,
-you can add links without interrupting the narrative flow of your
-prose.
-
-
-<h3 id="em">Emphasis</h3>
-
-Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
-emphasis. Text wrapped with one `*` or `_` will be wrapped with an
-HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
-`<strong>` tag. E.g., this input:
-
- *single asterisks*
-
- _single underscores_
-
- **double asterisks**
-
- __double underscores__
-
-will produce:
-
- <em>single asterisks</em>
-
- <em>single underscores</em>
-
- <strong>double asterisks</strong>
-
- <strong>double underscores</strong>
-
-You can use whichever style you prefer; the lone restriction is that
-the same character must be used to open and close an emphasis span.
-
-Emphasis can be used in the middle of a word:
-
- un*fucking*believable
-
-But if you surround an `*` or `_` with spaces, it'll be treated as a
-literal asterisk or underscore.
-
-To produce a literal asterisk or underscore at a position where it
-would otherwise be used as an emphasis delimiter, you can backslash
-escape it:
-
- \*this text is surrounded by literal asterisks\*
-
-
-
-<h3 id="code">Code</h3>
-
-To indicate a span of code, wrap it with backtick quotes (`` ` ``).
-Unlike a pre-formatted code block, a code span indicates code within a
-normal paragraph. For example:
-
- Use the `printf()` function.
-
-will produce:
-
- <p>Use the <code>printf()</code> function.</p>
-
-To include a literal backtick character within a code span, you can use
-multiple backticks as the opening and closing delimiters:
-
- ``There is a literal backtick (`) here.``
-
-which will produce this:
-
- <p><code>There is a literal backtick (`) here.</code></p>
-
-The backtick delimiters surrounding a code span may include spaces --
-one after the opening, one before the closing. This allows you to place
-literal backtick characters at the beginning or end of a code span:
-
- A single backtick in a code span: `` ` ``
-
- A backtick-delimited string in a code span: `` `foo` ``
-
-will produce:
-
- <p>A single backtick in a code span: <code>`</code></p>
-
- <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
-
-With a code span, ampersands and angle brackets are encoded as HTML
-entities automatically, which makes it easy to include example HTML
-tags. Markdown will turn this:
-
- Please don't use any `<blink>` tags.
-
-into:
-
- <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
-
-You can write this:
-
- `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
-
-to produce:
-
- <p><code>&amp;#8212;</code> is the decimal-encoded
- equivalent of <code>&amp;mdash;</code>.</p>
-
-
-
-<h3 id="img">Images</h3>
-
-Admittedly, it's fairly difficult to devise a "natural" syntax for
-placing images into a plain text document format.
-
-Markdown uses an image syntax that is intended to resemble the syntax
-for links, allowing for two styles: *inline* and *reference*.
-
-Inline image syntax looks like this:
-
- ![Alt text](/path/to/img.jpg)
-
- ![Alt text](/path/to/img.jpg "Optional title")
-
-That is:
-
-* An exclamation mark: `!`;
-* followed by a set of square brackets, containing the `alt`
- attribute text for the image;
-* followed by a set of parentheses, containing the URL or path to
- the image, and an optional `title` attribute enclosed in double
- or single quotes.
-
-Reference-style image syntax looks like this:
-
- ![Alt text][id]
-
-Where "id" is the name of a defined image reference. Image references
-are defined using syntax identical to link references:
-
- [id]: url/to/image "Optional title attribute"
-
-As of this writing, Markdown has no syntax for specifying the
-dimensions of an image; if this is important to you, you can simply
-use regular HTML `<img>` tags.
-
-
-* * *
-
-
-<h2 id="misc">Miscellaneous</h2>
-
-<h3 id="autolink">Automatic Links</h3>
-
-Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
-
- <http://example.com/>
-
-Markdown will turn this into:
-
- <a href="http://example.com/">http://example.com/</a>
-
-Automatic links for email addresses work similarly, except that
-Markdown will also perform a bit of randomized decimal and hex
-entity-encoding to help obscure your address from address-harvesting
-spambots. For example, Markdown will turn this:
-
- <address@example.com>
-
-into something like this:
-
- <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
- &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
- &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
- &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
-
-which will render in a browser as a clickable link to "address@example.com".
-
-(This sort of entity-encoding trick will indeed fool many, if not
-most, address-harvesting bots, but it definitely won't fool all of
-them. It's better than nothing, but an address published in this way
-will probably eventually start receiving spam.)
-
-
-
-<h3 id="backslash">Backslash Escapes</h3>
-
-Markdown allows you to use backslash escapes to generate literal
-characters which would otherwise have special meaning in Markdown's
-formatting syntax. For example, if you wanted to surround a word with
-literal asterisks (instead of an HTML `<em>` tag), you can backslashes
-before the asterisks, like this:
-
- \*literal asterisks\*
-
-Markdown provides backslash escapes for the following characters:
-
- \ backslash
- ` backtick
- * asterisk
- _ underscore
- {} curly braces
- [] square brackets
- () parentheses
- # hash mark
- + plus sign
- - minus sign (hyphen)
- . dot
- ! exclamation mark
-
diff --git a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
deleted file mode 100644
index d8ec7f8e0..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<blockquote>
- <p>foo</p>
-
- <blockquote>
- <p>bar</p>
- </blockquote>
-
- <p>foo</p>
-</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
deleted file mode 100644
index ed3c624ff..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
+++ /dev/null
@@ -1,5 +0,0 @@
-> foo
->
-> > bar
->
-> foo
diff --git a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
deleted file mode 100644
index ba71eab39..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
+++ /dev/null
@@ -1,148 +0,0 @@
-<h2>Unordered</h2>
-
-<p>Asterisks tight:</p>
-
-<ul>
-<li>asterisk 1</li>
-<li>asterisk 2</li>
-<li>asterisk 3</li>
-</ul>
-
-<p>Asterisks loose:</p>
-
-<ul>
-<li><p>asterisk 1</p></li>
-<li><p>asterisk 2</p></li>
-<li><p>asterisk 3</p></li>
-</ul>
-
-<hr />
-
-<p>Pluses tight:</p>
-
-<ul>
-<li>Plus 1</li>
-<li>Plus 2</li>
-<li>Plus 3</li>
-</ul>
-
-<p>Pluses loose:</p>
-
-<ul>
-<li><p>Plus 1</p></li>
-<li><p>Plus 2</p></li>
-<li><p>Plus 3</p></li>
-</ul>
-
-<hr />
-
-<p>Minuses tight:</p>
-
-<ul>
-<li>Minus 1</li>
-<li>Minus 2</li>
-<li>Minus 3</li>
-</ul>
-
-<p>Minuses loose:</p>
-
-<ul>
-<li><p>Minus 1</p></li>
-<li><p>Minus 2</p></li>
-<li><p>Minus 3</p></li>
-</ul>
-
-<h2>Ordered</h2>
-
-<p>Tight:</p>
-
-<ol>
-<li>First</li>
-<li>Second</li>
-<li>Third</li>
-</ol>
-
-<p>and:</p>
-
-<ol>
-<li>One</li>
-<li>Two</li>
-<li>Three</li>
-</ol>
-
-<p>Loose using tabs:</p>
-
-<ol>
-<li><p>First</p></li>
-<li><p>Second</p></li>
-<li><p>Third</p></li>
-</ol>
-
-<p>and using spaces:</p>
-
-<ol>
-<li><p>One</p></li>
-<li><p>Two</p></li>
-<li><p>Three</p></li>
-</ol>
-
-<p>Multiple paragraphs:</p>
-
-<ol>
-<li><p>Item 1, graf one.</p>
-
-<p>Item 2. 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>
-
-<h2>Nested</h2>
-
-<ul>
-<li>Tab
-<ul>
-<li>Tab
-<ul>
-<li>Tab</li>
-</ul></li>
-</ul></li>
-</ul>
-
-<p>Here's another:</p>
-
-<ol>
-<li>First</li>
-<li>Second:
-<ul>
-<li>Fee</li>
-<li>Fie</li>
-<li>Foe</li>
-</ul></li>
-<li>Third</li>
-</ol>
-
-<p>Same thing but with paragraphs:</p>
-
-<ol>
-<li><p>First</p></li>
-<li><p>Second:</p>
-
-<ul>
-<li>Fee</li>
-<li>Fie</li>
-<li>Foe</li>
-</ul></li>
-<li><p>Third</p></li>
-</ol>
-
-
-<p>This was an error in Markdown 1.0.1:</p>
-
-<ul>
-<li><p>this</p>
-
-<ul><li>sub</li></ul>
-
-<p>that</p></li>
-</ul>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
deleted file mode 100644
index 7f3b49777..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
+++ /dev/null
@@ -1,131 +0,0 @@
-## Unordered
-
-Asterisks tight:
-
-* asterisk 1
-* asterisk 2
-* asterisk 3
-
-
-Asterisks loose:
-
-* asterisk 1
-
-* asterisk 2
-
-* asterisk 3
-
-* * *
-
-Pluses tight:
-
-+ Plus 1
-+ Plus 2
-+ Plus 3
-
-
-Pluses loose:
-
-+ Plus 1
-
-+ Plus 2
-
-+ Plus 3
-
-* * *
-
-
-Minuses tight:
-
-- Minus 1
-- Minus 2
-- Minus 3
-
-
-Minuses loose:
-
-- Minus 1
-
-- Minus 2
-
-- Minus 3
-
-
-## Ordered
-
-Tight:
-
-1. First
-2. Second
-3. Third
-
-and:
-
-1. One
-2. Two
-3. Three
-
-
-Loose using tabs:
-
-1. First
-
-2. Second
-
-3. Third
-
-and using spaces:
-
-1. One
-
-2. Two
-
-3. Three
-
-Multiple paragraphs:
-
-1. Item 1, graf one.
-
- Item 2. graf two. The quick brown fox jumped over the lazy dog's
- back.
-
-2. Item 2.
-
-3. Item 3.
-
-
-
-## Nested
-
-* Tab
- * Tab
- * Tab
-
-Here's another:
-
-1. First
-2. Second:
- * Fee
- * Fie
- * Foe
-3. Third
-
-Same thing but with paragraphs:
-
-1. First
-
-2. Second:
- * Fee
- * Fie
- * Foe
-
-3. Third
-
-
-This was an error in Markdown 1.0.1:
-
-* this
-
- * sub
-
- that
diff --git a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html
deleted file mode 100644
index 71ec78c70..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<p><strong><em>This is strong and em.</em></strong></p>
-
-<p>So is <strong><em>this</em></strong> word.</p>
-
-<p><strong><em>This is strong and em.</em></strong></p>
-
-<p>So is <strong><em>this</em></strong> word.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text
deleted file mode 100644
index 95ee690db..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text
+++ /dev/null
@@ -1,7 +0,0 @@
-***This is strong and em.***
-
-So is ***this*** word.
-
-___This is strong and em.___
-
-So is ___this___ word.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tabs.html b/tests/MarkdownTest_1.0.3/Tests/Tabs.html
deleted file mode 100644
index 3301ba803..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Tabs.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<ul>
-<li><p>this is a list item
-indented with tabs</p></li>
-<li><p>this is a list item
-indented with spaces</p></li>
-</ul>
-
-<p>Code:</p>
-
-<pre><code>this code block is indented by one tab
-</code></pre>
-
-<p>And:</p>
-
-<pre><code> this code block is indented by two tabs
-</code></pre>
-
-<p>And:</p>
-
-<pre><code>+ this is an example list item
- indented with tabs
-
-+ this is an example list item
- indented with spaces
-</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tabs.text b/tests/MarkdownTest_1.0.3/Tests/Tabs.text
deleted file mode 100644
index 589d1136e..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Tabs.text
+++ /dev/null
@@ -1,21 +0,0 @@
-+ this is a list item
- indented with tabs
-
-+ this is a list item
- indented with spaces
-
-Code:
-
- this code block is indented by one tab
-
-And:
-
- this code block is indented by two tabs
-
-And:
-
- + this is an example list item
- indented with tabs
-
- + this is an example list item
- indented with spaces
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tidyness.html b/tests/MarkdownTest_1.0.3/Tests/Tidyness.html
deleted file mode 100644
index f2a8ce70f..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Tidyness.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<blockquote>
-<p>A list within a blockquote:</p>
-<ul>
-<li>asterisk 1</li>
-<li>asterisk 2</li>
-<li>asterisk 3</li>
-</ul>
-</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tidyness.text b/tests/MarkdownTest_1.0.3/Tests/Tidyness.text
deleted file mode 100644
index 5f18b8da2..000000000
--- a/tests/MarkdownTest_1.0.3/Tests/Tidyness.text
+++ /dev/null
@@ -1,5 +0,0 @@
-> A list within a blockquote:
->
-> * asterisk 1
-> * asterisk 2
-> * asterisk 3
diff --git a/tests/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs
index c1efd1b68..8ff23ebc1 100644
--- a/tests/Tests/Readers/LaTeX.hs
+++ b/tests/Tests/Readers/LaTeX.hs
@@ -21,7 +21,7 @@ tests = [ testGroup "basic"
[ "simple" =:
"word" =?> para "word"
, "space" =:
- "some text" =?> para ("some text")
+ "some text" =?> para "some text"
, "emphasized" =:
"\\emph{emphasized}" =?> para (emph "emphasized")
]
diff --git a/tests/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs
index b04ff9a0d..492680a35 100644
--- a/tests/Tests/Readers/Markdown.hs
+++ b/tests/Tests/Readers/Markdown.hs
@@ -171,13 +171,13 @@ tests = [ testGroup "inline code"
, testGroup "smart punctuation"
[ test markdownSmart "quote before ellipses"
("'...hi'"
- =?> para (singleQuoted ("…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»"))
+ =?> 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/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
new file mode 100644
index 000000000..8c5982302
--- /dev/null
+++ b/tests/Tests/Readers/Org.hs
@@ -0,0 +1,533 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Tests.Readers.Org (tests) where
+
+import Text.Pandoc.Definition
+import Test.Framework
+import Tests.Helpers
+import Tests.Arbitrary()
+import Text.Pandoc.Builder
+import Text.Pandoc
+import Data.List (intersperse)
+import Data.Monoid (mempty, mconcat)
+
+org :: String -> Pandoc
+org = readOrg def
+
+infix 4 =:
+(=:) :: ToString c
+ => String -> (String, c) -> Test
+(=:) = test org
+
+spcSep :: [Inlines] -> Inlines
+spcSep = mconcat . intersperse space
+
+simpleTable' :: Int
+ -> [Blocks]
+ -> [[Blocks]]
+ -> Blocks
+simpleTable' n = table "" (take n $ repeat (AlignDefault, 0.0))
+
+tests :: [Test]
+tests =
+ [ testGroup "Inlines" $
+ [ "Plain String" =:
+ "Hello, World" =?>
+ para (spcSep [ "Hello,", "World" ])
+
+ , "Emphasis" =:
+ "/Planet Punk/" =?>
+ para (emph . spcSep $ ["Planet", "Punk"])
+
+ , "Strong" =:
+ "*Cider*" =?>
+ para (strong "Cider")
+
+ , "Strikeout" =:
+ "+Kill Bill+" =?>
+ para (strikeout . spcSep $ [ "Kill", "Bill" ])
+
+ , "Code" =:
+ "=Robot.rock()=" =?>
+ para (code "Robot.rock()")
+
+ , "Verbatim" =:
+ "~word for word~" =?>
+ para (rawInline "" "word for word")
+
+ , "Symbol" =:
+ "A * symbol" =?>
+ para (str "A" <> space <> str "*" <> space <> "symbol")
+
+ , "Superscript single char" =:
+ "2^n" =?>
+ para (str "2" <> superscript "n")
+
+ , "Superscript multi char" =:
+ "2^{n-1}" =?>
+ para (str "2" <> superscript "n-1")
+
+ , "Subscript single char" =:
+ "a_n" =?>
+ para (str "a" <> subscript "n")
+
+ , "Subscript multi char" =:
+ "a_{n+1}" =?>
+ para (str "a" <> subscript "n+1")
+
+ , "Markup-chars not occuring on word break are symbols" =:
+ unlines [ "this+that+ +so+on"
+ , "seven*eight* nine*"
+ , "+not+funny+"
+ ] =?>
+ para (spcSep [ "this+that+", "+so+on"
+ , "seven*eight*", "nine*"
+ , strikeout "not+funny"
+ ])
+
+ , "Markup may not span more than two lines" =:
+ unlines [ "/this *is", "not*", "emph/" ] =?>
+ para (spcSep [ "/this"
+ , (strong ("is" <> space <> "not"))
+ , "emph/" ])
+
+ , "Explicit link" =:
+ "[[http://zeitlens.com/][pseudo-random nonsense]]" =?>
+ (para $ link "http://zeitlens.com/" ""
+ ("pseudo-random" <> space <> "nonsense"))
+
+ , "Self-link" =:
+ "[[http://zeitlens.com/]]" =?>
+ (para $ link "http://zeitlens.com/" "" "http://zeitlens.com/")
+ ]
+
+ , testGroup "Meta Information" $
+ [ "Comment" =:
+ "# Nothing to see here" =?>
+ (mempty::Blocks)
+
+ , "Not a comment" =:
+ "#-tag" =?>
+ para "#-tag"
+
+ , "Comment surrounded by Text" =:
+ unlines [ "Before"
+ , "# Comment"
+ , "After"
+ ] =?>
+ mconcat [ para "Before"
+ , para "After"
+ ]
+
+ , "Title" =:
+ "#+TITLE: Hello, World" =?>
+ let titleInline = toList $ "Hello," <> space <> "World"
+ meta = setMeta "title" (MetaInlines titleInline) $ nullMeta
+ in Pandoc meta mempty
+
+ , "Author" =:
+ "#+author: Albert /Emacs-Fanboy/ Krewinkel" =?>
+ let author = toList . spcSep $ [ "Albert", emph "Emacs-Fanboy", "Krewinkel" ]
+ meta = setMeta "author" (MetaInlines author) $ nullMeta
+ in Pandoc meta mempty
+
+ , "Date" =:
+ "#+Date: Feb. *28*, 2014" =?>
+ let date = toList . spcSep $ [ "Feb.", (strong "28") <> ",", "2014" ]
+ meta = setMeta "date" (MetaInlines date) $ nullMeta
+ in Pandoc meta mempty
+
+ , "Description" =:
+ "#+DESCRIPTION: Explanatory text" =?>
+ let description = toList . spcSep $ [ "Explanatory", "text" ]
+ meta = setMeta "description" (MetaInlines description) $ nullMeta
+ in Pandoc meta mempty
+
+ , "Properties drawer" =:
+ unlines [ " :PROPERTIES:"
+ , " :setting: foo"
+ , " :END:"
+ ] =?>
+ (mempty::Blocks)
+
+ , "Logbook drawer" =:
+ unlines [ " :LogBook:"
+ , " - State \"DONE\" from \"TODO\" [2014-03-03 Mon 11:00]"
+ , " :END:"
+ ] =?>
+ (mempty::Blocks)
+
+ , "Drawer surrounded by text" =:
+ unlines [ "Before"
+ , ":PROPERTIES:"
+ , ":END:"
+ , "After"
+ ] =?>
+ para "Before" <> para "After"
+
+ , "Drawer start is the only text in first line of a drawer" =:
+ unlines [ " :LOGBOOK: foo"
+ , " :END:"
+ ] =?>
+ para (spcSep [ ":LOGBOOK:", "foo", ":END:" ])
+
+ , "Drawers with unknown names are just text" =:
+ unlines [ ":FOO:"
+ , ":END:"
+ ] =?>
+ para (":FOO:" <> space <> ":END:")
+ ]
+
+ , testGroup "Basic Blocks" $
+ [ "Paragraph" =:
+ "Paragraph\n" =?>
+ para "Paragraph"
+
+ , "First Level Header" =:
+ "* Headline\n" =?>
+ header 1 "Headline"
+
+ , "Third Level Header" =:
+ "*** Third Level Headline\n" =?>
+ header 3 ("Third" <> space <>
+ "Level" <> space <>
+ "Headline")
+
+ , "Compact Headers with Paragraph" =:
+ unlines [ "* First Level"
+ , "** Second Level"
+ , " Text"
+ ] =?>
+ mconcat [ header 1 ("First" <> space <> "Level")
+ , header 2 ("Second" <> space <> "Level")
+ , para "Text"
+ ]
+
+ , "Separated Headers with Paragraph" =:
+ unlines [ "* First Level"
+ , ""
+ , "** Second Level"
+ , ""
+ , " Text"
+ ] =?>
+ mconcat [ header 1 ("First" <> space <> "Level")
+ , header 2 ("Second" <> space <> "Level")
+ , para "Text"
+ ]
+
+ , "Headers not preceded by a blank line" =:
+ unlines [ "** eat dinner"
+ , "Spaghetti and meatballs tonight."
+ , "** walk dog"
+ ] =?>
+ mconcat [ header 2 ("eat" <> space <> "dinner")
+ , para $ spcSep [ "Spaghetti", "and", "meatballs", "tonight." ]
+ , header 2 ("walk" <> space <> "dog")
+ ]
+
+ , "Paragraph starting with an asterisk" =:
+ "*five" =?>
+ para "*five"
+
+ , "Paragraph containing asterisk at beginning of line" =:
+ unlines [ "lucky"
+ , "*star"
+ ] =?>
+ para ("lucky" <> space <> "*star")
+
+ , "Example block" =:
+ unlines [ ": echo hello"
+ , ": echo dear tester"
+ ] =?>
+ codeBlockWith ("", ["example"], []) "echo hello\necho dear tester\n"
+
+ , "Example block surrounded by text" =:
+ unlines [ "Greetings"
+ , ": echo hello"
+ , ": echo dear tester"
+ , "Bye"
+ ] =?>
+ mconcat [ para "Greetings"
+ , codeBlockWith ("", ["example"], [])
+ "echo hello\necho dear tester\n"
+ , para "Bye"
+ ]
+
+ , "Horizontal Rule" =:
+ unlines [ "before"
+ , "-----"
+ , "after"
+ ] =?>
+ mconcat [ para "before"
+ , horizontalRule
+ , para "after"
+ ]
+
+ , "Not a Horizontal Rule" =:
+ "----- five dashes" =?>
+ (para $ spcSep [ "-----", "five", "dashes" ])
+
+ , "Comment Block" =:
+ unlines [ "#+BEGIN_COMMENT"
+ , "stuff"
+ , "bla"
+ , "#+END_COMMENT"] =?>
+ (mempty::Blocks)
+
+ , "Source Block in Text" =:
+ unlines [ "Low German greeting"
+ , " #+BEGIN_SRC haskell"
+ , " main = putStrLn greeting"
+ , " where greeting = \"moin\""
+ , " #+END_SRC" ] =?>
+ let attr' = ("", ["haskell"], [])
+ code' = "main = putStrLn greeting\n" ++
+ " where greeting = \"moin\"\n"
+ in mconcat [ para $ spcSep [ "Low", "German", "greeting" ]
+ , codeBlockWith attr' code'
+ ]
+
+ , "Source Block" =:
+ unlines [ " #+BEGIN_SRC haskell"
+ , " main = putStrLn greeting"
+ , " where greeting = \"moin\""
+ , " #+END_SRC" ] =?>
+ let attr' = ("", ["haskell"], [])
+ code' = "main = putStrLn greeting\n" ++
+ " where greeting = \"moin\"\n"
+ in codeBlockWith attr' code'
+ ]
+
+ , testGroup "Lists" $
+ [ "Simple Bullet Lists" =:
+ ("- Item1\n" ++
+ "- Item2\n") =?>
+ bulletList [ plain "Item1"
+ , plain "Item2"
+ ]
+
+ , "Indented Bullet Lists" =:
+ (" - Item1\n" ++
+ " - Item2\n") =?>
+ bulletList [ plain "Item1"
+ , plain "Item2"
+ ]
+
+ , "Multi-line Bullet Lists" =:
+ ("- *Fat\n" ++
+ " Tony*\n" ++
+ "- /Sideshow\n" ++
+ " Bob/") =?>
+ bulletList [ plain $ strong ("Fat" <> space <> "Tony")
+ , plain $ emph ("Sideshow" <> space <> "Bob")
+ ]
+
+ , "Nested Bullet Lists" =:
+ ("- Discovery\n" ++
+ " + One More Time\n" ++
+ " + Harder, Better, Faster, Stronger\n" ++
+ "- Homework\n" ++
+ " + Around the World\n"++
+ "- Human After All\n" ++
+ " + Technologic\n" ++
+ " + Robot Rock\n") =?>
+ bulletList [ mconcat
+ [ para "Discovery"
+ , bulletList [ plain ("One" <> space <>
+ "More" <> space <>
+ "Time")
+ , plain ("Harder," <> space <>
+ "Better," <> space <>
+ "Faster," <> space <>
+ "Stronger")
+ ]
+ ]
+ , mconcat
+ [ para "Homework"
+ , bulletList [ plain ("Around" <> space <>
+ "the" <> space <>
+ "World")
+ ]
+ ]
+ , mconcat
+ [ para ("Human" <> space <> "After" <> space <> "All")
+ , bulletList [ plain "Technologic"
+ , plain ("Robot" <> space <> "Rock")
+ ]
+ ]
+ ]
+
+ , "Simple Ordered List" =:
+ ("1. Item1\n" ++
+ "2. Item2\n") =?>
+ let listStyle = (1, DefaultStyle, DefaultDelim)
+ listStructure = [ plain "Item1"
+ , plain "Item2"
+ ]
+ in orderedListWith listStyle listStructure
+
+ , "Simple Ordered List with Parens" =:
+ ("1) Item1\n" ++
+ "2) Item2\n") =?>
+ let listStyle = (1, DefaultStyle, DefaultDelim)
+ listStructure = [ plain "Item1"
+ , plain "Item2"
+ ]
+ in orderedListWith listStyle listStructure
+
+ , "Indented Ordered List" =:
+ (" 1. Item1\n" ++
+ " 2. Item2\n") =?>
+ let listStyle = (1, DefaultStyle, DefaultDelim)
+ listStructure = [ plain "Item1"
+ , plain "Item2"
+ ]
+ in orderedListWith listStyle listStructure
+
+ , "Nested Ordered Lists" =:
+ ("1. One\n" ++
+ " 1. One-One\n" ++
+ " 2. One-Two\n" ++
+ "2. Two\n" ++
+ " 1. Two-One\n"++
+ " 2. Two-Two\n") =?>
+ let listStyle = (1, DefaultStyle, DefaultDelim)
+ listStructure = [ mconcat
+ [ para "One"
+ , orderedList [ plain "One-One"
+ , plain "One-Two"
+ ]
+ ]
+ , mconcat
+ [ para "Two"
+ , orderedList [ plain "Two-One"
+ , plain "Two-Two"
+ ]
+ ]
+ ]
+ in orderedListWith listStyle listStructure
+
+ , "Ordered List in Bullet List" =:
+ ("- Emacs\n" ++
+ " 1. Org\n") =?>
+ bulletList [ (para "Emacs") <>
+ (orderedList [ plain "Org"])
+ ]
+
+ , "Bullet List in Ordered List" =:
+ ("1. GNU\n" ++
+ " - Freedom\n") =?>
+ orderedList [ (para "GNU") <> bulletList [ (plain "Freedom") ] ]
+ ]
+
+ , testGroup "Tables"
+ [ "Single cell table" =:
+ "|Test|" =?>
+ simpleTable' 1 mempty [[plain "Test"]]
+
+ , "Multi cell table" =:
+ "| One | Two |" =?>
+ simpleTable' 2 mempty [ [ plain "One", plain "Two" ] ]
+
+ , "Multi line table" =:
+ unlines [ "| One |"
+ , "| Two |"
+ , "| Three |"
+ ] =?>
+ simpleTable' 1 mempty
+ [ [ plain "One" ]
+ , [ plain "Two" ]
+ , [ plain "Three" ]
+ ]
+
+ , "Empty table" =:
+ "||" =?>
+ simpleTable' 1 mempty mempty
+
+ , "Glider Table" =:
+ unlines [ "| 1 | 0 | 0 |"
+ , "| 0 | 1 | 1 |"
+ , "| 1 | 1 | 0 |"
+ ] =?>
+ simpleTable' 3 mempty
+ [ [ plain "1", plain "0", plain "0" ]
+ , [ plain "0", plain "1", plain "1" ]
+ , [ plain "1", plain "1", plain "0" ]
+ ]
+
+ , "Table between Paragraphs" =:
+ unlines [ "Before"
+ , "| One | Two |"
+ , "After"
+ ] =?>
+ mconcat [ para "Before"
+ , simpleTable' 2 mempty [ [ plain "One", plain "Two" ] ]
+ , para "After"
+ ]
+
+ , "Table with Header" =:
+ unlines [ "| Species | Status |"
+ , "|--------------+--------------|"
+ , "| cervisiae | domesticated |"
+ , "| paradoxus | wild |"
+ ] =?>
+ simpleTable [ plain "Species", plain "Status" ]
+ [ [ plain "cervisiae", plain "domesticated" ]
+ , [ plain "paradoxus", plain "wild" ]
+ ]
+
+ , "Table with final hline" =:
+ unlines [ "| cervisiae | domesticated |"
+ , "| paradoxus | wild |"
+ , "|--------------+--------------|"
+ ] =?>
+ simpleTable' 2 mempty
+ [ [ plain "cervisiae", plain "domesticated" ]
+ , [ plain "paradoxus", plain "wild" ]
+ ]
+
+ , "Table in a box" =:
+ unlines [ "|---------|---------|"
+ , "| static | Haskell |"
+ , "| dynamic | Lisp |"
+ , "|---------+---------|"
+ ] =?>
+ simpleTable' 2 mempty
+ [ [ plain "static", plain "Haskell" ]
+ , [ plain "dynamic", plain "Lisp" ]
+ ]
+
+ , "Table with alignment row" =:
+ unlines [ "| Numbers | Text | More |"
+ , "| <c> | <r> | |"
+ , "| 1 | One | foo |"
+ , "| 2 | Two | bar |"
+ ] =?>
+ table "" (zip [AlignCenter, AlignRight, AlignDefault] [0, 0, 0])
+ []
+ [ [ plain "Numbers", plain "Text", plain "More" ]
+ , [ plain "1" , plain "One" , plain "foo" ]
+ , [ plain "2" , plain "Two" , plain "bar" ]
+ ]
+
+ , "Pipe within text doesn't start a table" =:
+ "Ceci n'est pas une | pipe " =?>
+ para (spcSep [ "Ceci", "n'est", "pas", "une", "|", "pipe" ])
+
+ , "Missing pipe at end of row" =:
+ "|incomplete-but-valid" =?>
+ simpleTable' 1 mempty [ [ plain "incomplete-but-valid" ] ]
+
+ , "Table with differing row lengths" =:
+ unlines [ "| Numbers | Text "
+ , "|-"
+ , "| <c> | <r> |"
+ , "| 1 | One | foo |"
+ , "| 2"
+ ] =?>
+ table "" (zip [AlignCenter, AlignRight, AlignDefault] [0, 0, 0])
+ [ plain "Numbers", plain "Text" , plain mempty ]
+ [ [ plain "1" , plain "One" , plain "foo" ]
+ , [ plain "2" , plain mempty , plain mempty ]
+ ]
+ ]
+ ]
diff --git a/tests/Tests/Walk.hs b/tests/Tests/Walk.hs
index f6aa1beae..34350e28a 100644
--- a/tests/Tests/Walk.hs
+++ b/tests/Tests/Walk.hs
@@ -21,11 +21,11 @@ tests = [ testGroup "Walk"
p_walk :: (Typeable a, Walkable a Pandoc)
=> (a -> a) -> Pandoc -> Bool
-p_walk f = (\(d :: Pandoc) -> everywhere (mkT f) d == walk f d)
+p_walk f d = everywhere (mkT f) d == walk f d
p_query :: (Eq a, Typeable a1, Monoid a, Walkable a1 Pandoc)
=> (a1 -> a) -> Pandoc -> Bool
-p_query f = (\(d :: Pandoc) -> everything mappend (mempty `mkQ` f) d == query f d)
+p_query f d = everything mappend (mempty `mkQ` f) d == query f d
inlineTrans :: Inline -> Inline
inlineTrans (Str xs) = Str $ map toUpper xs
diff --git a/tests/html-reader.native b/tests/html-reader.native
index 15937e594..e80905729 100644
--- a/tests/html-reader.native
+++ b/tests/html-reader.native
@@ -1,4 +1,4 @@
-Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
+Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("title",MetaInlines [Str "Pandoc",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",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 "'",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
,HorizontalRule
,Header 1 ("",[],[]) [Str "Headers"]
@@ -207,18 +207,18 @@ Pandoc (Meta {unMeta = fromList [("title",MetaInlines [Str "Pandoc",Space,Str "T
,BulletList
[[Plain [Str "\\cite[22",Str "-",Str "23]{smith",Str ".",Str "1899}"]]
,[Plain [Str "\\doublespacing"]]
- ,[Plain [Str "$2+2=4$"]]
- ,[Plain [Str "$x",Space,Str "\\in",Space,Str "y$"]]
- ,[Plain [Str "$\\alpha",Space,Str "\\wedge",Space,Str "\\omega$"]]
- ,[Plain [Str "$223$"]]
- ,[Plain [Str "$p$",Str "-",Str "Tree"]]
- ,[Plain [Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)",Str "-",Str "f(x)}{h}$"]]
- ,[Plain [Str "Here",Str "'",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,Str "$\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2$",Str "."]]]
+ ,[Plain [Str "$",Str "2+2=4",Str "$"]]
+ ,[Plain [Str "$",Str "x",Space,Str "\\in",Space,Str "y",Str "$"]]
+ ,[Plain [Str "$",Str "\\alpha",Space,Str "\\wedge",Space,Str "\\omega",Str "$"]]
+ ,[Plain [Str "$",Str "223",Str "$"]]
+ ,[Plain [Str "$",Str "p",Str "$",Str "-",Str "Tree"]]
+ ,[Plain [Str "$",Str "\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)",Str "-",Str "f(x)}{h}",Str "$"]]
+ ,[Plain [Str "Here",Str "'",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,Str "$",Str "\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2",Str "$",Str "."]]]
,Para [Str "These",Space,Str "shouldn",Str "'",Str "t",Space,Str "be",Space,Str "math:"]
,BulletList
[[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
- ,[Plain [Str "$22,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 "$34,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"",Str "lot",Str "\"",Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]]
- ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$",Str "."]]]
+ ,[Plain [Str "$",Str "22,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,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"",Str "lot",Str "\"",Space,Str "is",Space,Str "emphasized",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",Str "'",Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
,Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",Space,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
,HorizontalRule
diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex
index 51c62f98a..78f072600 100644
--- a/tests/lhs-test.latex
+++ b/tests/lhs-test.latex
@@ -1,5 +1,4 @@
\documentclass[]{article}
-\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
@@ -7,6 +6,7 @@
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+ \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs
index 606d49a12..50a0e15e1 100644
--- a/tests/lhs-test.latex+lhs
+++ b/tests/lhs-test.latex+lhs
@@ -1,5 +1,4 @@
\documentclass[]{article}
-\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
@@ -7,6 +6,7 @@
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+ \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
diff --git a/tests/lhs-test.markdown b/tests/lhs-test.markdown
index 47ec920d3..75a253bf4 100644
--- a/tests/lhs-test.markdown
+++ b/tests/lhs-test.markdown
@@ -4,11 +4,11 @@ lhs test
`unsplit` is an arrow that takes a pair of values and combines them to return
a single value:
-~~~~ {.sourceCode .literate .haskell}
+``` {.sourceCode .literate .haskell}
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
unsplit = arr . uncurry
-- arr (\op (x,y) -> x `op` y)
-~~~~
+```
`(***)` 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
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index ca588571f..27f09dada 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -40,7 +40,7 @@
,OrderedList (3,Example,TwoParens)
[[Plain [Str "Third",Space,Str "example."]]]
,Header 2 ("macros",[],[]) [Str "Macros"]
-,Para [Math InlineMath "\\langle x,y \\rangle"]
+,Para [Math InlineMath "{\\langle x,y \\rangle}"]
,Header 2 ("case-insensitive-references",[],[]) [Str "Case-insensitive",Space,Str "references"]
,Para [Link [Str "Fum"] ("/fum","")]
,Para [Link [Str "FUM"] ("/fum","")]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index 26f4ef164..c0c22bec6 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -232,11 +232,11 @@ ends the list.
<li>list item A2</li>
</ol>
-<ul>
+<ol>
#abc
#def
#ghi
-</ul>
+</ol>
<ol start="9">
<li>Amsterdam</li>
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
index 497810f39..fd48bc60c 100644
--- a/tests/rst-reader.native
+++ b/tests/rst-reader.native
@@ -319,5 +319,15 @@ Pandoc (Meta {unMeta = fromList [("authors",MetaList [MetaInlines [Str "John",Sp
,Para [Str "Some",Space,Superscript [Str "of"],Space,Str "these",Space,Superscript [Str "words"],Space,Str "are",Space,Str "in",Space,Superscript [Str "superscript"],Str "."]
,Para [Str "Reset",Space,Str "default-role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default."]
,Para [Str "And",Space,Str "now",Space,Str "some-invalid-string-3231231",Space,Str "is",Space,Str "nonsense."]
+,Null
+,Para [Str "And",Space,Str "now",Space,Str "with",Space,RawInline (Format "html") "<b>inline</b> <span id=\"test\">HTML</span>",Str "."]
+,Null
+,Para [Str "And",Space,Str "some",Space,Str "inline",Space,Str "haskell",Space,Code ("",["sourceCode","haskell"],[]) "fmap id [1,2..10]",Str "."]
+,Null
+,Null
+,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["sourceCode","python"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]
+,Null
+,Null
+,Para [Str "Different",Space,Str "indirect",Space,Str "C",Space,Code ("",["sourceCode","c"],[]) "int x = 15;",Str "."]
,Header 2 ("literal-symbols",[],[]) [Str "Literal",Space,Str "symbols"]
,Para [Str "2*2",Space,Str "=",Space,Str "4*1"]]
diff --git a/tests/rst-reader.rst b/tests/rst-reader.rst
index 748bfe0a5..930bf2ed2 100644
--- a/tests/rst-reader.rst
+++ b/tests/rst-reader.rst
@@ -599,6 +599,30 @@ Reset default-role to the default default.
And now `some-invalid-string-3231231` is nonsense.
+.. role:: html(raw)
+ :format: html
+
+And now with :html:`<b>inline</b> <span id="test">HTML</span>`.
+
+.. role:: haskell(code)
+ :language: haskell
+
+And some inline haskell :haskell:`fmap id [1,2..10]`.
+
+.. role:: indirect(code)
+
+.. role:: python(indirect)
+ :language: python
+
+Indirect python role :python:`[x*x for x in [1,2,3,4,5]]`.
+
+.. role:: different-indirect(code)
+ :language: c
+
+.. role:: c(different-indirect)
+
+Different indirect C :c:`int x = 15;`.
+
Literal symbols
---------------
diff --git a/tests/tables.latex b/tests/tables.latex
index c27e10461..1a87c4f71 100644
--- a/tests/tables.latex
+++ b/tests/tables.latex
@@ -1,59 +1,59 @@
Simple table with caption:
\begin{longtable}[c]{@{}rlcl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
Right & Left & Center & Default
-\\\noalign{\medskip}
-\hline\noalign{\medskip}
+\\\addlinespace
+\midrule\endhead
12 & 12 & 12 & 12
-\\\noalign{\medskip}
+\\\addlinespace
123 & 123 & 123 & 123
-\\\noalign{\medskip}
+\\\addlinespace
1 & 1 & 1 & 1
-\\\noalign{\medskip}
-\hline
-\noalign{\medskip}
+\\\addlinespace
+\bottomrule
+\addlinespace
\caption{Demonstration of simple table syntax.}
\end{longtable}
Simple table without caption:
\begin{longtable}[c]{@{}rlcl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
Right & Left & Center & Default
-\\\noalign{\medskip}
-\hline\noalign{\medskip}
+\\\addlinespace
+\midrule\endhead
12 & 12 & 12 & 12
-\\\noalign{\medskip}
+\\\addlinespace
123 & 123 & 123 & 123
-\\\noalign{\medskip}
+\\\addlinespace
1 & 1 & 1 & 1
-\\\noalign{\medskip}
-\hline
+\\\addlinespace
+\bottomrule
\end{longtable}
Simple table indented two spaces:
\begin{longtable}[c]{@{}rlcl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
Right & Left & Center & Default
-\\\noalign{\medskip}
-\hline\noalign{\medskip}
+\\\addlinespace
+\midrule\endhead
12 & 12 & 12 & 12
-\\\noalign{\medskip}
+\\\addlinespace
123 & 123 & 123 & 123
-\\\noalign{\medskip}
+\\\addlinespace
1 & 1 & 1 & 1
-\\\noalign{\medskip}
-\hline
-\noalign{\medskip}
+\\\addlinespace
+\bottomrule
+\addlinespace
\caption{Demonstration of simple table syntax.}
\end{longtable}
Multiline table with caption:
\begin{longtable}[c]{@{}clrl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
\begin{minipage}[b]{0.13\columnwidth}\centering
Centered Header
\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
@@ -63,8 +63,8 @@ Right Aligned
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
Default aligned
\end{minipage}
-\\\noalign{\medskip}
-\hline\noalign{\medskip}
+\\\addlinespace
+\midrule\endhead
\begin{minipage}[t]{0.13\columnwidth}\centering
First
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -74,7 +74,7 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Example of a row that spans multiple lines.
\end{minipage}
-\\\noalign{\medskip}
+\\\addlinespace
\begin{minipage}[t]{0.13\columnwidth}\centering
Second
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -84,16 +84,16 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage}
-\\\noalign{\medskip}
-\hline
-\noalign{\medskip}
+\\\addlinespace
+\bottomrule
+\addlinespace
\caption{Here's the caption. It may span multiple lines.}
\end{longtable}
Multiline table without caption:
\begin{longtable}[c]{@{}clrl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
\begin{minipage}[b]{0.13\columnwidth}\centering
Centered Header
\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
@@ -103,8 +103,8 @@ Right Aligned
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
Default aligned
\end{minipage}
-\\\noalign{\medskip}
-\hline\noalign{\medskip}
+\\\addlinespace
+\midrule\endhead
\begin{minipage}[t]{0.13\columnwidth}\centering
First
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -114,7 +114,7 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Example of a row that spans multiple lines.
\end{minipage}
-\\\noalign{\medskip}
+\\\addlinespace
\begin{minipage}[t]{0.13\columnwidth}\centering
Second
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -124,27 +124,27 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage}
-\\\noalign{\medskip}
-\hline
+\\\addlinespace
+\bottomrule
\end{longtable}
Table without column headers:
\begin{longtable}[c]{@{}rlcr@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
12 & 12 & 12 & 12
-\\\noalign{\medskip}
+\\\addlinespace
123 & 123 & 123 & 123
-\\\noalign{\medskip}
+\\\addlinespace
1 & 1 & 1 & 1
-\\\noalign{\medskip}
-\hline
+\\\addlinespace
+\bottomrule
\end{longtable}
Multiline table without column headers:
\begin{longtable}[c]{@{}clrl@{}}
-\hline\noalign{\medskip}
+\toprule\addlinespace
\begin{minipage}[t]{0.13\columnwidth}\centering
First
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -154,7 +154,7 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Example of a row that spans multiple lines.
\end{minipage}
-\\\noalign{\medskip}
+\\\addlinespace
\begin{minipage}[t]{0.13\columnwidth}\centering
Second
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
@@ -164,6 +164,6 @@ row
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
Here's another one. Note the blank line between rows.
\end{minipage}
-\\\noalign{\medskip}
-\hline
+\\\addlinespace
+\bottomrule
\end{longtable}
diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs
index ae521541a..74f8e5044 100644
--- a/tests/test-pandoc.hs
+++ b/tests/test-pandoc.hs
@@ -7,6 +7,7 @@ import GHC.IO.Encoding
import qualified Tests.Old
import qualified Tests.Readers.LaTeX
import qualified Tests.Readers.Markdown
+import qualified Tests.Readers.Org
import qualified Tests.Readers.RST
import qualified Tests.Writers.ConTeXt
import qualified Tests.Writers.LaTeX
@@ -31,6 +32,7 @@ tests = [ testGroup "Old" Tests.Old.tests
, testGroup "Readers"
[ testGroup "LaTeX" Tests.Readers.LaTeX.tests
, testGroup "Markdown" Tests.Readers.Markdown.tests
+ , testGroup "Org" Tests.Readers.Org.tests
, testGroup "RST" Tests.Readers.RST.tests
]
]
diff --git a/tests/writer.latex b/tests/writer.latex
index 9431f43b1..4cb989fba 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -1,5 +1,4 @@
\documentclass[]{article}
-\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
@@ -7,6 +6,7 @@
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
+ \usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
diff --git a/windows/make-windows-installer.bat b/windows/make-windows-installer.bat
index cf20bc98c..d27859057 100644
--- a/windows/make-windows-installer.bat
+++ b/windows/make-windows-installer.bat
@@ -10,7 +10,6 @@ cabal-dev install -v1 --reinstall --flags="embed_data_files" pandoc-citeproc
if %errorlevel% neq 0 exit /b %errorlevel%
strip cabal-dev\bin\pandoc.exe
strip cabal-dev\bin\pandoc-citeproc.exe
-strip cabal-dev\bin\biblio2yaml.exe
cabal-dev\bin\pandoc.exe -s --template data\templates\default.html -S README -o README.html
if %errorlevel% neq 0 exit /b %errorlevel%
cabal-dev\bin\pandoc.exe -s --template data\templates\default.rtf COPYING -t rtf -S -o COPYING.rtf
diff --git a/windows/pandoc.wxs b/windows/pandoc.wxs
index 5fe0a022e..7a20effe5 100644
--- a/windows/pandoc.wxs
+++ b/windows/pandoc.wxs
@@ -57,8 +57,6 @@
Name="Version" Type="string" Value="[ProductVersion]" KeyPath="yes"/>
<File Id="pandoc_citeprocEXE" Name="pandoc-citeproc.exe"
Source="..\cabal-dev\bin\pandoc-citeproc.exe" />
- <File Id="biblio2yamlEXE" Name="biblio2yaml.exe"
- Source="..\cabal-dev\bin\biblio2yaml.exe" />
</Component>
<Component Id="UpdatePathUser"