diff options
81 files changed, 2862 insertions, 290 deletions
diff --git a/.gitignore b/.gitignore index 97150be15..c3154ea10 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ man/man?/*.html /windows/*.msi /windows/*.wixpdb windows/*.wixobj +data/reference.docx +data/reference.odt diff --git a/.travis.yml b/.travis.yml index 7c579348f..4ec48b8a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ # The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for. env: # - GHCVER=6.12.3 - - CABALVER=1.16 GHCVER=7.4.2 - - CABALVER=1.18 GHCVER=7.6.3 - - CABALVER=1.18 GHCVER=7.8.4 # see note about Alex/Happy -# - CABALVER=1.22 GHCVER=7.10.1 + - CABALVER=1.16 GHCVER=7.4.2 GHCOPTS="-Werror" + - CABALVER=1.18 GHCVER=7.6.3 GHCOPTS="-Werror" + - CABALVER=1.18 GHCVER=7.8.4 GHCOPTS="-Werror" # see note on Alex/Happy + - CABALVER=1.22 GHCVER=7.10.1 GHCOPTS="" # - GHCVER=head # see section about GHC HEAD snapshots # Note: the distinction between `before_install` and `install` is not important. @@ -24,6 +24,6 @@ install: # Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail. script: - cabal-$CABALVER configure --enable-tests -v2 # -v2 provides useful information for debugging - - cabal-$CABALVER build --ghc-options=-Werror # this builds all libraries and executables (including tests/benchmarks) + - cabal-$CABALVER build --ghc-options=$GHCOPTS # this builds all libraries and executables (including tests/benchmarks) - cabal-$CABALVER test - cabal-$CABALVER check @@ -12,17 +12,18 @@ 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], [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], [Slideous], [DZSlides], [reveal.js] or -[S5] HTML slide shows. It can also produce [PDF] output on systems where -LaTeX is installed. +[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], [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, @@ -154,11 +155,13 @@ General options --------------- `-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT* + : Specify input format. *FORMAT* can be `native` (native Haskell), `json` (JSON version of native AST), `markdown` (pandoc's extended markdown), `markdown_strict` (original unextended markdown), `markdown_phpextra` (PHP Markdown Extra extended markdown), `markdown_github` (github extended markdown), + `commonmark` (CommonMark markdown), `textile` (Textile), `rst` (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t` (txt2tags), `docx` (docx), `epub` (EPUB), `opml` (OPML), `org` (Emacs Org-mode), `mediawiki` (MediaWiki markup), @@ -176,6 +179,7 @@ General options their names. `-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT* + : Specify output format. *FORMAT* can be `native` (native Haskell), `json` (JSON version of native AST), `plain` (plain text), `markdown` (pandoc's extended markdown), `markdown_strict` (original @@ -205,11 +209,13 @@ General options above under `-f`. `-o` *FILE*, `--output=`*FILE* + : Write output to *FILE* instead of *stdout*. If *FILE* is `-`, output will go to *stdout*. (Exception: if the output format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.) `--data-dir=`*DIRECTORY* + : Specify the user data directory to search for pandoc data files. If this option is not specified, the default user data directory will be used. This is @@ -231,19 +237,23 @@ General options placed in this directory will override pandoc's normal defaults. `--verbose` + : Give verbose debugging output. Currently this only has an effect with PDF output. `-v`, `--version` + : Print version. `-h`, `--help` + : Show usage message. Reader options -------------- `-R`, `--parse-raw` + : Parse untranslatable HTML codes and LaTeX environments as raw HTML or LaTeX, instead of ignoring them. Affects only HTML and LaTeX input. Raw HTML can be printed in markdown, reStructuredText, HTML, @@ -254,6 +264,7 @@ Reader options LaTeX *commands*, even if `-R` is not specified.) `-S`, `--smart` + : Produce typographically correct output, converting straight quotes to curly quotes, `---` to em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces are inserted after certain @@ -264,25 +275,30 @@ Reader options is used.) `--old-dashes` + : Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before a numeral is an en-dash, and `--` is an em-dash. This option is selected automatically for `textile` input. `--base-header-level=`*NUMBER* + : Specify the base level for headers (defaults to 1). `--indented-code-classes=`*CLASSES* + : Specify classes to use for indented code blocks--for example, `perl,numberLines` or `haskell`. Multiple classes may be separated by spaces or commas. `--default-image-extension=`*EXTENSION* + : Specify a default extension to use when image paths/URLs have no extension. This allows you to use the same source for formats that require different kinds of images. Currently this option only affects the markdown and LaTeX readers. `--filter=`*EXECUTABLE* + : Specify an executable to be used as a filter transforming the Pandoc AST after the input is parsed and before the output is written. The executable should read JSON from stdin and write @@ -309,6 +325,7 @@ Reader options preface the filename with `./`. `-M` *KEY[=VAL]*, `--metadata=`*KEY[:VAL]* + : Set the metadata field *KEY* to the value *VAL*. A value specified on the command line overrides a value specified in the document. Values will be parsed as YAML boolean or string values. If no value is @@ -319,18 +336,22 @@ Reader options printed in some output formats). `--normalize` + : Normalize the document after reading: merge adjacent `Str` or `Emph` elements, for example, and remove repeated `Space`s. `-p`, `--preserve-tabs` + : Preserve tabs instead of converting them to spaces (the default). Note that this will only affect tabs in literal code spans and code blocks; tabs in regular text will be treated as spaces. `--tab-stop=`*NUMBER* + : Specify the number of spaces per tab (default is 4). `--track-changes=`*accept|reject|all* + : Specifies what to do with insertions and deletions produced by the MS Word "track-changes" feature. *accept* (the default), inserts all insertions, and ignores all deletions. *reject* inserts all @@ -342,6 +363,7 @@ Reader options option only affects the docx reader. `--extract-media=`*DIR* + : Extract images and other media contained in a docx or epub container to the path *DIR*, creating it if necessary, and adjust the images references in the document so they point to the extracted files. @@ -351,12 +373,14 @@ General writer options ---------------------- `-s`, `--standalone` + : Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, or RTF file, not a fragment). This option is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt` output. `--template=`*FILE* + : Use *FILE* as a custom template for the generated document. Implies `--standalone`. See [Templates](#templates) below for a description of template syntax. If no extension is specified, an extension @@ -368,6 +392,7 @@ General writer options `-D/--print-default-template`). `-V` *KEY[=VAL]*, `--variable=`*KEY[:VAL]* + : Set the template variable *KEY* to the value *VAL* when rendering the document in standalone mode. This is generally only useful when the `--template` option is used to specify a custom template, since @@ -376,40 +401,49 @@ General writer options value `true`. `-D` *FORMAT*, `--print-default-template=`*FORMAT* + : Print the default template for an output *FORMAT*. (See `-t` for a list of possible *FORMAT*s.) `--print-default-data-file=`*FILE* + : Print a default data file. `--no-wrap` + : Disable text wrapping in output. By default, text is wrapped appropriately for the output format. `--columns`=*NUMBER* + : Specify length of lines in characters (for text wrapping). `--toc`, `--table-of-contents` + : Include an automatically generated table of contents (or, in the case of `latex`, `context`, and `rst`, an instruction to create one) in the output document. This option has no effect on `man`, `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output. `--toc-depth=`*NUMBER* + : Specify the number of section levels to include in the table of contents. The default is 3 (which means that level 1, 2, and 3 headers will be listed in the contents). `--no-highlight` + : Disables syntax highlighting for code blocks and inlines, even when a language attribute is given. `--highlight-style`=*STYLE* + : Specifies the coloring style to be used in highlighted source code. Options are `pygments` (the default), `kate`, `monochrome`, `espresso`, `zenburn`, `haddock`, and `tango`. `-H` *FILE*, `--include-in-header=`*FILE* + : Include contents of *FILE*, verbatim, at the end of the header. This can be used, for example, to include special CSS or javascript in HTML documents. This option can be used @@ -417,6 +451,7 @@ General writer options included in the order specified. Implies `--standalone`. `-B` *FILE*, `--include-before-body=`*FILE* + : Include contents of *FILE*, verbatim, at the beginning of the document body (e.g. after the `<body>` tag in HTML, or the `\begin{document}` command in LaTeX). This can be used to include @@ -425,6 +460,7 @@ General writer options the order specified. Implies `--standalone`. `-A` *FILE*, `--include-after-body=`*FILE* + : Include contents of *FILE*, verbatim, at the end of the document body (before the `</body>` tag in HTML, or the `\end{document}` command in LaTeX). This option can be be used @@ -435,6 +471,7 @@ Options affecting specific writers ---------------------------------- `--self-contained` + : Produce a standalone HTML file with no external dependencies, using `data:` URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. The resulting file should be "self-contained," @@ -448,41 +485,50 @@ Options affecting specific writers file is remote). `--self-contained` does not work with `--mathjax`. `--offline` + : Deprecated synonym for `--self-contained`. `-5`, `--html5` + : Produce HTML5 instead of HTML4. This option has no effect for writers other than `html`. (*Deprecated:* Use the `html5` output format instead.) `--html-q-tags` + : Use `<q>` tags for quotes in HTML. `--ascii` + : Use only ascii characters in output. Currently supported only for HTML output (which uses numerical entities instead of UTF-8 when this option is selected). `--reference-links` + : Use reference-style links, rather than inline links, in writing markdown or reStructuredText. By default inline links are used. `--atx-headers` + : Use ATX style headers in markdown and asciidoc output. The default is to use setext-style headers for levels 1-2, and then ATX headers. `--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 the output format, top-level headers will become `\part{..}`. `-N`, `--number-sections` + : Number section headings in LaTeX, ConTeXt, HTML, or EPUB output. By default, sections are not numbered. Sections with class `unnumbered` will never be numbered, even if `--number-sections` is specified. `--number-offset`=*NUMBER[,NUMBER,...]*, + : Offset for section headings in HTML output (ignored in other output formats). The first number is added to the section number for top-level headers, the second for second-level headers, and so on. @@ -493,6 +539,7 @@ Options affecting specific writers Offsets are 0 by default. Implies `--number-sections`. `--no-tex-ligatures` + : Do not convert quotation marks, apostrophes, and dashes to the TeX ligatures when writing LaTeX or ConTeXt. Instead, just use literal unicode characters. This is needed for using advanced @@ -504,13 +551,16 @@ Options affecting specific writers without `--smart`. `--listings` + : Use listings package for LaTeX code blocks `-i`, `--incremental` + : Make list items in slide shows display incrementally (one by one). The default is for lists to be displayed all at once. `--slide-level`=*NUMBER* + : Specifies that headers with the specified level create slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers above this level in the hierarchy are used to divide the @@ -520,34 +570,40 @@ Options affecting specific writers [Structuring the slide show](#structuring-the-slide-show), below. `--section-divs` + : Wrap sections in `<div>` tags (or `<section>` tags in HTML5), and attach identifiers to the enclosing `<div>` (or `<section>`) rather than the header itself. See [Section identifiers](#header-identifiers-in-html-latex-and-context), below. `--email-obfuscation=`*none|javascript|references* + : Specify a method for obfuscating `mailto:` links in HTML documents. *none* leaves `mailto:` links as they are. *javascript* obfuscates them using javascript. *references* obfuscates them by printing their letters as decimal or hexadecimal character references. `--id-prefix`=*STRING* + : Specify a prefix to be added to all automatically generated identifiers in HTML and DocBook output, and to footnote numbers in markdown output. This is useful for preventing duplicate identifiers when generating fragments to be included in other pages. `-T` *STRING*, `--title-prefix=`*STRING* + : Specify *STRING* as a prefix at the beginning of the title that appears in the HTML header (but not in the title as it appears at the beginning of the HTML body). Implies `--standalone`. `-c` *URL*, `--css=`*URL* + : Link to a CSS style sheet. This option can be be used repeatedly to include multiple files. They will be included in the order specified. `--reference-odt=`*FILE* + : Use the specified file as a style reference in producing an ODT. For best results, the reference ODT should be a modified version of an ODT produced using pandoc. The contents of the reference ODT @@ -558,6 +614,7 @@ Options affecting specific writers used. `--reference-docx=`*FILE* + : Use the specified file as a style reference in producing a docx file. For best results, the reference docx should be a modified version of a docx file produced using pandoc. The contents of the reference docx @@ -574,18 +631,21 @@ Options affecting specific writers Footnote Ref, Link. `--epub-stylesheet=`*FILE* + : Use the specified CSS file to style the EPUB. If no stylesheet is specified, pandoc will look for a file `epub.css` in the user data directory (see `--data-dir`). If it is not found there, sensible defaults will be used. `--epub-cover-image=`*FILE* + : Use the specified image as the EPUB cover. It is recommended that the image be less than 1000px in width and height. Note that in a markdown source document you can also specify `cover-image` in a YAML metadata block (see [EPUB Metadata], below). `--epub-metadata=`*FILE* + : Look in the specified XML file for metadata for the EPUB. The file should contain a series of Dublin Core elements, as documented at <http://dublincore.org/documents/dces/>. @@ -607,6 +667,7 @@ Options affecting specific writers [EPUB Metadata]. `--epub-embed-font=`*FILE* + : Embed the specified font in the EPUB. This option can be repeated to embed multiple fonts. Wildcards can also be used: for example, `DejaVuSans-*.ttf`. However, if you use wildcards on the command @@ -642,6 +703,7 @@ Options affecting specific writers body { font-family: "DejaVuSans"; } `--epub-chapter-level=`*NUMBER* + : Specify the header level at which to split the EPUB into separate "chapter" files. The default is to split into chapters at level 1 headers. This option only affects the internal composition of the @@ -651,36 +713,48 @@ Options affecting specific writers level of 2 or 3. `--latex-engine=`*pdflatex|lualatex|xelatex* + : Use the specified LaTeX engine when producing PDF output. The default is `pdflatex`. If the engine is not in your PATH, the full path of the engine may be specified here. +`--latex-engine-opt=`*STRING* + +: Use the given string as a command-line argument to the `latex-engine`. + If used multiple times, the arguments are provided with spaces between + them. Note that no check for duplicate options is done. + Citation rendering ------------------ `--bibliography=`*FILE* + : Set the `bibliography` field in the document's metadata to *FILE*, overriding any value set in the metadata, and process citations using `pandoc-citeproc`. (This is equivalent to `--metadata bibliography=FILE --filter pandoc-citeproc`.) `--csl=`*FILE* + : Set the `csl` field in the document's metadata to *FILE*, overriding any value set in the metadata. (This is equivalent to `--metadata csl=FILE`.) `--citation-abbreviations=`*FILE* + : Set the `citation-abbreviations` field in the document's metadata to *FILE*, overriding any value set in the metadata. (This is equivalent to `--metadata citation-abbreviations=FILE`.) `--natbib` + : Use natbib for citations in LaTeX output. This option is not for use with the `pandoc-citeproc` filter or with PDF output. It is intended for use in producing a LaTeX file that can be processed with pdflatex and bibtex. `--biblatex` + : Use biblatex for citations in LaTeX output. This option is not for use with the `pandoc-citeproc` filter or with PDF output. It is intended for use in producing a LaTeX file that can be processed with pdflatex and @@ -690,6 +764,7 @@ Math rendering in HTML ---------------------- `-m` [*URL*], `--latexmathml`[=*URL*] + : Use the [LaTeXMathML] script to display embedded TeX math in HTML output. To insert a link to a local copy of the `LaTeXMathML.js` script, provide a *URL*. If no *URL* is provided, the contents of the @@ -699,12 +774,14 @@ Math rendering in HTML so it can be cached. `--mathml`[=*URL*] + : Convert TeX math to MathML (in `docbook` as well as `html` and `html5`). In standalone `html` output, a small javascript (or a link to such a script if a *URL* is supplied) will be inserted that allows the MathML to be viewed on some browsers. `--jsmath`[=*URL*] + : Use [jsMath] to display embedded TeX math in HTML output. The *URL* should point to the jsMath load script (e.g. `jsMath/easy/load.js`); if provided, it will be linked to in @@ -713,31 +790,37 @@ Math rendering in HTML up to the author to provide such a link in the HTML template. `--mathjax`[=*URL*] + : Use [MathJax] to display embedded TeX math in HTML output. The *URL* should point to the `MathJax.js` load script. If a *URL* is not provided, a link to the MathJax CDN will be inserted. `--gladtex` + : Enclose TeX math in `<eq>` tags in HTML output. These can then be processed by [gladTeX] to produce links to images of the typeset formulas. `--mimetex`[=*URL*] + : Render TeX math using the [mimeTeX] CGI script. If *URL* is not specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`. `--webtex`[=*URL*] + : Render TeX formulas using an external script that converts TeX formulas to images. The formula will be concatenated with the URL provided. If *URL* is not specified, the Google Chart API will be used. `--katex`[=*URL*] + : Use [KaTeX] to display embedded TeX math in HTML output. The *URL* should point to the `katex.js` load script. If a *URL* is not provided, a link to the KaTeX CDN will be inserted. `--katex-stylesheet=*URL*` + : The *URL* should point to the `katex.css` stylesheet. If this option is not specified, a link to the KaTeX CDN will be inserted. Note that this option does not imply `--katex`. @@ -746,6 +829,7 @@ Options for wrapper scripts --------------------------- `--dump-args` + : Print information about command-line arguments to *stdout*, then exit. This option is intended primarily for use in wrapper scripts. The first line of output contains the name of the output file specified @@ -756,6 +840,7 @@ Options for wrapper scripts after a `--` separator at the end of the line. `--ignore-args` + : Ignore command-line arguments (for use in wrapper scripts). Regular Pandoc options are not ignored. Thus, for example, @@ -1822,8 +1907,8 @@ Pipe tables look like this: The syntax is [the same as in PHP markdown extra]. The beginning and ending pipe characters are optional, but pipes are required between all columns. The colons indicate column alignment as shown. The header -can be omitted, but the horizontal line must still be included, as -it defines column alignments. +cannot be omitted. To simulate a headerless table, include a header +with blank cells. Since the pipes indicate column boundaries, columns need not be vertically aligned, as they are in the above example. So, this is a perfectly @@ -2434,9 +2519,9 @@ Note that link labels are not case sensitive. So, this will work: [Foo]: /bar/baz In an *implicit* reference link, the second pair of brackets is -empty, or omitted entirely: +empty: - See [my website][], or [my website]. + See [my website][]. [my website]: http://foo.bar.baz @@ -2450,6 +2535,15 @@ not in most other implementations: > > [quote]: /foo +#### Extension: `shortcut_reference_links` #### + +In a *shortcut* reference link, the second pair of brackets may +be omitted entirely: + + See [my website]. + + [my website]: http://foo.bar.baz + ### Internal links ### To link to another section of the same document, use the automatically @@ -2796,7 +2890,7 @@ variants are supported: `fenced_code_blocks`, `definition_lists`, `intraword_underscores`, `header_attributes`, `abbreviations`. -`markdown_github` (Github-flavored Markdown) +`markdown_github` (GitHub-flavored Markdown) : `pipe_tables`, `raw_html`, `tex_math_single_backslash`, `fenced_code_blocks`, `auto_identifiers`, `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`, @@ -3224,3 +3318,4 @@ Rosenthal. [EPUB]: http://idpf.org/epub [EPUBspine]: http://www.idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem [KaTeX]: https://github.com/Khan/KaTeX +[CommonMark]: http://commonmark.org @@ -22,7 +22,10 @@ import Distribution.PackageDescription (PackageDescription(..), Executable(..)) import System.Process ( rawSystem ) import System.FilePath ( (</>) ) import System.Directory ( findExecutable ) -import Distribution.Simple.Utils (info) +import Distribution.Simple.Utils (info, rawSystemExit) +import Distribution.Simple.Setup +import Distribution.Simple.LocalBuildInfo +import Distribution.Verbosity main :: IO () main = defaultMainWithHooks $ simpleUserHooks { @@ -30,12 +33,15 @@ main = defaultMainWithHooks $ simpleUserHooks { hookedPreProcessors = [ppBlobSuffixHandler] -- ensure that make-pandoc-man-pages doesn't get installed to bindir , copyHook = \pkgdescr -> - (copyHook simpleUserHooks) pkgdescr{ executables = - [x | x <- executables pkgdescr, exeName x /= "make-pandoc-man-pages"] } + copyHook simpleUserHooks pkgdescr{ executables = + [x | x <- executables pkgdescr, exeName x `notElem` noInstall] } , instHook = \pkgdescr -> - (instHook simpleUserHooks) pkgdescr{ executables = - [x | x <- executables pkgdescr, exeName x /= "make-pandoc-man-pages"] } + instHook simpleUserHooks pkgdescr{ executables = + [x | x <- executables pkgdescr, exeName x `notElem` noInstall] } + , postBuild = makeReferenceFiles } + where + noInstall = ["make-pandoc-man-pages","make-reference-files"] ppBlobSuffixHandler :: PPSuffixHandler ppBlobSuffixHandler = ("hsb", \_ _ -> @@ -49,3 +55,13 @@ ppBlobSuffixHandler = ("hsb", \_ _ -> Nothing -> error "hsb2hs is needed to build this program: cabal install hsb2hs" return () }) + +makeReferenceFiles :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () +makeReferenceFiles _ bf _ LocalBuildInfo{buildDir=buildDir} + = mapM_ + (rawSystemExit verbosity progPath . return) + referenceFormats + where + verbosity = fromFlagOrDefault normal $ buildVerbosity bf + progPath = buildDir </> "make-reference-files" </> "make-reference-files" + referenceFormats = ["docx", "odt"] diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index 61e838cbc..5c0dab460 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -28,12 +28,18 @@ import Control.Applicative readerBench :: Pandoc -> (String, ReaderOptions -> String -> IO (Either PandocError Pandoc)) -> Maybe Benchmark -readerBench doc (name, reader) = case lookup name writers of - Just (PureStringWriter writer) -> - let inp = writer def{ writerWrapText = True} doc - in return $ bench (name ++ " reader") $ nfIO $ +readerBench doc (name, reader) = + case lookup name writers of + Just (PureStringWriter writer) -> + let inp = writer def{ writerWrapText = True} doc + in return $ bench (name ++ " reader") $ nfIO $ (fmap handleError <$> reader def{ readerSmart = True }) inp - _ -> trace ("\nCould not find writer for " ++ name ++ "\n") Nothing + _ | name == "commonmark" -> + let inp = writeMarkdown def{ writerWrapText = True} doc + in return $ bench (name ++ " reader") $ nfIO $ + (fmap handleError <$> reader def{ readerSmart = True }) inp + | otherwise -> trace ("\nCould not find writer for " ++ name ++ + "\n") Nothing writerBench :: Pandoc -> (String, WriterOptions -> Pandoc -> String) @@ -3975,7 +3975,7 @@ pandoc (1.9) These constructions are now supported now by `rst2latex.py`. - * Github syntax for fenced code blocks is supported in pandoc's + * GitHub syntax for fenced code blocks is supported in pandoc's markdown. You can now write ```ruby diff --git a/data/docx/[Content_Types].xml b/data/docx/[Content_Types].xml new file mode 100644 index 000000000..9c5756aed --- /dev/null +++ b/data/docx/[Content_Types].xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml" /><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Override PartName="/word/webSettings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml" /><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" /><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" /><Override PartName="/word/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml" /><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" /><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" /><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml" /><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" /><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" /><Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" /></Types> diff --git a/data/docx/_rels/.rels b/data/docx/_rels/.rels new file mode 100644 index 000000000..44e5daa3d --- /dev/null +++ b/data/docx/_rels/.rels @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" /><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml" /><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml" /></Relationships>
\ No newline at end of file diff --git a/data/docx/docProps/app.xml b/data/docx/docProps/app.xml new file mode 100644 index 000000000..1764f14d7 --- /dev/null +++ b/data/docx/docProps/app.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"> + <Words>83</Words> + <SharedDoc>false</SharedDoc> + <HyperlinksChanged>false</HyperlinksChanged> + <Lines>12</Lines> + <AppVersion>12.0000</AppVersion> + <LinksUpToDate>false</LinksUpToDate> + <Application>Microsoft Word 12.0.0</Application> + <CharactersWithSpaces>583</CharactersWithSpaces> + <Template>Normal.dotm</Template> + <DocSecurity>0</DocSecurity> + <TotalTime>6</TotalTime> + <ScaleCrop>false</ScaleCrop> + <Characters>475</Characters> + <Paragraphs>8</Paragraphs> + <Pages>1</Pages> +</Properties>
\ No newline at end of file diff --git a/data/docx/docProps/core.xml b/data/docx/docProps/core.xml new file mode 100644 index 000000000..2274766e4 --- /dev/null +++ b/data/docx/docProps/core.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title></dc:title><dc:creator></dc:creator></cp:coreProperties>
\ No newline at end of file diff --git a/data/docx/word/_rels/document.xml.rels b/data/docx/word/_rels/document.xml.rels new file mode 100644 index 000000000..ca0c57b63 --- /dev/null +++ b/data/docx/word/_rels/document.xml.rels @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Id="rId1" Target="numbering.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId2" Target="styles.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Id="rId3" Target="settings.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Id="rId4" Target="webSettings.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Id="rId5" Target="fontTable.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Id="rId6" Target="theme/theme1.xml" /><Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Id="rId7" Target="footnotes.xml" /></Relationships> diff --git a/data/docx/word/_rels/footnotes.xml.rels b/data/docx/word/_rels/footnotes.xml.rels new file mode 100644 index 000000000..be7e70853 --- /dev/null +++ b/data/docx/word/_rels/footnotes.xml.rels @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships" />
\ No newline at end of file diff --git a/data/docx/word/document.xml b/data/docx/word/document.xml new file mode 100644 index 000000000..7199034da --- /dev/null +++ b/data/docx/word/document.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><w:body><w:p><w:r><w:t xml:space="preserve">Hello world.</w:t></w:r></w:p></w:body></w:document> diff --git a/data/docx/word/fontTable.xml b/data/docx/word/fontTable.xml new file mode 100644 index 000000000..fce61de9c --- /dev/null +++ b/data/docx/word/fontTable.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:fonts xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> +	<w:font w:name="Symbol"> +		<w:panose1 w:val="02000500000000000000" /> +		<w:charset w:val="02" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000000" w:usb1="00000000" w:usb2="00010000" w:usb3="00000000" w:csb0="80000000" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Times New Roman"> +		<w:panose1 w:val="02020603050405020304" /> +		<w:charset w:val="00" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Courier New"> +		<w:panose1 w:val="02070309020205020404" /> +		<w:charset w:val="00" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Wingdings"> +		<w:panose1 w:val="05020102010804080708" /> +		<w:charset w:val="02" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000000" w:usb1="00000000" w:usb2="00010000" w:usb3="00000000" w:csb0="80000000" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Cambria"> +		<w:panose1 w:val="02040503050406030204" /> +		<w:charset w:val="00" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Calibri"> +		<w:panose1 w:val="020F0502020204030204" /> +		<w:charset w:val="00" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000" /> +	</w:font> +	<w:font w:name="Arial"> +		<w:panose1 w:val="020B0604020202020204" /> +		<w:charset w:val="00" /> +		<w:family w:val="auto" /> +		<w:pitch w:val="variable" /> +		<w:sig w:usb0="00000003" w:usb1="00000000" w:usb2="00000000" w:usb3="00000000" w:csb0="00000001" w:csb1="00000000" /> +	</w:font> +</w:fonts>
\ No newline at end of file diff --git a/data/docx/word/footnotes.xml b/data/docx/word/footnotes.xml new file mode 100644 index 000000000..9c2ed2add --- /dev/null +++ b/data/docx/word/footnotes.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:footnotes xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" />
\ No newline at end of file diff --git a/data/docx/word/numbering.xml b/data/docx/word/numbering.xml new file mode 100644 index 000000000..b9e91371b --- /dev/null +++ b/data/docx/word/numbering.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:numbering xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:abstractNum w:abstractNumId="0"><w:nsid w:val="e17f69ba" /><w:multiLevelType w:val="multilevel" /><w:lvl w:ilvl="0"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="0" /></w:tabs><w:ind w:left="480" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="1"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="720" /></w:tabs><w:ind w:left="1200" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="2"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="1440" /></w:tabs><w:ind w:left="1920" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="3"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="2160" /></w:tabs><w:ind w:left="2640" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="4"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="2880" /></w:tabs><w:ind w:left="3360" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="5"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="3600" /></w:tabs><w:ind w:left="4080" w:hanging="480" /></w:pPr></w:lvl><w:lvl w:ilvl="6"><w:numFmt w:val="bullet" /><w:lvlText w:val=" " /><w:lvlJc w:val="left" /><w:pPr><w:tabs><w:tab w:val="num" w:pos="4320" /></w:tabs><w:ind w:left="4800" w:hanging="480" /></w:pPr></w:lvl></w:abstractNum><w:num w:numId="1"><w:abstractNumId w:val="0" /></w:num></w:numbering>
\ No newline at end of file diff --git a/data/docx/word/settings.xml b/data/docx/word/settings.xml new file mode 100644 index 000000000..425e6f7b5 --- /dev/null +++ b/data/docx/word/settings.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main"> + <w:zoom w:percent="90" /> + <w:embedSystemFonts /> + <w:proofState w:spelling="clean" w:grammar="clean" /> + <w:stylePaneFormatFilter w:val="0004" /> + <w:footnotePr> + <w:footnote w:id="-1" /> + <w:footnote w:id="0" /> + </w:footnotePr> + <w:doNotTrackMoves /> + <w:defaultTabStop w:val="720" /> + <w:drawingGridHorizontalSpacing w:val="360" /> + <w:drawingGridVerticalSpacing w:val="360" /> + <w:displayHorizontalDrawingGridEvery w:val="0" /> + <w:displayVerticalDrawingGridEvery w:val="0" /> + <w:characterSpacingControl w:val="doNotCompress" /> + <w:savePreviewPicture /> + <w:rsids> + <w:rsidRoot w:val="00590D07" /> + <w:rsid w:val="00011C8B" /> + <w:rsid w:val="004E29B3" /> + <w:rsid w:val="00590D07" /> + <w:rsid w:val="00784D58" /> + <w:rsid w:val="008D6863" /> + <w:rsid w:val="00B86B75" /> + <w:rsid w:val="00BC48D5" /> + <w:rsid w:val="00C36279" /> + <w:rsid w:val="00E315A3" /> + </w:rsids> + <m:mathPr> + <m:mathFont m:val="Lucida Grande" /> + <m:brkBin m:val="before" /> + <m:brkBinSub m:val="--" /> + <m:smallFrac m:val="false" /> + <m:dispDef m:val="false" /> + <m:lMargin m:val="0" /> + <m:rMargin m:val="0" /> + <m:wrapRight /> + <m:intLim m:val="subSup" /> + <m:naryLim m:val="subSup" /> + </m:mathPr> + <w:themeFontLang w:val="en-US" /> + <w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink" /> + <w:decimalSymbol w:val="." /> + <w:listSeparator w:val="," /> +</w:settings> diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml new file mode 100644 index 000000000..0de21bd4c --- /dev/null +++ b/data/docx/word/styles.xml @@ -0,0 +1,343 @@ +<?xml version="1.0" encoding="UTF-8"?> +<w:styles xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> + <w:docDefaults> + <w:rPrDefault> + <w:rPr> + <w:rFonts w:asciiTheme="minorHAnsi" w:eastAsiaTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorBidi" /> + <w:sz w:val="24" /> + <w:szCs w:val="24" /> + <w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="ar-SA" /> + </w:rPr> + </w:rPrDefault> + <w:pPrDefault> + <w:pPr> + <w:spacing w:after="200" /> + </w:pPr> + </w:pPrDefault> + </w:docDefaults> + <w:latentStyles w:defLockedState="0" w:defUIPriority="0" w:defSemiHidden="0" w:defUnhideWhenUsed="0" w:defQFormat="0" w:count="276" /> + <w:style w:type="paragraph" w:default="1" w:styleId="Normal"> + <w:name w:val="Normal" /> + <w:qFormat /> + </w:style> + <w:style w:type="paragraph" w:styleId="BodyText"> + <w:name w:val="Body Text" /> + <w:basedOn w:val="Normal" /> + <w:link w:val="BodyTextChar" /> + <w:pPr> + <w:spacing w:before="180" w:after="180" /> + </w:pPr> + <w:qFormat /> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="FirstParagraph"> + <w:name w:val="First Paragraph" /> + <w:basedOn w:val="BodyText" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="Compact"> + <w:name w:val="Compact" /> + <w:basedOn w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:spacing w:before="36" w:after="36" /> + </w:pPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Title"> + <w:name w:val="Title" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="480" w:after="240" /> + <w:jc w:val="center" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:b /> + <w:bCs /> + <w:color w:val="345A8A" w:themeColor="accent1" w:themeShade="B5" /> + <w:sz w:val="36" /> + <w:szCs w:val="36" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Subtitle"> + <w:name w:val="Subtitle" /> + <w:basedOn w:val="Title" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="240" w:after="240" /> + <w:jc w:val="center" /> + </w:pPr> + <w:rPr> + <w:sz w:val="30" /> + <w:szCs w:val="30" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="Author"> + <w:name w:val="Author" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:jc w:val="center" /> + </w:pPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Date"> + <w:name w:val="Date" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:jc w:val="center" /> + </w:pPr> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="Abstract"> + <w:name w:val="Abstract" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="300" w:after="300" /> + </w:pPr> + <w:rPr> + <w:sz w:val="20" /> + <w:szCs w:val="20" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Bibliography"> + <w:name w:val="Bibliography" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="Bibliography" /> + <w:qFormat /> + <w:pPr /> + <w:rPr /> + </w:style> + <w:style w:type="paragraph" w:styleId="Heading1"> + <w:name w:val="Heading 1" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="480" w:after="0" /> + <w:outlineLvl w:val="0" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:b /> + <w:bCs /> + <w:color w:val="345A8A" w:themeColor="accent1" w:themeShade="B5" /> + <w:sz w:val="32" /> + <w:szCs w:val="32" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Heading2"> + <w:name w:val="Heading 2" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="200" w:after="0" /> + <w:outlineLvl w:val="1" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:b /> + <w:bCs /> + <w:color w:val="4F81BD" w:themeColor="accent1" /> + <w:sz w:val="32" /> + <w:szCs w:val="32" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Heading3"> + <w:name w:val="Heading 3" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="200" w:after="0" /> + <w:outlineLvl w:val="1" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:b /> + <w:bCs /> + <w:color w:val="4F81BD" w:themeColor="accent1" /> + <w:sz w:val="28" /> + <w:szCs w:val="28" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Heading4"> + <w:name w:val="Heading 4" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="200" w:after="0" /> + <w:outlineLvl w:val="1" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:b /> + <w:bCs /> + <w:color w:val="4F81BD" w:themeColor="accent1" /> + <w:sz w:val="24" /> + <w:szCs w:val="24" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="Heading5"> + <w:name w:val="Heading 5" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:before="200" w:after="0" /> + <w:outlineLvl w:val="1" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:i /> + <w:iCs /> + <w:color w:val="4F81BD" w:themeColor="accent1" /> + <w:sz w:val="24" /> + <w:szCs w:val="24" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="BlockText"> + <w:name w:val="Block Text" /> + <w:basedOn w:val="BodyText" /> + <w:next w:val="BodyText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:pPr> + <w:spacing w:before="100" w:after="100" /> + <w:ind w:firstLine="0" /> + </w:pPr> + <w:rPr> + <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi" w:cstheme="majorBidi" /> + <w:bCs /> + <w:sz w:val="20" /> + <w:szCs w:val="20" /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:styleId="FootnoteText"> + <w:name w:val="Footnote Text" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="FootnoteText" /> + <w:uiPriority w:val="9" /> + <w:unhideWhenUsed /> + <w:qFormat /> + </w:style> + <w:style w:type="character" w:default="1" w:styleId="DefaultParagraphFont"> + <w:name w:val="Default Paragraph Font" /> + <w:semiHidden /> + <w:unhideWhenUsed /> + </w:style> + <w:style w:type="table" w:default="1" w:styleId="TableNormal"> + <w:name w:val="Normal Table" /> + <w:semiHidden /> + <w:unhideWhenUsed /> + <w:qFormat /> + <w:tblPr> + <w:tblInd w:w="0" w:type="dxa" /> + <w:tblCellMar> + <w:top w:w="0" w:type="dxa" /> + <w:left w:w="108" w:type="dxa" /> + <w:bottom w:w="0" w:type="dxa" /> + <w:right w:w="108" w:type="dxa" /> + </w:tblCellMar> + </w:tblPr> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="DefinitionTerm"> + <w:name w:val="Definition Term" /> + <w:basedOn w:val="Normal" /> + <w:next w:val="Definition" /> + <w:pPr> + <w:keepNext /> + <w:keepLines /> + <w:spacing w:after="0" /> + </w:pPr> + <w:rPr> + <w:b /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="Definition"> + <w:name w:val="Definition" /> + <w:basedOn w:val="Normal" /> + </w:style> + <w:style w:type="paragraph" w:styleId="Caption"> + <w:name w:val="Caption" /> + <w:basedOn w:val="Normal" /> + <w:link w:val="BodyTextChar" /> + <w:pPr> + <w:spacing w:before="0" w:after="120" /> + </w:pPr> + <w:rPr> + <w:i /> + </w:rPr> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="TableCaption"> + <w:name w:val="Table Caption" /> + <w:basedOn w:val="Caption" /> + </w:style> + <w:style w:type="paragraph" w:customStyle="1" w:styleId="ImageCaption"> + <w:name w:val="Image Caption" /> + <w:basedOn w:val="Caption" /> + </w:style> + <w:style w:type="character" w:customStyle="1" w:styleId="BodyTextChar"> + <w:name w:val="Body Text Char" /> + <w:basedOn w:val="DefaultParagraphFont" /> + <w:link w:val="BodyText" /> + </w:style> + <w:style w:type="character" w:customStyle="1" w:styleId="VerbatimChar"> + <w:name w:val="Verbatim Char" /> + <w:basedOn w:val="BodyTextChar" /> + <w:rPr> + <w:rFonts w:ascii="Consolas" w:hAnsi="Consolas" /> + <w:sz w:val="22" /> + </w:rPr> + </w:style> + <w:style w:type="character" w:styleId="FootnoteReference"> + <w:name w:val="Footnote Reference" /> + <w:basedOn w:val="BodyTextChar" /> + <w:rPr> + <w:vertAlign w:val="superscript" /> + </w:rPr> + </w:style> + <w:style w:type="character" w:styleId="Hyperlink"> + <w:name w:val="Hyperlink" /> + <w:basedOn w:val="BodyTextChar" /> + <w:rPr> + <w:color w:val="4F81BD" w:themeColor="accent1" /> + </w:rPr> + </w:style> +</w:styles> diff --git a/data/docx/word/theme/theme1.xml b/data/docx/word/theme/theme1.xml new file mode 100644 index 000000000..a6f7240c4 --- /dev/null +++ b/data/docx/word/theme/theme1.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000" /></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF" /></a:lt1><a:dk2><a:srgbClr val="1F497D" /></a:dk2><a:lt2><a:srgbClr val="EEECE1" /></a:lt2><a:accent1><a:srgbClr val="4F81BD" /></a:accent1><a:accent2><a:srgbClr val="C0504D" /></a:accent2><a:accent3><a:srgbClr val="9BBB59" /></a:accent3><a:accent4><a:srgbClr val="8064A2" /></a:accent4><a:accent5><a:srgbClr val="4BACC6" /></a:accent5><a:accent6><a:srgbClr val="F79646" /></a:accent6><a:hlink><a:srgbClr val="0000FF" /></a:hlink><a:folHlink><a:srgbClr val="800080" /></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont><a:latin typeface="Calibri" /><a:ea typeface="" /><a:cs typeface="" /><a:font script="Jpan" typeface="MS ゴシック" /><a:font script="Hang" typeface="맑은 고딕" /><a:font script="Hans" typeface="宋体" /><a:font script="Hant" typeface="新細明體" /><a:font script="Arab" typeface="Times New Roman" /><a:font script="Hebr" typeface="Times New Roman" /><a:font script="Thai" typeface="Angsana New" /><a:font script="Ethi" typeface="Nyala" /><a:font script="Beng" typeface="Vrinda" /><a:font script="Gujr" typeface="Shruti" /><a:font script="Khmr" typeface="MoolBoran" /><a:font script="Knda" typeface="Tunga" /><a:font script="Guru" typeface="Raavi" /><a:font script="Cans" typeface="Euphemia" /><a:font script="Cher" typeface="Plantagenet Cherokee" /><a:font script="Yiii" typeface="Microsoft Yi Baiti" /><a:font script="Tibt" typeface="Microsoft Himalaya" /><a:font script="Thaa" typeface="MV Boli" /><a:font script="Deva" typeface="Mangal" /><a:font script="Telu" typeface="Gautami" /><a:font script="Taml" typeface="Latha" /><a:font script="Syrc" typeface="Estrangelo Edessa" /><a:font script="Orya" typeface="Kalinga" /><a:font script="Mlym" typeface="Kartika" /><a:font script="Laoo" typeface="DokChampa" /><a:font script="Sinh" typeface="Iskoola Pota" /><a:font script="Mong" typeface="Mongolian Baiti" /><a:font script="Viet" typeface="Times New Roman" /><a:font script="Uigh" typeface="Microsoft Uighur" /></a:majorFont><a:minorFont><a:latin typeface="Cambria" /><a:ea typeface="" /><a:cs typeface="" /><a:font script="Jpan" typeface="MS 明朝" /><a:font script="Hang" typeface="맑은 고딕" /><a:font script="Hans" typeface="宋体" /><a:font script="Hant" typeface="新細明體" /><a:font script="Arab" typeface="Arial" /><a:font script="Hebr" typeface="Arial" /><a:font script="Thai" typeface="Cordia New" /><a:font script="Ethi" typeface="Nyala" /><a:font script="Beng" typeface="Vrinda" /><a:font script="Gujr" typeface="Shruti" /><a:font script="Khmr" typeface="DaunPenh" /><a:font script="Knda" typeface="Tunga" /><a:font script="Guru" typeface="Raavi" /><a:font script="Cans" typeface="Euphemia" /><a:font script="Cher" typeface="Plantagenet Cherokee" /><a:font script="Yiii" typeface="Microsoft Yi Baiti" /><a:font script="Tibt" typeface="Microsoft Himalaya" /><a:font script="Thaa" typeface="MV Boli" /><a:font script="Deva" typeface="Mangal" /><a:font script="Telu" typeface="Gautami" /><a:font script="Taml" typeface="Latha" /><a:font script="Syrc" typeface="Estrangelo Edessa" /><a:font script="Orya" typeface="Kalinga" /><a:font script="Mlym" typeface="Kartika" /><a:font script="Laoo" typeface="DokChampa" /><a:font script="Sinh" typeface="Iskoola Pota" /><a:font script="Mong" typeface="Mongolian Baiti" /><a:font script="Viet" typeface="Arial" /><a:font script="Uigh" typeface="Microsoft Uighur" /></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr" /></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000" /><a:satMod val="300000" /></a:schemeClr></a:gs><a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000" /><a:satMod val="300000" /></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000" /><a:satMod val="350000" /></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="1" /></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000" /><a:shade val="100000" /><a:satMod val="130000" /></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000" /><a:shade val="100000" /><a:satMod val="350000" /></a:schemeClr></a:gs></a:gsLst><a:lin ang="16200000" scaled="0" /></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000" /><a:satMod val="105000" /></a:schemeClr></a:solidFill><a:prstDash val="solid" /></a:ln><a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr" /></a:solidFill><a:prstDash val="solid" /></a:ln><a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr" /></a:solidFill><a:prstDash val="solid" /></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000" /></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000" /></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000" /></a:srgbClr></a:outerShdw></a:effectLst><a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0" /></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000" /></a:lightRig></a:scene3d><a:sp3d><a:bevelT w="63500" h="25400" /></a:sp3d></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr" /></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000" /><a:satMod val="350000" /></a:schemeClr></a:gs><a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000" /><a:shade val="99000" /><a:satMod val="350000" /></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000" /><a:satMod val="255000" /></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000" /></a:path></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000" /><a:satMod val="300000" /></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000" /><a:satMod val="200000" /></a:schemeClr></a:gs></a:gsLst><a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000" /></a:path></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults><a:spDef><a:spPr /><a:bodyPr /><a:lstStyle /><a:style><a:lnRef idx="1"><a:schemeClr val="accent1" /></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1" /></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1" /></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1" /></a:fontRef></a:style></a:spDef><a:lnDef><a:spPr /><a:bodyPr /><a:lstStyle /><a:style><a:lnRef idx="2"><a:schemeClr val="accent1" /></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1" /></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1" /></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1" /></a:fontRef></a:style></a:lnDef></a:objectDefaults><a:extraClrSchemeLst /></a:theme>
\ No newline at end of file diff --git a/data/docx/word/webSettings.xml b/data/docx/word/webSettings.xml new file mode 100644 index 000000000..570ca8e1a --- /dev/null +++ b/data/docx/word/webSettings.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ns0:webSettings xmlns:ns0="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> + <ns0:allowPNG /> + <ns0:doNotSaveAsSingleFile /> +</ns0:webSettings>
\ No newline at end of file diff --git a/data/make-reference-files.hs b/data/make-reference-files.hs new file mode 100644 index 000000000..2e64dc51f --- /dev/null +++ b/data/make-reference-files.hs @@ -0,0 +1,26 @@ +import System.Environment +import System.Directory +import Codec.Archive.Zip +import qualified Data.ByteString.Lazy as BS +import qualified Control.Exception as E +import System.IO.Error (isDoesNotExistError) + +mkzip :: String -> IO () +mkzip fmt = do + let dir = "data/"++fmt + output = "data/reference."++fmt + cd <- getCurrentDirectory + setCurrentDirectory dir + archive <- addFilesToArchive [OptRecursive] emptyArchive ["."] + setCurrentDirectory cd + removeIfExists output + BS.writeFile output $ fromArchive archive + +removeIfExists :: FilePath -> IO () +removeIfExists fileName = removeFile fileName `E.catch` handleExists + where handleExists e + | isDoesNotExistError e = return () + | otherwise = E.throwIO e + +main :: IO () +main = getArgs >>= mkzip . (!!0) diff --git a/data/odt/Configurations2/accelerator/current.xml b/data/odt/Configurations2/accelerator/current.xml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/data/odt/Configurations2/accelerator/current.xml diff --git a/data/odt/META-INF/manifest.xml b/data/odt/META-INF/manifest.xml new file mode 100644 index 000000000..2796993a5 --- /dev/null +++ b/data/odt/META-INF/manifest.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"> + <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/> + <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="settings.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Thumbnails/thumbnail.png" manifest:media-type="image/png"/> + <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/> + <manifest:file-entry manifest:full-path="Configurations2/accelerator/current.xml" manifest:media-type=""/> + <manifest:file-entry manifest:full-path="Configurations2/" manifest:media-type="application/vnd.sun.xml.ui.configuration"/> + <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/> +</manifest:manifest>
\ No newline at end of file diff --git a/data/odt/Thumbnails/thumbnail.png b/data/odt/Thumbnails/thumbnail.png Binary files differnew file mode 100644 index 000000000..63de13060 --- /dev/null +++ b/data/odt/Thumbnails/thumbnail.png diff --git a/data/odt/content.xml b/data/odt/content.xml new file mode 100644 index 000000000..3bf335bb6 --- /dev/null +++ b/data/odt/content.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="StarSymbol" svg:font-family="StarSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footer"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/></style:style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">Hello World!</text:p></office:text></office:body></office:document-content>
\ No newline at end of file diff --git a/data/odt/manifest.rdf b/data/odt/manifest.rdf new file mode 100644 index 000000000..927e206bb --- /dev/null +++ b/data/odt/manifest.rdf @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="styles.xml"> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/> + </rdf:Description> + <rdf:Description rdf:about="content.xml"> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/> + </rdf:Description> +</rdf:RDF> diff --git a/data/odt/meta.xml b/data/odt/meta.xml new file mode 100644 index 000000000..7fdd4d98c --- /dev/null +++ b/data/odt/meta.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-meta + xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" + xmlns:ooo="http://openoffice.org/2004/office" + xmlns:grddl="http://www.w3.org/2003/g/data-view#" + office:version="1.2"> + <office:meta> + <meta:document-statistic + meta:table-count="0" meta:image-count="0" meta:object-count="0" + meta:page-count="1" meta:paragraph-count="2" meta:word-count="3" + meta:character-count="14" + meta:non-whitespace-character-count="12"/> + <meta:generator>Pandoc</meta:generator> + </office:meta> +</office:document-meta> diff --git a/data/odt/mimetype b/data/odt/mimetype new file mode 100644 index 000000000..2e95b81c9 --- /dev/null +++ b/data/odt/mimetype @@ -0,0 +1 @@ +application/vnd.oasis.opendocument.text
\ No newline at end of file diff --git a/data/odt/settings.xml b/data/odt/settings.xml new file mode 100644 index 000000000..20bc19d14 --- /dev/null +++ b/data/odt/settings.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2"><office:settings><config:config-item-set config:name="ooo:view-settings"><config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaWidth" config:type="int">21747</config:config-item><config:config-item config:name="ViewAreaHeight" config:type="int">10874</config:config-item><config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item><config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item><config:config-item-map-indexed config:name="Views"><config:config-item-map-entry><config:config-item config:name="ViewId" config:type="string">view2</config:config-item><config:config-item config:name="ViewLeft" config:type="int">3041</config:config-item><config:config-item config:name="ViewTop" config:type="int">3041</config:config-item><config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item><config:config-item config:name="VisibleTop" config:type="int">0</config:config-item><config:config-item config:name="VisibleRight" config:type="int">21745</config:config-item><config:config-item config:name="VisibleBottom" config:type="int">10873</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item><config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item><config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-indexed></config:config-item-set><config:config-item-set config:name="ooo:configuration-settings"><config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item><config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item><config:config-item config:name="Rsid" config:type="int">1473719</config:config-item><config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item><config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item><config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item><config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item><config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseCommand" config:type="string"/><config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item><config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item><config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item><config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item><config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item><config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item><config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item><config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item><config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item><config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item><config:config-item config:name="PrintEmptyPages" config:type="boolean">false</config:config-item><config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item><config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item><config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item><config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item><config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item><config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item><config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item><config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item><config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item><config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item><config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item><config:config-item config:name="RsidRoot" config:type="int">1473719</config:config-item><config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item><config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item><config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item><config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/><config:config-item config:name="PrinterSetup" config:type="base64Binary"/><config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item><config:config-item config:name="PrinterName" config:type="string"/><config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item><config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item><config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item><config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item><config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item><config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item><config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item><config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item><config:config-item config:name="PrintFaxName" config:type="string"/><config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item><config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item><config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item><config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item><config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item><config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/><config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item><config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item><config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item><config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item><config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item></config:config-item-set></office:settings></office:document-settings>
\ No newline at end of file diff --git a/data/odt/styles.xml b/data/odt/styles.xml new file mode 100644 index 000000000..ac0cbd742 --- /dev/null +++ b/data/odt/styles.xml @@ -0,0 +1,1080 @@ +<?xml version="1.0" encoding="utf-8"?> +<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" +xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" +xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" +xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" +xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" +xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" +xmlns:xlink="http://www.w3.org/1999/xlink" +xmlns:dc="http://purl.org/dc/elements/1.1/" +xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" +xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" +xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" +xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" +xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" +xmlns:math="http://www.w3.org/1998/Math/MathML" +xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" +xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" +xmlns:ooo="http://openoffice.org/2004/office" +xmlns:ooow="http://openoffice.org/2004/writer" +xmlns:oooc="http://openoffice.org/2004/calc" +xmlns:dom="http://www.w3.org/2001/xml-events" +xmlns:rpt="http://openoffice.org/2005/report" +xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" +xmlns:xhtml="http://www.w3.org/1999/xhtml" +xmlns:grddl="http://www.w3.org/2003/g/data-view#" +xmlns:officeooo="http://openoffice.org/2009/office" +xmlns:tableooo="http://openoffice.org/2009/table" +xmlns:drawooo="http://openoffice.org/2010/draw" +xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" +xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"> + <office:font-face-decls> + <style:font-face style:name="StarSymbol" + svg:font-family="StarSymbol" /> + <style:font-face style:name="Tahoma1" + svg:font-family="Tahoma" /> + <style:font-face style:name="Courier New" + svg:font-family="'Courier New'" + style:font-family-generic="modern" style:font-pitch="fixed" /> + <style:font-face style:name="Times New Roman" + svg:font-family="'Times New Roman'" + style:font-family-generic="roman" + style:font-pitch="variable" /> + <style:font-face style:name="Arial" svg:font-family="Arial" + style:font-family-generic="swiss" + style:font-pitch="variable" /> + <style:font-face style:name="Lucida Sans Unicode" + svg:font-family="'Lucida Sans Unicode'" + style:font-family-generic="system" + style:font-pitch="variable" /> + <style:font-face style:name="Tahoma" svg:font-family="Tahoma" + style:font-family-generic="system" + style:font-pitch="variable" /> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties fo:wrap-option="wrap" + draw:shadow-offset-x="0.1181in" + draw:shadow-offset-y="0.1181in" + draw:start-line-spacing-horizontal="0.1114in" + draw:start-line-spacing-vertical="0.1114in" + draw:end-line-spacing-horizontal="0.1114in" + draw:end-line-spacing-vertical="0.1114in" + style:flow-with-text="false" /> + <style:paragraph-properties style:text-autospace="ideograph-alpha" + style:line-break="strict" style:writing-mode="lr-tb" + style:font-independent-line-spacing="false"> + <style:tab-stops /> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" + fo:font-size="12pt" fo:language="en" fo:country="US" + style:letter-kerning="true" style:font-size-asian="12pt" + style:language-asian="zxx" style:country-asian="none" + style:font-size-complex="12pt" style:language-complex="zxx" + style:country-complex="none" /> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" + style:text-autospace="ideograph-alpha" + style:punctuation-wrap="hanging" style:line-break="strict" + style:tab-stop-distance="0.4925in" + style:writing-mode="page" /> + <style:text-properties style:use-window-font-color="true" + style:font-name="Times New Roman" fo:font-size="12pt" + fo:language="en" fo:country="US" style:letter-kerning="true" + style:font-name-asian="Lucida Sans Unicode" + style:font-size-asian="12pt" style:language-asian="zxx" + style:country-asian="none" style:font-name-complex="Tahoma" + style:font-size-complex="12pt" style:language-complex="zxx" + style:country-complex="none" fo:hyphenate="false" + fo:hyphenation-remain-char-count="2" + fo:hyphenation-push-char-count="2" /> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing" /> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto" /> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" + style:class="text" /> + <style:style style:name="Heading" style:family="paragraph" + style:parent-style-name="Standard" + style:next-style-name="Text_20_body" style:class="text"> + <style:paragraph-properties fo:margin-top="0.1665in" + fo:margin-bottom="0.0835in" style:contextual-spacing="false" + fo:keep-with-next="always" /> + <style:text-properties style:font-name="Arial" + fo:font-size="14pt" + style:font-name-asian="Lucida Sans Unicode" + style:font-size-asian="14pt" style:font-name-complex="Tahoma" + style:font-size-complex="14pt" /> + </style:style> + <style:style style:name="Text_20_body" + style:display-name="Text body" style:family="paragraph" + style:parent-style-name="Standard" style:class="text"> + <style:paragraph-properties fo:margin-top="0.0598in" + fo:margin-bottom="0.0598in" + style:contextual-spacing="false" /> + </style:style> + <style:style style:name="List" style:family="paragraph" + style:parent-style-name="Text_20_body" style:class="list"> + <style:text-properties style:font-name-complex="Tahoma1" /> + </style:style> + <style:style style:name="Caption" style:family="paragraph" + style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-top="0.0835in" + fo:margin-bottom="0.0835in" style:contextual-spacing="false" + text:number-lines="false" text:line-number="0" /> + <style:text-properties fo:font-size="12pt" + fo:font-style="italic" style:font-size-asian="12pt" + style:font-style-asian="italic" + style:font-name-complex="Tahoma1" + style:font-size-complex="12pt" + style:font-style-complex="italic" /> + </style:style> + <style:style style:name="Index" style:family="paragraph" + style:parent-style-name="Standard" style:class="index"> + <style:paragraph-properties text:number-lines="false" + text:line-number="0" /> + <style:text-properties style:font-name-complex="Tahoma1" /> + </style:style> + <style:style style:name="Heading_20_1" + style:display-name="Heading 1" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="1" style:class="text"> + <style:text-properties fo:font-size="115%" + fo:font-weight="bold" style:font-size-asian="115%" + style:font-weight-asian="bold" style:font-size-complex="115%" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Heading_20_2" + style:display-name="Heading 2" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="2" style:class="text"> + <style:text-properties fo:font-size="14pt" + fo:font-style="italic" fo:font-weight="bold" + style:font-size-asian="14pt" style:font-style-asian="italic" + style:font-weight-asian="bold" style:font-size-complex="14pt" + style:font-style-complex="italic" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Heading_20_3" + style:display-name="Heading 3" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="3" style:class="text"> + <style:text-properties fo:font-size="14pt" + fo:font-weight="bold" style:font-size-asian="14pt" + style:font-weight-asian="bold" style:font-size-complex="14pt" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Heading_20_4" + style:display-name="Heading 4" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="4" style:class="text"> + <style:text-properties fo:font-size="85%" + fo:font-style="italic" fo:font-weight="bold" + style:font-size-asian="85%" style:font-style-asian="italic" + style:font-weight-asian="bold" style:font-size-complex="85%" + style:font-style-complex="italic" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Heading_20_5" + style:display-name="Heading 5" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="5" style:class="text"> + <style:text-properties fo:font-size="85%" + fo:font-weight="bold" style:font-size-asian="85%" + style:font-weight-asian="bold" style:font-size-complex="85%" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Heading_20_6" + style:display-name="Heading 6" style:family="paragraph" + style:parent-style-name="Heading" + style:next-style-name="Text_20_body" + style:default-outline-level="6" style:class="text"> + <style:text-properties fo:font-size="75%" + fo:font-weight="bold" style:font-size-asian="75%" + style:font-weight-asian="bold" style:font-size-complex="75%" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Quotations" style:family="paragraph" + style:parent-style-name="Standard" style:class="html"> + <style:paragraph-properties fo:margin-left="0.3937in" + fo:margin-right="0.3937in" fo:margin-top="0.1in" + fo:margin-bottom="0.1in" style:contextual-spacing="false" + fo:text-indent="0in" style:auto-text-indent="false" /> + </style:style> + <style:style style:name="Preformatted_20_Text" + style:display-name="Preformatted Text" style:family="paragraph" + style:parent-style-name="Standard" style:class="html"> + <style:paragraph-properties fo:margin-top="0in" + fo:margin-bottom="0in" style:contextual-spacing="false" /> + <style:text-properties style:font-name="Courier New" + fo:font-size="10pt" style:font-name-asian="Courier New" + style:font-size-asian="10pt" + style:font-name-complex="Courier New" + style:font-size-complex="10pt" /> + </style:style> + <style:style style:name="Definition_20_Term" + style:display-name="Definition Term" style:family="paragraph" + style:parent-style-name="Standard" + style:next-style-name="Definition_20_Definition"> + <style:paragraph-properties fo:margin-top="0.0598in" + fo:margin-bottom="0.0598in" + style:contextual-spacing="false" /> + </style:style> + <style:style style:name="Definition_20_Definition" + style:display-name="Definition Definition" + style:family="paragraph" style:parent-style-name="Standard" + style:next-style-name="Text_20_body"> + <style:paragraph-properties fo:margin-left="0.5in" + fo:margin-right="0in" fo:text-indent="0in" + style:auto-text-indent="false" /> + </style:style> + <style:style style:name="Table_20_Contents" + style:display-name="Table Contents" style:family="paragraph" + style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-left="0.0299in" + fo:margin-right="0.0299in" fo:text-indent="0in" + style:auto-text-indent="false" text:number-lines="false" + text:line-number="0" /> + </style:style> + <style:style style:name="Table_20_Heading" + style:display-name="Table Heading" style:family="paragraph" + style:parent-style-name="Table_20_Contents" + style:class="extra"> + <style:paragraph-properties fo:margin-left="0.0299in" + fo:margin-right="0.0299in" fo:text-align="start" + style:justify-single-word="false" fo:text-indent="0in" + style:auto-text-indent="false" style:shadow="none" + text:number-lines="false" text:line-number="0" /> + <style:text-properties fo:font-weight="bold" + style:font-weight-asian="bold" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Footnote" style:family="paragraph" + style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:margin-left="0.1965in" + fo:margin-right="0in" fo:text-indent="-0.1965in" + style:auto-text-indent="false" text:number-lines="false" + text:line-number="0" /> + <style:text-properties fo:font-size="10pt" + style:font-size-asian="10pt" + style:font-size-complex="10pt" /> + </style:style> + <style:style style:name="Footer" style:family="paragraph" + style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties text:number-lines="false" + text:line-number="0"> + <style:tab-stops> + <style:tab-stop style:position="3.25in" + style:type="center" /> + <style:tab-stop style:position="6.5in" + style:type="right" /> + </style:tab-stops> + </style:paragraph-properties> + </style:style> + <style:style style:name="Definition_20_Term_20_Tight" + style:display-name="Definition Term Tight" + style:family="paragraph" style:parent-style-name="Standard" + style:next-style-name="Definition_20_Definition_20_Tight"> + <style:paragraph-properties fo:margin-top="0.0799in" + fo:margin-bottom="0.0799in" + style:contextual-spacing="false" /> + </style:style> + <style:style style:name="Definition_20_Definition_20_Tight" + style:display-name="Definition Definition Tight" + style:family="paragraph" style:parent-style-name="Standard"> + <style:paragraph-properties fo:margin-left="0.5in" + fo:margin-right="0in" fo:margin-top="0in" + fo:margin-bottom="0in" style:contextual-spacing="false" + fo:text-indent="0in" style:auto-text-indent="false" /> + </style:style> + <style:style style:name="Date" style:family="paragraph" + style:parent-style-name="Standard" + style:next-style-name="Text_20_body"> + <style:text-properties fo:font-style="italic" /> + </style:style> + <style:style style:name="Author" style:family="paragraph" + style:parent-style-name="Standard" style:next-style-name="Date" + style:master-page-name=""> + <style:paragraph-properties style:page-number="auto" /> + <style:text-properties fo:font-style="italic" /> + </style:style> + <style:style style:name="Horizontal_20_Line" + style:display-name="Horizontal Line" style:family="paragraph" + style:parent-style-name="Standard" + style:next-style-name="Text_20_body" style:class="html"> + <style:paragraph-properties fo:margin-top="0in" + fo:margin-bottom="0.1965in" style:contextual-spacing="false" + style:border-line-width-bottom="0.0008in 0.0138in 0.0008in" + fo:padding="0in" fo:border-left="none" fo:border-right="none" + fo:border-top="none" fo:border-bottom="1.11pt double #808080" + text:number-lines="false" text:line-number="0" + style:join-border="false" /> + <style:text-properties fo:font-size="6pt" + style:font-size-asian="6pt" style:font-size-complex="6pt" /> + </style:style> + <style:style style:name="First_20_paragraph" + style:display-name="First paragraph" style:family="paragraph" + style:parent-style-name="Standard" + style:next-style-name="Text_20_body" style:class="text" /> + <style:style style:name="Numbering_20_Symbols" + style:display-name="Numbering Symbols" style:family="text" /> + <style:style style:name="Bullet_20_Symbols" + style:display-name="Bullet Symbols" style:family="text"> + <style:text-properties style:font-name="StarSymbol" + fo:font-size="9pt" style:font-name-asian="StarSymbol" + style:font-size-asian="9pt" + style:font-name-complex="StarSymbol" + style:font-size-complex="9pt" /> + </style:style> + <style:style style:name="Emphasis" style:family="text"> + <style:text-properties fo:font-style="italic" + style:font-style-asian="italic" + style:font-style-complex="italic" /> + </style:style> + <style:style style:name="Strong_20_Emphasis" + style:display-name="Strong Emphasis" style:family="text"> + <style:text-properties fo:font-weight="bold" + style:font-weight-asian="bold" + style:font-weight-complex="bold" /> + </style:style> + <style:style style:name="Strikeout" style:family="text"> + <style:text-properties style:text-line-through-style="solid" /> + </style:style> + <style:style style:name="Superscript" style:family="text"> + <style:text-properties style:text-position="super 58%" /> + </style:style> + <style:style style:name="Subscript" style:family="text"> + <style:text-properties style:text-position="sub 58%" /> + </style:style> + <style:style style:name="Citation" style:family="text"> + <style:text-properties fo:font-style="italic" + style:font-style-asian="italic" + style:font-style-complex="italic" /> + </style:style> + <style:style style:name="Teletype" style:family="text"> + <style:text-properties style:font-name="Courier New" + style:font-name-asian="Courier New" + style:font-name-complex="Courier New" /> + </style:style> + <style:style style:name="Internet_20_link" + style:display-name="Internet link" style:family="text"> + <style:text-properties fo:color="#000080" + style:text-underline-style="solid" + style:text-underline-width="auto" + style:text-underline-color="font-color" /> + </style:style> + <style:style style:name="Footnote_20_Symbol" + style:display-name="Footnote Symbol" style:family="text" /> + <style:style style:name="Footnote_20_anchor" + style:display-name="Footnote anchor" style:family="text"> + <style:text-properties style:text-position="super 58%" /> + </style:style> + <style:style style:name="Definition" style:family="text" /> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="2" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="3" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="4" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="5" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="6" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="7" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="8" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="9" style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + <text:outline-level-style text:level="10" + style:num-format=""> + <style:list-level-properties text:min-label-distance="0.15in" /> + </text:outline-level-style> + </text:outline-style> + <text:list-style style:name="Numbering_20_1" + style:display-name="Numbering 1"> + <text:list-level-style-number text:level="1" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="2" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="0.1972in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="3" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="0.3937in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="4" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="0.5909in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="5" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="0.7874in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="6" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="0.9846in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="7" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="1.1815in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="8" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="1.3787in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="9" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="1.5752in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="10" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:space-before="1.7724in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + </text:list-style> + <text:list-style style:name="Numbering_20_2" + style:display-name="Numbering 2"> + <text:list-level-style-number text:level="1" + text:style-name="Numbering_20_Symbols" style:num-format="1"> + <style:list-level-properties text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="2" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="2"> + <style:list-level-properties text:space-before="0.1965in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="3" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="3"> + <style:list-level-properties text:space-before="0.3929in" + text:min-label-width="0.3937in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="4" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="4"> + <style:list-level-properties text:space-before="0.7866in" + text:min-label-width="0.4925in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="5" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="5"> + <style:list-level-properties text:space-before="1.2791in" + text:min-label-width="0.5902in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="6" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="6"> + <style:list-level-properties text:space-before="1.8693in" + text:min-label-width="0.7091in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="7" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="7"> + <style:list-level-properties text:space-before="2.5783in" + text:min-label-width="0.9055in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="8" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="8"> + <style:list-level-properties text:space-before="3.4839in" + text:min-label-width="1.0236in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="9" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="9"> + <style:list-level-properties text:space-before="4.5075in" + text:min-label-width="1.1028in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="10" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="10"> + <style:list-level-properties text:space-before="5.6102in" + text:min-label-width="1.2209in" /> + </text:list-level-style-number> + </text:list-style> + <text:list-style style:name="Numbering_20_3" + style:display-name="Numbering 3"> + <text:list-level-style-number text:level="1" + text:style-name="Numbering_20_Symbols" style:num-format="1"> + <style:list-level-properties text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="2" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="2"> + <style:list-level-properties text:space-before="1.1815in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="3" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="3"> + <style:list-level-properties text:space-before="2.3626in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="4" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="4"> + <style:list-level-properties text:space-before="3.5441in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="5" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="5"> + <style:list-level-properties text:space-before="4.7252in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="6" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="6"> + <style:list-level-properties text:space-before="5.9063in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="7" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="7"> + <style:list-level-properties text:space-before="7.0878in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="8" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="8"> + <style:list-level-properties text:space-before="8.2689in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="9" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="9"> + <style:list-level-properties text:space-before="9.45in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="10" + text:style-name="Numbering_20_Symbols" style:num-format="1" + text:start-value="10"> + <style:list-level-properties text:space-before="10.6315in" + text:min-label-width="1.1811in" /> + </text:list-level-style-number> + </text:list-style> + <text:list-style style:name="Numbering_20_4" + style:display-name="Numbering 4"> + <text:list-level-style-number text:level="1" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I"> + <style:list-level-properties text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="2" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="2"> + <style:list-level-properties text:space-before="0.1972in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="3" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="3"> + <style:list-level-properties text:space-before="0.3937in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="4" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="4"> + <style:list-level-properties text:space-before="0.5909in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="5" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="5"> + <style:list-level-properties text:space-before="0.7874in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="6" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="6"> + <style:list-level-properties text:space-before="0.9846in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="7" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="7"> + <style:list-level-properties text:space-before="1.1815in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="8" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="8"> + <style:list-level-properties text:space-before="1.3787in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="9" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="9"> + <style:list-level-properties text:space-before="1.5752in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="10" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="I" text:start-value="10"> + <style:list-level-properties text:space-before="1.7724in" + text:min-label-width="0.1965in" /> + </text:list-level-style-number> + </text:list-style> + <text:list-style style:name="Numbering_20_5" + style:display-name="Numbering 5"> + <text:list-level-style-number text:level="1" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1"> + <style:list-level-properties text:min-label-width="0.1575in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="2" + text:style-name="Numbering_20_Symbols" style:num-suffix="." + style:num-format="1" text:start-value="2" + text:display-levels="2"> + <style:list-level-properties text:space-before="0.1772in" + text:min-label-width="0.2563in" /> + </text:list-level-style-number> + <text:list-level-style-number text:level="3" + text:style-name="Numbering_20_Symbols" style:num-suffix=")" + style:num-format="a" text:start-value="3"> + <style:list-level-properties text:space-before="0.4331in" + text:min-label-width="0.1772in" /> + </text:list-level-style-number> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.6319in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.7874in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.9429in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.0988in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.2543in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.4098in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.5654in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:list-style style:name="List_20_1" + style:display-name="List 1"> + <text:list-level-style-bullet text:level="1" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.1579in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.3146in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.4724in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.6299in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.7878in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="0.9445in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.1024in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.2598in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char="•"> + <style:list-level-properties text:space-before="1.4177in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:list-style style:name="List_20_2" + style:display-name="List 2"> + <text:list-level-style-bullet text:level="1" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.1181in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.2362in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.3539in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.472in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.5902in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.7091in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.8272in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="0.9453in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char="–"> + <style:list-level-properties text:space-before="1.063in" + text:min-label-width="0.1181in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:list-style style:name="List_20_3" + style:display-name="List 3"> + <text:list-level-style-bullet text:level="1" + text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> + <style:list-level-properties text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" + text:style-name="Numbering_20_Symbols" text:bullet-char="□"> + <style:list-level-properties text:space-before="0.1555in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" + text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> + <style:list-level-properties text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char="□"> + <style:list-level-properties text:space-before="0.1555in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> + <style:list-level-properties text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char="□"> + <style:list-level-properties text:space-before="0.1555in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> + <style:list-level-properties text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char="□"> + <style:list-level-properties text:space-before="0.1555in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char="☑"> + <style:list-level-properties text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char="□"> + <style:list-level-properties text:space-before="0.1555in" + text:min-label-width="0.1555in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:list-style style:name="List_20_4" + style:display-name="List 4"> + <text:list-level-style-bullet text:level="1" + text:style-name="Numbering_20_Symbols" text:bullet-char="➢"> + <style:list-level-properties text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.1579in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.3146in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.4724in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.6299in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.7878in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="0.9445in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="1.1024in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="1.2598in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char=""> + <style:list-level-properties text:space-before="1.4177in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:list-style style:name="List_20_5" + style:display-name="List 5"> + <text:list-level-style-bullet text:level="1" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="2" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.1579in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="3" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.3146in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="4" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.4724in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="5" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.6299in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="6" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.7878in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="7" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="0.9445in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="8" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="1.1024in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="9" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="1.2598in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + <text:list-level-style-bullet text:level="10" + text:style-name="Numbering_20_Symbols" text:bullet-char="✗"> + <style:list-level-properties text:space-before="1.4177in" + text:min-label-width="0.1575in" /> + <style:text-properties style:font-name="StarSymbol" /> + </text:list-level-style-bullet> + </text:list-style> + <text:notes-configuration text:note-class="footnote" + text:citation-style-name="Footnote_20_Symbol" + text:citation-body-style-name="Footnote_20_anchor" + style:num-format="1" text:start-value="0" + text:footnotes-position="page" + text:start-numbering-at="document" /> + <text:notes-configuration text:note-class="endnote" + style:num-format="i" text:start-value="0" /> + <text:linenumbering-configuration text:number-lines="false" + text:offset="0.1965in" style:num-format="1" + text:number-position="left" text:increment="5" /> + </office:styles> + <office:automatic-styles> + <style:style style:name="MP1" style:family="paragraph" + style:parent-style-name="Footer"> + <style:paragraph-properties fo:text-align="center" + style:justify-single-word="false" /> + </style:style> + <style:page-layout style:name="Mpm1"> + <style:page-layout-properties fo:page-width="8.5in" + fo:page-height="11in" style:num-format="1" + style:print-orientation="portrait" fo:margin-top="1in" + fo:margin-bottom="1in" fo:margin-left="1in" + fo:margin-right="1in" style:writing-mode="lr-tb" + style:footnote-max-height="0in"> + <style:footnote-sep style:width="0.0071in" + style:distance-before-sep="0.0398in" + style:distance-after-sep="0.0398in" style:line-style="none" + style:adjustment="left" style:rel-width="25%" + style:color="#000000" /> + </style:page-layout-properties> + <style:header-style /> + <style:footer-style> + <style:header-footer-properties fo:min-height="0.4in" + fo:margin-left="0in" fo:margin-right="0in" + fo:margin-top="0.2in" style:dynamic-spacing="false" /> + </style:footer-style> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" + style:page-layout-name="Mpm1"> + <style:footer> + <text:p text:style-name="MP1"> + <text:page-number text:select-page="current"> + 1</text:page-number> + </text:p> + </style:footer> + </style:master-page> + </office:master-styles> +</office:document-styles> diff --git a/data/reference.docx b/data/reference.docx Binary files differdeleted file mode 100644 index c2e5075b1..000000000 --- a/data/reference.docx +++ /dev/null diff --git a/data/reference.odt b/data/reference.odt Binary files differdeleted file mode 100644 index c01345612..000000000 --- a/data/reference.odt +++ /dev/null diff --git a/pandoc.cabal b/pandoc.cabal index dd31927c7..2edb0d80a 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -223,14 +223,14 @@ Library array >= 0.3 && < 0.6, parsec >= 3.1 && < 3.2, mtl >= 1.1 && < 2.3, - filepath >= 1.1 && < 1.4, + filepath >= 1.1 && < 1.5, process >= 1 && < 1.3, directory >= 1 && < 1.3, bytestring >= 0.9 && < 0.11, text >= 0.11 && < 1.3, zip-archive >= 0.2.3.4 && < 0.3, HTTP >= 4000.0.5 && < 4000.3, - texmath >= 0.8.0.1 && < 0.9, + texmath >= 0.8.0.2 && < 0.9, xml >= 1.3.12 && < 1.4, random >= 1 && < 1.2, extensible-exceptions >= 0.1 && < 0.2, @@ -239,11 +239,11 @@ Library tagsoup >= 0.13.1 && < 0.14, base64-bytestring >= 0.1 && < 1.1, zlib >= 0.5 && < 0.6, - highlighting-kate >= 0.5.11.1 && < 0.6, + highlighting-kate >= 0.5.14 && < 0.6, data-default >= 0.4 && < 0.6, temporary >= 1.1 && < 1.3, - blaze-html >= 0.5 && < 0.8, - blaze-markup >= 0.5.1 && < 0.7, + blaze-html >= 0.5 && < 0.9, + blaze-markup >= 0.5.1 && < 0.8, yaml >= 0.8.8.2 && < 0.9, scientific >= 0.2 && < 0.4, vector >= 0.10 && < 0.11, @@ -254,7 +254,8 @@ Library old-time, deepseq-generics >= 0.1 && < 0.2, JuicyPixels >= 3.1.6.1 && < 3.3, - filemanip >= 0.3 && < 0.4 + filemanip >= 0.3 && < 0.4, + cmark >= 0.3 && < 0.4 if flag(old-locale) Build-Depends: old-locale >= 1 && < 1.1, time >= 1.2 && < 1.5 @@ -276,7 +277,7 @@ Library if os(windows) Cpp-options: -D_WINDOWS Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind - Ghc-Prof-Options: -auto-all -caf-all -rtsopts + Ghc-Prof-Options: -fprof-auto-exported -rtsopts Default-Language: Haskell98 Other-Extensions: PatternGuards, OverloadedStrings, ScopedTypeVariables, GeneralizedNewtypeDeriving, @@ -293,6 +294,7 @@ Library Text.Pandoc.Readers.HTML, Text.Pandoc.Readers.LaTeX, Text.Pandoc.Readers.Markdown, + Text.Pandoc.Readers.CommonMark, Text.Pandoc.Readers.MediaWiki, Text.Pandoc.Readers.RST, Text.Pandoc.Readers.Org, @@ -339,7 +341,9 @@ Library Other-Modules: Text.Pandoc.Readers.Docx.Lists, Text.Pandoc.Readers.Docx.Reducible, Text.Pandoc.Readers.Docx.Parse, - Text.Pandoc.Readers.Docx.Fonts + Text.Pandoc.Readers.Docx.Fonts, + Text.Pandoc.Readers.Docx.Util, + Text.Pandoc.Readers.Docx.StyleMap Text.Pandoc.Writers.Shared, Text.Pandoc.Asciify, Text.Pandoc.MIME, @@ -362,11 +366,11 @@ Executable pandoc pandoc-types >= 1.12.4 && < 1.13, base >= 4.2 && <5, directory >= 1 && < 1.3, - filepath >= 1.1 && < 1.4, + filepath >= 1.1 && < 1.5, text >= 0.11 && < 1.3, bytestring >= 0.9 && < 0.11, extensible-exceptions >= 0.1 && < 0.2, - highlighting-kate >= 0.5.11.1 && < 0.6, + highlighting-kate >= 0.5.14 && < 0.6, aeson >= 0.7.0.5 && < 0.9, yaml >= 0.8.8.2 && < 0.9, containers >= 0.1 && < 0.6, @@ -376,7 +380,7 @@ Executable pandoc else Build-Depends: network >= 2 && < 2.6 Ghc-Options: -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind - Ghc-Prof-Options: -auto-all -caf-all -rtsopts -with-rtsopts=-K16m + Ghc-Prof-Options: -fprof-auto-exported -rtsopts -with-rtsopts=-K16m if os(windows) Cpp-options: -D_WINDOWS Default-Language: Haskell98 @@ -406,7 +410,7 @@ Executable make-pandoc-man-pages Build-Depends: pandoc, base >= 4.2 && < 5, directory >= 1 && < 1.3, - filepath >= 1.1 && < 1.4, + filepath >= 1.1 && < 1.5, old-time >= 1.0 && < 1.2, time >= 1.2 && < 1.6 Default-Language: Haskell98 @@ -415,6 +419,15 @@ Executable make-pandoc-man-pages else Buildable: False +Executable make-reference-files + Main-Is: make-reference-files.hs + Hs-Source-Dirs: data + Build-Depends: zip-archive >= 0.2.3.4 && < 0.3, + base >= 4.2 && < 5, + directory >= 1 && < 1.3, + bytestring >= 0.9 && < 0.11 + Default-Language: Haskell2010 + Test-Suite test-pandoc Type: exitcode-stdio-1.0 Main-Is: test-pandoc.hs @@ -426,14 +439,14 @@ Test-Suite test-pandoc bytestring >= 0.9 && < 0.11, text >= 0.11 && < 1.3, directory >= 1 && < 1.3, - filepath >= 1.1 && < 1.4, + filepath >= 1.1 && < 1.5, process >= 1 && < 1.3, - highlighting-kate >= 0.5.11.1 && < 0.6, + highlighting-kate >= 0.5.14 && < 0.6, Diff >= 0.2 && < 0.4, test-framework >= 0.3 && < 0.9, test-framework-hunit >= 0.2 && < 0.4, test-framework-quickcheck2 >= 0.2.9 && < 0.4, - QuickCheck >= 2.4 && < 2.8, + QuickCheck >= 2.4 && < 2.9, HUnit >= 1.2 && < 1.3, containers >= 0.1 && < 0.6, ansi-terminal >= 0.5 && < 0.7, @@ -469,6 +482,6 @@ benchmark benchmark-pandoc Build-Depends: pandoc, base >= 4.2 && < 5, syb >= 0.1 && < 0.5, - criterion >= 0.5 && < 0.9 + criterion >= 0.5 && < 1.1 Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind Default-Language: Haskell98 @@ -49,7 +49,7 @@ import System.Exit ( exitWith, ExitCode (..) ) import System.FilePath import System.Console.GetOpt import Data.Char ( toLower ) -import Data.List ( intercalate, isPrefixOf, isSuffixOf, sort ) +import Data.List ( delete, intercalate, isPrefixOf, isSuffixOf, sort ) import System.Directory ( getAppUserDataDirectory, findExecutable, doesFileExist, Permissions(..), getPermissions ) import System.IO ( stdout, stderr ) @@ -200,6 +200,7 @@ data Opt = Opt , optCiteMethod :: CiteMethod -- ^ Method to output cites , optListings :: Bool -- ^ Use listings package for code blocks , optLaTeXEngine :: String -- ^ Program to use for latex -> pdf + , optLaTeXEngineArgs :: [String] -- ^ Flags to pass to the latex-engine , optSlideLevel :: Maybe Int -- ^ Header level that creates slides , optSetextHeaders :: Bool -- ^ Use atx headers for markdown level 1-2 , optAscii :: Bool -- ^ Use ascii characters only in html @@ -261,6 +262,7 @@ defaultOpts = Opt , optCiteMethod = Citeproc , optListings = False , optLaTeXEngine = "pdflatex" + , optLaTeXEngineArgs = [] , optSlideLevel = Nothing , optSetextHeaders = True , optAscii = False @@ -736,6 +738,14 @@ options = "PROGRAM") "" -- "Name of latex program to use in generating PDF" + , Option "" ["latex-engine-opt"] + (ReqArg + (\arg opt -> do + let oldArgs = optLaTeXEngineArgs opt + return opt { optLaTeXEngineArgs = arg : oldArgs }) + "STRING") + "" -- "Flags to pass to the LaTeX engine, all instances of this option are accumulated and used" + , Option "" ["bibliography"] (ReqArg (\arg opt -> return opt{ optMetadata = addMetadata @@ -907,13 +917,15 @@ readMetaValue s = case decode (UTF8.fromString s) of usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String usageMessage programName = usageInfo (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++ - (wrapWords 16 78 $ readers'names) ++ "\nOutput formats: " ++ + (wrapWords 16 78 $ readers'names) ++ + '\n' : replicate 16 ' ' ++ + "[ *only Pandoc's JSON version of native AST]" ++ "\nOutput formats: " ++ (wrapWords 16 78 $ writers'names) ++ '\n' : replicate 16 ' ' ++ - "[*for pdf output, use latex or beamer and -o FILENAME.pdf]\nOptions:") + "[**for pdf output, use latex or beamer and -o FILENAME.pdf]\nOptions:") where - writers'names = sort $ "pdf*" : map fst writers - readers'names = sort $ map fst readers + writers'names = sort $ "json*" : "pdf**" : delete "json" (map fst writers) + readers'names = sort $ "json*" : delete "json" (map fst readers) -- Determine default reader based on source file extensions defaultReaderName :: String -> [FilePath] -> String @@ -1082,6 +1094,7 @@ main = do , optCiteMethod = citeMethod , optListings = listings , optLaTeXEngine = latexEngine + , optLaTeXEngineArgs = latexEngineArgs , optSlideLevel = slideLevel , optSetextHeaders = setextHeaders , optAscii = ascii @@ -1314,7 +1327,8 @@ main = do writerReferenceODT = referenceODT, writerReferenceDocx = referenceDocx, writerMediaBag = media, - writerVerbose = verbose + writerVerbose = verbose, + writerLaTeXArgs = latexEngineArgs } diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index 89f61089b..b36046a5e 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -66,6 +66,7 @@ module Text.Pandoc , mkStringReader , readDocx , readMarkdown + , readCommonMark , readMediaWiki , readRST , readOrg @@ -124,6 +125,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Generic import Text.Pandoc.JSON import Text.Pandoc.Readers.Markdown +import Text.Pandoc.Readers.CommonMark import Text.Pandoc.Readers.MediaWiki import Text.Pandoc.Readers.RST import Text.Pandoc.Readers.Org @@ -229,6 +231,7 @@ readers = [ ("native" , StringReader $ \_ s -> return $ readNative s) ,("markdown_phpextra" , mkStringReaderWithWarnings readMarkdownWithWarnings) ,("markdown_github" , mkStringReaderWithWarnings readMarkdownWithWarnings) ,("markdown_mmd", mkStringReaderWithWarnings readMarkdownWithWarnings) + ,("commonmark" , mkStringReader readCommonMark) ,("rst" , mkStringReaderWithWarnings readRSTWithWarnings ) ,("mediawiki" , mkStringReader readMediaWiki) ,("docbook" , mkStringReader readDocBook) diff --git a/src/Text/Pandoc/MediaBag.hs b/src/Text/Pandoc/MediaBag.hs index a55d5417e..1246cdc8f 100644 --- a/src/Text/Pandoc/MediaBag.hs +++ b/src/Text/Pandoc/MediaBag.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE GeneralizedNewtypeDeriving, DeriveDataTypeable #-} {- Copyright (C) 2014 John MacFarlane <jgm@berkeley.edu> @@ -46,13 +46,15 @@ import Text.Pandoc.MIME (MimeType, getMimeTypeDef) import qualified Text.Pandoc.UTF8 as UTF8 import Data.Maybe (fromMaybe) import System.IO (stderr) +import Data.Data (Data) +import Data.Typeable (Typeable) -- | A container for a collection of binary resources, with names and -- mime types. Note that a 'MediaBag' is a Monoid, so 'mempty' -- can be used for an empty 'MediaBag', and '<>' can be used to append -- two 'MediaBag's. newtype MediaBag = MediaBag (M.Map [String] (MimeType, BL.ByteString)) - deriving (Monoid) + deriving (Monoid, Data, Typeable) instance Show MediaBag where show bag = "MediaBag " ++ show (mediaDirectory bag) diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 24e31fbb6..1776d14e5 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DeriveDataTypeable #-} {- Copyright (C) 2012-2014 John MacFarlane <jgm@berkeley.edu> @@ -51,6 +52,8 @@ import Data.Default import Text.Pandoc.Highlighting (Style, pygments) import Text.Pandoc.MediaBag (MediaBag) import Data.Monoid +import Data.Data (Data) +import Data.Typeable (Typeable) -- | Individually selectable syntax extensions. data Extension = @@ -74,7 +77,7 @@ data Extension = | Ext_latex_macros -- ^ Parse LaTeX macro definitions (for math only) | Ext_fenced_code_blocks -- ^ Parse fenced code blocks | Ext_fenced_code_attributes -- ^ Allow attributes on fenced code blocks - | Ext_backtick_code_blocks -- ^ Github style ``` code blocks + | Ext_backtick_code_blocks -- ^ GitHub style ``` code blocks | Ext_inline_code_attributes -- ^ Allow attributes on inline code | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks | Ext_native_divs -- ^ Use Div blocks for contents of <div> tags @@ -109,7 +112,8 @@ data Extension = | Ext_implicit_header_references -- ^ Implicit reference links for headers | Ext_line_blocks -- ^ RST style line blocks | Ext_epub_html_exts -- ^ Recognise the EPUB extended version of HTML - deriving (Show, Read, Enum, Eq, Ord, Bounded) + | Ext_shortcut_reference_links -- ^ Shortcut reference links + deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable) pandocExtensions :: Set Extension pandocExtensions = Set.fromList @@ -151,6 +155,7 @@ pandocExtensions = Set.fromList , Ext_header_attributes , Ext_implicit_header_references , Ext_line_blocks + , Ext_shortcut_reference_links ] phpMarkdownExtraExtensions :: Set Extension @@ -164,6 +169,7 @@ phpMarkdownExtraExtensions = Set.fromList , Ext_intraword_underscores , Ext_header_attributes , Ext_abbreviations + , Ext_shortcut_reference_links ] githubMarkdownExtensions :: Set Extension @@ -180,6 +186,7 @@ githubMarkdownExtensions = Set.fromList , Ext_strikeout , Ext_hard_line_breaks , Ext_lists_without_preceding_blankline + , Ext_shortcut_reference_links ] multimarkdownExtensions :: Set Extension @@ -202,7 +209,9 @@ multimarkdownExtensions = Set.fromList strictExtensions :: Set Extension strictExtensions = Set.fromList - [ Ext_raw_html ] + [ Ext_raw_html + , Ext_shortcut_reference_links + ] data ReaderOptions = ReaderOptions{ readerExtensions :: Set Extension -- ^ Syntax extensions @@ -220,7 +229,7 @@ data ReaderOptions = ReaderOptions{ , readerDefaultImageExtension :: String -- ^ Default extension for images , readerTrace :: Bool -- ^ Print debugging info , readerTrackChanges :: TrackChanges -} deriving (Show, Read) +} deriving (Show, Read, Data, Typeable) instance Default ReaderOptions where def = ReaderOptions{ @@ -242,7 +251,7 @@ instance Default ReaderOptions -- Writer options -- -data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read) +data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable) data HTMLMathMethod = PlainMath | LaTeXMathML (Maybe String) -- url of LaTeXMathML.js @@ -252,18 +261,18 @@ data HTMLMathMethod = PlainMath | MathML (Maybe String) -- url of MathMLinHTML.js | MathJax String -- url of MathJax.js | KaTeX String String -- url of stylesheet and katex.js - deriving (Show, Read, Eq) + deriving (Show, Read, Eq, Data, Typeable) data CiteMethod = Citeproc -- use citeproc to render them | Natbib -- output natbib cite commands | Biblatex -- output biblatex cite commands - deriving (Show, Read, Eq) + deriving (Show, Read, Eq, Data, Typeable) -- | Methods for obfuscating email addresses in HTML. data ObfuscationMethod = NoObfuscation | ReferenceObfuscation | JavascriptObfuscation - deriving (Show, Read, Eq) + deriving (Show, Read, Eq, Data, Typeable) -- | Varieties of HTML slide shows. data HTMLSlideVariant = S5Slides @@ -272,13 +281,13 @@ data HTMLSlideVariant = S5Slides | DZSlides | RevealJsSlides | NoSlides - deriving (Show, Read, Eq) + deriving (Show, Read, Eq, Data, Typeable) -- | Options for accepting or rejecting MS Word track-changes. data TrackChanges = AcceptChanges | RejectChanges | AllChanges - deriving (Show, Read, Eq) + deriving (Show, Read, Eq, Data, Typeable) -- | Options for writers data WriterOptions = WriterOptions @@ -324,7 +333,8 @@ data WriterOptions = WriterOptions , writerReferenceDocx :: Maybe FilePath -- ^ Path to reference DOCX if specified , writerMediaBag :: MediaBag -- ^ Media collected by docx or epub reader , writerVerbose :: Bool -- ^ Verbose debugging output - } deriving Show + , writerLaTeXArgs :: [String] -- ^ Flags to pass to latex-engine + } deriving (Show, Data, Typeable) instance Default WriterOptions where def = WriterOptions { writerStandalone = False @@ -368,6 +378,7 @@ instance Default WriterOptions where , writerReferenceDocx = Nothing , writerMediaBag = mempty , writerVerbose = False + , writerLaTeXArgs = [] } -- | Returns True if the given extension is enabled. diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index ea6699ac4..59a6ebede 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -71,7 +71,8 @@ makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex) makePDF program writer opts doc = withTempDir "tex2pdf." $ \tmpdir -> do doc' <- handleImages opts tmpdir doc let source = writer opts doc' - tex2pdf' (writerVerbose opts) tmpdir program source + args = writerLaTeXArgs opts + tex2pdf' (writerVerbose opts) args tmpdir program source handleImages :: WriterOptions -> FilePath -- ^ temp dir to store images @@ -132,15 +133,16 @@ convertImage tmpdir fname = doNothing = return (Right fname) tex2pdf' :: Bool -- ^ Verbose output + -> [String] -- ^ Arguments to the latex-engine -> FilePath -- ^ temp directory for output -> String -- ^ tex program -> String -- ^ tex source -> IO (Either ByteString ByteString) -tex2pdf' verbose tmpDir program source = do +tex2pdf' verbose args tmpDir program source = do let numruns = if "\\tableofcontents" `isInfixOf` source then 3 -- to get page numbers else 2 -- 1 run won't give you PDF bookmarks - (exit, log', mbPdf) <- runTeXProgram verbose program 1 numruns tmpDir source + (exit, log', mbPdf) <- runTeXProgram verbose program args 1 numruns tmpDir source case (exit, mbPdf) of (ExitFailure _, _) -> do let logmsg = extractMsg log' @@ -173,9 +175,9 @@ extractMsg log' = do -- Run a TeX program on an input bytestring and return (exit code, -- contents of stdout, contents of produced PDF if any). Rerun -- a fixed number of times to resolve references. -runTeXProgram :: Bool -> String -> Int -> Int -> FilePath -> String +runTeXProgram :: Bool -> String -> [String] -> Int -> Int -> FilePath -> String -> IO (ExitCode, ByteString, Maybe ByteString) -runTeXProgram verbose program runNumber numRuns tmpDir source = do +runTeXProgram verbose program args runNumber numRuns tmpDir source = do let file = tmpDir </> "input.tex" exists <- doesFileExist file unless exists $ UTF8.writeFile file source @@ -188,7 +190,7 @@ runTeXProgram verbose program runNumber numRuns tmpDir source = do let file' = file #endif let programArgs = ["-halt-on-error", "-interaction", "nonstopmode", - "-output-directory", tmpDir', file'] + "-output-directory", tmpDir', file'] ++ args env' <- getEnvironment let sep = searchPathSeparator:[] let texinputs = maybe (tmpDir' ++ sep) ((tmpDir' ++ sep) ++) @@ -212,7 +214,7 @@ runTeXProgram verbose program runNumber numRuns tmpDir source = do B.hPutStr stderr err putStr "\n" if runNumber <= numRuns - then runTeXProgram verbose program (runNumber + 1) numRuns tmpDir source + then runTeXProgram verbose program args (runNumber + 1) numRuns tmpDir source else do let pdfFile = replaceDirectory (replaceExtension file ".pdf") tmpDir pdfExists <- doesFileExist pdfFile diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs new file mode 100644 index 000000000..51a35c8ad --- /dev/null +++ b/src/Text/Pandoc/Readers/CommonMark.hs @@ -0,0 +1,119 @@ +{- +Copyright (C) 2015 John MacFarlane <jgm@berkeley.edu> + +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.CommonMark + Copyright : Copyright (C) 2015 John MacFarlane + License : GNU GPL, version 2 or above + + Maintainer : John MacFarlane <jgm@berkeley.edu> + Stability : alpha + Portability : portable + +Conversion of CommonMark-formatted plain text to 'Pandoc' document. + +CommonMark is a strongly specified variant of Markdown: http://commonmark.org. +-} +module Text.Pandoc.Readers.CommonMark (readCommonMark) +where + +import CMark +import Data.Text (unpack, pack) +import Data.List (groupBy) +import Text.Pandoc.Definition +import Text.Pandoc.Options +import Text.Pandoc.Error + +-- | Parse a CommonMark formatted string into a 'Pandoc' structure. +readCommonMark :: ReaderOptions -> String -> Either PandocError Pandoc +readCommonMark opts = Right . nodeToPandoc . commonmarkToNode opts' . pack + where opts' = if readerSmart opts + then [optNormalize, optSmart] + else [optNormalize] + +nodeToPandoc :: Node -> Pandoc +nodeToPandoc (Node _ DOCUMENT nodes) = + Pandoc nullMeta $ foldr addBlock [] nodes +nodeToPandoc n = -- shouldn't happen + Pandoc nullMeta $ foldr addBlock [] [n] + +addBlocks :: [Node] -> [Block] +addBlocks = foldr addBlock [] + +addBlock :: Node -> [Block] -> [Block] +addBlock (Node _ PARAGRAPH nodes) = + (Para (addInlines nodes) :) +addBlock (Node _ HRULE _) = + (HorizontalRule :) +addBlock (Node _ BLOCK_QUOTE nodes) = + (BlockQuote (addBlocks nodes) :) +addBlock (Node _ (HTML t) _) = + (RawBlock (Format "html") (unpack t) :) +addBlock (Node _ (CODE_BLOCK info t) _) = + (CodeBlock ("", take 1 (words (unpack info)), []) (unpack t) :) +addBlock (Node _ (HEADER lev) nodes) = + (Header lev ("",[],[]) (addInlines nodes) :) +addBlock (Node _ (LIST listAttrs) nodes) = + (constructor (map (setTightness . addBlocks . children) nodes) :) + where constructor = case listType listAttrs of + BULLET_LIST -> BulletList + ORDERED_LIST -> OrderedList + (start, DefaultStyle, delim) + start = listStart listAttrs + setTightness = if listTight listAttrs + then map paraToPlain + else id + paraToPlain (Para xs) = Plain (xs) + paraToPlain x = x + delim = case listDelim listAttrs of + PERIOD_DELIM -> Period + PAREN_DELIM -> OneParen +addBlock (Node _ ITEM _) = id -- handled in LIST +addBlock _ = id + +children :: Node -> [Node] +children (Node _ _ ns) = ns + +addInlines :: [Node] -> [Inline] +addInlines = foldr addInline [] + +addInline :: Node -> [Inline] -> [Inline] +addInline (Node _ (TEXT t) _) = (map toinl clumps ++) + where raw = unpack t + clumps = groupBy samekind raw + samekind ' ' ' ' = True + samekind ' ' _ = False + samekind _ ' ' = False + samekind _ _ = True + toinl (' ':_) = Space + toinl xs = Str xs +addInline (Node _ LINEBREAK _) = (LineBreak :) +addInline (Node _ SOFTBREAK _) = (Space :) +addInline (Node _ (INLINE_HTML t) _) = + (RawInline (Format "html") (unpack t) :) +addInline (Node _ (CODE t) _) = + (Code ("",[],[]) (unpack t) :) +addInline (Node _ EMPH nodes) = + (Emph (addInlines nodes) :) +addInline (Node _ STRONG nodes) = + (Strong (addInlines nodes) :) +addInline (Node _ (LINK url title) nodes) = + (Link (addInlines nodes) (unpack url, unpack title) :) +addInline (Node _ (IMAGE url title) nodes) = + (Image (addInlines nodes) (unpack url, unpack title) :) +addInline _ = id diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 900d0a1bf..67a97ae85 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -280,7 +280,13 @@ runToInlines :: Run -> DocxContext Inlines runToInlines (Run rs runElems) | Just (s, _) <- rStyle rs , s `elem` codeStyles = - return $ code $ concatMap runElemToString runElems + let rPr = resolveDependentRunStyle rs + codeString = code $ concatMap runElemToString runElems + in + return $ case rVertAlign rPr of + Just SupScrpt -> superscript codeString + Just SubScrpt -> subscript codeString + _ -> codeString | otherwise = do let ils = concatReduce (map runElemToInlines runElems) return $ (runStyleToTransform $ resolveDependentRunStyle rs) ils diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 671d2acf3..cce80fb48 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -65,6 +65,7 @@ import Text.Pandoc.Compat.Except import Text.TeXMath.Readers.OMML (readOMML) import Text.Pandoc.Readers.Docx.Fonts (getUnicode, Font(..)) import Text.TeXMath (Exp) +import Text.Pandoc.Readers.Docx.Util import Data.Char (readLitChar, ord, chr, isDigit) data ReaderEnv = ReaderEnv { envNotes :: Notes @@ -108,8 +109,6 @@ mapD f xs = in concatMapM handler xs -type NameSpaces = [(String, String)] - data Docx = Docx Document deriving Show @@ -158,6 +157,7 @@ data ParagraphStyle = ParagraphStyle { pStyle :: [String] , indentation :: Maybe ParIndentation , dropCap :: Bool , pHeading :: Maybe (String, Int) + , pNumInfo :: Maybe (String, String) , pBlockQuote :: Maybe Bool } deriving Show @@ -167,6 +167,7 @@ defaultParagraphStyle = ParagraphStyle { pStyle = [] , indentation = Nothing , dropCap = False , pHeading = Nothing + , pNumInfo = Nothing , pBlockQuote = Nothing } @@ -224,6 +225,7 @@ data RunStyle = RunStyle { isBold :: Maybe Bool data ParStyleData = ParStyleData { headingLev :: Maybe (String, Int) , isBlockQuote :: Maybe Bool + , numInfo :: Maybe (String, String) , psStyle :: Maybe ParStyle} deriving Show @@ -246,10 +248,6 @@ type ChangeId = String type Author = String type ChangeDate = String -attrToNSPair :: Attr -> Maybe (String, String) -attrToNSPair (Attr (QName s _ (Just "xmlns")) val) = Just (s, val) -attrToNSPair _ = Nothing - archiveToDocx :: Archive -> Either DocxError Docx archiveToDocx archive = do let notes = archiveToNotes archive @@ -266,7 +264,7 @@ archiveToDocument :: Archive -> D Document archiveToDocument zf = do entry <- maybeToD $ findEntryByPath "word/document.xml" zf docElem <- maybeToD $ (parseXMLDoc . UTF8.toStringLazy . fromEntry) entry - let namespaces = mapMaybe attrToNSPair (elAttribs docElem) + let namespaces = elemToNameSpaces docElem bodyElem <- maybeToD $ findChild (elemName namespaces "w" "body") docElem body <- elemToBody namespaces bodyElem return $ Document namespaces body @@ -285,7 +283,7 @@ archiveToStyles zf = case stylesElem of Nothing -> (M.empty, M.empty) Just styElem -> - let namespaces = mapMaybe attrToNSPair (elAttribs styElem) + let namespaces = elemToNameSpaces styElem in ( M.fromList $ buildBasedOnList namespaces styElem (Nothing :: Maybe CharStyle), @@ -353,10 +351,10 @@ archiveToNotes zf = enElem = findEntryByPath "word/endnotes.xml" zf >>= (parseXMLDoc . UTF8.toStringLazy . fromEntry) fn_namespaces = case fnElem of - Just e -> mapMaybe attrToNSPair (elAttribs e) + Just e -> elemToNameSpaces e Nothing -> [] en_namespaces = case enElem of - Just e -> mapMaybe attrToNSPair (elAttribs e) + Just e -> elemToNameSpaces e Nothing -> [] ns = unionBy (\x y -> fst x == fst y) fn_namespaces en_namespaces fn = fnElem >>= (elemToNotes ns "footnote") @@ -456,7 +454,7 @@ archiveToNumbering' zf = do Nothing -> Just $ Numbering [] [] [] Just entry -> do numberingElem <- (parseXMLDoc . UTF8.toStringLazy . fromEntry) entry - let namespaces = mapMaybe attrToNSPair (elAttribs numberingElem) + let namespaces = elemToNameSpaces numberingElem numElems = findChildren (QName "num" (lookup "w" namespaces) (Just "w")) numberingElem @@ -485,15 +483,6 @@ elemToNotes _ _ _ = Nothing --------------------------------------------- --------------------------------------------- -elemName :: NameSpaces -> String -> String -> QName -elemName ns prefix name = (QName name (lookup prefix ns) (Just prefix)) - -isElem :: NameSpaces -> String -> String -> Element -> Bool -isElem ns prefix name element = - qName (elName element) == name && - qURI (elName element) == (lookup prefix ns) - - elemToTblGrid :: NameSpaces -> Element -> D TblGrid elemToTblGrid ns element | isElem ns "w" "tblGrid" element = let cols = findChildren (elemName ns "w" "gridCol") element @@ -546,20 +535,6 @@ elemToParIndentation ns element | isElem ns "w" "ind" element = stringToInteger} elemToParIndentation _ _ = Nothing - -elemToNumInfo :: NameSpaces -> Element -> Maybe (String, String) -elemToNumInfo ns element | isElem ns "w" "p" element = do - let pPr = findChild (elemName ns "w" "pPr") element - numPr = pPr >>= findChild (elemName ns "w" "numPr") - lvl <- numPr >>= - findChild (elemName ns "w" "ilvl") >>= - findAttr (elemName ns "w" "val") - numId <- numPr >>= - findChild (elemName ns "w" "numId") >>= - findAttr (elemName ns "w" "val") - return (numId, lvl) -elemToNumInfo _ _ = Nothing - testBitMask :: String -> Int -> Bool testBitMask bitMaskS n = case (reads ("0x" ++ bitMaskS) :: [(Int, String)]) of @@ -578,20 +553,28 @@ elemToBodyPart ns element return $ OMathPara expsLst elemToBodyPart ns element | isElem ns "w" "p" element - , Just (numId, lvl) <- elemToNumInfo ns element = do + , Just (numId, lvl) <- getNumInfo ns element = do sty <- asks envParStyles let parstyle = elemToParagraphStyle ns element sty parparts <- mapD (elemToParPart ns) (elChildren element) num <- asks envNumbering case lookupLevel numId lvl num of - Just levelInfo -> return $ ListItem parstyle numId lvl levelInfo parparts - Nothing -> throwError WrongElem + Just levelInfo -> return $ ListItem parstyle numId lvl levelInfo parparts + Nothing -> throwError WrongElem elemToBodyPart ns element | isElem ns "w" "p" element = do - sty <- asks envParStyles - let parstyle = elemToParagraphStyle ns element sty - parparts <- mapD (elemToParPart ns) (elChildren element) - return $ Paragraph parstyle parparts + sty <- asks envParStyles + let parstyle = elemToParagraphStyle ns element sty + parparts <- mapD (elemToParPart ns) (elChildren element) + case pNumInfo parstyle of + Just (numId, lvl) -> do + num <- asks envNumbering + case lookupLevel numId lvl num of + Just levelInfo -> + return $ ListItem parstyle numId lvl levelInfo parparts + Nothing -> + throwError WrongElem + Nothing -> return $ Paragraph parstyle parparts elemToBodyPart ns element | isElem ns "w" "tbl" element = do let caption' = findChild (elemName ns "w" "tblPr") element @@ -771,6 +754,7 @@ elemToParagraphStyle ns element sty Just _ -> True Nothing -> False , pHeading = getParStyleField headingLev sty style + , pNumInfo = getParStyleField numInfo sty style , pBlockQuote = getParStyleField isBlockQuote sty style } elemToParagraphStyle _ _ _ = defaultParagraphStyle @@ -857,12 +841,26 @@ getBlockQuote ns element , styleName `elem` blockQuoteStyleNames = Just True getBlockQuote _ _ = Nothing +getNumInfo :: NameSpaces -> Element -> Maybe (String, String) +getNumInfo ns element = do + let numPr = findChild (elemName ns "w" "pPr") element >>= + findChild (elemName ns "w" "numPr") + lvl = fromMaybe "0" (numPr >>= + findChild (elemName ns "w" "ilvl") >>= + findAttr (elemName ns "w" "val")) + numId <- numPr >>= + findChild (elemName ns "w" "numId") >>= + findAttr (elemName ns "w" "val") + return (numId, lvl) + + elemToParStyleData :: NameSpaces -> Element -> Maybe ParStyle -> ParStyleData elemToParStyleData ns element parentStyle = ParStyleData { headingLev = getHeaderLevel ns element , isBlockQuote = getBlockQuote ns element + , numInfo = getNumInfo ns element , psStyle = parentStyle } diff --git a/src/Text/Pandoc/Readers/Docx/StyleMap.hs b/src/Text/Pandoc/Readers/Docx/StyleMap.hs new file mode 100644 index 000000000..2901ea2a3 --- /dev/null +++ b/src/Text/Pandoc/Readers/Docx/StyleMap.hs @@ -0,0 +1,106 @@ +module Text.Pandoc.Readers.Docx.StyleMap ( StyleMaps(..) + , defaultStyleMaps + , getStyleMaps + , getStyleId + , hasStyleName + ) where + +import Text.XML.Light +import Text.Pandoc.Readers.Docx.Util +import Control.Monad.State +import Data.Char (toLower) +import qualified Data.Map as M + +newtype ParaStyleMap = ParaStyleMap ( M.Map String String ) +newtype CharStyleMap = CharStyleMap ( M.Map String String ) + +class StyleMap a where + alterMap :: (M.Map String String -> M.Map String String) -> a -> a + getMap :: a -> M.Map String String + +instance StyleMap ParaStyleMap where + alterMap f (ParaStyleMap m) = ParaStyleMap $ f m + getMap (ParaStyleMap m) = m + +instance StyleMap CharStyleMap where + alterMap f (CharStyleMap m) = CharStyleMap $ f m + getMap (CharStyleMap m) = m + +insert :: (StyleMap a) => Maybe String -> Maybe String -> a -> a +insert (Just k) (Just v) m = alterMap (M.insert k v) m +insert _ _ m = m + +getStyleId :: (StyleMap a) => String -> a -> String +getStyleId s = M.findWithDefault (filter (/=' ') s) (map toLower s) . getMap + +hasStyleName :: (StyleMap a) => String -> a -> Bool +hasStyleName styleName = M.member (map toLower styleName) . getMap + +data StyleMaps = StyleMaps { sNameSpaces :: NameSpaces + , sParaStyleMap :: ParaStyleMap + , sCharStyleMap :: CharStyleMap + } + +data StyleType = ParaStyle | CharStyle + +defaultStyleMaps :: StyleMaps +defaultStyleMaps = StyleMaps { sNameSpaces = [] + , sParaStyleMap = ParaStyleMap M.empty + , sCharStyleMap = CharStyleMap M.empty + } + +type StateM a = State StyleMaps a + +getStyleMaps :: Element -> StyleMaps +getStyleMaps docElem = execState genStyleMap state' + where + state' = defaultStyleMaps {sNameSpaces = elemToNameSpaces docElem} + genStyleItem e = do + styleType <- getStyleType e + styleId <- getAttrStyleId e + nameValLowercase <- fmap (map toLower) `fmap` getNameVal e + case styleType of + Just ParaStyle -> modParaStyleMap $ insert nameValLowercase styleId + Just CharStyle -> modCharStyleMap $ insert nameValLowercase styleId + _ -> return () + genStyleMap = do + style <- elemName' "style" + let styles = findChildren style docElem + forM_ styles genStyleItem + +modParaStyleMap :: (ParaStyleMap -> ParaStyleMap) -> StateM () +modParaStyleMap f = modify $ \s -> + s {sParaStyleMap = f $ sParaStyleMap s} + +modCharStyleMap :: (CharStyleMap -> CharStyleMap) -> StateM () +modCharStyleMap f = modify $ \s -> + s {sCharStyleMap = f $ sCharStyleMap s} + +getStyleType :: Element -> StateM (Maybe StyleType) +getStyleType e = do + styleTypeStr <- getAttrType e + case styleTypeStr of + Just "paragraph" -> return $ Just ParaStyle + Just "character" -> return $ Just CharStyle + _ -> return Nothing + +getAttrType :: Element -> StateM (Maybe String) +getAttrType el = do + name <- elemName' "type" + return $ findAttr name el + +getAttrStyleId :: Element -> StateM (Maybe String) +getAttrStyleId el = do + name <- elemName' "styleId" + return $ findAttr name el + +getNameVal :: Element -> StateM (Maybe String) +getNameVal el = do + name <- elemName' "name" + val <- elemName' "val" + return $ findChild name el >>= findAttr val + +elemName' :: String -> StateM QName +elemName' name = do + namespaces <- gets sNameSpaces + return $ elemName namespaces "w" name diff --git a/src/Text/Pandoc/Readers/Docx/Util.hs b/src/Text/Pandoc/Readers/Docx/Util.hs new file mode 100644 index 000000000..891f107b0 --- /dev/null +++ b/src/Text/Pandoc/Readers/Docx/Util.hs @@ -0,0 +1,26 @@ +module Text.Pandoc.Readers.Docx.Util ( + NameSpaces + , elemName + , isElem + , elemToNameSpaces + ) where + +import Text.XML.Light +import Data.Maybe (mapMaybe) + +type NameSpaces = [(String, String)] + +elemToNameSpaces :: Element -> NameSpaces +elemToNameSpaces = mapMaybe attrToNSPair . elAttribs + +attrToNSPair :: Attr -> Maybe (String, String) +attrToNSPair (Attr (QName s _ (Just "xmlns")) val) = Just (s, val) +attrToNSPair _ = Nothing + +elemName :: NameSpaces -> String -> String -> QName +elemName ns prefix name = QName name (lookup prefix ns) (Just prefix) + +isElem :: NameSpaces -> String -> String -> Element -> Bool +isElem ns prefix name element = + qName (elName element) == name && + qURI (elName element) == lookup prefix ns diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 633388db8..a517f9566 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -272,7 +272,9 @@ ignoreBlocks name = (name, doraw <|> (mempty <$ optargs)) blockCommands :: M.Map String (LP Blocks) blockCommands = M.fromList $ [ ("par", mempty <$ skipopts) - , ("title", mempty <$ (skipopts *> tok >>= addMeta "title")) + , ("title", mempty <$ (skipopts *> + (grouped inline >>= addMeta "title") + <|> (grouped block >>= addMeta "title"))) , ("subtitle", mempty <$ (skipopts *> tok >>= addMeta "subtitle")) , ("author", mempty <$ (skipopts *> authors)) -- -- in letter class, temp. store address & sig as title, author @@ -342,7 +344,7 @@ setCaption :: LP Blocks setCaption = do ils <- tok mblabel <- option Nothing $ - try $ spaces >> controlSeq "label" >> (Just <$> tok) + try $ spaces' >> controlSeq "label" >> (Just <$> tok) let ils' = case mblabel of Just lab -> ils <> spanWith ("",[],[("data-label", stringify lab)]) mempty @@ -370,7 +372,7 @@ section (ident, classes, kvs) lvl = do let lvl' = if hasChapters then lvl + 1 else lvl skipopts contents <- grouped inline - lab <- option ident $ try (spaces >> controlSeq "label" >> spaces >> braced) + lab <- option ident $ try (spaces' >> controlSeq "label" >> spaces' >> braced) attr' <- registerHeader (lab, classes, kvs) contents return $ headerWith attr' lvl' contents @@ -496,7 +498,7 @@ inlineCommands = M.fromList $ , ("v", option (str "v") $ try $ tok >>= accent hacek) , ("u", option (str "u") $ try $ tok >>= accent breve) , ("i", lit "i") - , ("\\", linebreak <$ (optional (bracketed inline) *> optional sp)) + , ("\\", linebreak <$ (optional (bracketed inline) *> spaces')) , (",", pure mempty) , ("@", pure mempty) , (" ", lit "\160") @@ -509,7 +511,7 @@ inlineCommands = M.fromList $ , ("thanks", (note . mconcat) <$> (char '{' *> manyTill block (char '}'))) , ("footnote", (note . mconcat) <$> (char '{' *> manyTill block (char '}'))) , ("verb", doverb) - , ("lstinline", doverb) + , ("lstinline", skipopts *> doverb) , ("Verb", doverb) , ("texttt", (code . stringify . toList) <$> tok) , ("url", (unescapeURL <$> braced) >>= \url -> @@ -1272,7 +1274,7 @@ complexNatbibCitation mode = try $ do parseAligns :: LP [Alignment] parseAligns = try $ do char '{' - let maybeBar = skipMany $ sp <|> () <$ char '|' <|> () <$ try (string "@{}") + let maybeBar = skipMany $ sp <|> () <$ char '|' <|> () <$ (char '@' >> braced) maybeBar let cAlign = AlignCenter <$ char 'c' let lAlign = AlignLeft <$ char 'l' @@ -1286,13 +1288,13 @@ parseAligns = try $ do return aligns' hline :: LP () -hline = () <$ (try $ spaces >> controlSeq "hline") +hline = () <$ (try $ spaces' *> controlSeq "hline" <* spaces') lbreak :: LP () -lbreak = () <$ (try $ spaces *> controlSeq "\\") +lbreak = () <$ (try $ spaces' *> controlSeq "\\" <* spaces') amp :: LP () -amp = () <$ (try $ spaces *> char '&') +amp = () <$ (try $ spaces' *> char '&') parseTableRow :: Int -- ^ number of columns -> LP [Blocks] @@ -1305,20 +1307,22 @@ parseTableRow cols = try $ do guard $ cells' /= [mempty] -- note: a & b in a three-column table leaves an empty 3rd cell: let cells'' = cells' ++ replicate (cols - numcells) mempty - spaces + spaces' return cells'' +spaces' :: LP () +spaces' = spaces *> skipMany (comment *> spaces) + simpTable :: Bool -> LP Blocks simpTable hasWidthParameter = try $ do - when hasWidthParameter $ () <$ (spaces >> tok) - spaces + when hasWidthParameter $ () <$ (spaces' >> tok) + skipopts aligns <- parseAligns let cols = length aligns optional hline header' <- option [] $ try (parseTableRow cols <* lbreak <* hline) rows <- sepEndBy (parseTableRow cols) (lbreak <* optional hline) - spaces - skipMany (comment *> spaces) + spaces' let header'' = if null header' then replicate cols mempty else header' diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index b43dda3a1..369c889d1 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -36,7 +36,7 @@ import Data.List ( transpose, sortBy, intersperse, intercalate, elemIndex) import qualified Data.Map as M import Data.Scientific (coefficient, base10Exponent) import Data.Ord ( comparing ) -import Data.Char ( isAlphaNum, toLower ) +import Data.Char ( isSpace, isAlphaNum, toLower ) import Data.Maybe import Text.Pandoc.Definition import qualified Data.Text as T @@ -56,7 +56,7 @@ import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock ) import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag, isTextTag, isCommentTag ) import Data.Monoid (mconcat, mempty) -import Control.Applicative ((<$>), (<*), (*>), (<$)) +import Control.Applicative ((<$>), (<*), (*>), (<$), (<*>)) import Control.Monad import Control.Monad.Reader import System.FilePath (takeExtension, addExtension) @@ -80,7 +80,7 @@ readMarkdown opts s = -- and a list of warnings. readMarkdownWithWarnings :: ReaderOptions -- ^ Reader options -> String -- ^ String to parse (assuming @'\n'@ line endings) - -> Either PandocError (Pandoc, [String]) + -> Either PandocError (Pandoc, [String]) readMarkdownWithWarnings opts s = runMarkdown opts s (returnWarnings parseMarkdown) runMarkdown :: forall a . ReaderOptions -> String -> MarkdownParser a -> Either PandocError a @@ -284,7 +284,7 @@ ignorable :: Text -> Bool ignorable t = T.pack "_" `T.isSuffixOf` t toMetaValue :: ReaderOptions -> Text -> Either PandocError MetaValue -toMetaValue opts x = toMeta <$> readMarkdown opts (T.unpack x) +toMetaValue opts x = toMeta <$> readMarkdown opts' (T.unpack x) where toMeta p = case p of @@ -294,6 +294,11 @@ toMetaValue opts x = toMeta <$> readMarkdown opts (T.unpack x) | otherwise -> MetaInlines xs Pandoc _ bs -> MetaBlocks bs endsWithNewline t = T.pack "\n" `T.isSuffixOf` t + opts' = opts{readerExtensions=readerExtensions opts `Set.difference` meta_exts} + meta_exts = Set.fromList [ Ext_pandoc_title_block + , Ext_mmd_title_block + , Ext_yaml_metadata_block + ] yamlToMeta :: ReaderOptions -> Yaml.Value -> Either PandocError MetaValue yamlToMeta opts (Yaml.String t) = toMetaValue opts t @@ -329,11 +334,15 @@ mmdTitleBlock = try $ do kvPair :: MarkdownParser (String, MetaValue) kvPair = try $ do key <- many1Till (alphaNum <|> oneOf "_- ") (char ':') + skipMany1 spaceNoNewline val <- manyTill anyChar (try $ newline >> lookAhead (blankline <|> nonspaceChar)) + guard $ not . null . trim $ val let key' = concat $ words $ map toLower key let val' = MetaBlocks $ B.toList $ B.plain $ B.text $ trim val return (key',val') + where + spaceNoNewline = satisfy (\x -> isSpace x && (x/='\n') && (x/='\r')) parseMarkdown :: MarkdownParser Pandoc parseMarkdown = do @@ -471,12 +480,12 @@ block = do , bulletList , header , lhsCodeBlock - , rawTeXBlock , divHtml , htmlBlock , table - , lineBlock , codeBlockIndented + , rawTeXBlock + , lineBlock , blockQuote , hrule , orderedList @@ -1299,12 +1308,8 @@ pipeBreak = try $ do pipeTable :: MarkdownParser ([Alignment], [Double], [Blocks], [[Blocks]]) pipeTable = try $ do - (heads,aligns) <- try ( pipeBreak >>= \als -> - return (replicate (length als) mempty, als)) - <|> ( pipeTableRow >>= \row -> pipeBreak >>= \als -> - - return (row, als) ) - lines' <- many1 pipeTableRow + (heads,aligns) <- (,) <$> pipeTableRow <*> pipeBreak + lines' <- many pipeTableRow let widths = replicate (length aligns) 0.0 return (aligns, widths, heads, lines') @@ -1684,6 +1689,7 @@ referenceLink constructor (lab, raw) = do lookAhead (try (spnl >> normalCite >> return (mempty, ""))) <|> try (spnl >> reference) + when (raw' == "") $ guardEnabled Ext_shortcut_reference_links let labIsRef = raw' == "" || raw' == "[]" let key = toKey $ if labIsRef then raw else raw' parsedRaw <- parseFromString (mconcat <$> many inline) raw' diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 0bb6dd436..939d10fb2 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -593,11 +593,17 @@ imageOption = <|> try (many1 (oneOf "x0123456789") <* string "px") <|> try (oneOfStrings ["link=","alt=","page=","class="] <* many (noneOf "|]")) +collapseUnderscores :: String -> String +collapseUnderscores [] = [] +collapseUnderscores ('_':'_':xs) = collapseUnderscores ('_':xs) +collapseUnderscores (x:xs) = x : collapseUnderscores xs + +addUnderscores :: String -> String +addUnderscores = collapseUnderscores . intercalate "_" . words + internalLink :: MWParser Inlines internalLink = try $ do sym "[[" - let addUnderscores x = let (pref,suff) = break (=='#') x - in pref ++ intercalate "_" (words suff) pagename <- unwords . words <$> many (noneOf "|]") label <- option (B.text pagename) $ char '|' *> ( (mconcat <$> many1 (notFollowedBy (char ']') *> inline)) diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs index 9d2c355ee..1dfbdd700 100644 --- a/src/Text/Pandoc/Readers/Org.hs +++ b/src/Text/Pandoc/Readers/Org.hs @@ -2,6 +2,8 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} {- Copyright (C) 2014 Albert Krewinkel <tarleb@moltkeplatz.de> @@ -49,7 +51,7 @@ import Control.Applicative ( pure , (<$>), (<$), (<*>), (<*), (*>) ) import Control.Arrow (first) import Control.Monad (guard, mplus, mzero, when) -import Control.Monad.Reader (Reader, runReader, ask, asks) +import Control.Monad.Reader (Reader, runReader, asks, local) import Data.Char (isAlphaNum, toLower) import Data.Default import Data.List (intersperse, isPrefixOf, isSuffixOf, foldl') @@ -66,16 +68,19 @@ readOrg :: ReaderOptions -- ^ Reader options -> Either PandocError Pandoc readOrg opts s = runOrg opts s parseOrg +data OrgParserLocal = OrgParserLocal { orgLocalQuoteContext :: QuoteContext + , finalState :: OrgParserState } + +type OrgParser = ParserT [Char] OrgParserState (Reader OrgParserLocal) + runOrg :: ReaderOptions -> String -> OrgParser a -> Either PandocError a runOrg opts inp p = fst <$> res where imd = readWithM (returnState p) def{ orgStateOptions = opts } (inp ++ "\n\n") - res = runReader imd s + res = runReader imd def { finalState = s } s :: OrgParserState s = either def snd res -type OrgParser a = ParserT [Char] OrgParserState (Reader OrgParserState) a - parseOrg :: OrgParser Pandoc parseOrg = do blocks' <- parseBlocks @@ -134,6 +139,9 @@ data OrgParserState = OrgParserState , orgStateNotes' :: OrgNoteTable } +instance Default OrgParserLocal where + def = OrgParserLocal NoQuote def + instance HasReaderOptions OrgParserState where extractReaderOptions = orgStateOptions @@ -147,6 +155,10 @@ instance HasLastStrPosition OrgParserState where getLastStrPos = orgStateLastStrPos setLastStrPos pos st = st{ orgStateLastStrPos = Just pos } +instance HasQuoteContext st (Reader OrgParserLocal) where + getQuoteContext = asks orgLocalQuoteContext + withQuoteContext q = local (\s -> s{orgLocalQuoteContext = q}) + instance Default OrgParserState where def = defaultOrgParserState @@ -943,6 +955,7 @@ inline = , subscript , superscript , inlineLaTeX + , smart , symbol ] <* (guard =<< newlinesCountWithinLimits) <?> "inline" @@ -1050,7 +1063,7 @@ inlineNote = try $ do referencedNote :: OrgParser Inlines referencedNote = try $ do ref <- noteMarker - notes <- asks orgStateNotes' + notes <- asks (orgStateNotes' . finalState) return $ case lookup ref notes of Just contents -> B.note contents @@ -1113,7 +1126,7 @@ possiblyEmptyLinkTarget = try linkTarget <|> ("" <$ string "[]") applyCustomLinkFormat :: String -> OrgParser String applyCustomLinkFormat link = do let (linkType, rest) = break (== ':') link - fmts <- ask + fmts <- asks finalState return $ case M.lookup linkType (orgStateLinkFormatters fmts) of Just v -> (v (drop 1 rest)) @@ -1165,7 +1178,7 @@ isImageFilename filename = internalLink :: String -> Inlines -> OrgParser Inlines internalLink link title = do - anchorB <- ask + anchorB <- asks finalState return $ if link `elem` (orgStateAnchorIds anchorB) then B.link ('#':link) "" title @@ -1248,8 +1261,9 @@ math = B.math <$> choice [ math1CharBetween '$' displayMath :: OrgParser Inlines displayMath = B.displayMath <$> choice [ rawMathBetween "\\[" "\\]" - , rawMathBetween "$$" "$$" - ] + , rawMathBetween "$$" "$$" + ] + symbol :: OrgParser Inlines symbol = B.str . (: "") <$> (oneOf specialChars >>= updatePositions) where updatePositions c = do @@ -1466,3 +1480,31 @@ inlineLaTeXCommand = try $ do count len anyChar return cs _ -> mzero + +smart :: OrgParser Inlines +smart = do + getOption readerSmart >>= guard + doubleQuoted <|> singleQuoted <|> + choice [orgApostrophe, dash, ellipses] + where orgApostrophe = + (char '\'' <|> char '\8217') <* updateLastPreCharPos + <* updateLastForbiddenCharPos + *> return (B.str "\x2019") + +singleQuoted :: OrgParser Inlines +singleQuoted = try $ do + singleQuoteStart + withQuoteContext InSingleQuote $ + B.singleQuoted . trimInlines . mconcat <$> + many1Till inline singleQuoteEnd + +-- doubleQuoted will handle regular double-quoted sections, as well +-- as dialogues with an open double-quote without a close double-quote +-- in the same paragraph. +doubleQuoted :: OrgParser Inlines +doubleQuoted = try $ do + doubleQuoteStart + contents <- mconcat <$> many (try $ notFollowedBy doubleQuoteEnd >> inline) + (withQuoteContext InDoubleQuote $ (doubleQuoteEnd <* updateLastForbiddenCharPos) >> return + (B.doubleQuoted . trimInlines $ contents)) + <|> (return $ (B.str "\8220") <> contents) diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs index e5b8c5167..1c33b004a 100644 --- a/src/Text/Pandoc/Writers/AsciiDoc.hs +++ b/src/Text/Pandoc/Writers/AsciiDoc.hs @@ -126,7 +126,7 @@ blockToAsciiDoc :: WriterOptions -- ^ Options blockToAsciiDoc _ Null = return empty blockToAsciiDoc opts (Plain inlines) = do contents <- inlineListToAsciiDoc opts inlines - return $ contents <> cr + return $ contents <> blankline blockToAsciiDoc opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do blockToAsciiDoc opts (Para [Image alt (src,tit)]) blockToAsciiDoc opts (Para inlines) = do @@ -272,7 +272,7 @@ bulletListItemToAsciiDoc opts blocks = do contents <- foldM addBlock empty blocks modify $ \s -> s{ bulletListLevel = lev } let marker = text (replicate lev '*') - return $ marker <> space <> contents <> cr + return $ marker <> text " " <> contents <> cr -- | Convert ordered list item (a list of blocks) to asciidoc. orderedListItemToAsciiDoc :: WriterOptions -- ^ options @@ -292,7 +292,7 @@ orderedListItemToAsciiDoc opts marker blocks = do modify $ \s -> s{ orderedListLevel = lev + 1 } contents <- foldM addBlock empty blocks modify $ \s -> s{ orderedListLevel = lev } - return $ text marker <> space <> contents <> cr + return $ text marker <> text " " <> contents <> cr -- | Convert definition list item (label, list of blocks) to asciidoc. definitionListItemToAsciiDoc :: WriterOptions diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index b10317506..19f8f2f11 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -114,7 +114,8 @@ elementToDocbook opts lvl (Sec _ _num (id',_,_) title elements) = n | n == 0 -> "chapter" | n >= 1 && n <= 5 -> "sect" ++ show n | otherwise -> "simplesect" - in inTags True tag [("id", writerIdentifierPrefix opts ++ id')] $ + in inTags True tag [("id", writerIdentifierPrefix opts ++ id') | + not (null id')] $ inTagsSimple "title" (inlinesToDocbook opts title) $$ vcat (map (elementToDocbook opts (lvl + 1)) elements') diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 441392918..81369e278 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -29,7 +29,7 @@ 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, isPrefixOf, isSuffixOf, stripPrefix ) +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 @@ -54,6 +54,8 @@ import Text.Pandoc.Walk import Text.Highlighting.Kate.Types () import Text.XML.Light as XML import Text.TeXMath +import Text.Pandoc.Readers.Docx.StyleMap +import Text.Pandoc.Readers.Docx.Util (elemName) import Control.Monad.State import Text.Highlighting.Kate import Data.Unique (hashUnique, newUnique) @@ -63,8 +65,7 @@ import qualified Control.Exception as E import Text.Pandoc.MIME (MimeType, getMimeType, getMimeTypeDef, extensionFromMimeType) import Control.Applicative ((<$>), (<|>), (<*>)) -import Data.Maybe (fromMaybe, mapMaybe) -import Data.Char (isDigit) +import Data.Maybe (fromMaybe, mapMaybe, maybeToList) data ListMarker = NoMarker | BulletMarker @@ -106,7 +107,7 @@ data WriterState = WriterState{ , stChangesAuthor :: String , stChangesDate :: String , stPrintWidth :: Integer - , stHeadingStyles :: [(Int,String)] + , stStyleMaps :: StyleMaps , stFirstPara :: Bool } @@ -127,7 +128,7 @@ defaultWriterState = WriterState{ , stChangesAuthor = "unknown" , stChangesDate = "1969-12-31T19:00:00Z" , stPrintWidth = 1 - , stHeadingStyles = [] + , stStyleMaps = defaultStyleMaps , stFirstPara = False } @@ -215,32 +216,14 @@ writeDocx opts doc@(Pandoc meta _) = do styledoc <- parseXml refArchive distArchive stylepath -- parse styledoc for heading styles - let styleNamespaces = map ((,) <$> qName . attrKey <*> attrVal) . - filter ((==Just "xmlns") . qPrefix . attrKey) . - elAttribs $ styledoc - let headingStyles = - let - mywURI = lookup "w" styleNamespaces - myName name = QName name mywURI (Just "w") - getAttrStyleId = findAttr (myName "styleId") - getNameVal = findChild (myName "name") >=> findAttr (myName "val") - getNum s | not $ null s, all isDigit s = Just (read s :: Int) - | otherwise = Nothing - getEngHeader = getAttrStyleId >=> stripPrefix "Heading" >=> getNum - getIntHeader = getNameVal >=> stripPrefix "heading " >=> getNum - toTuple getF = liftM2 (,) <$> getF <*> getAttrStyleId - toMap getF = mapMaybe (toTuple getF) $ - findChildren (myName "style") styledoc - select a b | not $ null a = a - | otherwise = b - in - select (toMap getEngHeader) (toMap getIntHeader) + let styleMaps = getStyleMaps styledoc ((contents, footnotes), st) <- runStateT (writeOpenXML opts{writerWrapText = False} doc') defaultWriterState{ stChangesAuthor = fromMaybe "unknown" username , stChangesDate = formatTime defaultTimeLocale "%FT%XZ" utctime , stPrintWidth = (maybe 420 (\x -> quot x 20) pgContentWidth) - , stHeadingStyles = headingStyles} + , stStyleMaps = styleMaps + } let epochtime = floor $ utcTimeToPOSIXSeconds utctime let imgs = M.elems $ stImages st @@ -393,9 +376,18 @@ writeDocx opts doc@(Pandoc meta _) = do linkrels -- styles - let newstyles = styleToOpenXml $ writerHighlightStyle opts - let styledoc' = styledoc{ elContent = elContent styledoc ++ - [Elem x | x <- newstyles, writerHighlight opts] } + let newstyles = styleToOpenXml styleMaps $ writerHighlightStyle opts + let styledoc' = styledoc{ elContent = modifyContent (elContent styledoc) } + where + modifyContent + | writerHighlight opts = (++ map Elem newstyles) + | otherwise = filter notTokStyle + notTokStyle (Elem el) = notStyle el || notTokId el + notTokStyle _ = True + notStyle = (/= elemName' "style") . elName + notTokId = maybe True (`notElem` tokStys) . findAttr (elemName' "styleId") + tokStys = "SourceCode" : map show (enumFromTo KeywordTok NormalTok) + elemName' = elemName (sNameSpaces styleMaps) "w" let styleEntry = toEntry stylepath epochtime $ renderXml styledoc' -- construct word/numbering.xml @@ -472,10 +464,13 @@ writeDocx opts doc@(Pandoc meta _) = do miscRelEntries ++ otherMediaEntries return $ fromArchive archive -styleToOpenXml :: Style -> [Element] -styleToOpenXml style = parStyle : map toStyle alltoktypes +styleToOpenXml :: StyleMaps -> Style -> [Element] +styleToOpenXml sm style = + maybeToList parStyle ++ mapMaybe toStyle alltoktypes where alltoktypes = enumFromTo KeywordTok NormalTok - toStyle toktype = mknode "w:style" [("w:type","character"), + toStyle toktype | hasStyleName (show toktype) (sCharStyleMap sm) = Nothing + | otherwise = Just $ + mknode "w:style" [("w:type","character"), ("w:customStyle","1"),("w:styleId",show toktype)] [ mknode "w:name" [("w:val",show toktype)] () , mknode "w:basedOn" [("w:val","VerbatimChar")] () @@ -496,7 +491,9 @@ styleToOpenXml style = parStyle : map toStyle alltoktypes tokBg toktype = maybe "auto" (drop 1 . fromColor) $ (tokenBackground =<< lookup toktype tokStyles) `mplus` backgroundColor style - parStyle = mknode "w:style" [("w:type","paragraph"), + parStyle | hasStyleName "Source Code" (sParaStyleMap sm) = Nothing + | otherwise = Just $ + mknode "w:style" [("w:type","paragraph"), ("w:customStyle","1"),("w:styleId","SourceCode")] [ mknode "w:name" [("w:val","Source Code")] () , mknode "w:basedOn" [("w:val","Normal")] () @@ -602,14 +599,14 @@ writeOpenXML opts (Pandoc meta blocks) = do Just (MetaBlocks [Para xs]) -> xs Just (MetaInlines xs) -> xs _ -> [] - title <- withParaProp (pStyle "Title") $ blocksToOpenXML opts [Para tit | not (null tit)] - subtitle <- withParaProp (pStyle "Subtitle") $ blocksToOpenXML opts [Para subtitle' | not (null subtitle')] - authors <- withParaProp (pStyle "Author") $ blocksToOpenXML opts $ + title <- withParaPropM (pStyleM "Title") $ blocksToOpenXML opts [Para tit | not (null tit)] + subtitle <- withParaPropM (pStyleM "Subtitle") $ blocksToOpenXML opts [Para subtitle' | not (null subtitle')] + authors <- withParaProp (pCustomStyle "Author") $ blocksToOpenXML opts $ map Para auths - date <- withParaProp (pStyle "Date") $ blocksToOpenXML opts [Para dat | not (null dat)] + date <- withParaPropM (pStyleM "Date") $ blocksToOpenXML opts [Para dat | not (null dat)] abstract <- if null abstract' then return [] - else withParaProp (pStyle "Abstract") $ blocksToOpenXML opts abstract' + else withParaProp (pCustomStyle "Abstract") $ blocksToOpenXML opts abstract' let convertSpace (Str x : Space : Str y : xs) = Str (x ++ " " ++ y) : xs convertSpace (Str x : Str y : xs) = Str (x ++ y) : xs convertSpace xs = xs @@ -623,11 +620,23 @@ writeOpenXML opts (Pandoc meta blocks) = do blocksToOpenXML :: WriterOptions -> [Block] -> WS [Element] blocksToOpenXML opts bls = concat `fmap` mapM (blockToOpenXML opts) bls -pStyle :: String -> Element -pStyle sty = mknode "w:pStyle" [("w:val",sty)] () +pCustomStyle :: String -> Element +pCustomStyle sty = mknode "w:pStyle" [("w:val",sty)] () -rStyle :: String -> Element -rStyle sty = mknode "w:rStyle" [("w:val",sty)] () +pStyleM :: String -> WS XML.Element +pStyleM styleName = do + styleMaps <- gets stStyleMaps + let sty' = getStyleId styleName $ sParaStyleMap styleMaps + return $ mknode "w:pStyle" [("w:val",sty')] () + +rCustomStyle :: String -> Element +rCustomStyle sty = mknode "w:rStyle" [("w:val",sty)] () + +rStyleM :: String -> WS XML.Element +rStyleM styleName = do + styleMaps <- gets stStyleMaps + let sty' = getStyleId styleName $ sCharStyleMap styleMaps + return $ mknode "w:rStyle" [("w:val",sty')] () getUniqueId :: MonadIO m => m String -- the + 20 is to ensure that there are no clashes with the rIds @@ -641,13 +650,12 @@ blockToOpenXML opts (Div (_,["references"],_) bs) = do let (hs, bs') = span isHeaderBlock bs header <- blocksToOpenXML opts hs -- We put the Bibliography style on paragraphs after the header - rest <- withParaProp (pStyle "Bibliography") $ blocksToOpenXML opts bs' + rest <- withParaPropM (pStyleM "Bibliography") $ blocksToOpenXML opts bs' return (header ++ rest) blockToOpenXML opts (Div _ bs) = blocksToOpenXML opts bs blockToOpenXML opts (Header lev (ident,_,_) lst) = do setFirstPara - headingStyles <- gets stHeadingStyles - paraProps <- maybe id (withParaProp . pStyle) (lookup lev headingStyles) $ + paraProps <- withParaPropM (pStyleM ("Heading "++show lev)) $ getParaProps False contents <- inlinesToOpenXML opts lst usedIdents <- gets stSectionIds @@ -660,26 +668,27 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do ,("w:name",bookmarkName)] () let bookmarkEnd = mknode "w:bookmarkEnd" [("w:id", id')] () return [mknode "w:p" [] (paraProps ++ [bookmarkStart, bookmarkEnd] ++ contents)] -blockToOpenXML opts (Plain lst) = withParaProp (pStyle "Compact") +blockToOpenXML opts (Plain lst) = withParaProp (pCustomStyle "Compact") $ blockToOpenXML opts (Para lst) -- title beginning with fig: indicates that the image is a figure blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do setFirstPara paraProps <- getParaProps False contents <- inlinesToOpenXML opts [Image alt (src,tit)] - captionNode <- withParaProp (pStyle "ImageCaption") + captionNode <- withParaProp (pCustomStyle "ImageCaption") $ blockToOpenXML opts (Para alt) return $ mknode "w:p" [] (paraProps ++ contents) : captionNode -- fixDisplayMath sometimes produces a Para [] as artifact blockToOpenXML _ (Para []) = return [] blockToOpenXML opts (Para lst) = do - isFirstPara <- gets stFirstPara + isFirstPara <- gets stFirstPara paraProps <- getParaProps $ case lst of [Math DisplayMath _] -> True _ -> False + bodyTextStyle <- pStyleM "Body Text" let paraProps' = case paraProps of - [] | isFirstPara -> [mknode "w:pPr" [] [(pStyle "FirstParagraph")]] - [] -> [mknode "w:pPr" [] [(pStyle "BodyText")]] + [] | isFirstPara -> [mknode "w:pPr" [] [pCustomStyle "FirstParagraph"]] + [] -> [mknode "w:pPr" [] [bodyTextStyle]] ps -> ps modify $ \s -> s { stFirstPara = False } contents <- inlinesToOpenXML opts lst @@ -688,11 +697,11 @@ blockToOpenXML _ (RawBlock format str) | format == Format "openxml" = return [ x | Elem x <- parseXML str ] | otherwise = return [] blockToOpenXML opts (BlockQuote blocks) = do - p <- withParaProp (pStyle "BlockQuote") $ blocksToOpenXML opts blocks + p <- withParaPropM (pStyleM "Block Text") $ blocksToOpenXML opts blocks setFirstPara return p blockToOpenXML opts (CodeBlock attrs str) = do - p <- withParaProp (pStyle "SourceCode") $ (blockToOpenXML opts $ Para [Code attrs str]) + p <- withParaProp (pCustomStyle "SourceCode") (blockToOpenXML opts $ Para [Code attrs str]) setFirstPara return p blockToOpenXML _ HorizontalRule = do @@ -707,7 +716,7 @@ blockToOpenXML opts (Table caption aligns widths headers rows) = do let captionStr = stringify caption caption' <- if null caption then return [] - else withParaProp (pStyle "TableCaption") + else withParaProp (pCustomStyle "TableCaption") $ blockToOpenXML opts (Para caption) let alignmentFor al = mknode "w:jc" [("w:val",alignmentToString al)] () let cellToOpenXML (al, cell) = withParaProp (alignmentFor al) @@ -718,32 +727,36 @@ blockToOpenXML opts (Table caption aligns widths headers rows) = do [ mknode "w:tcBorders" [] $ mknode "w:bottom" [("w:val","single")] () , mknode "w:vAlign" [("w:val","bottom")] () ] - let emptyCell = [mknode "w:p" [] [mknode "w:pPr" [] - [mknode "w:pStyle" [("w:val","Compact")] ()]]] + let emptyCell = [mknode "w:p" [] [pCustomStyle "Compact"]] let mkcell border contents = mknode "w:tc" [] $ [ borderProps | border ] ++ if null contents then emptyCell else contents - let mkrow border cells = mknode "w:tr" [] $ map (mkcell border) cells + let mkrow border cells = mknode "w:tr" [] $ + [mknode "w:trPr" [] [ + mknode "w:cnfStyle" [("w:firstRow","1")] ()] | border] + ++ map (mkcell border) cells let textwidth = 7920 -- 5.5 in in twips, 1/20 pt let fullrow = 5000 -- 100% specified in pct let rowwidth = fullrow * sum widths let mkgridcol w = mknode "w:gridCol" [("w:w", show (floor (textwidth * w) :: Integer))] () + let hasHeader = not (all null headers) return $ caption' ++ [mknode "w:tbl" [] ( mknode "w:tblPr" [] ( mknode "w:tblStyle" [("w:val","TableNormal")] () : mknode "w:tblW" [("w:type", "pct"), ("w:w", show rowwidth)] () : + mknode "w:tblLook" [("w:firstRow","1") | hasHeader ] () : [ mknode "w:tblCaption" [("w:val", captionStr)] () | not (null caption) ] ) : mknode "w:tblGrid" [] (if all (==0) widths then [] else map mkgridcol widths) - : [ mkrow True headers' | not (all null headers) ] ++ + : [ mkrow True headers' | hasHeader ] ++ map (mkrow False) rows' )] blockToOpenXML opts (BulletList lst) = do @@ -767,9 +780,9 @@ blockToOpenXML opts (DefinitionList items) = do definitionListItemToOpenXML :: WriterOptions -> ([Inline],[[Block]]) -> WS [Element] definitionListItemToOpenXML opts (term,defs) = do - term' <- withParaProp (pStyle "DefinitionTerm") + term' <- withParaProp (pCustomStyle "DefinitionTerm") $ blockToOpenXML opts (Para term) - defs' <- withParaProp (pStyle "Definition") + defs' <- withParaProp (pCustomStyle "Definition") $ concat `fmap` mapM (blocksToOpenXML opts) defs return $ term' ++ defs' @@ -833,6 +846,9 @@ withTextProp d p = do popTextProp return res +withTextPropM :: WS Element -> WS a -> WS a +withTextPropM = (. flip withTextProp) . (>>=) + getParaProps :: Bool -> WS [Element] getParaProps displayMathPara = do props <- gets stParaProperties @@ -861,6 +877,9 @@ withParaProp d p = do popParaProp return res +withParaPropM :: WS Element -> WS a -> WS a +withParaPropM = (. flip withParaProp) . (>>=) + formattedString :: String -> WS [Element] formattedString str = do props <- getTextProps @@ -943,25 +962,26 @@ inlineToOpenXML opts (Math mathType str) = do Right r -> return [r] Left _ -> inlinesToOpenXML opts (texMathToInlines mathType str) inlineToOpenXML opts (Cite _ lst) = inlinesToOpenXML opts lst -inlineToOpenXML opts (Code attrs str) = - withTextProp (rStyle "VerbatimChar") - $ if writerHighlight opts - then case highlight formatOpenXML attrs str of - Nothing -> unhighlighted - Just h -> return h - else unhighlighted - where unhighlighted = intercalate [br] `fmap` - (mapM formattedString $ lines str) - formatOpenXML _fmtOpts = intercalate [br] . map (map toHlTok) - toHlTok (toktype,tok) = mknode "w:r" [] - [ mknode "w:rPr" [] - [ rStyle $ show toktype ] - , mknode "w:t" [("xml:space","preserve")] tok ] +inlineToOpenXML opts (Code attrs str) = do + let unhighlighted = intercalate [br] `fmap` + (mapM formattedString $ lines str) + formatOpenXML _fmtOpts = intercalate [br] . map (map toHlTok) + toHlTok (toktype,tok) = mknode "w:r" [] + [ mknode "w:rPr" [] + [ rCustomStyle (show toktype) ] + , mknode "w:t" [("xml:space","preserve")] tok ] + withTextProp (rCustomStyle "VerbatimChar") + $ if writerHighlight opts + then case highlight formatOpenXML attrs str of + Nothing -> unhighlighted + Just h -> return h + else unhighlighted inlineToOpenXML opts (Note bs) = do notes <- gets stFootnotes notenum <- getUniqueId + footnoteStyle <- rStyleM "Footnote Reference" let notemarker = mknode "w:r" [] - [ mknode "w:rPr" [] (rStyle "FootnoteRef") + [ mknode "w:rPr" [] footnoteStyle , mknode "w:footnoteRef" [] () ] let notemarkerXml = RawInline (Format "openxml") $ ppElement notemarker let insertNoteRef (Plain ils : xs) = Plain (notemarkerXml : ils) : xs @@ -971,22 +991,22 @@ inlineToOpenXML opts (Note bs) = do oldParaProperties <- gets stParaProperties oldTextProperties <- gets stTextProperties modify $ \st -> st{ stListLevel = -1, stParaProperties = [], stTextProperties = [] } - contents <- withParaProp (pStyle "FootnoteText") $ blocksToOpenXML opts + contents <- withParaPropM (pStyleM "Footnote Text") $ blocksToOpenXML opts $ insertNoteRef bs modify $ \st -> st{ stListLevel = oldListLevel, stParaProperties = oldParaProperties, stTextProperties = oldTextProperties } let newnote = mknode "w:footnote" [("w:id", notenum)] $ contents modify $ \s -> s{ stFootnotes = newnote : notes } return [ mknode "w:r" [] - [ mknode "w:rPr" [] (rStyle "FootnoteRef") + [ mknode "w:rPr" [] footnoteStyle , mknode "w:footnoteReference" [("w:id", notenum)] () ] ] -- internal link: inlineToOpenXML opts (Link txt ('#':xs,_)) = do - contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt + contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt return [ mknode "w:hyperlink" [("w:anchor",xs)] contents ] -- external link: inlineToOpenXML opts (Link txt (src,_)) = do - contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt + contents <- withTextPropM (rStyleM "Hyperlink") $ inlinesToOpenXML opts txt extlinks <- gets stExternalLinks id' <- case M.lookup src extlinks of Just i -> return i @@ -1088,7 +1108,7 @@ defaultFootnotes = [ mknode "w:footnote" [ mknode "w:p" [] $ [ mknode "w:r" [] $ [ mknode "w:continuationSeparator" [] ()]]]] - + parseXml :: Archive -> Archive -> String -> IO Element parseXml refArchive distArchive relpath = case ((findEntryByPath relpath refArchive `mplus` diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index ef00ea036..53dc931cc 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -446,19 +446,25 @@ blockToHtml opts (Para lst) = do contents <- inlineListToHtml opts lst return $ H.p contents blockToHtml opts (Div attr@(_,classes,_) bs) = do - contents <- blockListToHtml opts bs + let speakerNotes = "notes" `elem` classes + -- we don't want incremental output inside speaker notes, see #1394 + let opts' = if speakerNotes then opts{ writerIncremental = False } else opts + contents <- blockListToHtml opts' bs let contents' = nl opts >> contents >> nl opts return $ - if "notes" `elem` classes - then let opts' = opts{ writerIncremental = False } in - -- we don't want incremental output inside speaker notes - case writerSlideVariant opts of + if speakerNotes + then case writerSlideVariant opts of RevealJsSlides -> addAttrs opts' attr $ H5.aside $ contents' NoSlides -> addAttrs opts' attr $ H.div $ contents' _ -> mempty else addAttrs opts attr $ H.div $ contents' -blockToHtml _ (RawBlock f str) +blockToHtml opts (RawBlock f str) | f == Format "html" = return $ preEscapedString str + | f == Format "latex" = + case writerHTMLMathMethod opts of + MathJax _ -> do modify (\st -> st{ stMath = True }) + return $ toHtml str + _ -> return mempty | otherwise = return mempty blockToHtml opts (HorizontalRule) = return $ if writerHtml5 opts then H5.hr else H.hr blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do @@ -769,6 +775,8 @@ inlineToHtml opts inline = case writerHTMLMathMethod opts of LaTeXMathML _ -> do modify (\st -> st {stMath = True}) return $ toHtml str + MathJax _ -> do modify (\st -> st {stMath = True}) + return $ toHtml str _ -> return mempty | f == Format "html" -> return $ preEscapedString str | otherwise -> return mempty diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 0e5ec5c18..58456e3ab 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -42,6 +42,7 @@ import Data.List ( (\\), isSuffixOf, isInfixOf, stripPrefix, isPrefixOf, intercalate, intersperse ) import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord ) import Data.Maybe ( fromMaybe ) +import Data.Aeson.Types ( (.:), parseMaybe, withObject ) import Control.Applicative ((<|>)) import Control.Monad.State import Text.Pandoc.Pretty @@ -102,8 +103,16 @@ pandocToLaTeX options (Pandoc meta blocks) = do modify $ \s -> s{ stInternalLinks = query isInternalLink blocks' } let template = writerTemplate options -- set stBook depending on documentclass + let colwidth = if writerWrapText options + then Just $ writerColumns options + else Nothing + metadata <- metaToJSON options + (fmap (render colwidth) . blockListToLaTeX) + (fmap (render colwidth) . inlineListToLaTeX) + meta let bookClasses = ["memoir","book","report","scrreprt","scrbook"] - case lookup "documentclass" (writerVariables options) of + case lookup "documentclass" (writerVariables options) `mplus` + parseMaybe (withObject "object" (.: "documentclass")) metadata of Just x | x `elem` bookClasses -> modify $ \s -> s{stBook = True} | otherwise -> return () Nothing | any (\x -> "\\documentclass" `isPrefixOf` x && @@ -114,13 +123,6 @@ pandocToLaTeX options (Pandoc meta blocks) = do -- \enquote{...} for smart quotes: when ("{csquotes}" `isInfixOf` template) $ modify $ \s -> s{stCsquotes = True} - let colwidth = if writerWrapText options - then Just $ writerColumns options - else Nothing - metadata <- metaToJSON options - (fmap (render colwidth) . blockListToLaTeX) - (fmap (render colwidth) . inlineListToLaTeX) - meta let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then (blocks', []) else case last blocks' of @@ -701,7 +703,7 @@ inlineListToLaTeX lst = ("\\\\[" ++ show (length lbs) ++ "\\baselineskip]") : fixBreaks rest fixBreaks (y:ys) = y : fixBreaks ys - + isQuoted :: Inline -> Bool isQuoted (Quoted _ _) = True isQuoted _ = False @@ -750,10 +752,11 @@ inlineToLaTeX (Cite cits lst) = do inlineToLaTeX (Code (_,classes,_) str) = do opts <- gets stOptions + inHeading <- gets stInHeading case () of - _ | writerListings opts -> listingsCode + _ | writerListings opts && not inHeading -> listingsCode | writerHighlight opts && not (null classes) -> highlightCode - | otherwise -> rawCode + | otherwise -> rawCode where listingsCode = do inNote <- gets stInNote when inNote $ modify $ \s -> s{ stVerbInNote = True } diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index d71f0daf8..dee4d56a4 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -57,12 +57,15 @@ import qualified Data.Text as T type Notes = [[Block]] type Refs = [([Inline], Target)] -data WriterState = WriterState { stNotes :: Notes - , stRefs :: Refs - , stIds :: [String] - , stPlain :: Bool } +data WriterState = WriterState { stNotes :: Notes + , stRefs :: Refs + , stRefShortcutable :: Bool + , stInList :: Bool + , stIds :: [String] + , stPlain :: Bool } instance Default WriterState - where def = WriterState{ stNotes = [], stRefs = [], stIds = [], stPlain = False } + where def = WriterState{ stNotes = [], stRefs = [], stRefShortcutable = True, + stInList = False, stIds = [], stPlain = False } -- | Convert Pandoc to Markdown. writeMarkdown :: WriterOptions -> Pandoc -> String @@ -453,7 +456,7 @@ blockToMarkdown opts t@(Table caption aligns widths headers rows) = do $ Pandoc nullMeta [t] return $ nst $ tbl $$ blankline $$ caption'' $$ blankline blockToMarkdown opts (BulletList items) = do - contents <- mapM (bulletListItemToMarkdown opts) items + contents <- inList $ mapM (bulletListItemToMarkdown opts) items return $ cat contents <> blankline blockToMarkdown opts (OrderedList (start,sty,delim) items) = do let start' = if isEnabled Ext_startnum opts then start else 1 @@ -464,13 +467,22 @@ blockToMarkdown opts (OrderedList (start,sty,delim) items) = do let markers' = map (\m -> if length m < 3 then m ++ replicate (3 - length m) ' ' else m) markers - contents <- mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $ + contents <- inList $ + mapM (\(item, num) -> orderedListItemToMarkdown opts item num) $ zip markers' items return $ cat contents <> blankline blockToMarkdown opts (DefinitionList items) = do - contents <- mapM (definitionListItemToMarkdown opts) items + contents <- inList $ mapM (definitionListItemToMarkdown opts) items return $ cat contents <> blankline +inList :: State WriterState a -> State WriterState a +inList p = do + oldInList <- gets stInList + modify $ \st -> st{ stInList = True } + res <- p + modify $ \st -> st{ stInList = oldInList } + return res + addMarkdownAttribute :: String -> String addMarkdownAttribute s = case span isTagText $ reverse $ parseTags s of @@ -497,7 +509,12 @@ pipeTable headless aligns rawHeaders rawRows = do AlignCenter -> ':':replicate w '-' ++ ":" AlignRight -> replicate (w + 1) '-' ++ ":" AlignDefault -> replicate (w + 2) '-' - let header = if headless then empty else torow rawHeaders + -- note: pipe tables can't completely lack a + -- header; for a headerless table, we need a header of empty cells. + -- see jgm/pandoc#1996. + let header = if headless + then torow (replicate (length aligns) empty) + else torow rawHeaders let border = nowrap $ text "|" <> hcat (intersperse (text "|") $ map toborder $ zip aligns widths) <> text "|" let body = vcat $ map torow rawRows @@ -677,12 +694,53 @@ getReference label (src, tit) = do -- | Convert list of Pandoc inline elements to markdown. inlineListToMarkdown :: WriterOptions -> [Inline] -> State WriterState Doc -inlineListToMarkdown opts lst = - mapM (inlineToMarkdown opts) (avoidBadWraps lst) >>= return . cat - where avoidBadWraps [] = [] - avoidBadWraps (Space:Str (c:cs):xs) - | c `elem` ("-*+>" :: String) = Str (' ':c:cs) : avoidBadWraps xs - avoidBadWraps (x:xs) = x : avoidBadWraps xs +inlineListToMarkdown opts lst = do + inlist <- gets stInList + go (if inlist then avoidBadWrapsInList lst else lst) + where go [] = return empty + go (i:is) = case i of + (Link _ _) -> case is of + -- If a link is followed by another link or '[' we don't shortcut + (Link _ _):_ -> unshortcutable + Space:(Link _ _):_ -> unshortcutable + Space:(Str('[':_)):_ -> unshortcutable + Space:(RawInline _ ('[':_)):_ -> unshortcutable + Space:(Cite _ _):_ -> unshortcutable + (Cite _ _):_ -> unshortcutable + Str ('[':_):_ -> unshortcutable + (RawInline _ ('[':_)):_ -> unshortcutable + (RawInline _ (' ':'[':_)):_ -> unshortcutable + _ -> shortcutable + _ -> shortcutable + where shortcutable = liftM2 (<>) (inlineToMarkdown opts i) (go is) + unshortcutable = do + iMark <- withState (\s -> s { stRefShortcutable = False }) + (inlineToMarkdown opts i) + modify (\s -> s {stRefShortcutable = True }) + fmap (iMark <>) (go is) + +avoidBadWrapsInList :: [Inline] -> [Inline] +avoidBadWrapsInList [] = [] +avoidBadWrapsInList (Space:Str ('>':cs):xs) = + Str (' ':'>':cs) : avoidBadWrapsInList xs +avoidBadWrapsInList (Space:Str [c]:[]) + | c `elem` ['-','*','+'] = Str [' ', c] : [] +avoidBadWrapsInList (Space:Str [c]:Space:xs) + | c `elem` ['-','*','+'] = Str [' ', c] : Space : avoidBadWrapsInList xs +avoidBadWrapsInList (Space:Str cs:Space:xs) + | isOrderedListMarker cs = Str (' ':cs) : Space : avoidBadWrapsInList xs +avoidBadWrapsInList (Space:Str cs:[]) + | isOrderedListMarker cs = Str (' ':cs) : [] +avoidBadWrapsInList (x:xs) = x : avoidBadWrapsInList xs + +isOrderedListMarker :: String -> Bool +isOrderedListMarker xs = (last xs `elem` ['.',')']) && + isRight (runParserT (anyOrderedListMarker >> eof) + defaultParserState "" xs) + +isRight :: Either a b -> Bool +isRight (Right _) = True +isRight (Left _) = False escapeSpaces :: Inline -> Inline escapeSpaces (Str s) = Str $ substitute " " "\\ " s @@ -692,8 +750,10 @@ escapeSpaces x = x -- | Convert Pandoc inline element to markdown. inlineToMarkdown :: WriterOptions -> Inline -> State WriterState Doc inlineToMarkdown opts (Span attrs ils) = do + plain <- gets stPlain contents <- inlineListToMarkdown opts ils - return $ if isEnabled Ext_raw_html opts + return $ if not plain && + (isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts) then tagWithAttrs "span" attrs <> contents <> text "</span>" else contents inlineToMarkdown opts (Emph lst) = do @@ -726,13 +786,14 @@ inlineToMarkdown opts (Subscript lst) = do else "<sub>" <> contents <> "</sub>" inlineToMarkdown opts (SmallCaps lst) = do plain <- gets stPlain - if plain - then inlineListToMarkdown opts $ capitalize lst - else do + if not plain && + (isEnabled Ext_raw_html opts || isEnabled Ext_native_spans opts) + then do contents <- inlineListToMarkdown opts lst return $ tagWithAttrs "span" - ("",[],[("style","font-variant:small-caps;")]) + ("",[],[("style","font-variant:small-caps;")]) <> contents <> text "</span>" + else inlineListToMarkdown opts $ capitalize lst inlineToMarkdown opts (Quoted SingleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ "‘" <> contents <> "’" @@ -838,6 +899,9 @@ inlineToMarkdown opts (Link txt (src, tit)) = do [Str s] | escapeURI s == srcSuffix -> True _ -> False let useRefLinks = writerReferenceLinks opts && not useAuto + shortcutable <- gets stRefShortcutable + let useShortcutRefLinks = shortcutable && + isEnabled Ext_shortcut_reference_links opts ref <- if useRefLinks then getReference txt (src, tit) else return [] reftext <- inlineListToMarkdown opts ref return $ if useAuto @@ -847,7 +911,9 @@ inlineToMarkdown opts (Link txt (src, tit)) = do else if useRefLinks then let first = "[" <> linktext <> "]" second = if txt == ref - then "[]" + then if useShortcutRefLinks + then "" + else "[]" else "[" <> reftext <> "]" in first <> second else if plain diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs index 01e5d26f0..47292bc99 100644 --- a/tests/Tests/Readers/Docx.hs +++ b/tests/Tests/Readers/Docx.hs @@ -146,6 +146,10 @@ tests = [ testGroup "inlines" "inline code (with VerbatimChar style)" "docx/inline_code.docx" "docx/inline_code.native" + , testCompare + "inline code in subscript and superscript" + "docx/verbatim_subsuper.docx" + "docx/verbatim_subsuper.native" ] , testGroup "blocks" [ testCompare @@ -173,6 +177,10 @@ tests = [ testGroup "inlines" "docx/definition_list.docx" "docx/definition_list.native" , testCompare + "custom defined lists in styles" + "docx/german_styled_lists.docx" + "docx/german_styled_lists.native" + , testCompare "footnotes and endnotes" "docx/notes.docx" "docx/notes.native" diff --git a/tests/Tests/Readers/LaTeX.hs b/tests/Tests/Readers/LaTeX.hs index 7a07bf673..38363af59 100644 --- a/tests/Tests/Readers/LaTeX.hs +++ b/tests/Tests/Readers/LaTeX.hs @@ -7,6 +7,7 @@ import Tests.Helpers import Tests.Arbitrary() import Text.Pandoc.Builder import Text.Pandoc +import Data.Monoid (mempty) import Text.Pandoc.Error latex :: String -> Pandoc @@ -17,6 +18,10 @@ infix 4 =: => String -> (String, c) -> Test (=:) = test latex +simpleTable' :: [Alignment] -> [[Blocks]] -> Blocks +simpleTable' aligns = table "" (zip aligns (repeat 0.0)) + (map (const mempty) aligns) + tests :: [Test] tests = [ testGroup "basic" [ "simple" =: @@ -63,6 +68,40 @@ tests = [ testGroup "basic" "\\begin{lstlisting}\\end{lstlisting}" =?> codeBlock "" ] + , testGroup "tables" + [ "Single cell table" =: + "\\begin{tabular}{|l|}Test\\\\\\end{tabular}" =?> + simpleTable' [AlignLeft] [[plain "Test"]] + , "Multi cell table" =: + "\\begin{tabular}{|rl|}One & Two\\\\ \\end{tabular}" =?> + simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]] + , "Multi line table" =: + unlines [ "\\begin{tabular}{|c|}" + , "One\\\\" + , "Two\\\\" + , "Three\\\\" + , "\\end{tabular}" ] =?> + simpleTable' [AlignCenter] + [[plain "One"], [plain "Two"], [plain "Three"]] + , "Empty table" =: + "\\begin{tabular}{}\\end{tabular}" =?> + simpleTable' [] [] + , "Table with fixed column width" =: + "\\begin{tabular}{|p{5cm}r|}One & Two\\\\ \\end{tabular}" =?> + simpleTable' [AlignLeft,AlignRight] [[plain "One", plain "Two"]] + , "Table with empty column separators" =: + "\\begin{tabular}{@{}r@{}l}One & Two\\\\ \\end{tabular}" =?> + simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]] + , "Table with custom column separators" =: + unlines [ "\\begin{tabular}{@{($\\to$)}r@{\\hspace{2cm}}l}" + , "One&Two\\\\" + , "\\end{tabular}" ] =?> + simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]] + , "Table with vertical alignment argument" =: + "\\begin{tabular}[t]{r|r}One & Two\\\\ \\end{tabular}" =?> + simpleTable' [AlignRight,AlignRight] [[plain "One", plain "Two"]] + ] + , testGroup "citations" [ natbibCitations , biblatexCitations diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index 9a2e2d938..f555447c7 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -13,6 +13,9 @@ import Text.Pandoc.Error org :: String -> Pandoc org = handleError . readOrg def +orgSmart :: String -> Pandoc +orgSmart = handleError . readOrg def { readerSmart = True } + infix 4 =: (=:) :: ToString c => String -> (String, c) -> Test @@ -1153,4 +1156,25 @@ tests = ] in codeBlockWith ( "", classes, params) "code body\n" ] + , testGroup "Smart punctuation" + [ test orgSmart "quote before ellipses" + ("'...hi'" + =?> para (singleQuoted "…hi")) + + , test orgSmart "apostrophe before emph" + ("D'oh! A l'/aide/!" + =?> para ("D’oh! A l’" <> emph "aide" <> "!")) + + , test orgSmart "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»") + + , test orgSmart "Quotes cannot occur at the end of emphasized text" + ("/say \"yes\"/" =?> + para ("/say" <> space <> doubleQuoted "yes" <> "/")) + + , test orgSmart "Dashes are allowed at the borders of emphasis'" + ("/foo---/" =?> + para (emph "foo—")) + ] ] diff --git a/tests/Tests/Writers/Docx.hs b/tests/Tests/Writers/Docx.hs new file mode 100644 index 000000000..068c5a935 --- /dev/null +++ b/tests/Tests/Writers/Docx.hs @@ -0,0 +1,129 @@ +module Tests.Writers.Docx (tests) where + +import Text.Pandoc.Options +import Text.Pandoc.Readers.Native +import Text.Pandoc.Definition +import Tests.Helpers +import Test.Framework +import Text.Pandoc.Readers.Docx +import Text.Pandoc.Writers.Docx +import Text.Pandoc.Error + +type Options = (WriterOptions, ReaderOptions) + +compareOutput :: Options + -> FilePath + -> IO (Pandoc, Pandoc) +compareOutput opts nativeFile = do + nf <- Prelude.readFile nativeFile + df <- writeDocx (fst opts) (handleError $ readNative nf) + let (p, _) = handleError $ readDocx (snd opts) df + return (p, handleError $ readNative nf) + +testCompareWithOptsIO :: Options -> String -> FilePath -> IO Test +testCompareWithOptsIO opts name nativeFile = do + (dp, np) <- compareOutput opts nativeFile + return $ test id name (dp, np) + +testCompareWithOpts :: Options -> String -> FilePath -> Test +testCompareWithOpts opts name nativeFile = + buildTest $ testCompareWithOptsIO opts name nativeFile + +testCompare :: String -> FilePath -> Test +testCompare = testCompareWithOpts def + +tests :: [Test] +tests = [ testGroup "inlines" + [ testCompare + "font formatting" + "docx/inline_formatting_writer.native" + , testCompare + "font formatting with character styles" + "docx/char_styles.native" + , testCompare + "hyperlinks" + "docx/links_writer.native" + , testCompare + "inline image" + "docx/image_no_embed_writer.native" + , testCompare + "inline image in links" + "docx/inline_images_writer.native" + , testCompare + "handling unicode input" + "docx/unicode.native" + , testCompare + "literal tabs" + "docx/tabs.native" + , testCompare + "normalizing inlines" + "docx/normalize.native" + , testCompare + "normalizing inlines deep inside blocks" + "docx/deep_normalize.native" + , testCompare + "move trailing spaces outside of formatting" + "docx/trailing_spaces_in_formatting.native" + , testCompare + "inline code (with VerbatimChar style)" + "docx/inline_code.native" + , testCompare + "inline code in subscript and superscript" + "docx/verbatim_subsuper.native" + ] + , testGroup "blocks" + [ testCompare + "headers" + "docx/headers.native" + , testCompare + "headers already having auto identifiers" + "docx/already_auto_ident.native" + , testCompare + "numbered headers automatically made into list" + "docx/numbered_header.native" + , testCompare + "i18n blocks (headers and blockquotes)" + "docx/i18n_blocks.native" + -- Continuation does not survive round-trip + , testCompare + "lists" + "docx/lists_writer.native" + , testCompare + "definition lists" + "docx/definition_list.native" + , testCompare + "custom defined lists in styles" + "docx/german_styled_lists.native" + , testCompare + "footnotes and endnotes" + "docx/notes.native" + , testCompare + "blockquotes (parsing indent as blockquote)" + "docx/block_quotes_parse_indent.native" + , testCompare + "hanging indents" + "docx/hanging_indent.native" + -- tables headers do not survive round-trip, should look into that + , testCompare + "tables" + "docx/tables.native" + , testCompare + "tables with lists in cells" + "docx/table_with_list_cell.native" + , testCompare + "code block" + "docx/codeblock.native" + , testCompare + "dropcap paragraphs" + "docx/drop_cap.native" + ] + , testGroup "metadata" + [ testCompareWithOpts (def,def{readerStandalone=True}) + "metadata fields" + "docx/metadata.native" + , testCompareWithOpts (def,def{readerStandalone=True}) + "stop recording metadata with normal text" + "docx/metadata_after_normal.native" + ] + + ] diff --git a/tests/Tests/Writers/Markdown.hs b/tests/Tests/Writers/Markdown.hs index c2a8f5903..dce40ddcb 100644 --- a/tests/Tests/Writers/Markdown.hs +++ b/tests/Tests/Writers/Markdown.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Tests.Writers.Markdown (tests) where import Test.Framework @@ -35,4 +36,92 @@ tests = [ "indented code after list" =: bulletList [ plain "foo" <> bulletList [ plain "bar" ], plain "baz" ] =?> "- foo\n - bar\n- baz\n" - ] + ] ++ [shortcutLinkRefsTests] + +shortcutLinkRefsTests :: Test +shortcutLinkRefsTests = + let infix 4 =: + (=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> Test + (=:) = test (writeMarkdown (def {writerReferenceLinks = True}) . toPandoc) + in testGroup "Shortcut reference links" + [ "Simple link (shortcutable)" + =: (para (link "/url" "title" "foo")) + =?> "[foo]\n\n [foo]: /url \"title\"" + , "Followed by another link (unshortcutable)" + =: (para ((link "/url1" "title1" "first") + <> (link "/url2" "title2" "second"))) + =?> unlines [ "[first][][second]" + , "" + , " [first]: /url1 \"title1\"" + , " [second]: /url2 \"title2\"" + ] + , "Followed by space and another link (unshortcutable)" + =: (para ((link "/url1" "title1" "first") <> " " + <> (link "/url2" "title2" "second"))) + =?> unlines [ "[first][] [second]" + , "" + , " [first]: /url1 \"title1\"" + , " [second]: /url2 \"title2\"" + ] + , "Reference link is used multiple times (unshortcutable)" + =: (para ((link "/url1" "" "foo") <> (link "/url2" "" "foo") + <> (link "/url3" "" "foo"))) + =?> unlines [ "[foo][][foo][1][foo][2]" + , "" + , " [foo]: /url1" + , " [1]: /url2" + , " [2]: /url3" + ] + , "Reference link is used multiple times (unshortcutable)" + =: (para ((link "/url1" "" "foo") <> " " <> (link "/url2" "" "foo") + <> " " <> (link "/url3" "" "foo"))) + =?> unlines [ "[foo][] [foo][1] [foo][2]" + , "" + , " [foo]: /url1" + , " [1]: /url2" + , " [2]: /url3" + ] + , "Reference link is followed by text in brackets" + =: (para ((link "/url" "" "link") <> "[text in brackets]")) + =?> unlines [ "[link][][text in brackets]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by space and text in brackets" + =: (para ((link "/url" "" "link") <> " [text in brackets]")) + =?> unlines [ "[link][] [text in brackets]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by RawInline" + =: (para ((link "/url" "" "link") <> rawInline "markdown" "[rawText]")) + =?> unlines [ "[link][][rawText]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by space and RawInline" + =: (para ((link "/url" "" "link") <> space <> rawInline "markdown" "[rawText]")) + =?> unlines [ "[link][] [rawText]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by RawInline with space" + =: (para ((link "/url" "" "link") <> rawInline "markdown" " [rawText]")) + =?> unlines [ "[link][] [rawText]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by citation" + =: (para ((link "/url" "" "link") <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]"))) + =?> unlines [ "[link][][@author]" + , "" + , " [link]: /url" + ] + , "Reference link is followed by space and citation" + =: (para ((link "/url" "" "link") <> space <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]"))) + =?> unlines [ "[link][] [@author]" + , "" + , " [link]: /url" + ] + ] diff --git a/tests/docx/german_styled_lists.docx b/tests/docx/german_styled_lists.docx Binary files differnew file mode 100644 index 000000000..ce454e9cc --- /dev/null +++ b/tests/docx/german_styled_lists.docx diff --git a/tests/docx/german_styled_lists.native b/tests/docx/german_styled_lists.native new file mode 100644 index 000000000..4d5456dfc --- /dev/null +++ b/tests/docx/german_styled_lists.native @@ -0,0 +1,6 @@ +[BulletList + [[Para [Str "One",Space,Str "level",Space,Str "of",Space,Str "the",Space,Str "list."]] + ,[Para [Str "Second",Space,Str "level",Space,Str "of",Space,Str "the",Space,Str "list."] + ,BulletList + [[Para [Str "Next",Space,Str "level",Space,Str "of",Space,Str "the",Space,Str "list"]]]] + ,[Para [Str "Back",Space,Str "to",Space,Str "the",Space,Str "top",Space,Str "level."]]]] diff --git a/tests/docx/image_no_embed_writer.native b/tests/docx/image_no_embed_writer.native new file mode 100644 index 000000000..21802ebd1 --- /dev/null +++ b/tests/docx/image_no_embed_writer.native @@ -0,0 +1,2 @@ +[Para [Str "An",Space,Str "image:"] +,Para [Image [] ("media/rId25.jpg","")]] diff --git a/tests/docx/inline_formatting_writer.native b/tests/docx/inline_formatting_writer.native new file mode 100644 index 000000000..be346204e --- /dev/null +++ b/tests/docx/inline_formatting_writer.native @@ -0,0 +1,5 @@ +[Para [Str "Regular",Space,Str "text",Space,Emph [Str "italics"],Space,Strong [Str "bold",Space,Emph [Str "bold",Space,Str "italics"]],Str "."] +,Para [Str "This",Space,Str "is",Space,SmallCaps [Str "Small",Space,Str "Caps"],Str ",",Space,Str "and",Space,Str "this",Space,Str "is",Space,Strikeout [Str "strikethrough"],Str "."] +,Para [Str "Some",Space,Str "people",Space,Str "use",Space,Emph [Str "single",Space,Str "underlines",Space,Str "for",Space,Str "emphasis"],Str "."] +,Para [Str "Above",Space,Str "the",Space,Str "line",Space,Str "is",Space,Superscript [Str "superscript"],Space,Str "and",Space,Str "below",Space,Str "the",Space,Str "line",Space,Str "is",Space,Subscript [Str "subscript"],Str "."] +,Para [Str "A",Space,Str "line",LineBreak,Str "break."]] diff --git a/tests/docx/inline_images_writer.native b/tests/docx/inline_images_writer.native new file mode 100644 index 000000000..da2a2709b --- /dev/null +++ b/tests/docx/inline_images_writer.native @@ -0,0 +1,2 @@ +[Para [Str "This",Space,Str "picture",Space,Image [] ("media/rId26.jpg",""),Space,Str "is",Space,Str "an",Space,Str "identicon."] +,Para [Str "Here",Space,Str "is",Space,Link [Str "one",Space,Image [] ("media/rId27.jpg",""),Space,Str "that"] ("http://www.google.com",""),Space,Str "links."]] diff --git a/tests/docx/links_writer.native b/tests/docx/links_writer.native new file mode 100644 index 000000000..cc00e4326 --- /dev/null +++ b/tests/docx/links_writer.native @@ -0,0 +1,6 @@ +[Header 2 ("an-internal-link-and-an-external-link",[],[]) [Str "An",Space,Str "internal",Space,Str "link",Space,Str "and",Space,Str "an",Space,Str "external",Space,Str "link"] +,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://google.com",""),Space,Str "to",Space,Str "a",Space,Str "popular",Space,Str "website."] +,Para [Str "An",Space,Link [Str "external",Space,Str "link"] ("http://johnmacfarlane.net/pandoc/README.html#synopsis",""),Space,Str "to",Space,Str "a",Space,Str "website",Space,Str "with",Space,Str "an",Space,Str "anchor."] +,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#a-section-for-testing-link-targets",""),Space,Str "to",Space,Str "a",Space,Str "section",Space,Str "header."] +,Para [Str "An",Space,Link [Str "internal",Space,Str "link"] ("#my_bookmark",""),Space,Str "to",Space,Str "a",Space,Str "bookmark."] +,Header 2 ("a-section-for-testing-link-targets",[],[]) [Str "A",Space,Str "section",Space,Str "for",Space,Str "testing",Space,Str "link",Space,Str "targets"]] diff --git a/tests/docx/lists_writer.native b/tests/docx/lists_writer.native new file mode 100644 index 000000000..4c44ea603 --- /dev/null +++ b/tests/docx/lists_writer.native @@ -0,0 +1,17 @@ +[Header 2 ("some-nested-lists",[],[]) [Str "Some",Space,Str "nested",Space,Str "lists"] +,OrderedList (1,Decimal,Period) + [[Para [Str "one"]] + ,[Para [Str "two"] + ,OrderedList (1,LowerAlpha,DefaultDelim) + [[Para [Str "a"]] + ,[Para [Str "b"]]]]] +,BulletList + [[Para [Str "one"]] + ,[Para [Str "two"] + ,BulletList + [[Para [Str "three"] + ,BulletList + [[Para [Str "four"]]]]]] + ,[Para [Str "Same",Space,Str "list"]]] +,BulletList + [[Para [Str "Different",Space,Str "list",Space,Str "adjacent",Space,Str "to",Space,Str "the",Space,Str "one",Space,Str "above."]]]] diff --git a/tests/docx/verbatim_subsuper.docx b/tests/docx/verbatim_subsuper.docx Binary files differnew file mode 100644 index 000000000..2cb0dc16d --- /dev/null +++ b/tests/docx/verbatim_subsuper.docx diff --git a/tests/docx/verbatim_subsuper.native b/tests/docx/verbatim_subsuper.native new file mode 100644 index 000000000..2e11e646a --- /dev/null +++ b/tests/docx/verbatim_subsuper.native @@ -0,0 +1,8 @@ +[Para [Str "m",Superscript [Str "2"]] +,Para [Str "m",Superscript [Code ("",[],[]) "2"]] +,Para [Code ("",[],[]) "m",Superscript [Str "2"]] +,Para [Code ("",[],[]) "m",Superscript [Code ("",[],[]) "2"]] +,Para [Str "m",Subscript [Str "2"]] +,Para [Str "m",Subscript [Code ("",[],[]) "2"]] +,Para [Code ("",[],[]) "m",Subscript [Str "2"]] +,Para [Code ("",[],[]) "m",Subscript [Code ("",[],[]) "2"]]] diff --git a/tests/lhs-test.html b/tests/lhs-test.html index bde505a1e..cc53a3845 100644 --- a/tests/lhs-test.html +++ b/tests/lhs-test.html @@ -1,3 +1,4 @@ +B <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> @@ -7,6 +8,7 @@ <title></title> <style type="text/css">code{white-space: pre;}</style> <style type="text/css"> +div.sourceCode { x-overflow: auto; } table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { margin: 0; padding: 0; vertical-align: baseline; border: none; } table.sourceCode { width: 100%; line-height: 100%; } @@ -29,9 +31,9 @@ code > span.er { color: #ff0000; font-weight: bold; } <body> <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p> -<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d +<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d unsplit <span class="fu">=</span> arr <span class="fu">.</span> uncurry - <span class="co">-- arr (\op (x,y) -> x `op` y)</span></code></pre> + <span class="co">-- arr (\op (x,y) -> x `op` y)</span></code></pre></div> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p> <pre><code>f *** g = first f >>> second g</code></pre> <p>Block quote:</p> diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs index fcdcad303..8fbb16e10 100644 --- a/tests/lhs-test.html+lhs +++ b/tests/lhs-test.html+lhs @@ -7,6 +7,7 @@ <title></title> <style type="text/css">code{white-space: pre;}</style> <style type="text/css"> +div.sourceCode { x-overflow: auto; } table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { margin: 0; padding: 0; vertical-align: baseline; border: none; } table.sourceCode { width: 100%; line-height: 100%; } @@ -29,9 +30,9 @@ code > span.er { color: #ff0000; font-weight: bold; } <body> <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p> -<pre class="sourceCode literate literatehaskell"><code class="sourceCode literatehaskell"><span class="ot">> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d +<div class="sourceCode"><pre class="sourceCode literate literatehaskell"><code class="sourceCode literatehaskell"><span class="ot">> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d <span class="ot">></span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> uncurry -<span class="ot">></span> <span class="co">-- arr (\op (x,y) -> x `op` y)</span></code></pre> +<span class="ot">></span> <span class="co">-- arr (\op (x,y) -> x `op` y)</span></code></pre></div> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p> <pre><code>f *** g = first f >>> second g</code></pre> <p>Block quote:</p> diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native index 3f4bb5740..96204898e 100644 --- a/tests/markdown-reader-more.native +++ b/tests/markdown-reader-more.native @@ -156,4 +156,7 @@ ,Para [Str "MapReduce",Space,Str "is",Space,Str "a",Space,Str "paradigm",Space,Str "popularized",Space,Str "by",Space,Link [Str "Google"] ("http://google.com",""),Space,Cite [Citation {citationId = "mapreduce", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [Str "[@mapreduce]"],Space,Str "as",Space,Str "its",Space,Str "most",Space,Str "vocal",Space,Str "proponent."] ,Header 2 ("empty-reference-links",[],[]) [Str "Empty",Space,Str "reference",Space,Str "links"] ,Para [Str "bar"] -,Para [Link [Str "foo2"] ("","")]] +,Para [Link [Str "foo2"] ("","")] +,Header 2 ("wrapping-shouldnt-introduce-new-list-items",[],[]) [Str "Wrapping",Space,Str "shouldn\8217t",Space,Str "introduce",Space,Str "new",Space,Str "list",Space,Str "items"] +,BulletList + [[Plain [Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "blah",Space,Str "2015."]]]] diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt index d7439f6cb..99e9ec7e8 100644 --- a/tests/markdown-reader-more.txt +++ b/tests/markdown-reader-more.txt @@ -276,3 +276,8 @@ most vocal proponent. bar [foo2] + +## Wrapping shouldn't introduce new list items + +- blah blah blah blah blah blah blah blah blah blah blah blah blah blah 2015. + diff --git a/tests/media/rId25.jpg b/tests/media/rId25.jpg new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/media/rId25.jpg diff --git a/tests/media/rId26.jpg b/tests/media/rId26.jpg new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/media/rId26.jpg diff --git a/tests/media/rId27.jpg b/tests/media/rId27.jpg new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/media/rId27.jpg diff --git a/tests/pipe-tables.txt b/tests/pipe-tables.txt index ee8d54d9f..83debd595 100644 --- a/tests/pipe-tables.txt +++ b/tests/pipe-tables.txt @@ -1,7 +1,7 @@ Simplest table without caption: | Default1 | Default2 | Default3 | -|----------|----------|----------| + |----------|----------|----------| |12|12|12| |123|123|123| |1|1|1| @@ -27,6 +27,7 @@ Simple table without caption: Headerless table without caption: +| | | | |------:|:-----|:------:| |12|12|12| |123|123|123| @@ -48,5 +49,6 @@ One-column: Header-less one-column: +| | |:-:| |hi| diff --git a/tests/test-pandoc.hs b/tests/test-pandoc.hs index b7b1c30b1..dd92a271a 100644 --- a/tests/test-pandoc.hs +++ b/tests/test-pandoc.hs @@ -20,6 +20,7 @@ import qualified Tests.Writers.Native import qualified Tests.Writers.Markdown import qualified Tests.Writers.Plain import qualified Tests.Writers.AsciiDoc +import qualified Tests.Writers.Docx import qualified Tests.Shared import qualified Tests.Walk import Text.Pandoc.Shared (inDirectory) @@ -38,6 +39,7 @@ tests = [ testGroup "Old" Tests.Old.tests , testGroup "Markdown" Tests.Writers.Markdown.tests , testGroup "Plain" Tests.Writers.Plain.tests , testGroup "AsciiDoc" Tests.Writers.AsciiDoc.tests + , testGroup "Docx" Tests.Writers.Docx.tests ] , testGroup "Readers" [ testGroup "LaTeX" Tests.Readers.LaTeX.tests diff --git a/tests/writer.asciidoc b/tests/writer.asciidoc index 4b063fe68..aebc529f0 100644 --- a/tests/writer.asciidoc +++ b/tests/writer.asciidoc @@ -375,15 +375,19 @@ HTML Blocks Simple block on one line: foo + And nested without indentation: foo bar + Interpreted markdown in a table: This is _emphasized_ + And this is *strong* + Here’s a simple block: foo @@ -405,6 +409,7 @@ As should this: Now, nested: foo + This should just be an HTML comment: Multiline: @@ -485,7 +490,7 @@ Ellipses…and…and…. LaTeX ----- -* +* * latexmath:[$2+2=4$] * latexmath:[$x \in y$] * latexmath:[$\alpha \wedge \omega$] diff --git a/tests/writer.markdown b/tests/writer.markdown index ad97b15ef..7276b31c7 100644 --- a/tests/writer.markdown +++ b/tests/writer.markdown @@ -549,8 +549,8 @@ LaTeX These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. -- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is - emphasized.) +- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” + is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. diff --git a/tests/writer.opml b/tests/writer.opml index 840c3c6e1..8f79e842c 100644 --- a/tests/writer.opml +++ b/tests/writer.opml @@ -33,7 +33,7 @@ <outline text="Lists"> <outline text="Unordered" _note="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 "> </outline> - <outline text="Ordered" _note="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 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3. "> + <outline text="Ordered" _note="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 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3. "> </outline> <outline text="Nested" _note="- 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 "> </outline> @@ -50,7 +50,7 @@ </outline> <outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.” ‘A’, ‘B’, and ‘C’ are letters. ‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ ‘He said, “I want to go.”’ Were you alive in the 70’s? Here is some quoted ‘`code`’ and a “[quoted link](http://example.com/?foo=1&bar=2)”. Some dashes: one—two — three—four — five. Dashes between numbers: 5–7, 255–66, 1987–1999. Ellipses…and…and…. ------------------------------------------------------------------------"> </outline> -<outline text="LaTeX" _note="- \cite[22-23]{smith.1899} - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree - Here’s some display math: $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here’s one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. - \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. Here’s a LaTeX table: \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} ------------------------------------------------------------------------"> +<outline text="LaTeX" _note="- \cite[22-23]{smith.1899} - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree - Here’s some display math: $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here’s one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. - \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. Here’s a LaTeX table: \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} ------------------------------------------------------------------------"> </outline> <outline text="Special Characters" _note="Here is some unicode: - I hat: Î - o umlaut: ö - section: § - set membership: ∈ - copyright: © AT&T has an ampersand in their name. AT&T is another way to write it. This & that. 4 \< 5. 6 \> 5. Backslash: \\ Backtick: \` Asterisk: \* Underscore: \_ Left brace: { Right brace: } Left bracket: [ Right bracket: ] Left paren: ( Right paren: ) Greater-than: \> Hash: \# Period: . Bang: ! Plus: + Minus: - ------------------------------------------------------------------------"> </outline> diff --git a/tests/writer.plain b/tests/writer.plain index fab0489ac..0332a747b 100644 --- a/tests/writer.plain +++ b/tests/writer.plain @@ -499,8 +499,8 @@ LATEX These shouldn’t be math: - To get the famous equation, write $e = mc^2$. -- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot” is - emphasized.) +- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot” + is emphasized.) - Shoes ($20) and socks ($5). - Escaped $: $73 _this should be emphasized_ 23$. diff --git a/trypandoc/index.html b/trypandoc/index.html index 2c9c55ef2..6d781971e 100644 --- a/trypandoc/index.html +++ b/trypandoc/index.html @@ -73,7 +73,7 @@ $(document).ready(function() { <option value="markdown" selected>Markdown</option> <option value="markdown_strict">Markdown/strict</option> <option value="markdown_phpextra">PHP Markdown Extra</option> - <option value="markdown_github">Github Markdown</option> + <option value="markdown_github">GitHub Markdown</option> <option value="markdown_mmd">MultiMarkdown</option> <option value="rst">reStructuredText</option> <option value="textile">Textile</option> @@ -99,7 +99,7 @@ $(document).ready(function() { <option value="markdown">Markdown</option> <option value="markdown_strict">Markdown/strict</option> <option value="markdown_phpextra">PHP Markdown Extra</option> - <option value="markdown_github">Github Markdown</option> + <option value="markdown_github">GitHub Markdown</option> <option value="markdown_mmd">MultiMarkdown</option> <option value="rst">reStructuredText</option> <option value="asciidoc">AsciiDoc</option> |