summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rw-r--r--CONTRIBUTING.md33
-rw-r--r--INSTALL22
-rw-r--r--README17
-rw-r--r--data/bash_completion.tpl62
m---------data/templates11
-rw-r--r--man/pandoc.170
-rw-r--r--pandoc.cabal6
-rw-r--r--pandoc.hs19
-rw-r--r--src/Text/Pandoc.hs6
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs5
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs9
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs24
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs1
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs4
-rw-r--r--src/Text/Pandoc/Readers/Org.hs17
-rw-r--r--src/Text/Pandoc/Readers/RST.hs20
-rw-r--r--src/Text/Pandoc/Shared.hs1
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs8
-rw-r--r--src/Text/Pandoc/Writers/RST.hs9
-rw-r--r--stack.yaml11
-rw-r--r--tests/Tests/Readers/Org.hs58
-rw-r--r--tests/epub/features.native6
-rw-r--r--tests/epub/formatting.native8
-rw-r--r--tests/html-reader.native66
-rw-r--r--tests/media/rId25.jpgbin0 -> 1332 bytes
-rw-r--r--tests/media/rId26.jpgbin0 -> 1332 bytes
-rw-r--r--tests/media/rId27.jpgbin0 -> 1332 bytes
-rw-r--r--tests/mediawiki-reader.wiki2
-rw-r--r--tests/rst-reader.native2
-rw-r--r--tests/rst-reader.rst4
31 files changed, 375 insertions, 132 deletions
diff --git a/.travis.yml b/.travis.yml
index 9a67ac32b..4979593d0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,14 +12,14 @@ matrix:
addons: {apt: {packages: [cabal-install-1.18, ghc-7.6.3], sources: [hvr-ghc]}}
- env: CABALVER=1.18 GHCVER=7.8.4 GHCOPTS="-Werror" JOPTS="-j2"
addons: {apt: {packages: [cabal-install-1.18, ghc-7.8.4], sources: [hvr-ghc]}}
- - env: CABALVER=1.22 GHCVER=7.10.1 GHCOPTS="" JOPTS="-j2"
- addons: {apt: {packages: [cabal-install-1.22, ghc-7.10.1],sources: [hvr-ghc]}}
+ - env: CABALVER=head GHCVER=7.10.1 GHCOPTS="" JOPTS="-j2"
+ addons: {apt: {packages: [cabal-install-head, ghc-7.10.1],sources: [hvr-ghc]}}
# - env: CABALVER=head GHCVER=head GHCOPTS="-Werror" JOPTS="-j2"
# addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
# Note: the distinction between `before_install` and `install` is not important.
before_install:
- - export PATH=/opt/ghc/$GHCVER/bin:$PATH
+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
install:
- cabal-$CABALVER update
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7b321f868..b3581f376 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -25,6 +25,32 @@ including
A small test case (just a few lines) is ideal. If your input is large,
try to whittle it down to the minimum necessary to illustrate the problem.
+Out of scope?
+-------------
+
+A less than perfect conversion does not necessarily mean there's
+a bug in pandoc. Quoting from the README:
+
+> Because Pandoc's intermediate representation of a document is less
+> expressive than many of the formats it converts between, one should
+> not expect perfect conversions between every format and every other.
+> Pandoc attempts to preserve the structural elements of a document, but
+> not formatting details such as margin size. And some document elements,
+> such as complex tables, may not fit into Pandoc's simple document
+> model. While conversions from Pandoc's Markdown to all formats aspire
+> to be perfect, conversions from formats more expressive than Pandoc's
+> Markdown can be expected to be lossy.
+
+For example, both docx and odt can represent margin size, but because
+pandoc's internal document model does not contain a representation of
+margin size, this information will be lost on converting from docx
+to odt. (You can, however, customize margin size using `--reference-odt`.)
+
+So before submitting a bug report, consider whether it might be
+"out of scope." If it concerns a feature of documents that isn't
+representable in pandoc's Markdown, then it very likely is.
+(If in doubt, you can always ask on pandoc-discuss.)
+
Fixing bugs from the issue tracker
----------------------------------
@@ -106,6 +132,13 @@ Please follow these guidelines:
9. It is better not to introduce new dependencies. Dependencies on
external C libraries should especially be avoided.
+10. We aim for compatibility with ghc versions from 7.4.2 to the
+ latest release. All pull requests and commits are tested
+ automatically on travis-ci.org, using several GHC versions.
+ We currently relax the "`-Wall` clean" requirement for GHC 7.10.x,
+ because there are so many warnings relating to the addition of
+ type classes to the Prelude.
+
Tests
-----
diff --git a/INSTALL b/INSTALL
index 4f20c9d67..3cb428db9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -8,8 +8,26 @@ There are also binary installers for Windows and Mac OS X.
If you are installing the development version from github, see also:
https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc
-Quick install
--------------
+Quick install with stack
+------------------------
+
+1. Install [stack](https://github.com/commercialhaskell/stack/wiki/Downloads).
+
+2. If you used git to get the pandoc source (as opposed to unpacking
+ a release tarball), do
+
+ git submodule update --init
+
+3. In the pandoc source directory,
+
+ stack install
+
+ You may be prompted to run `stack setup`, which will automatically
+ download the ghc compiler if needed.
+
+
+Quick install with cabal
+------------------------
1. Install the [Haskell platform]. This will give you [GHC] and
the [cabal-install] build tool.
diff --git a/README b/README
index 6164693b9..5a75c5a0b 100644
--- a/README
+++ b/README
@@ -40,6 +40,16 @@ representation of the document, and a set of writers, which convert
this native representation into a target format. Thus, adding an input
or output format requires only adding a reader or writer.
+Because Pandoc's intermediate representation of a document is less
+expressive than many of the formats it converts between, one should
+not expect perfect conversions between every format and every other.
+Pandoc attempts to preserve the structural elements of a document, but
+not formatting details such as margin size. And some document elements,
+such as complex tables, may not fit into Pandoc's simple document
+model. While conversions from Pandoc's Markdown to all formats aspire
+to be perfect, conversions from formats more expressive than Pandoc's
+Markdown can be expected to be lossy.
+
Using `pandoc`
--------------
@@ -240,6 +250,13 @@ General options
`epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
placed in this directory will override pandoc's normal defaults.
+`--bash-completiion`
+
+: Generate a bash completion script. to enable bash completion
+ with pandoc, add this to your `.bashrc`:
+
+ eval "$(pandoc --bash-completion)"
+
`--verbose`
: Give verbose debugging output. Currently this only has an effect
diff --git a/data/bash_completion.tpl b/data/bash_completion.tpl
new file mode 100644
index 000000000..6d7e17215
--- /dev/null
+++ b/data/bash_completion.tpl
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# This script enables bash autocompletion for pandoc. To enable
+# bash completion, add this to your .bashrc:
+# eval "$(pandoc --bash-completion)"
+
+_pandoc()
+{
+ local cur prev opts lastc informats outformats datadir
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ # These should be filled in by pandoc:
+ opts="%s"
+ informats="%s"
+ outformats="%s"
+ datadir="%s"
+
+ case "${prev}" in
+ --from|-f|--read|-r)
+ COMPREPLY=( $(compgen -W "${informats}" -- ${cur}) )
+ return 0
+ ;;
+ --to|-t|--write|-w|-D|--print-default-template)
+ COMPREPLY=( $(compgen -W "${outformats}" -- ${cur}) )
+ return 0
+ ;;
+ --email-obfuscation)
+ COMPREPLY=( $(compgen -W "references javascript none" -- ${cur}) )
+ return 0
+ ;;
+ --latex-engine)
+ COMPREPLY=( $(compgen -W "pdflatex lualatex xelatex" -- ${cur}) )
+ return 0
+ ;;
+ --print-default-data-file)
+ COMPREPLY=( $(compgen -W "reference.odt reference.docx $(find ${datadir} | sed -e 's/.*\/data\///')" -- ${cur}) )
+ return 0
+ ;;
+ --highlight-style)
+ COMPREPLY=( $(compgen -W "pygments tango espresso zenburn kate monochrome haddock" -- ${cur}) )
+ return 0
+ ;;
+ *)
+ ;;
+ esac
+
+ case "${cur}" in
+ -*)
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $(compgen -f ${cur}) )
+ return 0
+ ;;
+ esac
+
+}
+
+complete -F _pandoc pandoc
diff --git a/data/templates b/data/templates
-Subproject d171db3e6d28134e0f98ba10c60ac8c13380a48
+Subproject 8ea41996bf982835ab0d7559d2801e93c8b8f91
diff --git a/man/pandoc.1 b/man/pandoc.1
index 2ffd794f6..579469215 100644
--- a/man/pandoc.1
+++ b/man/pandoc.1
@@ -11,12 +11,12 @@ 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, CommonMark, and (subsets of) Textile,
reStructuredText, HTML, LaTeX, MediaWiki markup, TWiki markup, Haddock
-markup, OPML, Emacs Org\-mode, DocBook, txt2tags, EPUB and Word docx;
-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, DokuWiki
-markup, Haddock markup, EPUB (v2 or v3), FictionBook2, Textile, groff
-man pages, Emacs Org\-Mode, AsciiDoc, InDesign ICML, and Slidy,
+markup, OPML, Emacs Org\-mode, DocBook, txt2tags, EPUB, ODT and Word
+docx; 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,
+DokuWiki markup, Haddock markup, EPUB (v2 or v3), FictionBook2, Textile,
+groff man pages, Emacs Org\-Mode, AsciiDoc, InDesign ICML, and Slidy,
Slideous, DZSlides, reveal.js or S5 HTML slide shows.
It can also produce PDF output on systems where LaTeX is installed.
.PP
@@ -35,6 +35,17 @@ native representation of the document, and a set of writers, which
convert this native representation into a target format.
Thus, adding an input or output format requires only adding a reader or
writer.
+.PP
+Because Pandoc\[aq]s intermediate representation of a document is less
+expressive than many of the formats it converts between, one should not
+expect perfect conversions between every format and every other.
+Pandoc attempts to preserve the structural elements of a document, but
+not formatting details such as margin size.
+And some document elements, such as complex tables, may not fit into
+Pandoc\[aq]s simple document model.
+While conversions from Pandoc\[aq]s Markdown to all formats aspire to be
+perfect, conversions from formats more expressive than Pandoc\[aq]s
+Markdown can be expected to be lossy.
.SS Using \f[C]pandoc\f[]
.PP
If no \f[I]input\-file\f[] is specified, input is read from
@@ -77,8 +88,8 @@ pandoc\ \-f\ html\ \-t\ markdown\ http://www.fsf.org
.PP
If multiple input files are given, \f[C]pandoc\f[] will concatenate them
all (with blank lines between them) before parsing.
-This feature is disabled for binary input formats such as \f[C]EPUB\f[]
-and \f[C]docx\f[].
+This feature is disabled for binary input formats such as \f[C]EPUB\f[],
+\f[C]odt\f[], and \f[C]docx\f[].
.PP
The format of the input and output can be specified explicitly using
command\-line options.
@@ -194,10 +205,10 @@ markdown), \f[C]markdown_strict\f[] (original unextended markdown),
\f[C]markdown_github\f[] (github extended markdown), \f[C]commonmark\f[]
(CommonMark markdown), \f[C]textile\f[] (Textile), \f[C]rst\f[]
(reStructuredText), \f[C]html\f[] (HTML), \f[C]docbook\f[] (DocBook),
-\f[C]t2t\f[] (txt2tags), \f[C]docx\f[] (docx), \f[C]epub\f[] (EPUB),
-\f[C]opml\f[] (OPML), \f[C]org\f[] (Emacs Org\-mode), \f[C]mediawiki\f[]
-(MediaWiki markup), \f[C]twiki\f[] (TWiki markup), \f[C]haddock\f[]
-(Haddock markup), or \f[C]latex\f[] (LaTeX).
+\f[C]t2t\f[] (txt2tags), \f[C]docx\f[] (docx), \f[C]odt\f[] (ODT),
+\f[C]epub\f[] (EPUB), \f[C]opml\f[] (OPML), \f[C]org\f[] (Emacs
+Org\-mode), \f[C]mediawiki\f[] (MediaWiki markup), \f[C]twiki\f[] (TWiki
+markup), \f[C]haddock\f[] (Haddock markup), or \f[C]latex\f[] (LaTeX).
If \f[C]+lhs\f[] is appended to \f[C]markdown\f[], \f[C]rst\f[],
\f[C]latex\f[], or \f[C]html\f[], the input will be treated as literate
Haskell source: see Literate Haskell support, below.
@@ -297,6 +308,19 @@ at the output of \f[C]pandoc\ \-\-version\f[].) A
will override pandoc\[aq]s normal defaults.
.RE
.TP
+.B \f[C]\-\-bash\-completiion\f[]
+Generate a bash completion script.
+to enable bash completion with pandoc, add this to your
+\f[C]\&.bashrc\f[]:
+.RS
+.IP
+.nf
+\f[C]
+\ eval\ "$(pandoc\ \-\-bash\-completion)"
+\f[]
+.fi
+.RE
+.TP
.B \f[C]\-\-verbose\f[]
Give verbose debugging output.
Currently this only has an effect with PDF output.
@@ -1699,7 +1723,7 @@ See\ [foo]
Markdown uses email conventions for quoting blocks of text.
A block quotation is one or more paragraphs or other block elements
(such as lists or headers), with each line preceded by a \f[C]>\f[]
-character and a space.
+character and an optional space.
(The \f[C]>\f[] need not start at the left margin, but it should not be
indented more than three spaces.)
.IP
@@ -1737,6 +1761,18 @@ That is, block quotes can be nested:
>\ >\ A\ block\ quote\ within\ a\ block\ quote.
\f[]
.fi
+.PP
+If the \f[C]>\f[] character is followed by an optional space, that space
+will be considered part of the block quote marker and not part of the
+indentation of the contents.
+Thus, to put an indented code block in a block quote, you need five
+spaces after the \f[C]>\f[]:
+.IP
+.nf
+\f[C]
+>\ \ \ \ \ code
+\f[]
+.fi
.SS Extension: \f[C]blank_before_blockquote\f[]
.PP
Standard markdown syntax does not require a blank line before a block
@@ -3379,7 +3415,7 @@ One way to do this is to insert a nonbreaking space after the image:
.IP
.nf
\f[C]
-![This\ image\ won\[aq]t\ be\ a\ figure](/url/of/image.png)\\
+![This\ image\ won\[aq]t\ be\ a\ figure](/url/of/image.png)\\\
\f[]
.fi
.SS Footnotes
@@ -4203,6 +4239,8 @@ In markdown input, "bird track" sections will be parsed as Haskell code
rather than block quotations.
Text between \f[C]\\begin{code}\f[] and \f[C]\\end{code}\f[] will also
be treated as Haskell code.
+For atx\-style headers the character \[aq]=\[aq] will be used instead of
+\[aq]#\[aq].
.IP \[bu] 2
In markdown output, code blocks with classes \f[C]haskell\f[] and
\f[C]literate\f[] will be rendered using bird tracks, and block
@@ -4251,8 +4289,8 @@ and pasted as literate Haskell source.
.PP
Pandoc will automatically highlight syntax in fenced code blocks that
are marked with a language name.
-(See [Extension: \f[C]inline_code_attributes\f[]] and [Extension:
-\f[C]fenced_code_attributes\f[]], above.) The Haskell library
+(See Extension: \f[C]inline_code_attributes\f[] and Extension:
+\f[C]fenced_code_attributes\f[], above.) The Haskell library
highlighting\-kate is used for highlighting, which works in HTML, Docx,
and LaTeX/PDF output.
The color scheme can be selected using the \f[C]\-\-highlight\-style\f[]
diff --git a/pandoc.cabal b/pandoc.cabal
index 9c0d0c3ef..f6884adb2 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -1,5 +1,5 @@
Name: pandoc
-Version: 1.15.0.6
+Version: 1.15.1
Cabal-Version: >= 1.10
Build-Type: Custom
License: GPL
@@ -105,6 +105,8 @@ Data-Files:
data/dzslides/template.html
-- sample lua custom writer
data/sample.lua
+ -- bash completion template
+ data/bash_completion.tpl
-- documentation
README, COPYRIGHT
Extra-Source-Files:
@@ -498,6 +500,6 @@ benchmark benchmark-pandoc
Build-Depends: pandoc,
base >= 4.2 && < 5,
syb >= 0.1 && < 0.6,
- criterion >= 0.5 && < 1.1
+ criterion >= 0.5 && < 1.2
Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind
Default-Language: Haskell98
diff --git a/pandoc.hs b/pandoc.hs
index fb9b9abbf..81d4584e3 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -71,7 +71,8 @@ import qualified Data.Text as T
import Control.Applicative ((<$>), (<|>))
import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
import Data.Monoid
-
+import Paths_pandoc (getDataDir)
+import Text.Printf (printf)
import Text.Pandoc.Error
type Transform = Pandoc -> Pandoc
@@ -880,6 +881,22 @@ options =
(\opt -> return opt { optVerbose = True }))
"" -- "Verbose diagnostic output."
+ , Option "" ["bash-completion"]
+ (NoArg
+ (\_ -> do
+ ddir <- getDataDir
+ tpl <- readDataFileUTF8 Nothing "bash_completion.tpl"
+ let optnames (Option shorts longs _ _) =
+ map (\c -> ['-',c]) shorts ++
+ map ("--" ++) longs
+ let allopts = unwords (concatMap optnames options)
+ UTF8.hPutStrLn stdout $ printf tpl allopts
+ (unwords (map fst readers))
+ (unwords ("pdf": map fst writers))
+ ddir
+ exitWith ExitSuccess ))
+ "" -- "Print bash completion script"
+
, Option "v" ["version"]
(NoArg
(\_ -> do
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index a4d963221..d7311d978 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -320,14 +320,14 @@ getDefaultExtensions "markdown_mmd" = multimarkdownExtensions
getDefaultExtensions "markdown_github" = githubMarkdownExtensions
getDefaultExtensions "markdown" = pandocExtensions
getDefaultExtensions "plain" = plainExtensions
-getDefaultExtensions "org" = Set.fromList [Ext_citations]
+getDefaultExtensions "org" = Set.fromList [Ext_citations,
+ Ext_auto_identifiers]
getDefaultExtensions "textile" = Set.fromList [Ext_auto_identifiers]
getDefaultExtensions "html" = Set.fromList [Ext_auto_identifiers,
Ext_native_divs,
Ext_native_spans]
getDefaultExtensions "html5" = getDefaultExtensions "html"
-getDefaultExtensions "epub" = Set.fromList [Ext_auto_identifiers,
- Ext_raw_html,
+getDefaultExtensions "epub" = Set.fromList [Ext_raw_html,
Ext_native_divs,
Ext_native_spans,
Ext_epub_html_exts]
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 3cc2a4479..352b94496 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -194,7 +194,7 @@ List of all DocBook tags, with [x] indicating implemented,
[x] indexterm - A wrapper for terms to be indexed
[x] info - A wrapper for information about a component or other block. (DocBook v5)
[x] informalequation - A displayed mathematical equation without a title
-[ ] informalexample - A displayed example without a title
+[x] informalexample - A displayed example without a title
[ ] informalfigure - A untitled figure
[ ] informaltable - A table without a title
[ ] initializer - The initializer for a FieldSynopsis
@@ -611,6 +611,7 @@ isBlockElement (Elem e) = qName (elName e) `elem` blocktags
"important","caution","note","tip","warning","qandadiv",
"question","answer","abstract","itemizedlist","orderedlist",
"variablelist","article","book","table","informaltable",
+ "informalexample",
"screen","programlisting","example","calloutlist"]
isBlockElement _ = False
@@ -766,6 +767,8 @@ parseBlock (Elem e) =
"book" -> modify (\st -> st{ dbBook = True }) >> getBlocks e
"table" -> parseTable
"informaltable" -> parseTable
+ "informalexample" -> divWith ("", ["informalexample"], []) <$>
+ getBlocks e
"literallayout" -> codeBlockWithLang
"screen" -> codeBlockWithLang
"programlisting" -> codeBlockWithLang
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index 338540533..aefc32e0e 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -181,7 +181,6 @@ getManifest archive = do
fixInternalReferences :: FilePath -> Pandoc -> Pandoc
fixInternalReferences pathToFile =
(walk $ renameImages root)
- . (walk normalisePath)
. (walk $ fixBlockIRs filename)
. (walk $ fixInlineIRs filename)
where
@@ -196,12 +195,6 @@ fixInlineIRs s (Link t ('#':url, tit)) =
Link t (addHash s url, tit)
fixInlineIRs _ v = v
-normalisePath :: Inline -> Inline
-normalisePath (Link t (url, tit)) =
- let (path, uid) = span (/= '#') url in
- Link t (takeFileName path ++ uid, tit)
-normalisePath s = s
-
prependHash :: [String] -> Inline -> Inline
prependHash ps l@(Link is (url, tit))
| or [s `isPrefixOf` url | s <- ps] =
@@ -223,7 +216,7 @@ fixAttrs s (ident, cs, kvs) = (addHash s ident, filter (not . null) cs, removeEP
addHash :: String -> String -> String
addHash _ "" = ""
-addHash s ident = s ++ "#" ++ ident
+addHash s ident = takeFileName s ++ "#" ++ ident
removeEPUBAttrs :: [(String, String)] -> [(String, String)]
removeEPUBAttrs kvs = filter (not . isEPUBAttr) kvs
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 02bfcb2bb..b32264d61 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -50,6 +50,7 @@ import Text.Pandoc.Options (ReaderOptions(readerParseRaw, readerTrace)
Ext_native_divs, Ext_native_spans))
import Text.Pandoc.Parsing hiding ((<|>))
import Text.Pandoc.Walk
+import qualified Data.Map as M
import Data.Maybe ( fromMaybe, isJust)
import Data.List ( intercalate, isInfixOf, isPrefixOf, isSuffixOf )
import Data.Char ( isDigit )
@@ -75,8 +76,9 @@ readHtml :: ReaderOptions -- ^ Reader options
-> Either PandocError Pandoc
readHtml opts inp =
mapLeft (ParseFailure . getError) . flip runReader def $
- runParserT parseDoc (HTMLState def{ stateOptions = opts } [] Nothing)
- "source" tags
+ runParserT parseDoc
+ (HTMLState def{ stateOptions = opts } [] Nothing [] M.empty)
+ "source" tags
where tags = stripPrefixes . canonicalizeTags $
parseTagsOptions parseOptions{ optTagPosition = True } inp
parseDoc = do
@@ -101,7 +103,9 @@ data HTMLState =
HTMLState
{ parserState :: ParserState,
noteTable :: [(String, Blocks)],
- baseHref :: Maybe String
+ baseHref :: Maybe String,
+ identifiers :: [String],
+ headerMap :: M.Map Inlines String
}
data HTMLLocal = HTMLLocal { quoteContext :: QuoteContext
@@ -398,9 +402,10 @@ pHeader = try $ do
let ident = fromMaybe "" $ lookup "id" attr
let classes = maybe [] words $ lookup "class" attr
let keyvals = [(k,v) | (k,v) <- attr, k /= "class", k /= "id"]
+ attr' <- registerHeader (ident, classes, keyvals) contents
return $ if bodyTitle
then mempty -- skip a representation of the title in the body
- else B.headerWith (ident, classes, keyvals) level contents
+ else B.headerWith attr' level contents
pHrule :: TagParser Blocks
pHrule = do
@@ -983,6 +988,14 @@ isSpace _ = False
-- Instances
+instance HasIdentifierList HTMLState where
+ extractIdentifierList = identifiers
+ updateIdentifierList f s = s{ identifiers = f (identifiers s) }
+
+instance HasHeaderMap HTMLState where
+ extractHeaderMap = headerMap
+ updateHeaderMap f s = s{ headerMap = f (headerMap s) }
+
-- This signature should be more general
-- MonadReader HTMLLocal m => HasQuoteContext st m
instance HasQuoteContext st (Reader HTMLLocal) where
@@ -992,9 +1005,6 @@ instance HasQuoteContext st (Reader HTMLLocal) where
instance HasReaderOptions HTMLState where
extractReaderOptions = extractReaderOptions . parserState
-instance Default HTMLState where
- def = HTMLState def [] Nothing
-
instance HasMeta HTMLState where
setMeta s b st = st {parserState = setMeta s b $ parserState st}
deleteMeta s st = st {parserState = deleteMeta s $ parserState st}
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 0da912ea6..16d387dc4 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -524,6 +524,7 @@ inlineCommands = M.fromList $
, ("includegraphics", skipopts *> (unescapeURL <$> braced) >>= mkImage)
, ("enquote", enquote)
, ("cite", citation "cite" AuthorInText False)
+ , ("Cite", citation "cite" AuthorInText False)
, ("citep", citation "citep" NormalCitation False)
, ("citep*", citation "citep*" NormalCitation False)
, ("citeal", citation "citeal" NormalCitation False)
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index 2a5adab22..b23b44544 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -252,8 +252,8 @@ parseAttr = try $ do
skipMany spaceChar
k <- many1 letter
char '='
- char '"'
- v <- many1Till (satisfy (/='\n')) (char '"')
+ v <- (char '"' >> many1Till (satisfy (/='\n')) (char '"'))
+ <|> many1 nonspaceChar
return (k,v)
tableStart :: MWParser ()
diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs
index 980f63504..55ac92bcb 100644
--- a/src/Text/Pandoc/Readers/Org.hs
+++ b/src/Text/Pandoc/Readers/Org.hs
@@ -70,6 +70,14 @@ data OrgParserLocal = OrgParserLocal { orgLocalQuoteContext :: QuoteContext }
type OrgParser = ParserT [Char] OrgParserState (Reader OrgParserLocal)
+instance HasIdentifierList OrgParserState where
+ extractIdentifierList = orgStateIdentifiers
+ updateIdentifierList f s = s{ orgStateIdentifiers = f (orgStateIdentifiers s) }
+
+instance HasHeaderMap OrgParserState where
+ extractHeaderMap = orgStateHeaderMap
+ updateHeaderMap f s = s{ orgStateHeaderMap = f (orgStateHeaderMap s) }
+
parseOrg :: OrgParser Pandoc
parseOrg = do
blocks' <- parseBlocks
@@ -135,6 +143,8 @@ data OrgParserState = OrgParserState
, orgStateMeta :: Meta
, orgStateMeta' :: F Meta
, orgStateNotes' :: OrgNoteTable
+ , orgStateIdentifiers :: [String]
+ , orgStateHeaderMap :: M.Map Inlines String
}
instance Default OrgParserLocal where
@@ -174,6 +184,8 @@ defaultOrgParserState = OrgParserState
, orgStateMeta = nullMeta
, orgStateMeta' = return nullMeta
, orgStateNotes' = []
+ , orgStateIdentifiers = []
+ , orgStateHeaderMap = M.empty
}
recordAnchorId :: String -> OrgParser ()
@@ -668,7 +680,10 @@ header = try $ do
title <- manyTill inline (lookAhead headerEnd)
tags <- headerEnd
let inlns = trimInlinesF . mconcat $ title <> map tagToInlineF tags
- return $ B.header level <$> inlns
+ st <- getState
+ let inlines = runF inlns st
+ attr <- registerHeader nullAttr inlines
+ return $ pure (B.headerWith attr level inlines)
where
tagToInlineF :: String -> F Inlines
tagToInlineF t = return $ B.spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 678eecc52..f9663b19a 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -614,20 +614,22 @@ directive' = do
return mempty
-- TODO:
--- - Silently ignores illegal fields
-- - 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
- let (baseRole, baseFmt, baseAttr) =
- maybe (parentRole, Nothing, nullAttr) id $
- M.lookup parentRole customRoles
+ let getBaseRole (r, f, a) roles =
+ case M.lookup r roles of
+ Just (r', f', a') -> getBaseRole (r', f', a') roles
+ Nothing -> (r, f, a)
+ (baseRole, baseFmt, baseAttr) =
+ getBaseRole (parentRole, Nothing, nullAttr) customRoles
fmt = if parentRole == "raw" then lookup "format" fields else baseFmt
annotate :: [String] -> [String]
annotate = maybe id (:) $
- if parentRole == "code"
+ if baseRole == "code"
then lookup "language" fields
else Nothing
attr = let (ident, classes, keyValues) = baseAttr
@@ -636,12 +638,12 @@ addNewRole roleString fields = do
-- warn about syntax we ignore
flip mapM_ fields $ \(key, _) -> case key of
- "language" -> when (parentRole /= "code") $ addWarning Nothing $
+ "language" -> when (baseRole /= "code") $ addWarning Nothing $
"ignoring :language: field because the parent of role :" ++
- role ++ ": is :" ++ parentRole ++ ": not :code:"
- "format" -> when (parentRole /= "raw") $ addWarning Nothing $
+ role ++ ": is :" ++ baseRole ++ ": not :code:"
+ "format" -> when (baseRole /= "raw") $ addWarning Nothing $
"ignoring :format: field because the parent of role :" ++
- role ++ ": is :" ++ parentRole ++ ": not :raw:"
+ role ++ ": is :" ++ baseRole ++ ": not :raw:"
_ -> addWarning Nothing $ "ignoring unknown field :" ++ key ++
": in definition of role :" ++ role ++ ": in"
when (parentRole == "raw" && countKeys "format" > 1) $
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 07a7e962c..c44133e12 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -540,6 +540,7 @@ stringify = query go . walk deNote
go (Str x) = x
go (Code _ x) = x
go (Math _ x) = x
+ go (RawInline (Format "html") ('<':'b':'r':_)) = " " -- see #2105
go LineBreak = " "
go _ = ""
deNote (Note _) = Str ""
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index da4c78cef..0cb313e7b 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -181,8 +181,8 @@ renumIds f renumMap = map (renumId f renumMap)
-- | Certain characters are invalid in XML even if escaped.
-- See #1992
-stripInvalidChars :: Pandoc -> Pandoc
-stripInvalidChars = bottomUp (filter isValidChar)
+stripInvalidChars :: String -> String
+stripInvalidChars = filter isValidChar
-- | See XML reference
isValidChar :: Char -> Bool
@@ -208,7 +208,7 @@ writeDocx :: WriterOptions -- ^ Writer options
-> IO BL.ByteString
writeDocx opts doc@(Pandoc meta _) = do
let datadir = writerUserDataDir opts
- let doc' = stripInvalidChars . walk fixDisplayMath $ doc
+ let doc' = walk fixDisplayMath $ doc
username <- lookup "USERNAME" <$> getEnvironment
utctime <- getCurrentTime
distArchive <- getDefaultReferenceDocx Nothing
@@ -974,7 +974,7 @@ formattedString str = do
return [ mknode "w:r" [] $
props ++
[ mknode (if inDel then "w:delText" else "w:t")
- [("xml:space","preserve")] str ] ]
+ [("xml:space","preserve")] (stripInvalidChars str) ] ]
setFirstPara :: WS ()
setFirstPara = modify $ \s -> s { stFirstPara = True }
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 151d3c2ae..fae908f30 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -333,7 +333,8 @@ blockListToRST = blockListToRST' False
-- | Convert list of Pandoc inline elements to RST.
inlineListToRST :: [Inline] -> State WriterState Doc
inlineListToRST lst =
- mapM inlineToRST (removeSpaceAfterDisplayMath $ insertBS lst) >>= return . hcat
+ mapM inlineToRST (removeSpaceAfterDisplayMath $ insertBS lst) >>=
+ return . hcat
where -- remove spaces after displaymath, as they screw up indentation:
removeSpaceAfterDisplayMath (Math DisplayMath x : zs) =
Math DisplayMath x : dropWhile (==Space) zs
@@ -341,8 +342,8 @@ inlineListToRST lst =
removeSpaceAfterDisplayMath [] = []
insertBS :: [Inline] -> [Inline] -- insert '\ ' where needed
insertBS (x:y:z:zs)
- | isComplex y && surroundComplex x z =
- x : y : RawInline "rst" "\\ " : insertBS (z:zs)
+ | isComplex y && (surroundComplex x z) =
+ x : y : insertBS (z : zs)
insertBS (x:y:zs)
| isComplex x && not (okAfterComplex y) =
x : RawInline "rst" "\\ " : insertBS (y : zs)
@@ -383,6 +384,8 @@ inlineListToRST lst =
isComplex (Image _ _) = True
isComplex (Code _ _) = True
isComplex (Math _ _) = True
+ isComplex (Cite _ (x:_)) = isComplex x
+ isComplex (Span _ (x:_)) = isComplex x
isComplex _ = False
-- | Convert Pandoc inline element to RST.
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 000000000..4db6cf0a7
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,11 @@
+flags:
+ pandoc:
+ trypandoc: false
+ https: true
+ embed_data_files: false
+ old-locale: false
+ network-uri: true
+packages:
+- '.'
+extra-deps: []
+resolver: lts-3.0
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index 92e6993df..5eed2c9f4 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -457,21 +457,25 @@ tests =
, "First Level Header" =:
"* Headline\n" =?>
- header 1 "Headline"
+ headerWith ("headline", [], []) 1 "Headline"
, "Third Level Header" =:
"*** Third Level Headline\n" =?>
- header 3 ("Third" <> space <>
- "Level" <> space <>
- "Headline")
+ headerWith ("third-level-headline", [], [])
+ 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")
+ mconcat [ headerWith ("first-level", [], [])
+ 1
+ ("First" <> space <> "Level")
+ , headerWith ("second-level", [], [])
+ 2
+ ("Second" <> space <> "Level")
, para "Text"
]
@@ -482,8 +486,12 @@ tests =
, ""
, " Text"
] =?>
- mconcat [ header 1 ("First" <> space <> "Level")
- , header 2 ("Second" <> space <> "Level")
+ mconcat [ headerWith ("first-level", [], [])
+ 1
+ ("First" <> space <> "Level")
+ , headerWith ("second-level", [], [])
+ 2
+ ("Second" <> space <> "Level")
, para "Text"
]
@@ -492,9 +500,13 @@ tests =
, "Spaghetti and meatballs tonight."
, "** walk dog"
] =?>
- mconcat [ header 2 ("eat" <> space <> "dinner")
+ mconcat [ headerWith ("eat-dinner", [], [])
+ 2
+ ("eat" <> space <> "dinner")
, para $ spcSep [ "Spaghetti", "and", "meatballs", "tonight." ]
- , header 2 ("walk" <> space <> "dog")
+ , headerWith ("walk-dog", [], [])
+ 2
+ ("walk" <> space <> "dog")
]
, "Tagged headers" =:
@@ -503,14 +515,20 @@ tests =
, "** Call John :@PHONE:JOHN: "
] =?>
let tagSpan t = spanWith ("", ["tag"], [("data-tag-name", t)]) mempty
- in mconcat [ header 1 ("Personal" <> tagSpan "PERSONAL")
- , header 2 ("Call Mom" <> tagSpan "@PHONE")
- , header 2 ("Call John" <> tagSpan "@PHONE" <> tagSpan "JOHN")
+ in mconcat [ headerWith ("personal", [], [])
+ 1
+ ("Personal" <> tagSpan "PERSONAL")
+ , headerWith ("call-mom", [], [])
+ 2
+ ("Call Mom" <> tagSpan "@PHONE")
+ , headerWith ("call-john", [], [])
+ 2
+ ("Call John" <> tagSpan "@PHONE" <> tagSpan "JOHN")
]
, "Untagged header containing colons" =:
"* This: is not: tagged" =?>
- header 1 "This: is not: tagged"
+ headerWith ("this-is-not-tagged", [], []) 1 "This: is not: tagged"
, "Comment Trees" =:
unlines [ "* COMMENT A comment tree"
@@ -518,7 +536,7 @@ tests =
, "** This will be dropped"
, "* Comment tree above"
] =?>
- header 1 "Comment tree above"
+ headerWith ("comment-tree-above", [], []) 1 "Comment tree above"
, "Nothing but a COMMENT header" =:
"* COMMENT Test" =?>
@@ -640,7 +658,7 @@ tests =
[ "Another", space, "note"
, note $ para ("This" <> space <> "is" <> space <> "great!")
])
- , header 2 "Headline"
+ , headerWith ("headline", [], []) 2 "Headline"
]
]
@@ -664,7 +682,7 @@ tests =
"* Item2\n") =?>
bulletList [ plain "Item1"
] <>
- header 1 "Item2"
+ headerWith ("item2", [], []) 1 "Item2"
, "Multi-line Bullet Lists" =:
("- *Fat\n" ++
@@ -724,7 +742,7 @@ tests =
mconcat [ bulletList [ plain "Discovery"
, plain ("Human" <> space <> "After" <> space <> "All")
]
- , header 1 "Homework"
+ , headerWith ("homework", [], []) 1 "Homework"
]
, "Bullet List Unindented with trailing Header" =:
@@ -734,7 +752,7 @@ tests =
mconcat [ bulletList [ plain "Discovery"
, plain "Homework"
]
- , header 1 "NotValidListItem"
+ , headerWith ("notvalidlistitem", [], []) 1 "NotValidListItem"
]
, "Simple Ordered List" =:
@@ -839,7 +857,7 @@ tests =
mconcat [ definitionList [ ("definition", [plain "list"])
, ("cool", [plain "defs"])
]
- , header 1 "header"
+ , headerWith ("header", [], []) 1 "header"
]
, "Loose bullet list" =:
diff --git a/tests/epub/features.native b/tests/epub/features.native
index 6ccc04f43..f71e15cf5 100644
--- a/tests/epub/features.native
+++ b/tests/epub/features.native
@@ -5,14 +5,14 @@
,Header 2 ("",[],[]) [Str "Status",Space,Str "of",Space,Str "this",Space,Str "Document"]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "currently",Space,Str "considered",Space,Span ("",["status"],[]) [Str "[UNDER",Space,Str "DEVELOPMENT]"],Space,Str "by",Space,Str "the",Space,Str "IDPF."]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "part",Space,Str "of",Space,Str "version",Space,Span ("",["version"],[]) [Str "X.X"],Space,Str "of",Space,Str "the",Space,Str "EPUB",Space,Str "3.0",Space,Str "Compliance",Space,Str "Test",Space,Str "Suite",Space,Str "released",Space,Str "on",Space,RawInline (Format "html") "<time class=\"release\">",Str "TBD",RawInline (Format "html") "</time>",Str "."]
-,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",Space,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",Space,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link [Str "TBD"] ("","")]
+,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",Space,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",Space,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link [Str "TBD"] ("http://idpf.org/","")]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "one",Space,Str "of",Space,Str "several",Space,Str "that",Space,Str "currently",Space,Str "comprise",Space,Str "the",Space,Str "EPUB",Space,Str "3",Space,Str "conformance",Space,Str "test",Space,Str "suite",Space,Str "for",Space,Str "reflowable",Space,Str "content.",Space,Str "The",Space,Str "complete",Space,Str "test",Space,Str "suite",Space,Str "includes",Space,Str "all",Space,Str "of",Space,Str "the",Space,Str "following",Space,Str "publications:"]
,OrderedList (1,DefaultStyle,DefaultDelim)
[[Plain [Str "."]]]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section>"
,Header 2 ("",[],[]) [Str "About",Space,Str "this",Space,Str "Document"]
-,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",Space,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",Space,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,Str "wiki"] ("Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",Space,Str "information."]
+,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",Space,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",Space,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,Str "wiki"] ("https://github.com/mgylling/epub-testsuite/wiki/Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",Space,Str "information."]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section>"
,Header 2 ("",[],[]) [Str "Conventions"]
@@ -74,7 +74,7 @@
,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-025"],Str "Testing",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "rowspan",Space,Str "attributes,",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "fonts"]
,Para [Str "Tests",Space,Str "whether",Space,Code ("",[],[]) "mtable",Space,Str "with",Space,Code ("",[],[]) "colspan",Space,Str "and",Space,Code ("",[],[]) "mspace",Space,Str "attributes",Space,Str "(colum",Space,Str "and",Space,Str "row",Space,Str "spanning)",Space,Str "are",Space,Str "supported;",Space,Str "uses",Space,Str "Hebrew",Space,Str "and",Space,Str "Script",Space,Str "alphabets."]
,Para [Math DisplayMath "\\begin{array}{llllllllll}\n & {\\operatorname{cov}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cof}\\left( \\mathcal{L} \\right)} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{L} \\right)} & \\longrightarrow & {\\operatorname{add}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{cov}\\left( \\mathcal{K} \\right)} & \\longrightarrow & {\\operatorname{non}\\left( \\mathcal{L} \\right)} & \\\\\n\\end{array}"]
-,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Link [Str "Cicho\324's",Space,Str "Diagram"] ("Cicho%C5%84's_diagram",""),Str ":",Space,Str "."]
+,Para [Str "The",Space,Str "test",Space,Str "passes",Space,Str "if",Space,Str "the",Space,Str "rendering",Space,Str "looks",Space,Str "like",Space,Link [Str "Cicho\324's",Space,Str "Diagram"] ("http://en.wikipedia.org/wiki/Cicho%C5%84's_diagram",""),Str ":",Space,Str "."]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section id=\"mathml-026\" class=\"ctest\">"
,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "mathml-026"],Str "BiDi,",Space,Str "RTL",Space,Str "and",Space,Str "Arabic",Space,Str "alphabets"]
diff --git a/tests/epub/formatting.native b/tests/epub/formatting.native
index bdf86fa20..133c16120 100644
--- a/tests/epub/formatting.native
+++ b/tests/epub/formatting.native
@@ -5,14 +5,14 @@
,Header 2 ("",[],[]) [Str "Status",Space,Str "of",Space,Str "this",Space,Str "Document"]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "currently",Space,Str "considered",Space,Span ("",["status"],[]) [Str "[UNDER",Space,Str "DEVELOPMENT]"],Space,Str "by",Space,Str "the",Space,Str "IDPF."]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "part",Space,Str "of",Space,Str "version",Space,Span ("",["version"],[]) [Str "X.X"],Space,Str "of",Space,Str "the",Space,Str "EPUB",Space,Str "3.0",Space,Str "Compliance",Space,Str "Test",Space,Str "Suite",Space,Str "released",Space,Str "on",Space,RawInline (Format "html") "<time class=\"release\">",Str "TBD",RawInline (Format "html") "</time>",Str "."]
-,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",Space,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",Space,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link [Str "TBD"] ("","")]
+,Para [Str "Before",Space,Str "using",Space,Str "this",Space,Str "publication",Space,Str "to",Space,Str "evaluate",Space,Str "reading",Space,Str "systems,",Space,Str "testers",Space,Str "are",Space,Str "strongly",Space,Str "encouraged",Space,Str "to",Space,Str "verify",Space,Str "that",Space,Str "they",Space,Str "have",Space,Str "the",Space,Str "latest",Space,Str "release",Space,Str "by",Space,Str "checking",Space,Str "the",Space,Str "current",Space,Str "release",Space,Str "version",Space,Str "and",Space,Str "date",Space,Str "of",Space,Str "the",Space,Str "test",Space,Str "suite",Space,Str "at",Space,Link [Str "TBD"] ("http://idpf.org/","")]
,Para [Str "This",Space,Str "publication",Space,Str "is",Space,Str "one",Space,Str "of",Space,Str "several",Space,Str "that",Space,Str "currently",Space,Str "comprise",Space,Str "the",Space,Str "EPUB",Space,Str "3",Space,Str "conformance",Space,Str "test",Space,Str "suite",Space,Str "for",Space,Str "reflowable",Space,Str "content.",Space,Str "The",Space,Str "complete",Space,Str "test",Space,Str "suite",Space,Str "includes",Space,Str "all",Space,Str "of",Space,Str "the",Space,Str "following",Space,Str "publications:"]
,OrderedList (1,DefaultStyle,DefaultDelim)
[[Plain [Str "."]]]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section>"
,Header 2 ("",[],[]) [Str "About",Space,Str "this",Space,Str "Document"]
-,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",Space,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",Space,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,Str "wiki"] ("Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",Space,Str "information."]
+,Para [Str "This",Space,Str "document",Space,Str "focuses",Space,Str "on",Space,Str "human-evaluated",Space,Str "binary",Space,Str "(pass/fail)",Space,Str "tests",Space,Str "in",Space,Str "a",Space,Str "reflowable",Space,Str "context.",Space,Str "Tests",Space,Str "for",Space,Str "fixed-layout",Space,Str "content",Space,Str "and",Space,Str "other",Space,Str "individual",Space,Str "tests",Space,Str "that",Space,Str "require",Space,Str "a",Space,Str "dedicated",Space,Str "epub",Space,Str "file",Space,Str "are",Space,Str "available",Space,Str "in",Space,Str "additional",Space,Str "sibling",Space,Str "documents;",Space,Str "refer",Space,Str "to",Space,Str "the",Space,Link [Str "test",Space,Str "suite",Space,Str "wiki"] ("https://github.com/mgylling/epub-testsuite/wiki/Overview",""),Space,Str "(",Code ("",[],[]) "https://github.com/mgylling/epub-testsuite/wiki/Overview",Str ")",Space,Str "for",Space,Str "additional",Space,Str "information."]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section>"
,Header 2 ("",[],[]) [Str "Conventions"]
@@ -430,13 +430,13 @@
,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-410"],Space,Code ("",[],[]) "over"]
,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "-epub-ruby-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "over",Space,Str "is",Space,Str "supported."]
,Para [RawInline (Format "html") "<ruby class=\"ruby-over\">",Strong [Str "Lorem",Space,Str "Ipsum"],Space,RawInline (Format "html") "<rp>",Str "(",RawInline (Format "html") "</rp>",RawInline (Format "html") "<rt>",Str "Lorem",Space,Str "Ipsum",RawInline (Format "html") "</rt>",RawInline (Format "html") "<rp>",Str ")",RawInline (Format "html") "</rp>",RawInline (Format "html") "</ruby>"]
-,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link [Str "over"] ("#over",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]
+,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link [Str "over"] ("http://www.w3.org/TR/css3-writing-modes/#over",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section id=\"style-411\" class=\"ctest\">"
,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-411"],Space,Code ("",[],[]) "under"]
,Para [Str "Tests",Space,Str "whether",Space,Str "the",Space,Code ("",[],[]) "-epub-ruby-position",Space,Str "property",Space,Str "set",Space,Str "to",Space,Str "under",Space,Str "is",Space,Str "supported."]
,Para [RawInline (Format "html") "<ruby class=\"ruby-under\">",Strong [Str "Lorem",Space,Str "Ipsum"],Space,RawInline (Format "html") "<rp>",Str "(",RawInline (Format "html") "</rp>",RawInline (Format "html") "<rt>",Str "Lorem",Space,Str "Ipsum",RawInline (Format "html") "</rt>",RawInline (Format "html") "<rp>",Str ")",RawInline (Format "html") "</rp>",RawInline (Format "html") "</ruby>"]
-,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link [Str "under"] ("#under",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]
+,Para [Str "If",Space,Str "the",Space,Str "Ruby",Space,Str "text",Space,Str "is",Space,Str "positioned",Space,Str "on",Space,Str "the",Space,Link [Str "under"] ("http://www.w3.org/TR/css3-writing-modes/#under",""),Space,Str "side",Space,Str "of",Space,Str "the",Space,Str "ruby",Space,Str "base,",Space,Str "the",Space,Str "test",Space,Str "passes."]
,RawBlock (Format "html") "</section>"
,RawBlock (Format "html") "<section id=\"style-412\" class=\"ctest\">"
,Header 2 ("",[],[]) [Span ("",["nature"],[]) [Str "[REQUIRED]"],Space,Span ("",["test-id"],[]) [Str "style-412"],Space,Code ("",[],[]) "inter-character"]
diff --git a/tests/html-reader.native b/tests/html-reader.native
index 1abb0ba79..1d3141690 100644
--- a/tests/html-reader.native
+++ b/tests/html-reader.native
@@ -1,25 +1,25 @@
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.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Headers"]
-,Header 2 ("",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
-,Header 3 ("",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 4 ("",[],[]) [Str "Level",Space,Str "4"]
-,Header 5 ("",[],[]) [Str "Level",Space,Str "5"]
-,Header 1 ("",[],[]) [Str "Level",Space,Str "1"]
-,Header 2 ("",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
-,Header 3 ("",[],[]) [Str "Level",Space,Str "3"]
+,Header 1 ("headers",[],[]) [Str "Headers"]
+,Header 2 ("level-2-with-an-embedded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
+,Header 3 ("level-3-with-emphasis",[],[]) [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
+,Header 4 ("level-4",[],[]) [Str "Level",Space,Str "4"]
+,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
+,Header 1 ("level-1",[],[]) [Str "Level",Space,Str "1"]
+,Header 2 ("level-2-with-emphasis",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
+,Header 3 ("level-3",[],[]) [Str "Level",Space,Str "3"]
,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
-,Header 2 ("",[],[]) [Str "Level",Space,Str "2"]
+,Header 2 ("level-2",[],[]) [Str "Level",Space,Str "2"]
,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Paragraphs"]
+,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
,Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Space,Str "here."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Block",Space,Str "Quotes"]
+,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
,Para [Str "E-mail",Space,Str "style:"]
,BlockQuote
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
@@ -51,14 +51,14 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
[Para [Str "Don't",Space,Str "quote",Space,Str "me."]]]
,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Code",Space,Str "Blocks"]
+,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
,Para [Str "Code:"]
,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
,Para [Str "And:"]
,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Lists"]
-,Header 2 ("",[],[]) [Str "Unordered"]
+,Header 1 ("lists",[],[]) [Str "Lists"]
+,Header 2 ("unordered",[],[]) [Str "Unordered"]
,Para [Str "Asterisks",Space,Str "tight:"]
,BulletList
[[Plain [Str "asterisk",Space,Str "1"]]
@@ -89,7 +89,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
[[Para [Str "Minus",Space,Str "1"]]
,[Para [Str "Minus",Space,Str "2"]]
,[Para [Str "Minus",Space,Str "3"]]]
-,Header 2 ("",[],[]) [Str "Ordered"]
+,Header 2 ("ordered",[],[]) [Str "Ordered"]
,Para [Str "Tight:"]
,OrderedList (1,DefaultStyle,DefaultDelim)
[[Plain [Str "First"]]
@@ -129,7 +129,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
[]
,OrderedList (1,LowerRoman,DefaultDelim)
[]
-,Header 2 ("",[],[]) [Str "Nested"]
+,Header 2 ("nested",[],[]) [Str "Nested"]
,BulletList
[[Plain [Str "Tab"]
,BulletList
@@ -154,7 +154,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,[Plain [Str "Fie"]]
,[Plain [Str "Foe"]]]]
,[Para [Str "Third"]]]
-,Header 2 ("",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
+,Header 2 ("tabs-and-spaces",[],[]) [Str "Tabs",Space,Str "and",Space,Str "spaces"]
,BulletList
[[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"]]
,[Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
@@ -188,7 +188,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,OrderedList (1,DefaultStyle,DefaultDelim)
[[Plain [Str "Nested."]]]]]
,HorizontalRule
-,Header 2 ("",[],[]) [Str "Definition"]
+,Header 2 ("definition",[],[]) [Str "Definition"]
,DefinitionList
[([Str "Violin"],
[[Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument."]]
@@ -196,7 +196,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,([Str "Cello",LineBreak,Str "Violoncello"],
[[Plain [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."]]])]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Inline",Space,Str "Markup"]
+,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
,Para [Str "Empty",Space,Strong [],Space,Str "and",Space,Emph [],Str "."]
@@ -208,7 +208,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
,Para [Str "This",Space,Str "is",Space,SmallCaps [Str "small",Space,Str "caps"],Str "."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
+,Header 1 ("smart-quotes-ellipses-dashes",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
,Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
,Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
,Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
@@ -218,7 +218,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5-7,",Space,Str "255-66,",Space,Str "1987-1999."]
,Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "LaTeX"]
+,Header 1 ("latex",[],[]) [Str "LaTeX"]
,BulletList
[[Plain [Str "\\cite[22-23]{smith.1899}"]]
,[Plain [Str "\\doublespacing"]]
@@ -237,7 +237,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Str "Here'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
-,Header 1 ("",[],[]) [Str "Special",Space,Str "Characters"]
+,Header 1 ("special-characters",[],[]) [Str "Special",Space,Str "Characters"]
,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
,BulletList
[[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
@@ -267,8 +267,8 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Str "Plus:",Space,Str "+"]
,Para [Str "Minus:",Space,Str "-"]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Links"]
-,Header 2 ("",[],[]) [Str "Explicit"]
+,Header 1 ("links",[],[]) [Str "Links"]
+,Header 2 ("explicit",[],[]) [Str "Explicit"]
,Para [Str "Just",Space,Str "a",Space,Link [Str "URL"] ("/url/",""),Str "."]
,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title"),Str "."]
,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by two spaces"),Str "."]
@@ -277,7 +277,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
,Para [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere.net)"]
,Para [Link [Str "Empty"] ("",""),Str "."]
-,Header 2 ("",[],[]) [Str "Reference"]
+,Header 2 ("reference",[],[]) [Str "Reference"]
,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
@@ -290,12 +290,12 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,CodeBlock ("",[],[]) "[not]: /url"
,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
-,Header 2 ("",[],[]) [Str "With",Space,Str "ampersands"]
+,Header 2 ("with-ampersands",[],[]) [Str "With",Space,Str "ampersands"]
,Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
,Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
,Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
,Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
-,Header 2 ("",[],[]) [Str "Autolinks"]
+,Header 2 ("autolinks",[],[]) [Str "Autolinks"]
,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
,BulletList
[[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
@@ -307,12 +307,12 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
,CodeBlock ("",[],[]) "or here: <http://example.com/>"
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Images"]
+,Header 1 ("images",[],[]) [Str "Images"]
,Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
,Para [Image [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
,HorizontalRule
-,Header 1 ("",[],[]) [Str "Footnotes"]
+,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link [Str "(1)"] ("#note_1",""),Str ",",Space,Str "and",Space,Str "another",Link [Str "(longnote)"] ("#note_longnote",""),Str ".",Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space^(my",Space,Str "note)."]
,Para [Link [Str "(1)"] ("#ref_1",""),Space,Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."]
,Para [Link [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
@@ -323,8 +323,8 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,Para [Emph [Str "Trailing",Space,Str "space"],Space,Str "text"]
,Para [Str "text",Space,Emph [Str "Leading",Space,Str "spaces"]]
,Para [Emph [Str "Trailing",Space,Str "spaces"],Space,Str "text"]
-,Header 1 ("",[],[]) [Str "Tables"]
-,Header 2 ("",[],[]) [Str "Tables",Space,Str "with",Space,Str "Headers"]
+,Header 1 ("tables",[],[]) [Str "Tables"]
+,Header 2 ("tables-with-headers",[],[]) [Str "Tables",Space,Str "with",Space,Str "Headers"]
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
[[Plain [Str "X"]]
,[Plain [Str "Y"]]
@@ -423,7 +423,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,[[Plain [Str "4"]]
,[Plain [Str "5"]]
,[Plain [Str "6"]]]]
-,Header 2 ("",[],[]) [Str "Tables",Space,Str "without",Space,Str "Headers"]
+,Header 2 ("tables-without-headers",[],[]) [Str "Tables",Space,Str "without",Space,Str "Headers"]
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
[]
[[[Plain [Str "1"]]
@@ -459,5 +459,5 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
,[[Plain [Str "4"]]
,[Plain [Str "5"]]
,[Plain [Str "6"]]]]
-,Header 2 ("",[],[]) [Str "Empty",Space,Str "Tables"]
+,Header 2 ("empty-tables",[],[]) [Str "Empty",Space,Str "Tables"]
,Para [Str "This",Space,Str "section",Space,Str "should",Space,Str "be",Space,Str "empty."]]
diff --git a/tests/media/rId25.jpg b/tests/media/rId25.jpg
index e69de29bb..277ace7d1 100644
--- a/tests/media/rId25.jpg
+++ b/tests/media/rId25.jpg
Binary files differ
diff --git a/tests/media/rId26.jpg b/tests/media/rId26.jpg
index e69de29bb..277ace7d1 100644
--- a/tests/media/rId26.jpg
+++ b/tests/media/rId26.jpg
Binary files differ
diff --git a/tests/media/rId27.jpg b/tests/media/rId27.jpg
index e69de29bb..277ace7d1 100644
--- a/tests/media/rId27.jpg
+++ b/tests/media/rId27.jpg
Binary files differ
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index f30dafa33..5da865b70 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -344,7 +344,7 @@ and cheese
| Butter || Ice cream || and more
|}
-{|width="50%"
+{|width=50%
! align="left" width="50%"| Left
! align="right"|Right
! align="center"|Center
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
index 1f402f835..c7110eabd 100644
--- a/tests/rst-reader.native
+++ b/tests/rst-reader.native
@@ -325,7 +325,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
,Para [Str "And",Space,Str "some",Space,Str "inline",Space,Str "haskell",Space,Code ("",["haskell","sourceCode"],[]) "fmap id [1,2..10]",Str "."]
,Null
,Null
-,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["python","indirect","sourceCode"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]
+,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["py","python","indirect","sourceCode"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]
,Null
,Null
,Para [Str "Different",Space,Str "indirect",Space,Str "C",Space,Code ("",["c","different-indirect","sourceCode"],[]) "int x = 15;",Str "."]
diff --git a/tests/rst-reader.rst b/tests/rst-reader.rst
index 930bf2ed2..ff10abe24 100644
--- a/tests/rst-reader.rst
+++ b/tests/rst-reader.rst
@@ -611,10 +611,10 @@ And some inline haskell :haskell:`fmap id [1,2..10]`.
.. role:: indirect(code)
-.. role:: python(indirect)
+.. role:: py(indirect)
:language: python
-Indirect python role :python:`[x*x for x in [1,2,3,4,5]]`.
+Indirect python role :py:`[x*x for x in [1,2,3,4,5]]`.
.. role:: different-indirect(code)
:language: c