Comparing changes
Open a pull request
jgm |
Fixed debpkg target.
|
90a2df3
|
||
jgm |
Textile reader: don't allow block HTML tags in inline contexts.
The reader previously did allow this, following redcloth, which happily parses Html blocks can be <div>inlined</div> as well. as <p>Html blocks can be <div>inlined</div> as well.</p> This is invalid HTML, and this kind of thing can lead to parsing problems (stack overflows) as well. So this commit undoes this behavior. The above sample now produces; <p>Html blocks can be</p> <div> <p>inlined</p> </div> <p>as well.</p> |
97c9691
|
jgm |
Updated binary package stack.yamls to ensure pandoc-citeproc...
is built with embed_data_files. This fixes a problem with the original 1.16 binary packages. |
1cee481
|
||
jgm |
windows/stack.yaml - use local pandoc-citeproc.
I'm not sure why this is needed, but it is. Otherwise the build fails. |
a6d20b3
|
jgm |
Fixed v1.16 reversion with --latex-engine.
In 1.16 --latex-engine raises an error if a full path is given. This commit fixes this reversion. Closes #2618. |
4990350
|
||
jgm |
Updated .travis.yml, added ghc 7.10.3 to tested-with.
|
694eb87
|
||
jgm |
Added 7.10.3 to make_travis_yml.hs known versions.
|
51a415e
|
||
jgm |
Regenerated .travis.yml to include 7.10.3.
|
e792920
|
||
jgm |
Go back to testing with ghc 7.10.2.
Avoids the dreaded "the version of cabal being used has changed" error. https://www.reddit.com/r/haskell/comments/3f4bgr/the_version_of_cabal_being_used_has_changed/ |
a81b093
|
||
jgm |
RST, Markdown writers: Fixed rendering of grid tables with blank rows.
Closes #2615. |
a796538
|
conklech |
Add .stack-work to gitignore
The .stack-work directory is analogous to a cabal sandbox; it comprises temporary build artifacts. |
45f5fc9
|
||
jgm |
Merge pull request #2622 from conklech/ignore-stack
Add .stack-work to gitignore |
2aee5a3
|
||
jgm |
stack.yaml: bump pandoc-types version to 1.16.0.1.
|
73d1175
|
||
jgm |
Make file globbing work on windows.
Windows cmd doesn't expand wildcards; the application has to do this. So on windows we use 'glob' to expand. |
363ecfe
|
||
jgm |
Revert "Make file globbing work on windows."
This reverts commit 363ecfe. |
197f301
|
||
jgm |
stack.yaml, stack.full.yaml - use lts-4.0 resolver.
|
f6fe430
|
||
jgm |
Improved default template lookup for custom lua scripts.
Previously, if you tried to do `pandoc -s -t /path/to/lua/script.lua`, pandoc would look for the template in `~/.pandoc/templates/default./path/to/lua/script.lua`. With this change it will look in the more reasonable `~/.pandoc/templates/default.script.lua`. This makes it possible to store default templates for custom writers. Closes #2625. |
a5efd2a
|
matt-e |
Update stack.full.yaml
|
dbff1d1
|
||
matt-e |
Update stack.yaml
Another typo? |
1730e63
|
||
jgm |
Merge pull request #2632 from matt-e/fix-stack-build
Fix typo in stack build files |
52d95dd
|
jgm |
Entity handling fixes:
- Text.Pandoc.XML.fromEntities: handle entities without a semicolon. Always lookup character references with the trailing ';', even if it wasn't present. And never add it when looking up numerical entities. (This is what tagsoup seems to require.) - Text.Pandoc.Parsing.characterReference: Always lookup character references with the trailing ';', and leave off the ';' when looking up numerical entities. This fixes a regression for e.g. `⟨`. |
12a5bd3
|
||
jgm |
Work around tagsoup bug - not allowing uppercase x in hex entities.
Issue submitted at tagsoup. |
5884ff6
|
||
jgm |
Added some entity tests in Markdown reader tests.
|
d5f6782
|
||
jgm |
Fixed shadowing warning.
|
729911a
|
||
jgm |
LaTeX writer: restore old treatment of Span.
A Span is rendered with surrounding {braces}. This was a regression in 1.16. Closes #2624. |
1506e62
|
||
jgm |
Version bump to 1.16.0.1
|
687c39e
|
||
jgm |
Updated changelog.
|
1fbbc2b
|
||
jgm |
Updated stack.yaml.
|
5eb8087
|
||
jgm |
Fixed typo in deb/stack.yaml.
|
a412104
|
mb21 |
LaTeX writer: figure label
|
1fde920
|
jgm |
osx package fixes: correct version, allow installation to any drive.
|
6936a6a
|
||
jgm |
README - changed date.
|
37ac274
|
||
jgm |
Regenerated man page.
|
293f31c
|
||
jgm |
Release checklist: added note on regenerating Hackage docs.
|
4db912f
|
||
jgm |
Fixed regression in latex smart quote parsing.
Closes #2645. In cases where a match was not found for a quote, everything from the open quote to the end of the paragraph was being dropped. |
8611ac5
|
||
jgm |
Depend on deepseq rather than deepseq-generics.
See fpco/stackage#1096. |
f34382e
|
||
tarleb |
Prefix even empty figure names with "fig:"
The convention used by pandoc for figures is to mark them by prefixing the name with "fig:". The org reader failed to do this if a figure had no name. The test for this was broken as well. This fixes #2643. |
fabbd1a
|
jgm |
Version to 1.16.0.2, updated changelog.
|
3004306
|
||
jgm |
Updated README date.
|
ee09ee1
|
||
jgm |
Updated man page.
|
f8776ed
|
jgm |
Org writer - pass through RawInline with format "org".
|
f45a8e1
|
||
jgm |
make_osx_package.sh: Use env variable for developer id certs.
|
20c55ab
|
||
jgm |
HTML writer: harmless code simplification.
Since the 'math' is only put into the template if stMath is set anyway, there's no need for this conditional. |
f2c0974
|
csforste |
Add TEI Writer.
|
25a9ca6
|
||
jgm |
Added some entity tests in Markdown reader tests.
Change types of divs. From Docbook "sect#" and "simplesect" to "level#" and "section." Add tests. Add mention of TEI to README. Small changes to TEI writer. |
4d74a96
|
Henrik Tramberend |
LaTeX writer: Allow more flexible table alignment
|
7a18879
|
||
jgm |
Merge pull request #2665 from monofon/fix/table-alignment
LaTeX writer: Allow more flexible table alignment |
3875df7
|
||
jgm |
Adjusted longtable in tests.
New default is not to include `[c]` option. |
7ea4d17
|
jgm |
Changed type of Shared.uniqueIdent argument from [String] to Set String.
This avoids performance problems in documents with many identically named headers. Closes #2671. |
20170c3
|
||
jgm |
Bump version to 1.17.
API change in type of Text.Pandoc.Shared.uniqueIdent. |
f35fa88
|
jgm |
stack.yaml - use cmark 0.5.1.
|
d015284
|
jgm |
Make language extensions trigger highlighting.
For example, `py` will now work as well as `python`. Closes jgm/highlighting-kate#83. |
11c5831
|
jgm |
Textile reader: Support `>`, `<`, `=`, `<>` text alignment attributes.
Closes #2674. |
a1021bd
|
pra85 |
Update license year range to 2016
|
fdc9f0e
|
||
jgm |
Merge pull request #2681 from pra85/patch-1
Update license year range to 2016 |
373aaa8
|
jgm |
Properly handle LaTeX "math" environment as inline math.
See #2171. |
76983c3
|
||
jgm |
HTML reader: handle multiple meta tags with same name.
Put them in a list in the metadata so they are all preserved, rather than (as before) throwing out all but one.. |
a02c26d
|
jgm |
LaTeX reader: `inlineCommand` now gobbles an empty `{}` after any com…
…mand. This gives better results when people write e.g. `\TeX{}` in Markdown. \TeX{} and \LaTeX{} now works as expected with `pandoc -f markdown -t latex`. Closes #2687. |
1874558
|
||
tarleb |
Org reader: Refactor link-target processing
Cleanup of the code for link target handling. Most notably, the canonicalization of a link is handled by a separate function. This fixes #2684. |
92e6ae4
|
jkr |
Docx reader: Add a "Link" modifier to Reducible
We want to make sure that links have their spaces removed, and are appropriately smushed together. This closes #2689 |
2ee7752
|
||
jkr |
Docx reader: Add tests for adjacent hyperlinks.
|
7a10507
|
jgm |
HTML writer: don't include alignment attribute for default table colu…
…mns. Previously these were given "left" alignment. Better to leave off alignment attributes altogether. Closes #2694. |
93a05df
|
jgm |
Markdown reader: Fixed bug with smart quotes around tex math.
Previously smart quotes were incorrect in the following: '$\neg(x \in x)$'. (because of the following period). This commit fixes the problem, which was introduced by commit 4229cf2. |
6cb4991
|
MathieuDuponchelle |
CONTRIBUTING.md : update test enabling documentation
On my end, in a clean sandbox, I had to run this before I could run the tests, I'm a cabal / haskell noob so that might not be the best way to do so but :) |
a326600
|
jgm |
Custom writer: Pass attributes parameter to CaptionedImage.
Closes #2697. |
a692bd2
|
||
jgm |
Merge pull request #2699 from MathieuDuponchelle/patch-1
CONTRIBUTING.md : update test enabling documentation |
7358b47
|
||
jgm |
Added info on Stack to CONTRIBUTING.md.
|
c0515e0
|
rski |
Fix stack link in INSTALL
Stack installation instructions have moved to docs.haskellstack.org |
c428231
|
||
jgm |
Merge pull request #2703 from rski/stack_link_fix
Fix stack link in INSTALL |
7034366
|
jgm |
Allow aeson 0.11.
|
e552a14
|
||
jgm |
Updated to lts-5.2 resolver, aeson 0.11 in stack.yaml.
|
522f8f3
|
||
jgm |
Changed aeson version in stack.yaml to 0.11.0.0.
|
1aaf4b8
|
jgm |
HTML reader: properly handle an empty cell in a simple table.
Closes #2718. |
b8dadc6
|
jgm |
Try new travis stack+cabal script.
|
1a87794
|
||
jgm |
Fixed stack.yaml.
|
134a5e5
|
||
jgm |
Travis fixes.
cabal sdist has problems on cabal 1.16, because of our Text.Pandoc.Data module. So we don't test it. |
dda7c27
|
||
jgm |
Travis: don't build with lts-3.
It doesn't have recent enough dependencies. |
9e3f739
|
||
jgm |
Don't build with lts-2 or lts-3.
|
44bcc88
|
adunning |
Remove stray line from stack.full.yaml
The line causes an error with stack 1.0.2: ``` Could not parse '/pandoc-build/pandoc/stack.full.yaml': AesonException "Error in $.extra-deps: failed to parse field 'extra-deps': failed to parse field extra-deps: expected [a], encountered Null" See http://docs.haskellstack.org/en/stable/yaml_configuration.html. ``` |
4dfe373
|
jgm |
Merge pull request #2725 from adunning/patch-1
Remove stray line from stack.full.yaml |
5848416
|
||
jkr |
LaTeX writer: treat memoir template with `article` opt as article
We currently treat all memoir templates as books. This means that pandoc will infer the `--chapters` argument, even if the `article` iption is set for memoir. This commit makes pandoc treats the document as an article if there is an article option (i.e., `\documentclass[12pt,article]{memoir}`). Note that this refactors out the parsec parsers for document class and options, to make it a little clearer what's going on. |
4112b32
|
||
jkr |
LaTeX writer: clean up options parser.
Make sure that we require the closing bracket. |
4438ff1
|
pra85 |
Fix typos in Readme
Remove extra `be` `overriden` → `overridden` |
8a114e9
|
||
jgm |
Merge pull request #2732 from pra85/patch-2
Fix typos in Readme |
d45fcf9
|
||
jgm |
HTML reader: rewrote htmlInBalanced.
This version avoids an exponential performance problem with `<script>` tags, and it should be faster in general. Closes #2730. |
1534052
|
jgm |
Merge pull request #2691 from tarleb/org-image-file-links
Org reader: Refactor link-target processing |
e369e60
|
||
jgm |
Merge pull request #2668 from monofon/fix/yaml-metadata-block-bottom-…
…line Markdown writer: Use hyphens for yaml metadata block bottom line |
649cfb6
|
||
jgm |
Merge pull request #2646 from tarleb/org-figure-with-no-name
Prefix even empty figure names with "fig:" |
29706ee
|
||
jgm |
Fixed some linter warnings.
|
9693de7
|
||
jkr |
Update README to reflect 4112b32.
We don't infer `--chapters` if `article` document option is set. For example: `\documentclass[article]{memoir}`. |
f1c59b2
|
||
jgm |
Markdown reader: use htmlInBalanced for rawVerbatimBlock.
This should give better performance. See #2730. |
04d1e40
|
jgm |
Raise tagsoup lower bound to 0.13.7.
This fixes entity-related problems. Closes #2734. |
0180807
|
jgm |
Make protocol-relative URIs work again.
Closes #2737. |
f2bd6fd
|
jgm |
Allow zip-archive 0.3.
|
38bd416
|
jkr |
Docx Reader: Get rid of Modifiable typeclass.
The docx reader used to use a Modifiable typeclass to combine both Blocks and Inlines. But all the work was in the inlines. So most of the generality was wasted, at the expense of making the code harder to understand. This gets rid of the generality, and adds functions for Blocks and Inlines. It should be a bit easier to work with going forward. |
a7a0b45
|
||
mb21 |
Add relocatable stack build
|
752be50
|
||
jgm |
Merge pull request #2739 from mb21/patch-2
Add relocatable stack build |
ea70495
|
jgm |
LaTeX reader: handle interior `$` characters in math.
e.g. `$$\hbox{$i$}$$`. Partially addresses #2743. |
7c6a3c0
|
ickc |
Update pandoc.1
|
b411e0f
|
||
ickc |
Update README
|
846fa87
|
||
jgm |
Merge pull request #2760 from ickc/master
Very Minor update on the documentation |
0510396
|
||
jgm |
Stack-based appveyor setup.
|
928a050
|
jkr |
Docx reader: update feature checklist.
The feature checklist in the source code was out of date. Update. |
0b9c54d
|
||
jgm |
DokuWiki writer: use $$ for display math.
|
6bfaa5a
|
jgm |
Markdown reader: don't cross line boundary parsing pipe table row.
Previously an emph element could be parsed across the newline at the end of the pipe table row. I thought this would help with #2765, but it doesn't. |
4ed6483
|
||
jgm |
Markdown reader: allow `+` separators in pipe table cells.
We already allowed them in the header, but not in the body rows, for some reason. This gives compatibility with org-mode tables. |
6e950a8
|
||
jgm |
Markdown reader: Clean up pipe table parsing.
|
54a6861
|
||
jgm |
Markdown reader: Improved pipe table parsing.
Fixes #2765. Added test case. |
2b55b76
|
mb21 |
Docx Writer: handle image alt text
closes #2754 |
139fa54
|
||
jgm |
Merge pull request #2771 from mb21/docx-alt-text
Docx Writer: handle image alt text |
06a57b2
|
jgm |
Fixed behavior of base tag.
+ If the base path does not end with slash, the last component will be replaced. E.g. base = `http://example.com/foo` combines with `bar.html` to give `http://example.com/bar.html`. + If the href begins with a slash, the whole path of the base is replaced. E.g. base = `http://example.com/foo/` combines with `/bar.html` to give `http://example.com/bar.html`. Closes #2777. |
a485c42
|
jkr |
Docx Reader: Add state to the parser, for warnings
In order to be able to collect warnings during parsing, we add a state monad transformer to the D monad. At the moment, this only includes a list of warning strings (nothing currently triggers them, however). We use StateT instead of WriterT to correspond more closely with the warnings behavior in T.P.Parsing. |
102ba9e
|
||
jkr |
Add readDocxWithWarnings
The regular readDocx just becomes a special case. |
ee03e95
|
||
jkr |
Add a general ByteStringReader with warnings.
Have docx reader use it. |
68fd333
|
jkr |
Introduce file-scope parsing (parse-before-combine)
Traditionally pandoc operates on multiple files by first concetenating them (around extra line breaks) and then processing the joined file. So it only parses a multi-file document at the document scope. This has the benefit that footnotes and links can be in different files, but it also introduces a couple of difficulties: - it is difficult to join files with footnotes without some sort of preprocessing, which makes it difficult to write academic documents in small pieces. - it makes it impossible to process multiple binary input files, which can't be catted. - it makes it impossible to process files from different input formats. This commit introduces alternative method. Instead of catting the files first, it parses the files first, and then combines the parsed output. This makes it impossible to have links across multiple files, and auto-identified headers won't work correctly if headers in multiple files have the same name. On the other hand, footnotes across multiple files will work correctly and will allow more freedom for input formats. Since ByteStringReaders can currently only read one binary file, and will ignore subsequent files, we also changes the behavior to automatically parse before combining if using the ByteStringReader. If we use one file, it will work as normal. If there is more than one file it will combine them after parsing (assuming that the format is the same). Note that this is intended to be an optional method, defaulting to off. Turn it on with `--file-scope`. |
5c055b4
|
||
jkr |
README: Add description of `--file-scope` option.
|
c7c4ee4
|
||
jkr |
pandoc.hs: Also use filescope for json files.
JSON files have metadata and list structure, so they can't be simply catted, but they're useful as intermediate build files in large projects. |
09b4f29
|
jkr |
Docx reader: Don't make numbered heads into lists.
Word uses list numbering styles to number its headings. We only call something a numbered list if it does not also heave a heading style. |
855c8b4
|
||
jkr |
Docx reader: Add test for enumerated headers.
We don't want them to turn into a list. |
7f4a404
|
jkr |
Docx reader: Handle alternate content
Some word functions -- especially graphics -- give various choices for content so there can be backwards compatibility. This follows the largely undocumented feature by working through the choices until we find one that works. Note that we had to split out the processing of child elems of runs into a separate function so we can recurse properly. Any processing of an element *within* a run (other than a plain run) should go into `childElemToRun`. |
28c7617
|
||
jgm |
README: document that --toc works with docx.
Closes #2787. |
8d1c018
|
||
jgm |
LaTeX writer: Avoid double toprule in headerless table with caption.
Closes #2742. |
e821b05
|
||
jgm |
ConTeXt writer: fix whitespace at line beginning in line blocks.
|
976e7e2
|
jkr |
Fix stdin handling for file-scope
Regardless of input type, we should use default handling if we are dealing with stdin. In other words, there should be no file-scope if there are no files. This was an issue with pandoc json, which could be piped on stdin, but which was read by default with `--file-scope`. |
a8a2d4f
|
||
jgm |
Improved documentation of templates.
Note that there's no docx template. Closes #2797. |
2649a0d
|
||
jgm |
Version to 1.17.0.1.
|
edcb8b6
|
||
jgm |
Updated changelog.
|
650c12d
|
||
jgm |
Updated man page.
|
db20790
|
- +1 −0 .gitignore
- +111 −22 .travis.yml
- +25 −4 CONTRIBUTING.md
- +1 −1 COPYRIGHT
- +5 −1 INSTALL
- +1 −1 Makefile
- +41 −22 README
- +3 −0 RELEASE-CHECKLIST
- +14 −33 appveyor.yml
- +217 −0 changelog
- +1 −1 data/sample.lua
- +1 −1 data/templates
- +3 −2 deb/Makefile
- +3 −7 { → deb}/make_deb.sh
- +5 −4 deb/stack.yaml
- +6 −2 make_osx_package.sh
- +1 −1 make_travis_yml.hs
- +47 −23 man/pandoc.1
- +3 −3 osx/{distribution.xml → distribution.xml.in}
- +5 −4 osx/stack.yaml
- +12 −9 pandoc.cabal
- +45 −23 pandoc.hs
- +12 −1 src/Text/Pandoc.hs
- +2 −1 src/Text/Pandoc/Highlighting.hs
- +2 −1 src/Text/Pandoc/Options.hs
- +2 −2 src/Text/Pandoc/PDF.hs
- +11 −7 src/Text/Pandoc/Parsing.hs
- +37 −29 src/Text/Pandoc/Readers/Docx.hs
- +154 −0 src/Text/Pandoc/Readers/Docx/Combine.hs
- +64 −26 src/Text/Pandoc/Readers/Docx/Parse.hs
- +0 −181 src/Text/Pandoc/Readers/Docx/Reducible.hs
- +1 −1 src/Text/Pandoc/Readers/EPUB.hs
- +62 −34 src/Text/Pandoc/Readers/HTML.hs
- +20 −9 src/Text/Pandoc/Readers/LaTeX.hs
- +34 −27 src/Text/Pandoc/Readers/Markdown.hs
- +3 −2 src/Text/Pandoc/Readers/MediaWiki.hs
- +2 −1 src/Text/Pandoc/Readers/Odt/ContentReader.hs
- +39 −36 src/Text/Pandoc/Readers/Org.hs
- +21 −4 src/Text/Pandoc/Readers/Textile.hs
- +7 −5 src/Text/Pandoc/Shared.hs
- +11 −1 src/Text/Pandoc/Writers/ConTeXt.hs
- +2 −2 src/Text/Pandoc/Writers/Custom.hs
- +6 −5 src/Text/Pandoc/Writers/Docx.hs
- +4 −1 src/Text/Pandoc/Writers/DokuWiki.hs
- +3 −2 src/Text/Pandoc/Writers/EPUB.hs
- +37 −36 src/Text/Pandoc/Writers/HTML.hs
- +72 −50 src/Text/Pandoc/Writers/LaTeX.hs
- +6 −5 src/Text/Pandoc/Writers/Markdown.hs
- +7 −2 src/Text/Pandoc/Writers/Org.hs
- +1 −1 src/Text/Pandoc/Writers/RST.hs
- +320 −0 src/Text/Pandoc/Writers/TEI.hs
- +4 −3 src/Text/Pandoc/Writers/Texinfo.hs
- +7 −2 src/Text/Pandoc/XML.hs
- +4 −3 stack.full.yaml
- +1 −1 stack.hsb2hs.yaml
- +6 −5 stack.yaml
- +1 −1 tests/Tests/Old.hs
- +9 −1 tests/Tests/Readers/Docx.hs
- +4 −1 tests/Tests/Readers/HTML.hs
- +9 −0 tests/Tests/Readers/Markdown.hs
- +18 −4 tests/Tests/Readers/Org.hs
- +43 −0 tests/Tests/Writers/TEI.hs
- BIN tests/docx/adjacent_links.docx
- +1 −0 tests/docx/adjacent_links.native
- BIN tests/docx/enumerated_headings.docx
- +4 −0 tests/docx/enumerated_headings.native
- +15 −1 tests/pipe-tables.native
- +8 −0 tests/pipe-tables.txt
- +14 −14 tests/tables.html
- +7 −7 tests/tables.latex
- +171 −0 tests/tables.tei
- +2 −0 tests/test-pandoc.hs
- +10 −6 tests/textile-reader.native
- +7 −4 tests/textile-reader.textile
- +1 −1 tests/writer.dokuwiki
- +1 −1 tests/writer.markdown
- +861 −0 tests/writer.tei
- +1 −1 tests/writers-lang-and-dir.latex
- +0 −2 windows/make-windows-installer.bat
- +5 −5 windows/stack.yaml
@@ -1,36 +1,125 @@ | ||
-language: haskell | ||
+# Copy these contents into the root directory of your Github project in a file | ||
+# named .travis.yml | ||
+# Use new container infrastructure to enable caching | ||
sudo: false | ||
+ | ||
+# Choose a lightweight base image; we provide our own build tools. | ||
+language: c | ||
+ | ||
+# Caching so the next build will be fast too. | ||
cache: | ||
directories: | ||
- - $HOME/.stack/ | ||
+ - $HOME/.ghc | ||
+ - $HOME/.cabal | ||
+ - $HOME/.stack | ||
+# The different configurations we want to test. We have BUILD=cabal which uses | ||
+# cabal-install, and BUILD=stack which uses Stack. More documentation on each | ||
+# of those below. | ||
+# | ||
+# We set the compiler values here to tell Travis to use a different | ||
+# cache file per set of arguments. | ||
+# | ||
+# If you need to have different apt packages for each combination in the | ||
+# matrix, you can use a line such as: | ||
+# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}} | ||
matrix: | ||
include: | ||
-# - env: GHCVER=7.4.2 GHCOPTS=-Werror | ||
-# compiler: ": #GHC 7.4.2" | ||
-# addons: {apt: {packages: [ghc-7.4.2], sources: [hvr-ghc]}} | ||
-# - env: GHCVER=7.6.3 GHCOPTS=-Werror | ||
-# compiler: ": #GHC 7.6.3" | ||
-# addons: {apt: {packages: [ghc-7.6.3], sources: [hvr-ghc]}} | ||
-# - env: GHCVER=7.8.4 GHCOPTS=-Werror | ||
-# compiler: ": #GHC 7.8.4" | ||
-# addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} | ||
- - env: GHCVER=7.10.2 GHCOPTS=-Werror | ||
- compiler: ": #GHC 7.10.2" | ||
- addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}} | ||
+ # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: | ||
+ # https://github.com/hvr/multi-ghc-travis | ||
+ - env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 | ||
+ compiler: ": #GHC 7.4.2" | ||
+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} | ||
+ - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 | ||
+ compiler: ": #GHC 7.6.3" | ||
+ addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} | ||
+ - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 | ||
+ compiler: ": #GHC 7.8.4" | ||
+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} | ||
+ - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 | ||
+ compiler: ": #GHC 7.10.3" | ||
+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} | ||
+ | ||
+ # Build with the newest GHC and cabal-install. This is an accepted failure, | ||
+ # see below. | ||
+ - env: BUILD=cabal GHCVER=head CABALVER=head | ||
+ compiler: ": #GHC HEAD" | ||
+ addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} | ||
+ | ||
+ # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS | ||
+ # variable, such as using --stack-yaml to point to a different file. | ||
+ - env: BUILD=stack ARGS="--resolver lts-5" | ||
+ compiler: ": #stack 7.10.3" | ||
+ addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} | ||
+ | ||
+ # Nightly builds are allowed to fail | ||
+ - env: BUILD=stack ARGS="--resolver nightly" | ||
+ compiler: ": #stack nightly" | ||
+ addons: {apt: {packages: [libgmp-dev]}} | ||
+ | ||
+ - env: BUILD=stack ARGS="--resolver lts-5" | ||
+ compiler: ": #stack 7.10.3 osx" | ||
+ os: osx | ||
+ | ||
+ - env: BUILD=stack ARGS="--resolver nightly" | ||
+ compiler: ": #stack nightly osx" | ||
+ os: osx | ||
+ | ||
+ allow_failures: | ||
+ - env: BUILD=cabal GHCVER=head CABALVER=head | ||
+ - env: BUILD=stack ARGS="--resolver nightly" | ||
before_install: | ||
+# Using compiler above sets CC to an invalid value, so unset it | ||
+- unset CC | ||
+ | ||
+# We want to always allow newer versions of packages when building on GHC HEAD | ||
+- CABALARGS="" | ||
+- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi | ||
+ | ||
+# Download and unpack the stack executable | ||
+- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH | ||
- mkdir -p ~/.local/bin | ||
-- export STACKVER=0.1.8.0 | ||
-- export PATH=~/.local/bin:/opt/ghc/$GHCVER/bin:$PATH | ||
-- travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACKVER/stack-$STACKVER-linux-x86_64.tar.gz | tar xvzf - | ||
-- cp stack-$STACKVER-linux-x86_64/stack ~/.local/bin/stack | ||
-- chmod a+x ~/.local/bin/stack | ||
+- | | ||
+ if [ `uname` = "Darwin" ] | ||
+ then | ||
+ curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin | ||
+ else | ||
+ curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' | ||
+ fi | ||
install: | ||
- - stack setup $GHCVER --system-ghc --no-terminal --skip-ghc-check | ||
- - stack test --only-snapshot --no-terminal --skip-ghc-check | ||
+- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" | ||
+- if [ -f configure.ac ]; then autoreconf -i; fi | ||
+- | | ||
+ case "$BUILD" in | ||
+ stack) | ||
+ stack --no-terminal --install-ghc $ARGS test --only-dependencies | ||
+ ;; | ||
+ cabal) | ||
+ cabal --version | ||
+ travis_retry cabal update | ||
+ cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS | ||
+ ;; | ||
+ esac | ||
script: | ||
- - stack test --no-terminal --skip-ghc-check | ||
+- | | ||
+ case "$BUILD" in | ||
+ stack) | ||
+ stack --no-terminal $ARGS test --haddock --no-haddock-deps | ||
+ ;; | ||
+ cabal) | ||
+ cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror" | ||
+ cabal build | ||
+ cabal check || [ "$CABALVER" == "1.16" ] | ||
+ cabal test | ||
+ cabal copy | ||
+ # cabal sdist fails on cabal 1.16: | ||
+ cabal sdist || [ "$CABALVER" == "1.16" ] | ||
+ SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \ | ||
+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ" || \ | ||
+ [ "$CABALVER" == "1.16" ]) | ||
+ ;; | ||
+ esac |
@@ -1,38 +1,19 @@ | ||
-install: | ||
-- cmd: 'git submodule update --init' | ||
-- ps: | | ||
- choco install haskellplatform -version 2014.2.0.0 -y | ||
- # Haskell Platfrom package doesn't update PATH for the current shell instance | ||
+cache: | ||
+- "c:\\sr" # stack root, short paths == fewer problems | ||
- $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\bin" | ||
- $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\lib\extralibs\bin" | ||
- $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\mingw\bin" | ||
- # choco install wixtoolset | ||
- cabal sandbox init | ||
- $env:Path += ";.\.cabal-sandbox\bin" | ||
- cabal update | ||
- cabal install --force hsb2hs | ||
+build: off | ||
-build_script: | ||
-- cmd: | | ||
- cabal install --force --enable-tests -fembed_data_files | ||
+before_test: | ||
+- curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386 | ||
+- 7z x stack.zip stack.exe | ||
-# after_build: | ||
-# - cmd: | | ||
-# cabal install -fembed_data_files pandoc-citeproc | ||
-# strip .\.cabal-sandbox\bin\pandoc.exe | ||
-# strip .\.cabal-sandbox\bin\pandoc-citeproc.exe | ||
-# .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.html -S README -o README.html | ||
-# .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.rtf COPYING -t rtf -S -o COPYING.rtf | ||
-# copy COPYRIGHT COPYRIGHT.txt | ||
-# for /f "tokens=2 delims= " %%a in ('.\.cabal-sandbox\bin\pandoc --version') do ( set "VERSION=%%a" && exit ) | ||
-# if "%VERSION%" == "" ( echo "Error: could not determine version number." && exit /b 1 ) | ||
-# cd windows | ||
-# echo Creating msi... | ||
-# candle -dVERSION=%VERSION% pandoc.wxs | ||
-# if %errorlevel% neq 0 exit /b %errorlevel% | ||
-# light -sw1076 -ext WixUIExtension -ext WixUtilExtension -out pandoc-%VERSION%-windows.msi pandoc.wixobj | ||
+clone_folder: "c:\\stack" | ||
+environment: | ||
+ global: | ||
+ STACK_ROOT: "c:\\sr" | ||
test_script: | ||
-- cmd: | | ||
- cabal test | ||
+- stack setup > nul | ||
+# The ugly echo "" hack is to avoid complaints about 0 being an invalid file | ||
+# descriptor | ||
+- echo "" | stack --no-terminal test |
@@ -1 +1 @@ | ||
-Subproject commit 8660958b2add3dba83f84d3f8845a029b672bbe7 | ||
+Subproject commit d39b2207f98e8a6c6f91b0498c183069a0aa7c97 |
@@ -0,0 +1,154 @@ | ||
+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, | ||
+ PatternGuards #-} | ||
+ | ||
+module Text.Pandoc.Readers.Docx.Combine ( smushInlines | ||
+ , smushBlocks | ||
+ ) | ||
+ where | ||
+ | ||
+import Text.Pandoc.Builder | ||
+import Data.List | ||
+import Data.Sequence (ViewR(..), ViewL(..), viewl, viewr, (><), (|>)) | ||
+import qualified Data.Sequence as Seq (null) | ||
+ | ||
+data Modifier a = Modifier (a -> a) | ||
+ | AttrModifier (Attr -> a -> a) Attr | ||
+ | NullModifier | ||
+ | ||
+spaceOutInlinesL :: Inlines -> (Inlines, Inlines) | ||
+spaceOutInlinesL ms = (l, stackInlines fs (m' <> r)) | ||
+ where (l, m, r) = spaceOutInlines ms | ||
+ (fs, m') = unstackInlines m | ||
+ | ||
+spaceOutInlinesR :: Inlines -> (Inlines, Inlines) | ||
+spaceOutInlinesR ms = (stackInlines fs (l <> m'), r) | ||
+ where (l, m, r) = spaceOutInlines ms | ||
+ (fs, m') = unstackInlines m | ||
+ | ||
+spaceOutInlines :: Inlines -> (Inlines, Inlines, Inlines) | ||
+spaceOutInlines ils = | ||
+ let (fs, ils') = unstackInlines ils | ||
+ contents = unMany ils' | ||
+ left = case viewl contents of | ||
+ (Space :< _) -> space | ||
+ _ -> mempty | ||
+ right = case viewr contents of | ||
+ (_ :> Space) -> space | ||
+ _ -> mempty in | ||
+ (left, (stackInlines fs $ trimInlines . Many $ contents), right) | ||
+ | ||
+stackInlines :: [Modifier Inlines] -> Inlines -> Inlines | ||
+stackInlines [] ms = ms | ||
+stackInlines (NullModifier : fs) ms = stackInlines fs ms | ||
+stackInlines ((Modifier f) : fs) ms = | ||
+ if isEmpty ms | ||
+ then stackInlines fs ms | ||
+ else f $ stackInlines fs ms | ||
+stackInlines ((AttrModifier f attr) : fs) ms = f attr $ stackInlines fs ms | ||
+ | ||
+unstackInlines :: Inlines -> ([Modifier Inlines], Inlines) | ||
+unstackInlines ms = case ilModifier ms of | ||
+ NullModifier -> ([], ms) | ||
+ _ -> (f : fs, ms') where | ||
+ f = ilModifier ms | ||
+ (fs, ms') = unstackInlines $ ilInnards ms | ||
+ | ||
+ilModifier :: Inlines -> Modifier Inlines | ||
+ilModifier ils = case viewl (unMany ils) of | ||
+ (x :< xs) | Seq.null xs -> case x of | ||
+ (Emph _) -> Modifier emph | ||
+ (Strong _) -> Modifier strong | ||
+ (SmallCaps _) -> Modifier smallcaps | ||
+ (Strikeout _) -> Modifier strikeout | ||
+ (Superscript _) -> Modifier superscript | ||
+ (Subscript _) -> Modifier subscript | ||
+ (Link attr _ tgt) -> Modifier $ linkWith attr (fst tgt) (snd tgt) | ||
+ (Span attr _) -> AttrModifier spanWith attr | ||
+ _ -> NullModifier | ||
+ _ -> NullModifier | ||
+ | ||
+ilInnards :: Inlines -> Inlines | ||
+ilInnards ils = case viewl (unMany ils) of | ||
+ (x :< xs) | Seq.null xs -> case x of | ||
+ (Emph lst) -> fromList lst | ||
+ (Strong lst) -> fromList lst | ||
+ (SmallCaps lst) -> fromList lst | ||
+ (Strikeout lst) -> fromList lst | ||
+ (Superscript lst) -> fromList lst | ||
+ (Subscript lst) -> fromList lst | ||
+ (Link _ lst _) -> fromList lst | ||
+ (Span _ lst) -> fromList lst | ||
+ _ -> ils | ||
+ _ -> ils | ||
+ | ||
+inlinesL :: Inlines -> (Inlines, Inlines) | ||
+inlinesL ils = case viewl $ unMany ils of | ||
+ (s :< sq) -> (singleton s, Many sq) | ||
+ _ -> (mempty, ils) | ||
+ | ||
+inlinesR :: Inlines -> (Inlines, Inlines) | ||
+inlinesR ils = case viewr $ unMany ils of | ||
+ (sq :> s) -> (Many sq, singleton s) | ||
+ _ -> (ils, mempty) | ||
+ | ||
+combineInlines :: Inlines -> Inlines -> Inlines | ||
+combineInlines x y = | ||
+ let (xs', x') = inlinesR x | ||
+ (y', ys') = inlinesL y | ||
+ in | ||
+ xs' <> (combineSingletonInlines x' y') <> ys' | ||
+ | ||
+combineSingletonInlines :: Inlines -> Inlines -> Inlines | ||
+combineSingletonInlines x y = | ||
+ let (xfs, xs) = unstackInlines x | ||
+ (yfs, ys) = unstackInlines y | ||
+ shared = xfs `intersect` yfs | ||
+ x_remaining = xfs \\ shared | ||
+ y_remaining = yfs \\ shared | ||
+ x_rem_attr = filter isAttrModifier x_remaining | ||
+ y_rem_attr = filter isAttrModifier y_remaining | ||
+ in | ||
+ case null shared of | ||
+ True | isEmpty xs && isEmpty ys -> | ||
+ stackInlines (x_rem_attr ++ y_rem_attr) mempty | ||
+ | isEmpty xs -> | ||
+ let (sp, y') = spaceOutInlinesL y in | ||
+ (stackInlines x_rem_attr mempty) <> sp <> y' | ||
+ | isEmpty ys -> | ||
+ let (x', sp) = spaceOutInlinesR x in | ||
+ x' <> sp <> (stackInlines y_rem_attr mempty) | ||
+ | otherwise -> | ||
+ let (x', xsp) = spaceOutInlinesR x | ||
+ (ysp, y') = spaceOutInlinesL y | ||
+ in | ||
+ x' <> xsp <> ysp <> y' | ||
+ False -> stackInlines shared $ | ||
+ combineInlines | ||
+ (stackInlines x_remaining xs) | ||
+ (stackInlines y_remaining ys) | ||
+ | ||
+combineBlocks :: Blocks -> Blocks -> Blocks | ||
+combineBlocks bs cs | ||
+ | bs' :> (BlockQuote bs'') <- viewr (unMany bs) | ||
+ , (BlockQuote cs'') :< cs' <- viewl (unMany cs) = | ||
+ Many $ (bs' |> (BlockQuote (bs'' <> cs''))) >< cs' | ||
+combineBlocks bs cs = bs <> cs | ||
+ | ||
+instance (Monoid a, Eq a) => Eq (Modifier a) where | ||
+ (Modifier f) == (Modifier g) = (f mempty == g mempty) | ||
+ (AttrModifier f attr) == (AttrModifier g attr') = (f attr mempty == g attr' mempty) | ||
+ (NullModifier) == (NullModifier) = True | ||
+ _ == _ = False | ||
+ | ||
+isEmpty :: (Monoid a, Eq a) => a -> Bool | ||
+isEmpty x = x == mempty | ||
+ | ||
+isAttrModifier :: Modifier a -> Bool | ||
+isAttrModifier (AttrModifier _ _) = True | ||
+isAttrModifier _ = False | ||
+ | ||
+smushInlines :: [Inlines] -> Inlines | ||
+smushInlines xs = foldl combineInlines mempty xs | ||
+ | ||
+smushBlocks :: [Blocks] -> Blocks | ||
+smushBlocks xs = foldl combineBlocks mempty xs |
@@ -1,181 +0,0 @@ | ||
-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, | ||
- PatternGuards #-} | ||
- | ||
-module Text.Pandoc.Readers.Docx.Reducible ( concatReduce | ||
- , (<+>) | ||
- ) | ||
- where | ||
- | ||
- | ||
-import Text.Pandoc.Builder | ||
-import Data.List | ||
-import Data.Sequence (ViewR(..), ViewL(..), viewl, viewr) | ||
-import qualified Data.Sequence as Seq (null) | ||
- | ||
-data Modifier a = Modifier (a -> a) | ||
- | AttrModifier (Attr -> a -> a) Attr | ||
- | NullModifier | ||
- | ||
-class (Eq a) => Modifiable a where | ||
- modifier :: a -> Modifier a | ||
- innards :: a -> a | ||
- getL :: a -> (a, a) | ||
- getR :: a -> (a, a) | ||
- spaceOut :: a -> (a, a, a) | ||
- | ||
-spaceOutL :: (Monoid a, Modifiable a) => a -> (a, a) | ||
-spaceOutL ms = (l, stack fs (m' <> r)) | ||
- where (l, m, r) = spaceOut ms | ||
- (fs, m') = unstack m | ||
- | ||
-spaceOutR :: (Monoid a, Modifiable a) => a -> (a, a) | ||
-spaceOutR ms = (stack fs (l <> m'), r) | ||
- where (l, m, r) = spaceOut ms | ||
- (fs, m') = unstack m | ||
- | ||
-instance (Monoid a, Show a) => Show (Modifier a) where | ||
- show (Modifier f) = show $ f mempty | ||
- show (AttrModifier f attr) = show $ f attr mempty | ||
- show (NullModifier) = "NullModifier" | ||
- | ||
-instance (Monoid a, Eq a) => Eq (Modifier a) where | ||
- (Modifier f) == (Modifier g) = (f mempty == g mempty) | ||
- (AttrModifier f attr) == (AttrModifier g attr') = (f attr mempty == g attr' mempty) | ||
- (NullModifier) == (NullModifier) = True | ||
- _ == _ = False | ||
- | ||
-instance Modifiable Inlines where | ||
- modifier ils = case viewl (unMany ils) of | ||
- (x :< xs) | Seq.null xs -> case x of | ||
- (Emph _) -> Modifier emph | ||
- (Strong _) -> Modifier strong | ||
- (SmallCaps _) -> Modifier smallcaps | ||
- (Strikeout _) -> Modifier strikeout | ||
- (Superscript _) -> Modifier superscript | ||
- (Subscript _) -> Modifier subscript | ||
- (Span attr _) -> AttrModifier spanWith attr | ||
- _ -> NullModifier | ||
- _ -> NullModifier | ||
- | ||
- innards ils = case viewl (unMany ils) of | ||
- (x :< xs) | Seq.null xs -> case x of | ||
- (Emph lst) -> fromList lst | ||
- (Strong lst) -> fromList lst | ||
- (SmallCaps lst) -> fromList lst | ||
- (Strikeout lst) -> fromList lst | ||
- (Superscript lst) -> fromList lst | ||
- (Subscript lst) -> fromList lst | ||
- (Span _ lst) -> fromList lst | ||
- _ -> ils | ||
- _ -> ils | ||
- | ||
- getL ils = case viewl $ unMany ils of | ||
- (s :< sq) -> (singleton s, Many sq) | ||
- _ -> (mempty, ils) | ||
- | ||
- getR ils = case viewr $ unMany ils of | ||
- (sq :> s) -> (Many sq, singleton s) | ||
- _ -> (ils, mempty) | ||
- | ||
- spaceOut ils = | ||
- let (fs, ils') = unstack ils | ||
- contents = unMany ils' | ||
- left = case viewl contents of | ||
- (Space :< _) -> space | ||
- _ -> mempty | ||
- right = case viewr contents of | ||
- (_ :> Space) -> space | ||
- _ -> mempty in | ||
- (left, (stack fs $ trimInlines .Many $ contents), right) | ||
- | ||
-instance Modifiable Blocks where | ||
- modifier blks = case viewl (unMany blks) of | ||
- (x :< xs) | Seq.null xs -> case x of | ||
- (BlockQuote _) -> Modifier blockQuote | ||
- -- (Div attr _) -> AttrModifier divWith attr | ||
- _ -> NullModifier | ||
- _ -> NullModifier | ||
- | ||
- innards blks = case viewl (unMany blks) of | ||
- (x :< xs) | Seq.null xs -> case x of | ||
- (BlockQuote lst) -> fromList lst | ||
- -- (Div attr lst) -> fromList lst | ||
- _ -> blks | ||
- _ -> blks | ||
- | ||
- spaceOut blks = (mempty, blks, mempty) | ||
- | ||
- getL ils = case viewl $ unMany ils of | ||
- (s :< sq) -> (singleton s, Many sq) | ||
- _ -> (mempty, ils) | ||
- | ||
- getR ils = case viewr $ unMany ils of | ||
- (sq :> s) -> (Many sq, singleton s) | ||
- _ -> (ils, mempty) | ||
- | ||
- | ||
-unstack :: (Modifiable a) => a -> ([Modifier a], a) | ||
-unstack ms = case modifier ms of | ||
- NullModifier -> ([], ms) | ||
- _ -> (f : fs, ms') where | ||
- f = modifier ms | ||
- (fs, ms') = unstack $ innards ms | ||
- | ||
-stack :: (Monoid a, Modifiable a) => [Modifier a] -> a -> a | ||
-stack [] ms = ms | ||
-stack (NullModifier : fs) ms = stack fs ms | ||
-stack ((Modifier f) : fs) ms = | ||
- if isEmpty ms | ||
- then stack fs ms | ||
- else f $ stack fs ms | ||
-stack ((AttrModifier f attr) : fs) ms = f attr $ stack fs ms | ||
- | ||
-isEmpty :: (Monoid a, Eq a) => a -> Bool | ||
-isEmpty x = x == mempty | ||
- | ||
- | ||
-combine :: (Monoid a, Modifiable a, Eq a) => a -> a -> a | ||
-combine x y = | ||
- let (xs', x') = getR x | ||
- (y', ys') = getL y | ||
- in | ||
- xs' <> (combineSingleton x' y') <> ys' | ||
- | ||
-isAttrModifier :: Modifier a -> Bool | ||
-isAttrModifier (AttrModifier _ _) = True | ||
-isAttrModifier _ = False | ||
- | ||
-combineSingleton :: (Monoid a, Modifiable a, Eq a) => a -> a -> a | ||
-combineSingleton x y = | ||
- let (xfs, xs) = unstack x | ||
- (yfs, ys) = unstack y | ||
- shared = xfs `intersect` yfs | ||
- x_remaining = xfs \\ shared | ||
- y_remaining = yfs \\ shared | ||
- x_rem_attr = filter isAttrModifier x_remaining | ||
- y_rem_attr = filter isAttrModifier y_remaining | ||
- in | ||
- case null shared of | ||
- True | isEmpty xs && isEmpty ys -> | ||
- stack (x_rem_attr ++ y_rem_attr) mempty | ||
- | isEmpty xs -> | ||
- let (sp, y') = spaceOutL y in | ||
- (stack x_rem_attr mempty) <> sp <> y' | ||
- | isEmpty ys -> | ||
- let (x', sp) = spaceOutR x in | ||
- x' <> sp <> (stack y_rem_attr mempty) | ||
- | otherwise -> | ||
- let (x', xsp) = spaceOutR x | ||
- (ysp, y') = spaceOutL y | ||
- in | ||
- x' <> xsp <> ysp <> y' | ||
- False -> stack shared $ | ||
- combine | ||
- (stack x_remaining xs) | ||
- (stack y_remaining ys) | ||
- | ||
-(<+>) :: (Monoid a, Modifiable a, Eq a) => a -> a -> a | ||
-x <+> y = combine x y | ||
- | ||
-concatReduce :: (Monoid a, Modifiable a) => [a] -> a | ||
-concatReduce xs = foldl combine mempty xs |
@@ -0,0 +1,320 @@ | ||
+{-# LANGUAGE OverloadedStrings, PatternGuards #-} | ||
+{- | ||
+Copyright (C) 2006-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.Writers.Docbook | ||
+ Copyright : Copyright (C) 2006-2015 John MacFarlane | ||
+ License : GNU GPL, version 2 or above | ||
+ | ||
+ Maintainer : John MacFarlane <jgm@berkeley.edu> | ||
+ Stability : alpha | ||
+ Portability : portable | ||
+ | ||
+Conversion of 'Pandoc' documents to Docbook XML. | ||
+-} | ||
+module Text.Pandoc.Writers.TEI (writeTEI) where | ||
+import Text.Pandoc.Definition | ||
+import Text.Pandoc.XML | ||
+import Text.Pandoc.Shared | ||
+import Text.Pandoc.Writers.Shared | ||
+import Text.Pandoc.Options | ||
+import Text.Pandoc.Templates (renderTemplate') | ||
+import Data.List ( stripPrefix, isPrefixOf, isSuffixOf ) | ||
+import Data.Char ( toLower ) | ||
+import Text.Pandoc.Highlighting ( languages, languagesByExtension ) | ||
+import Text.Pandoc.Pretty | ||
+import Text.Pandoc.ImageSize | ||
+import qualified Text.Pandoc.Builder as B | ||
+ | ||
+-- | Convert list of authors to a docbook <author> section | ||
+authorToTEI :: WriterOptions -> [Inline] -> B.Inlines | ||
+authorToTEI opts name' = | ||
+ let name = render Nothing $ inlinesToTEI opts name' | ||
+ colwidth = if writerWrapText opts == WrapAuto | ||
+ then Just $ writerColumns opts | ||
+ else Nothing | ||
+ in B.rawInline "tei" $ render colwidth $ | ||
+ inTagsSimple "author" (text $ escapeStringForXML name) | ||
+ | ||
+-- | Convert Pandoc document to string in Docbook format. | ||
+writeTEI :: WriterOptions -> Pandoc -> String | ||
+writeTEI opts (Pandoc meta blocks) = | ||
+ let elements = hierarchicalize blocks | ||
+ colwidth = if writerWrapText opts == WrapAuto | ||
+ then Just $ writerColumns opts | ||
+ else Nothing | ||
+ render' = render colwidth | ||
+ opts' = if "/book>" `isSuffixOf` | ||
+ (trimr $ writerTemplate opts) | ||
+ then opts{ writerChapters = True } | ||
+ else opts | ||
+ startLvl = if writerChapters opts' then 0 else 1 | ||
+ auths' = map (authorToTEI opts) $ docAuthors meta | ||
+ meta' = B.setMeta "author" auths' meta | ||
+ Just metadata = metaToJSON opts | ||
+ (Just . render colwidth . (vcat . | ||
+ (map (elementToTEI opts' startLvl)) . hierarchicalize)) | ||
+ (Just . render colwidth . inlinesToTEI opts') | ||
+ meta' | ||
+ main = render' $ vcat (map (elementToTEI opts' startLvl) elements) | ||
+ context = defField "body" main | ||
+ $ defField "mathml" (case writerHTMLMathMethod opts of | ||
+ MathML _ -> True | ||
+ _ -> False) | ||
+ $ metadata | ||
+ in if writerStandalone opts | ||
+ then renderTemplate' (writerTemplate opts) context | ||
+ else main | ||
+ | ||
+-- | Convert an Element to TEI. | ||
+elementToTEI :: WriterOptions -> Int -> Element -> Doc | ||
+elementToTEI opts _ (Blk block) = blockToTEI opts block | ||
+elementToTEI opts lvl (Sec _ _num (id',_,_) title elements) = | ||
+ -- TEI doesn't allow sections with no content, so insert some if needed | ||
+ let elements' = if null elements | ||
+ then [Blk (Para [])] | ||
+ else elements | ||
+ divType = case lvl of | ||
+ n | n == 0 -> "chapter" | ||
+ | n >= 1 && n <= 5 -> "level" ++ show n | ||
+ | otherwise -> "section" | ||
+ in inTags True "div" [("type", divType) | not (null id')] $ | ||
+-- ("id", writerIdentifierPrefix opts ++ id') | not (null id')] $ | ||
+ inTagsSimple "head" (inlinesToTEI opts title) $$ | ||
+ vcat (map (elementToTEI opts (lvl + 1)) elements') | ||
+ | ||
+-- | Convert a list of Pandoc blocks to TEI. | ||
+blocksToTEI :: WriterOptions -> [Block] -> Doc | ||
+blocksToTEI opts = vcat . map (blockToTEI opts) | ||
+ | ||
+-- | Auxiliary function to convert Plain block to Para. | ||
+plainToPara :: Block -> Block | ||
+plainToPara (Plain x) = Para x | ||
+plainToPara x = x | ||
+ | ||
+-- | Convert a list of pairs of terms and definitions into a TEI | ||
+-- list with labels and items. | ||
+deflistItemsToTEI :: WriterOptions -> [([Inline],[[Block]])] -> Doc | ||
+deflistItemsToTEI opts items = | ||
+ vcat $ map (\(term, defs) -> deflistItemToTEI opts term defs) items | ||
+ | ||
+-- | Convert a term and a list of blocks into a TEI varlistentry. | ||
+deflistItemToTEI :: WriterOptions -> [Inline] -> [[Block]] -> Doc | ||
+deflistItemToTEI opts term defs = | ||
+ let def' = concatMap (map plainToPara) defs | ||
+ in inTagsIndented "label" (inlinesToTEI opts term) $$ | ||
+ inTagsIndented "item" (blocksToTEI opts def') | ||
+ | ||
+-- | Convert a list of lists of blocks to a list of TEI list items. | ||
+listItemsToTEI :: WriterOptions -> [[Block]] -> Doc | ||
+listItemsToTEI opts items = vcat $ map (listItemToTEI opts) items | ||
+ | ||
+-- | Convert a list of blocks into a TEI list item. | ||
+listItemToTEI :: WriterOptions -> [Block] -> Doc | ||
+listItemToTEI opts item = | ||
+ inTagsIndented "item" $ blocksToTEI opts $ map plainToPara item | ||
+ | ||
+imageToTEI :: WriterOptions -> Attr -> String -> Doc | ||
+imageToTEI _ attr src = selfClosingTag "graphic" $ | ||
+ ("url", src) : idAndRole attr ++ dims | ||
+ where | ||
+ dims = go Width "width" ++ go Height "depth" | ||
+ go dir dstr = case (dimension dir attr) of | ||
+ Just a -> [(dstr, show a)] | ||
+ Nothing -> [] | ||
+ | ||
+-- | Convert a Pandoc block element to TEI. | ||
+blockToTEI :: WriterOptions -> Block -> Doc | ||
+blockToTEI _ Null = empty | ||
+-- Add ids to paragraphs in divs with ids - this is needed for | ||
+-- pandoc-citeproc to get link anchors in bibliographies: | ||
+blockToTEI opts (Div (ident,_,_) [Para lst]) = | ||
+ let attribs = [("id", ident) | not (null ident)] in | ||
+ inTags False "p" attribs $ inlinesToTEI opts lst | ||
+blockToTEI opts (Div _ bs) = blocksToTEI opts $ map plainToPara bs | ||
+blockToTEI _ (Header _ _ _) = empty -- should not occur after hierarchicalize | ||
+-- For TEI simple, text must be within containing block element, so | ||
+-- we use plainToPara to ensure that Plain text ends up contained by | ||
+-- something. | ||
+blockToTEI opts (Plain lst) = blockToTEI opts $ Para lst | ||
+-- title beginning with fig: indicates that the image is a figure | ||
+--blockToTEI opts (Para [Image attr txt (src,'f':'i':'g':':':_)]) = | ||
+-- let alt = inlinesToTEI opts txt | ||
+-- capt = if null txt | ||
+-- then empty | ||
+-- else inTagsSimple "title" alt | ||
+-- in inTagsIndented "figure" $ | ||
+-- capt $$ | ||
+-- (inTagsIndented "mediaobject" $ | ||
+-- (inTagsIndented "imageobject" | ||
+-- (imageToTEI opts attr src)) $$ | ||
+-- inTagsSimple "textobject" (inTagsSimple "phrase" alt)) | ||
+blockToTEI opts (Para lst) = | ||
+ inTags False "p" [] $ inlinesToTEI opts lst | ||
+blockToTEI opts (BlockQuote blocks) = | ||
+ inTagsIndented "quote" $ blocksToTEI opts blocks | ||
+blockToTEI _ (CodeBlock (_,classes,_) str) = | ||
+ text ("<ab type='codeblock " ++ lang ++ "'>") <> cr <> | ||
+ flush (text (escapeStringForXML str) <> cr <> text "</ab>") | ||
+ where lang = if null langs | ||
+ then "" | ||
+ else escapeStringForXML (head langs) | ||
+ isLang l = map toLower l `elem` map (map toLower) languages | ||
+ langsFrom s = if isLang s | ||
+ then [s] | ||
+ else languagesByExtension . map toLower $ s | ||
+ langs = concatMap langsFrom classes | ||
+blockToTEI opts (BulletList lst) = | ||
+ let attribs = [("type", "unordered")] | ||
+ in inTags True "list" attribs $ listItemsToTEI opts lst | ||
+blockToTEI _ (OrderedList _ []) = empty | ||
+blockToTEI opts (OrderedList (start, numstyle, _) (first:rest)) = | ||
+ let attribs = case numstyle of | ||
+ DefaultStyle -> [] | ||
+ Decimal -> [("type", "ordered:arabic")] | ||
+ Example -> [("type", "ordered:arabic")] | ||
+ UpperAlpha -> [("type", "ordered:upperalpha")] | ||
+ LowerAlpha -> [("type", "ordered:loweralpha")] | ||
+ UpperRoman -> [("type", "ordered:upperroman")] | ||
+ LowerRoman -> [("type", "ordered:lowerroman")] | ||
+ items = if start == 1 | ||
+ then listItemsToTEI opts (first:rest) | ||
+ else (inTags True "item" [("n",show start)] | ||
+ (blocksToTEI opts $ map plainToPara first)) $$ | ||
+ listItemsToTEI opts rest | ||
+ in inTags True "list" attribs items | ||
+blockToTEI opts (DefinitionList lst) = | ||
+ let attribs = [("type", "definition")] | ||
+ in inTags True "list" attribs $ deflistItemsToTEI opts lst | ||
+blockToTEI _ (RawBlock f str) | ||
+ | f == "tei" = text str -- raw TEI block (should such a thing exist). | ||
+-- | f == "html" = text str -- allow html for backwards compatibility | ||
+ | otherwise = empty | ||
+blockToTEI _ HorizontalRule = | ||
+ selfClosingTag "milestone" [("unit","undefined"), ("type","separator"),("rendition","line")] | ||
+ | ||
+-- | TEI Tables | ||
+-- TEI Simple's tables are composed of cells and rows; other | ||
+-- table info in the AST is here lossily discard. | ||
+blockToTEI opts (Table _ _ _ headers rows) = | ||
+ let | ||
+ headers' = tableHeadersToTEI opts headers | ||
+-- headers' = if all null headers | ||
+-- then return empty | ||
+-- else tableRowToTEI opts headers | ||
+ in | ||
+ inTags True "table" [] $ | ||
+ vcat $ [headers'] <> map (tableRowToTEI opts) rows | ||
+ | ||
+tableRowToTEI :: WriterOptions | ||
+ -> [[Block]] | ||
+ -> Doc | ||
+tableRowToTEI opts cols = | ||
+ inTagsIndented "row" $ vcat $ map (tableItemToTEI opts) cols | ||
+ | ||
+tableHeadersToTEI :: WriterOptions | ||
+ -> [[Block]] | ||
+ -> Doc | ||
+tableHeadersToTEI opts cols = | ||
+ inTags True "row" [("role","label")] $ vcat $ map (tableItemToTEI opts) cols | ||
+ | ||
+tableItemToTEI :: WriterOptions | ||
+ -> [Block] | ||
+ -> Doc | ||
+tableItemToTEI opts item = | ||
+ inTags False "cell" [] $ vcat $ map (blockToTEI opts) item | ||
+ | ||
+-- | Convert a list of inline elements to TEI. | ||
+inlinesToTEI :: WriterOptions -> [Inline] -> Doc | ||
+inlinesToTEI opts lst = hcat $ map (inlineToTEI opts) lst | ||
+ | ||
+-- | Convert an inline element to TEI. | ||
+inlineToTEI :: WriterOptions -> Inline -> Doc | ||
+inlineToTEI _ (Str str) = text $ escapeStringForXML str | ||
+inlineToTEI opts (Emph lst) = | ||
+ inTags False "hi" [("rendition","simple:italic")] $ inlinesToTEI opts lst | ||
+inlineToTEI opts (Strong lst) = | ||
+ inTags False "hi" [("rendition", "simple:bold")] $ inlinesToTEI opts lst | ||
+inlineToTEI opts (Strikeout lst) = | ||
+ inTags False "hi" [("rendition", "simple:strikethrough")] $ | ||
+ inlinesToTEI opts lst | ||
+inlineToTEI opts (Superscript lst) = | ||
+ inTags False "hi" [("rendition", "simple:superscript")] $ inlinesToTEI opts lst | ||
+inlineToTEI opts (Subscript lst) = | ||
+ inTags False "hi" [("rendition", "simple:subscript")] $ inlinesToTEI opts lst | ||
+inlineToTEI opts (SmallCaps lst) = | ||
+ inTags False "hi" [("rendition", "simple:smallcaps")] $ | ||
+ inlinesToTEI opts lst | ||
+inlineToTEI opts (Quoted _ lst) = | ||
+ inTagsSimple "quote" $ inlinesToTEI opts lst | ||
+inlineToTEI opts (Cite _ lst) = | ||
+ inlinesToTEI opts lst | ||
+inlineToTEI opts (Span _ ils) = | ||
+ inlinesToTEI opts ils | ||
+inlineToTEI _ (Code _ str) = | ||
+ inTags False "seg" [("type","code")] $ text (escapeStringForXML str) | ||
+-- Distinguish display from inline math by wrapping the former in a "figure." | ||
+inlineToTEI _ (Math t str) = | ||
+ case t of | ||
+ InlineMath -> inTags False "formula" [("notation","TeX")] $ | ||
+ text (str) | ||
+ DisplayMath -> inTags True "figure" [("type","math")] $ | ||
+ inTags False "formula" [("notation","TeX")] $ text (str) | ||
+ | ||
+inlineToTEI _ (RawInline f x) | f == "tei" = text x | ||
+ | otherwise = empty | ||
+inlineToTEI _ LineBreak = selfClosingTag "lb" [] | ||
+inlineToTEI _ Space = space | ||
+-- because we use \n for LineBreak, we can't do soft breaks: | ||
+inlineToTEI _ SoftBreak = space | ||
+inlineToTEI opts (Link attr txt (src, _)) | ||
+ | Just email <- stripPrefix "mailto:" src = | ||
+ let emailLink = text $ | ||
+ escapeStringForXML $ email | ||
+ in case txt of | ||
+ [Str s] | escapeURI s == email -> emailLink | ||
+ _ -> inlinesToTEI opts txt <+> | ||
+ char '(' <> emailLink <> char ')' | ||
+ | otherwise = | ||
+ (if isPrefixOf "#" src | ||
+ then inTags False "ref" $ ("target", drop 1 src) : idAndRole attr | ||
+ else inTags False "ref" $ ("target", src) : idAndRole attr ) $ | ||
+ inlinesToTEI opts txt | ||
+inlineToTEI opts (Image attr description (src, tit)) = | ||
+ let titleDoc = if null tit | ||
+ then empty | ||
+ else inTags False "figDesc" [] (text $ escapeStringForXML tit) | ||
+ imageDesc = if null description | ||
+ then empty | ||
+ else inTags False "head" [] (inlinesToTEI opts description) | ||
+ in inTagsIndented "figure" $ imageDesc $$ | ||
+ imageToTEI opts attr src $$ titleDoc | ||
+inlineToTEI opts (Note contents) = | ||
+ inTagsIndented "note" $ blocksToTEI opts contents | ||
+ | ||
+idAndRole :: Attr -> [(String, String)] | ||
+idAndRole (id',cls,_) = ident ++ role | ||
+ where | ||
+ ident = if null id' | ||
+ then [] | ||
+ else [("id", id')] | ||
+ role = if null cls | ||
+ then [] | ||
+ else [("role", unwords cls)] | ||
+ |
@@ -1,4 +1,4 @@ | ||
packages: | ||
- 'https://hackage.haskell.org/package/preprocessor-tools-1.0.1/preprocessor-tools-1.0.1.tar.gz' | ||
- 'https://hackage.haskell.org/package/hsb2hs-0.3.1/hsb2hs-0.3.1.tar.gz' | ||
-resolver: lts-3.10 | ||
+resolver: lts-4.0 |
@@ -0,0 +1,43 @@ | ||
+{-# LANGUAGE OverloadedStrings #-} | ||
+module Tests.Writers.TEI (tests) where | ||
+ | ||
+import Test.Framework | ||
+import Text.Pandoc.Builder | ||
+import Text.Pandoc | ||
+import Tests.Helpers | ||
+import Tests.Arbitrary() | ||
+ | ||
+{- | ||
+ "my test" =: X =?> Y | ||
+ | ||
+is shorthand for | ||
+ | ||
+ test html "my test" $ X =?> Y | ||
+ | ||
+which is in turn shorthand for | ||
+ | ||
+ test html "my test" (X,Y) | ||
+-} | ||
+ | ||
+infix 4 =: | ||
+(=:) :: (ToString a, ToPandoc a) | ||
+ => String -> (a, String) -> Test | ||
+(=:) = test (writeTEI def . toPandoc) | ||
+ | ||
+tests :: [Test] | ||
+tests = [ testGroup "block elements" | ||
+ ["para" =: para "Lorem ipsum cetera." | ||
+ =?> "<p>Lorem ipsum cetera.</p>" | ||
+ ] | ||
+ , testGroup "inlines" | ||
+ [ | ||
+ "Emphasis" =: emph ("emphasized") | ||
+ =?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>" | ||
+ ,"SingleQuoted" =: singleQuoted (text "quoted material") | ||
+ =?> "<p><quote>quoted material</quote></p>" | ||
+ ,"DoubleQuoted" =: doubleQuoted (text "quoted material") | ||
+ =?> "<p><quote>quoted material</quote></p>" | ||
+ ,"NestedQuoted" =: doubleQuoted (singleQuoted (text "quoted material")) | ||
+ =?> "<p><quote><quote>quoted material</quote></quote></p>" | ||
+ ] | ||
+ ] |
@@ -0,0 +1 @@ | ||
+[Para [Str "Le",Space,Str "plus",Space,Str "int\233ressant",Space,Str "\233tant",Space,Str "sans",Space,Str "doute",Space,Str "le",Space,Str "Marsan,",Space,Str "propos\233",Space,Str "par",Space,Str "Claude",Space,Str "Marsan",Space,Str "en",Space,Str "1976",Space,Str "qui",Space,Str "avait",Space,Str "m\234me",Space,Str "fait",Space,Str "l'objet",Space,Str "d'une",Space,Str "norme,",Space,Str "mais",Space,Str "qui",Space,Str "n'a",Space,Str "pas",Space,Str "du",Space,Str "tout",Space,Str "\233t\233",Space,Str "adopt\233",Space,Str "\224",Space,Str "cause",Space,Str "des",Space,Str "habitudes",Space,Str "trop",Space,Str "ancr\233es",Space,Str "et",Space,Str "qui",Space,Str "a",Space,Str "fini",Space,Str "par",Space,Str "tomber",Space,Str "dans",Space,Str "l'oubli,",Space,Str "gros",Space,Str "clin",Space,Str "d'\339il",Space,Str "\224",Space,Str "cela",Space,Str "d'ailleurs",Space,Str "dans",Space,Str "le",Space,Str "film",Space,Link ("",[],[]) [Emph [Str "\"Le",Space,Str "nom",Space,Str "des",Space,Str "gens\""]] ("http://www.allocine.fr/film/fichefilm_gen_cfilm=172167.html",""),Str ".",Space,Str "D\8217ailleurs",Space,Str "l\8217\233tat,",Space,Str "bien",Space,Str "conscient",Space,Str "que",Space,Str "tous",Space,Str "les",Space,Str "fran\231ais",Space,Str "\233crivent",Space,Str "sur",Space,Str "des",Space,Str "claviers",Space,Str "compl\232tement",Space,Str "inadapt\233s,",Space,Link ("",[],[]) [Emph [Str "tente",Space,Str "encore",Space,Str "une",Space,Str "fois",Space,Str "de",Space,Str "faire",Space,Str "une",Space,Str "norme",Space,Str "en",Space,Str "ce",Space,Str "moment",Space,Str "m\234me"]] ("http://www.appy-geek.com/Web/ArticleWeb.aspx?regionid=2&articleid=56103389&source=messenger",""),Str "."]] |
@@ -0,0 +1,4 @@ | ||
+[Header 1 ("h1",[],[]) [Str "H1"] | ||
+,Header 2 ("h2",[],[]) [Str "H2"] | ||
+,Header 3 ("h3",[],[]) [Str "H3"] | ||
+,Para [Str "And",Space,Str "some",Space,Str "text"]] |
@@ -0,0 +1,171 @@ | ||
+<p>Simple table with caption:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell><p>Right</p></cell> | ||
+ <cell><p>Left</p></cell> | ||
+ <cell><p>Center</p></cell> | ||
+ <cell><p>Default</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Simple table without caption:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell><p>Right</p></cell> | ||
+ <cell><p>Left</p></cell> | ||
+ <cell><p>Center</p></cell> | ||
+ <cell><p>Default</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Simple table indented two spaces:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell><p>Right</p></cell> | ||
+ <cell><p>Left</p></cell> | ||
+ <cell><p>Center</p></cell> | ||
+ <cell><p>Default</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Multiline table with caption:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell><p>Centered Header</p></cell> | ||
+ <cell><p>Left Aligned</p></cell> | ||
+ <cell><p>Right Aligned</p></cell> | ||
+ <cell><p>Default aligned</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>First</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>12.0</p></cell> | ||
+ <cell><p>Example of a row that spans multiple lines.</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>Second</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>5.0</p></cell> | ||
+ <cell><p>Here's another one. Note the blank line between rows.</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Multiline table without caption:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell><p>Centered Header</p></cell> | ||
+ <cell><p>Left Aligned</p></cell> | ||
+ <cell><p>Right Aligned</p></cell> | ||
+ <cell><p>Default aligned</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>First</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>12.0</p></cell> | ||
+ <cell><p>Example of a row that spans multiple lines.</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>Second</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>5.0</p></cell> | ||
+ <cell><p>Here's another one. Note the blank line between rows.</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Table without column headers:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ <cell><p>12</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ <cell><p>123</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ <cell><p>1</p></cell> | ||
+ </row> | ||
+</table> | ||
+<p>Multiline table without column headers:</p> | ||
+<table> | ||
+ <row role="label"> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ <cell></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>First</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>12.0</p></cell> | ||
+ <cell><p>Example of a row that spans multiple lines.</p></cell> | ||
+ </row> | ||
+ <row> | ||
+ <cell><p>Second</p></cell> | ||
+ <cell><p>row</p></cell> | ||
+ <cell><p>5.0</p></cell> | ||
+ <cell><p>Here's another one. Note the blank line between rows.</p></cell> | ||
+ </row> | ||
+</table> |
@@ -0,0 +1,861 @@ | ||
+<?xml version="1.0" encoding="utf-8"?> | ||
+<TEI xmlns="http://www.tei-c.org/ns/1.0"> | ||
+<teiHeader> | ||
+ <fileDesc> | ||
+ <titleStmt> | ||
+ <title>Pandoc Test Suite</title> | ||
+ <author>John MacFarlane</author> | ||
+ <author>Anonymous</author> | ||
+ </titleStmt> | ||
+ <publicationStmt> | ||
+ <p></p> | ||
+ </publicationStmt> | ||
+ <sourceDesc> | ||
+ <p>Produced by pandoc.</p> | ||
+ </sourceDesc> | ||
+ </fileDesc> | ||
+</teiHeader> | ||
+<text> | ||
+<body> | ||
+<p>This is a set of tests for pandoc. Most of them are adapted from John | ||
+Gruber’s markdown test suite.</p> | ||
+<milestone unit="undefined" type="separator" rendition="line" /> | ||
+<div type="level1"> | ||
+ <head>Headers</head> | ||
+ <div type="level2"> | ||
+ <head>Level 2 with an <ref target="/url">embedded link</ref></head> | ||
+ <div type="level3"> | ||
+ <head>Level 3 with <hi rendition="simple:italic">emphasis</hi></head> | ||
+ <div type="level4"> | ||
+ <head>Level 4</head> | ||
+ <div type="level5"> | ||
+ <head>Level 5</head> | ||
+ <p></p> | ||
+ </div> | ||
+ </div> | ||
+ </div> | ||
+ </div> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Level 1</head> | ||
+ <div type="level2"> | ||
+ <head>Level 2 with <hi rendition="simple:italic">emphasis</hi></head> | ||
+ <div type="level3"> | ||
+ <head>Level 3</head> | ||
+ <p>with no blank line</p> | ||
+ </div> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Level 2</head> | ||
+ <p>with no blank line</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+ </div> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Paragraphs</head> | ||
+ <p>Here’s a regular paragraph.</p> | ||
+ <p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list | ||
+ item. Because a hard-wrapped line in the middle of a paragraph looked like a | ||
+ list item.</p> | ||
+ <p>Here’s one with a bullet. * criminey.</p> | ||
+ <p>There should be a hard line break<lb />here.</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Block Quotes</head> | ||
+ <p>E-mail style:</p> | ||
+ <quote> | ||
+ <p>This is a block quote. It is pretty short.</p> | ||
+ </quote> | ||
+ <quote> | ||
+ <p>Code in a block quote:</p> | ||
+ <ab type='codeblock '> | ||
+sub status { | ||
+ print "working"; | ||
+} | ||
+</ab> | ||
+ <p>A list:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>item one</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>item two</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Nested block quotes:</p> | ||
+ <quote> | ||
+ <p>nested</p> | ||
+ </quote> | ||
+ <quote> | ||
+ <p>nested</p> | ||
+ </quote> | ||
+ </quote> | ||
+ <p>This should not be a block quote: 2 > 1.</p> | ||
+ <p>And a following paragraph.</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Code Blocks</head> | ||
+ <p>Code:</p> | ||
+ <ab type='codeblock '> | ||
+---- (should be four hyphens) | ||
+ | ||
+sub status { | ||
+ print "working"; | ||
+} | ||
+ | ||
+this code block is indented by one tab | ||
+</ab> | ||
+ <p>And:</p> | ||
+ <ab type='codeblock '> | ||
+ this code block is indented by two tabs | ||
+ | ||
+These should not be escaped: \$ \\ \> \[ \{ | ||
+</ab> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Lists</head> | ||
+ <div type="level2"> | ||
+ <head>Unordered</head> | ||
+ <p>Asterisks tight:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>asterisk 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>asterisk 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>asterisk 3</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Asterisks loose:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>asterisk 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>asterisk 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>asterisk 3</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Pluses tight:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Plus 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Plus 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Plus 3</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Pluses loose:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Plus 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Plus 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Plus 3</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Minuses tight:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Minus 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Minus 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Minus 3</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Minuses loose:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Minus 1</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Minus 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Minus 3</p> | ||
+ </item> | ||
+ </list> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Ordered</head> | ||
+ <p>Tight:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>First</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Second</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Third</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>and:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>One</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Two</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Three</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Loose using tabs:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>First</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Second</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Third</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>and using spaces:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>One</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Two</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Three</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Multiple paragraphs:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>Item 1, graf one.</p> | ||
+ <p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s | ||
+ back.</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Item 2.</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Item 3.</p> | ||
+ </item> | ||
+ </list> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Nested</head> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Tab</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Tab</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Tab</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ <p>Here’s another:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>First</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Second:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Fee</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Fie</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Foe</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ <item> | ||
+ <p>Third</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Same thing but with paragraphs:</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>First</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Second:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>Fee</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Fie</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Foe</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ <item> | ||
+ <p>Third</p> | ||
+ </item> | ||
+ </list> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Tabs and spaces</head> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>this is a list item indented with tabs</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>this is a list item indented with spaces</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>this is an example list item indented with tabs</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>this is an example list item indented with spaces</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Fancy list markers</head> | ||
+ <list type="ordered:arabic"> | ||
+ <item n="2"> | ||
+ <p>begins with 2</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>and now 3</p> | ||
+ <p>with a continuation</p> | ||
+ <list type="ordered:lowerroman"> | ||
+ <item n="4"> | ||
+ <p>sublist with roman numerals, starting with 4</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>more items</p> | ||
+ <list type="ordered:upperalpha"> | ||
+ <item> | ||
+ <p>a subsublist</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>a subsublist</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ <p>Nesting:</p> | ||
+ <list type="ordered:upperalpha"> | ||
+ <item> | ||
+ <p>Upper Alpha</p> | ||
+ <list type="ordered:upperroman"> | ||
+ <item> | ||
+ <p>Upper Roman.</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item n="6"> | ||
+ <p>Decimal start with 6</p> | ||
+ <list type="ordered:loweralpha"> | ||
+ <item n="3"> | ||
+ <p>Lower alpha with paren</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ <p>Autonumbering:</p> | ||
+ <list> | ||
+ <item> | ||
+ <p>Autonumber.</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>More.</p> | ||
+ <list> | ||
+ <item> | ||
+ <p>Nested.</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+ <p>Should not be a list item:</p> | ||
+ <p>M.A. 2007</p> | ||
+ <p>B. Williams</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+ </div> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Definition Lists</head> | ||
+ <p>Tight using spaces:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ banana | ||
+ </label> | ||
+ <item> | ||
+ <p>yellow fruit</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Tight using tabs:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ banana | ||
+ </label> | ||
+ <item> | ||
+ <p>yellow fruit</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Loose:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ </item> | ||
+ <label> | ||
+ banana | ||
+ </label> | ||
+ <item> | ||
+ <p>yellow fruit</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Multiple blocks with italics:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ <hi rendition="simple:italic">apple</hi> | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ <p>contains seeds, crisp, pleasant to taste</p> | ||
+ </item> | ||
+ <label> | ||
+ <hi rendition="simple:italic">orange</hi> | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ <ab type='codeblock '> | ||
+{ orange code block } | ||
+</ab> | ||
+ <quote> | ||
+ <p>orange block quote</p> | ||
+ </quote> | ||
+ </item> | ||
+ </list> | ||
+ <p>Multiple definitions, tight:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ <p>computer</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ <p>bank</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Multiple definitions, loose:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ <p>computer</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ <p>bank</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Blank line after term, indented marker, alternate markers:</p> | ||
+ <list type="definition"> | ||
+ <label> | ||
+ apple | ||
+ </label> | ||
+ <item> | ||
+ <p>red fruit</p> | ||
+ <p>computer</p> | ||
+ </item> | ||
+ <label> | ||
+ orange | ||
+ </label> | ||
+ <item> | ||
+ <p>orange fruit</p> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>sublist</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>sublist</p> | ||
+ </item> | ||
+ </list> | ||
+ </item> | ||
+ </list> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>HTML Blocks</head> | ||
+ <p>Simple block on one line:</p> | ||
+ <p>foo</p> | ||
+ <p>And nested without indentation:</p> | ||
+ <p>foo</p> | ||
+ <p>bar</p> | ||
+ <p>Interpreted markdown in a table:</p> | ||
+ <p>This is <hi rendition="simple:italic">emphasized</hi></p> | ||
+ <p>And this is <hi rendition="simple:bold">strong</hi></p> | ||
+ <p>Here’s a simple block:</p> | ||
+ <p>foo</p> | ||
+ <p>This should be a code block, though:</p> | ||
+ <ab type='codeblock '> | ||
+<div> | ||
+ foo | ||
+</div> | ||
+</ab> | ||
+ <p>As should this:</p> | ||
+ <ab type='codeblock '> | ||
+<div>foo</div> | ||
+</ab> | ||
+ <p>Now, nested:</p> | ||
+ <p>foo</p> | ||
+ <p>This should just be an HTML comment:</p> | ||
+ <p>Multiline:</p> | ||
+ <p>Code block:</p> | ||
+ <ab type='codeblock '> | ||
+<!-- Comment --> | ||
+</ab> | ||
+ <p>Just plain comment, with trailing spaces on the line:</p> | ||
+ <p>Code:</p> | ||
+ <ab type='codeblock '> | ||
+<hr /> | ||
+</ab> | ||
+ <p>Hr’s:</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Inline Markup</head> | ||
+ <p>This is <hi rendition="simple:italic">emphasized</hi>, and so | ||
+ <hi rendition="simple:italic">is this</hi>.</p> | ||
+ <p>This is <hi rendition="simple:bold">strong</hi>, and so | ||
+ <hi rendition="simple:bold">is this</hi>.</p> | ||
+ <p>An <hi rendition="simple:italic"><ref target="/url">emphasized | ||
+ link</ref></hi>.</p> | ||
+ <p><hi rendition="simple:bold"><hi rendition="simple:italic">This is strong | ||
+ and em.</hi></hi></p> | ||
+ <p>So is | ||
+ <hi rendition="simple:bold"><hi rendition="simple:italic">this</hi></hi> | ||
+ word.</p> | ||
+ <p><hi rendition="simple:bold"><hi rendition="simple:italic">This is strong | ||
+ and em.</hi></hi></p> | ||
+ <p>So is | ||
+ <hi rendition="simple:bold"><hi rendition="simple:italic">this</hi></hi> | ||
+ word.</p> | ||
+ <p>This is code: <seg type="code">></seg>, <seg type="code">$</seg>, | ||
+ <seg type="code">\</seg>, <seg type="code">\$</seg>, | ||
+ <seg type="code"><html></seg>.</p> | ||
+ <p><hi rendition="simple:strikethrough">This is | ||
+ <hi rendition="simple:italic">strikeout</hi>.</hi></p> | ||
+ <p>Superscripts: a<hi rendition="simple:superscript">bc</hi>d | ||
+ a<hi rendition="simple:superscript"><hi rendition="simple:italic">hello</hi></hi> | ||
+ a<hi rendition="simple:superscript">hello there</hi>.</p> | ||
+ <p>Subscripts: H<hi rendition="simple:subscript">2</hi>O, | ||
+ H<hi rendition="simple:subscript">23</hi>O, | ||
+ H<hi rendition="simple:subscript">many of them</hi>O.</p> | ||
+ <p>These should not be superscripts or subscripts, because of the unescaped | ||
+ spaces: a^b c^d, a~b c~d.</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Smart quotes, ellipses, dashes</head> | ||
+ <p><quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is my | ||
+ name.</quote></p> | ||
+ <p><quote>A</quote>, <quote>B</quote>, and <quote>C</quote> are letters.</p> | ||
+ <p><quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are | ||
+ names of trees. So is <quote>pine.</quote></p> | ||
+ <p><quote>He said, <quote>I want to go.</quote></quote> Were you alive in | ||
+ the 70’s?</p> | ||
+ <p>Here is some quoted <quote><seg type="code">code</seg></quote> and a | ||
+ <quote><ref target="http://example.com/?foo=1&bar=2">quoted | ||
+ link</ref></quote>.</p> | ||
+ <p>Some dashes: one—two — three—four — five.</p> | ||
+ <p>Dashes between numbers: 5–7, 255–66, 1987–1999.</p> | ||
+ <p>Ellipses…and…and….</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>LaTeX</head> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p></p> | ||
+ </item> | ||
+ <item> | ||
+ <p><formula notation="TeX">2+2=4</formula></p> | ||
+ </item> | ||
+ <item> | ||
+ <p><formula notation="TeX">x \in y</formula></p> | ||
+ </item> | ||
+ <item> | ||
+ <p><formula notation="TeX">\alpha \wedge \omega</formula></p> | ||
+ </item> | ||
+ <item> | ||
+ <p><formula notation="TeX">223</formula></p> | ||
+ </item> | ||
+ <item> | ||
+ <p><formula notation="TeX">p</formula>-Tree</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Here’s some display math: <figure type="math"> | ||
+ <formula notation="TeX">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</formula> | ||
+ </figure></p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Here’s one that has a line break in it: | ||
+ <formula notation="TeX">\alpha + \omega \times x^2</formula>.</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>These shouldn’t be math:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>To get the famous equation, write | ||
+ <seg type="code">$e = mc^2$</seg>.</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>$22,000 is a <hi rendition="simple:italic">lot</hi> of money. So is | ||
+ $34,000. (It worked if <quote>lot</quote> is emphasized.)</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Shoes ($20) and socks ($5).</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>Escaped <seg type="code">$</seg>: $73 | ||
+ <hi rendition="simple:italic">this should be emphasized</hi> 23$.</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>Here’s a LaTeX table:</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Special Characters</head> | ||
+ <p>Here is some unicode:</p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>I hat: Î</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>o umlaut: ö</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>section: §</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>set membership: ∈</p> | ||
+ </item> | ||
+ <item> | ||
+ <p>copyright: ©</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>AT&T has an ampersand in their name.</p> | ||
+ <p>AT&T is another way to write it.</p> | ||
+ <p>This & that.</p> | ||
+ <p>4 < 5.</p> | ||
+ <p>6 > 5.</p> | ||
+ <p>Backslash: \</p> | ||
+ <p>Backtick: `</p> | ||
+ <p>Asterisk: *</p> | ||
+ <p>Underscore: _</p> | ||
+ <p>Left brace: {</p> | ||
+ <p>Right brace: }</p> | ||
+ <p>Left bracket: [</p> | ||
+ <p>Right bracket: ]</p> | ||
+ <p>Left paren: (</p> | ||
+ <p>Right paren: )</p> | ||
+ <p>Greater-than: ></p> | ||
+ <p>Hash: #</p> | ||
+ <p>Period: .</p> | ||
+ <p>Bang: !</p> | ||
+ <p>Plus: +</p> | ||
+ <p>Minus: -</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Links</head> | ||
+ <div type="level2"> | ||
+ <head>Explicit</head> | ||
+ <p>Just a <ref target="/url/">URL</ref>.</p> | ||
+ <p><ref target="/url/">URL and title</ref>.</p> | ||
+ <p><ref target="/url/">URL and title</ref>.</p> | ||
+ <p><ref target="/url/">URL and title</ref>.</p> | ||
+ <p><ref target="/url/">URL and title</ref></p> | ||
+ <p><ref target="/url/">URL and title</ref></p> | ||
+ <p><ref target="/url/with_underscore">with_underscore</ref></p> | ||
+ <p>Email link (nobody@nowhere.net)</p> | ||
+ <p><ref target="">Empty</ref>.</p> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Reference</head> | ||
+ <p>Foo <ref target="/url/">bar</ref>.</p> | ||
+ <p>Foo <ref target="/url/">bar</ref>.</p> | ||
+ <p>Foo <ref target="/url/">bar</ref>.</p> | ||
+ <p>With <ref target="/url/">embedded [brackets]</ref>.</p> | ||
+ <p><ref target="/url/">b</ref> by itself should be a link.</p> | ||
+ <p>Indented <ref target="/url">once</ref>.</p> | ||
+ <p>Indented <ref target="/url">twice</ref>.</p> | ||
+ <p>Indented <ref target="/url">thrice</ref>.</p> | ||
+ <p>This should [not][] be a link.</p> | ||
+ <ab type='codeblock '> | ||
+[not]: /url | ||
+</ab> | ||
+ <p>Foo <ref target="/url/">bar</ref>.</p> | ||
+ <p>Foo <ref target="/url/">biz</ref>.</p> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>With ampersands</head> | ||
+ <p>Here’s a <ref target="http://example.com/?foo=1&bar=2">link with an | ||
+ ampersand in the URL</ref>.</p> | ||
+ <p>Here’s a link with an amersand in the link text: | ||
+ <ref target="http://att.com/">AT&T</ref>.</p> | ||
+ <p>Here’s an <ref target="/script?foo=1&bar=2">inline link</ref>.</p> | ||
+ <p>Here’s an <ref target="/script?foo=1&bar=2">inline link in pointy | ||
+ braces</ref>.</p> | ||
+ </div> | ||
+ <div type="level2"> | ||
+ <head>Autolinks</head> | ||
+ <p>With an ampersand: | ||
+ <ref target="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</ref></p> | ||
+ <list type="unordered"> | ||
+ <item> | ||
+ <p>In a list?</p> | ||
+ </item> | ||
+ <item> | ||
+ <p><ref target="http://example.com/">http://example.com/</ref></p> | ||
+ </item> | ||
+ <item> | ||
+ <p>It should.</p> | ||
+ </item> | ||
+ </list> | ||
+ <p>An e-mail address: nobody@nowhere.net</p> | ||
+ <quote> | ||
+ <p>Blockquoted: | ||
+ <ref target="http://example.com/">http://example.com/</ref></p> | ||
+ </quote> | ||
+ <p>Auto-links should not occur here: | ||
+ <seg type="code"><http://example.com/></seg></p> | ||
+ <ab type='codeblock '> | ||
+or here: <http://example.com/> | ||
+</ab> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+ </div> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Images</head> | ||
+ <p>From <quote>Voyage dans la Lune</quote> by Georges Melies (1902):</p> | ||
+ <p><figure> | ||
+ <head>lalune</head> | ||
+ <graphic url="lalune.jpg" /> | ||
+ <figDesc>fig:Voyage dans la Lune</figDesc> | ||
+ </figure></p> | ||
+ <p>Here is a movie <figure> | ||
+ <head>movie</head> | ||
+ <graphic url="movie.jpg" /> | ||
+ </figure> icon.</p> | ||
+ <milestone unit="undefined" type="separator" rendition="line" /> | ||
+</div> | ||
+<div type="level1"> | ||
+ <head>Footnotes</head> | ||
+ <p>Here is a footnote reference,<note> | ||
+ <p>Here is the footnote. It can go anywhere after the footnote reference. | ||
+ It need not be placed at the end of the document.</p> | ||
+ </note> and another.<note> | ||
+ <p>Here’s the long note. This one contains multiple blocks.</p> | ||
+ <p>Subsequent blocks are indented to show that they belong to the footnote | ||
+ (as with list items).</p> | ||
+ <ab type='codeblock '> | ||
+ { <code> } | ||
+</ab> | ||
+ <p>If you want, you can indent every line, but you can also be lazy and | ||
+ just indent the first line of each block.</p> | ||
+ </note> This should <hi rendition="simple:italic">not</hi> be a footnote | ||
+ reference, because it contains a space.[^my note] Here is an inline | ||
+ note.<note> | ||
+ <p>This is <hi rendition="simple:italic">easier</hi> to type. Inline notes | ||
+ may contain <ref target="http://google.com">links</ref> and | ||
+ <seg type="code">]</seg> verbatim characters, as well as [bracketed | ||
+ text].</p> | ||
+ </note></p> | ||
+ <quote> | ||
+ <p>Notes can go in quotes.<note> | ||
+ <p>In quote.</p> | ||
+ </note></p> | ||
+ </quote> | ||
+ <list type="ordered:arabic"> | ||
+ <item> | ||
+ <p>And in list items.<note> | ||
+ <p>In list.</p> | ||
+ </note></p> | ||
+ </item> | ||
+ </list> | ||
+ <p>This paragraph should not be part of the note, as it is not indented.</p> | ||
+</div> | ||
+</body> | ||
+</text> | ||
+</TEI> |
Showing you all comments on commits in this comparison.
Nice !
I just have a question (unrelated to this commit), is there a special argument or a way to prevent the italic on the markdown generated links ? In my docx In-file the links have a regular style but there are all converted with surrounded '*' in the markdown out-file.
The problem is that your file explicitly tells word to underline the hyperlink, and underlines are understood as emphasis. Usually the underline is built into the hyperlink style, so we can ignore it. I could consider ignoring underlines in a hyperlink in general, but that could be tricky. (What if someone changes their hyperlink style, but still wants to use underline for emphasis?) I think this comes out of a problem with the copy-paste job that created the file. Do you have this problem with the file you created from scratch?
Note you could write a pandoc filter to unitalicize links pretty easily. (I could help you with it some other time, but it should be fairly trivial given the procedures outlines in the documentation.)
I tried to do something but I'm stuck with an error.
According to this forum on python filters, "Link" seem to expect 2 arguments but after I tried making this filter for links:
from pandocfilters import toJSONFilter, Link
def linksimple(key, value, format, meta):
if key == 'Link':
return Link(value[0],value[1])
if __name__ == "__main__":
toJSONFilter(linksimple)
It throw me this error:
ValueError: Link expects 3 arguments, but given 2
full detail of the error here:
$ pandoc -s -o sauceFF.odt kbcorrect.odt -F ./ln.py
Traceback (most recent call last):
File "./ln.py", line 15, in <module>
toJSONFilter(linksimple)
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 46, in toJSONFilter
toJSONFilters([action])
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 76, in toJSONFilters
altered = reduce(lambda x, action: walk(x, action, format, doc[0]['unMeta']), actions, doc)
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 76, in <lambda>
altered = reduce(lambda x, action: walk(x, action, format, doc[0]['unMeta']), actions, doc)
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 34, in walk
array.append(walk(item, action, format, meta))
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 27, in walk
array.append(walk(item, action, format, meta))
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 39, in walk
obj[k] = walk(x[k], action, format, meta)
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 25, in walk
res = action(item['t'], item['c'], format, meta)
File "./ln.py", line 12, in linksimple
return Link("sauce", [value[0],value[1]])
File "C:\Users\etudiant\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pandocfilters.py", line 119, in fun
+ str(lenargs))
ValueError: Link expects 3 arguments, but given 2
pandoc.exe: Error running filter ./ln.py
Filter returned error status 1
There are three arguments to Link in the newest version of pandoc. I have to admit that I don't know much about the python filters, so there might be a better way to do this, but the below should work. (The only problem with it is that it deals with the JSON directly in one place, which could be a problem if the JSON format changes.) You might be able to get some improvements on the pandoc-discuss list. In any case, it should work for the document you're dealing with.
from pandocfilters import toJSONFilter, Link, Emph
def linksimple(key, value, format, meta):
if key == 'Link':
ils = value[1]
# move the inlines into a variable.
newval = ils
# If there is only one element in the inlines and it has a
# type...
if len(ils) == 1 and "t" in ils[0]:
# And that type is emph
if ils[0]["t"] == "Emph":
# we unwrap the inlines from that emph
newval = ils[0]["c"]
return Link(value[0],newval, value[2])
if __name__ == "__main__":
toJSONFilter(linksimple)
stack complains about the use of aeson-0.11
instead of aeson-0.11.0.0
:
Populated index cache.
Didn't see aeson-0.11 in your package indices.
Updating and trying again.
Updating package index Hackage (mirrored at https://github.co/commercialhaskell
Fetched package index.
Populated index cache.
The following package identifiers were not found in your indices: aeson-0.11
Possible candidates: aeson-0.11.0.0.
But changing stack.yaml to aeson-0.11.0.0
produces unresolvable dependency problems.
At the top of the releases page the version number 1.16.0.1 is missing. I'm wondering if it's manually added to that page? Would it be useful to include the release dates here?