Commit graph

3626 commits

Author SHA1 Message Date
John MacFarlane
ba7868765a HTML writer: Better support for raw LaTeX environments.
Previously we just passed all raw TeX through when MathJax
was used for HTML math.  This passed through too much.
With this patch, only raw LaTeX environments that MathJax
can handle get passed through.

This patch also causes raw LaTeX environments to be treated
as math, when possible, with MathML and WebTeX output.

Closes #2758.
2016-06-22 11:47:44 -07:00
Albert Krewinkel
7df656089f Org reader: remove partial functions
Partial functions like `head` lead to avoidable errors and should be
avoided.  They are replaced with total functions.

This fixes #2991.
2016-06-21 23:51:15 +02:00
John MacFarlane
58d60b1c85 Changed email-obfuscation default to no obfuscation.
- `writerEmailObfuscation` in `defaultWriterOptions` is now
  `NoObfuscation`
- the default for the command-line `--email-obfuscation` option is
  now `none`.

Closes #2988.
2016-06-20 10:37:23 -07:00
Albert Krewinkel
29552eff3e Org reader: support arbitrary raw inlines
Org mode allows arbitrary raw inlines ("export snippets" in Emacs
parlance) to be included as `@@format:raw foreign format text@@`.

Support for this features is added to the Org reader.
2016-06-13 23:53:14 +02:00
Albert Krewinkel
cf2502de8f Org writer: support arbitrary raw inlines
Org mode allows arbitrary raw inlines ("export snippets" in Emacs
parlance) to be included as `@@format:raw foreign format text@@`.

Support for this features is added to the Org writer.
2016-06-13 23:13:05 +02:00
Ivo Clarysse
240cdfd1b3 Docbook writer: Declare xlink namespace in Docbook5 output 2016-06-07 06:03:06 -07:00
Albert Krewinkel
8a9f5915ab Org reader: add support for "Berkeley-style" cites
A specification for an official Org-mode citation syntax was drafted by
Richard Lawrence and enhanced with the help of others on the orgmode
mailing list.  Basic support for this citation style is added to the
reader.

This closes #1978.
2016-06-05 11:28:57 +02:00
Albert Krewinkel
06dfe3276d Org reader: add semicolon to list of special chars
Semicolons are used as special characters in citations syntax.  This
ensures the correct parsing of Pandoc-style citations:

    [prefix; @key; suffix]

Previously, parsing would have failed unless there was a space or other
special character as the last <prefix> character.
2016-06-05 11:28:57 +02:00
Albert Krewinkel
f56792927f
Org reader: support special strings export option
Parsing of special strings (like '...' as ellipsis or '--' as en dash)
can be toggled using the `-` option.
2016-06-03 11:41:23 +02:00
Albert Krewinkel
d4de8451b9 Org reader: support emphasized text export option
Parsing of emphasized text can be toggled using the `*` option.  This
influences parsing of text marked as emphasized, strong, strikeout, and
underline.  Parsing of inline math, code, and verbatim text is not
affected by this option.
2016-06-03 11:17:02 +02:00
Albert Krewinkel
952a7dac58 Org reader: support smart quotes export option
Reading of smart quotes can be toggled using the `'` option.
2016-06-03 11:16:35 +02:00
Albert Krewinkel
729fca311f Org reader: drop unused field from parser state
The `OrgParserState` contained both an `orgStateMeta` and
`orgStateMeta'` field, the former for plain meta information and the
latter for F-monad wrapped meta info.  The plain meta info is only used
to make `OrgParserState` an instance of the `HasMeta` class, which in
turn is never used in the reader.  The (F Meta) version is hence renamed
to the "un-primed" version while the other one is dropped.
2016-06-02 15:30:21 +02:00
Albert Krewinkel
512bf2eebf Org reader: undo code duplication
Some code was duplicated (copy-pasted) or placed in an inappropriate
module during the modularization refactoring.  Those functions are moved
into a `Shared` module, as was originally intended but forgotten.
Better documentation of the respective functions is a positive
side-effect.
2016-06-02 15:30:20 +02:00
John MacFarlane
061bc60f70 Merge pull request #2950 from tarleb/org-ref-support
Org reader: support org-ref style citations
2016-05-31 12:44:29 -07:00
John MacFarlane
669ecbd4ab Merge pull request #2954 from tarleb/org-export-blocks
Org export blocks
2016-05-31 11:16:08 -07:00
John MacFarlane
561afac0bc brazilian -> brazil for polyglossia.
Closes #2953.
2016-05-31 11:15:21 -07:00
Albert Krewinkel
c17c62a2c7 Org reader: support new syntax for export blocks
Org-mode version 9 usees a new syntax for export blocks.  Instead of
`#+BEGIN_<FORMAT>`, where `<FORMAT>` is the format of the block's
content, the new format uses `#+BEGIN_export <FORMAT>` instead.  Both
types are supported.
2016-05-29 21:08:50 +02:00
Albert Krewinkel
4f84cf02c7 Org reader: refactor BEGIN…END block parsing
- Reorder functions, grouping related functions together.

- Demote simple functions to local functions if they are used just once.

- Rename and document functions to increase code readability.

- Fix handling of whitespace in blocks, allowing content to be indented
  less then the block header.
2016-05-29 21:08:36 +02:00
Albert Krewinkel
bc82123122 Org reader: rename parseInlines to inlines
Having a function starting with `parse` in a parsing library is overly
redundant.  Let's use a nicer, shorter name more in line with the rest
of the library.
2016-05-29 21:08:31 +02:00
Albert Krewinkel
f226cb88b0 Org reader: support org-ref style citations
The *org-ref* package is an org-mode extension commonly used to manage
citations in org documents.  Basic support for the `cite:citeKey` and
`[[cite:citeKey][prefix text::suffix text]]` syntax is added.
2016-05-27 21:19:28 +02:00
Albert Krewinkel
eea6d6568f Org reader: extract blocks parser to module
Block parsing code is moved to a separate module.

This is part of the Org-mode reader cleanup effort.
2016-05-25 23:21:40 +02:00
Albert Krewinkel
39e8b4276e Org reader: extract inline parser to module
Inline parsing code is moved to a separate module.  Parsers for block
starts are extracted as well, as those are used in the `endline` parser.

This is part of the Org-mode reader cleanup effort.
2016-05-25 22:54:45 +02:00
Albert Krewinkel
a340c7249f Org reader: extract parsing function to module
The Org-mode reader uses many functions defined in the
`Text.Pandoc.Parsing` utility module.  Some of the functions are
overwritten with versions adapted to Org-mode idiosyncrasies.  These
special functions, as well as the normal Pandoc versions, are combined
in a single module to increase the ease of use.

This leads to decoupling of Org-mode and Pandoc and hence to slightly
cleaner code.  The downside is code-bloat due to repeated import/export
statements.
2016-05-25 22:53:55 +02:00
mb21
340f0aaef8 EPUB Reader: normalise Link id as well 2016-05-24 17:42:37 +02:00
Carlos Sosa
5667e0959a Org writer: add drawer capability
For the implementation of the Drawer element in the Org Writer, we make
use of a generic Block container with attributes.  The presence of a
`drawer` class defines that the `Div` constructor is a drawer. The first
class defines the drawer name to use. The key-value list in the
attributes defines the keys to add inside the Drawer. Lastly, the list
of Block elements contains miscellaneous blocks elements to add inside
of the Drawer.

Signed-off-by: Albert Krewinkel <albert@zeitkraut.de>
2016-05-23 10:00:14 +02:00
Albert Krewinkel
a4717c2fc5 Org reader: respect drawer export setting
The `d` export option can be used to control which drawers are exported
and which are discarded.  Basic support for this option is added here.
2016-05-23 09:44:37 +02:00
Albert Krewinkel
f3d27e4c80 Org reader/writer: use CUSTOM_ID in properties
The `ID` property is reserved for internal use by Org-mode and should
not be used.  The `CUSTOM_ID` property is to be used instead, it is
converted to the `ID` property for certain export format.

The reader and writer erroneously used `ID`.  This is corrected by using
`CUSTOM_ID` where appropriate.
2016-05-22 23:01:47 +02:00
John MacFarlane
446cf6a1cf HTML reader: fixed bug in pClose.
This caused exponential parsing behavior in documnets
with unclosed tags in dl, dd, dt.
2016-05-21 23:05:00 -07:00
Albert Krewinkel
cd3282b08d Org writer: add :PROPERTIES: drawer support
This allows header attributes to be added to org documents in the form
of `:PROPERTIES:` drawers.  All available attributes are stored as
key/value pairs.  This reflects the way the org reader handles
`:PROPERTIES:` blocks.

This closes #1962.
2016-05-20 17:01:50 +02:00
Albert Krewinkel
68d388f833 Org reader: add :PROPERTIES: drawer support
Headers can have optional `:PROPERTIES:` drawers associated with them.
These drawers contain key/value pairs like the header's `id`.  The
reader adds all listed pairs to the header's attributes; `id` and
`class` attributes are handled specially to match the way `Attr` are
defined.

This also changes behavior of how drawers of unknown type are handled.
Instead of including all unknown drawers, those are not read/exported,
thereby matching current Emacs behavior.

This closes #1877.
2016-05-20 17:01:26 +02:00
John MacFarlane
0958f2f5d0 Merge pull request #2927 from tarleb/org-attr-html
Org reader support for ATTR_HTML statements
2016-05-19 10:44:11 -07:00
Albert Krewinkel
16e233475a Org reader: add support for ATTR_HTML attributes
Arbitrary key-value pairs can be added to some block types using a
`#+ATTR_HTML` line before the block.  Emacs Org-mode only includes these
when exporting to HTML, but since we cannot make this distinction here,
the attributes are always added.

The functionality is now supported for figures.

This closes #1906.
2016-05-19 09:55:12 +02:00
Albert Krewinkel
26e8d98be2 Org reader: use custom anyLine
Additional state changes need to be made after a newline is parsed,
otherwise markup may not be recognized correctly.

This fixes a bug where markup after certain block-types would not be
recognized. E.g. `/emph/` in the following snippet was not parsed as
emphasized.

    foo
    # comment
    /emph/
2016-05-19 09:35:47 +02:00
Albert Krewinkel
1dda535378 Org reader: refactor block attribute handling
A parser state attribute was used to keep track of block attributes
defined in meta-lines.  Global state is undesirable, so block attributes
are no longer saved as part of the parser state.  Old functions and the
respective part of the parser state are removed.
2016-05-19 09:33:51 +02:00
John MacFarlane
847167804a EPUB reader: unescape URIs in spine.
This should fix #2924.

Testing on the epub that caused the problem originally
would be welcome.
2016-05-17 09:38:52 -07:00
John MacFarlane
7be30a40f1 LaTeX writer: Don't escape underscore in labels.
Previously they were escaped as ux5f.

Closes #2921.
2016-05-17 09:18:52 -07:00
John MacFarlane
344412cba8 Merge pull request #2894 from sid-kap/rst-code-class
Add class option for code block in RST reader
2016-05-12 00:03:14 -07:00
John MacFarlane
609fb33302 Merge pull request #2913 from jlduran/strut-minipage-tables
Retake on strut with \minipage inside tables
2016-05-11 23:57:47 -07:00
John MacFarlane
3800cb3d42 Merge pull request #2912 from tarleb/org-export-settings
Org reader: basic support for export settings
2016-05-11 13:36:02 -07:00
Albert Krewinkel
be5cccf248 Org reader: parse but ignore export options
All known export options are parsed but ignored.
2016-05-11 19:13:43 +02:00
Albert Krewinkel
76143de97e Org reader: add support for sub/superscript export options
Org-mode allows to specify export settings via `#+OPTIONS` lines.
Disabling simple sub- and superscripts is one of these export options,
this options is now supported.
2016-05-11 19:13:43 +02:00
Albert Krewinkel
7a0729ea09 Org reader: move parser state into separate module
The org reader code has become large and confusing.  Extracting smaller
parts into submodules should help to clean things up.
2016-05-11 19:13:42 +02:00
Jose Luis Duran
ec2fc30288 Retake on strut with \minipage inside tables
Reimplement on 4c684561ee

The problem with 4c68456 was a space between the cell contents and the
`\strut` that affected the alignment.
2016-05-11 14:02:09 -03:00
John MacFarlane
f7601297f0 Avoid lazy foldl in LaTeX writer. 2016-05-09 18:25:57 -07:00
John MacFarlane
fd9ec835ec Merge pull request #2907 from tarleb/org-fixes
Org fixes (reader and writer)
2016-05-09 10:17:56 -07:00
Albert Krewinkel
d32878b84b Org writer: print empty table rows
Empty table rows should not be dropped from the output, so row-height is
always set to be at least 1.
2016-05-09 19:06:24 +02:00
Albert Krewinkel
10a809f126 Org reader: fix inline-LaTeX regression
The last fix for whitespace handling of inline LaTeX commands was
incorrect, preventing correct recognition of inline LaTeX commands which
contain spaces.  This fix ensures that only trailing whitespace is cut
off.
2016-05-09 19:06:04 +02:00
roblabla
acd492c7f4 Allow spaces before '!' in MediaWiki table header 2016-05-09 17:54:40 +02:00
John MacFarlane
21d1a3b57c Merge pull request #2898 from tarleb/org-table-refactoring
Org reader: table parsing code refactoring and fixes
2016-05-05 16:22:56 -07:00
Albert Krewinkel
405c3e9c36 Org reader: fix spacing after LaTeX-style symbols
The org-reader was droping space after unescaped LaTeX-style symbol
commands: `\ForAll \Auml` resulted in `∀Ä` but should give `∀ Ä`
instead.  This seems to be because the LaTeX-reader treats the
command-terminating space as part of the command.  Dropping the trailing
space from the symbol-command fixes this issue.
2016-05-04 23:16:23 +02:00
Albert Krewinkel
2d825603c6 Org reader: fix handling of empty table cells, rows
This fixes Org mode parsing of some corner cases regarding empty cells
and rows.  Empty cells weren't parsed correctly, e.g. `|||` should be
two empty cells, but would be parsed as a single cell containing a pipe
character.  Empty rows where parsed as alignment rows and dropped from
the output.

This fixes #2616.
2016-05-04 16:02:03 +02:00
Albert Krewinkel
a51e4e8215 Org reader: refactor rows-to-table conversion
This refactores the codes conversing a list table lines to an org table
ADT.  The old code was simplified and is now slightly less ugly.
2016-05-04 16:01:22 +02:00
Albert Krewinkel
d5e4bc179c Org reader: stop padding short table rows
Emacs Org-mode doesn't add any padding to table rows.  The first
row (header or first body row) is used to determine the column count, no
other magic is performed.

The org reader was padding rows to the length of the longest table row.
This was done due to a misunderstanding of how Org handles tables.  This
feature reflected how Org-mode handles tables when pressing <TAB>.  The
Org exporter however, which is what the reader should implement, doesn't
do any of this.  So this was a mis-feature that made the reader more
complex and reduced comparability.  It was hence removed.
2016-05-04 15:48:07 +02:00
John MacFarlane
ee4e863225 Merge pull request #2890 from bcdevices/docbook5-writer
Docbook5 write support
2016-05-01 22:43:38 -07:00
Sidharth Kapur
490c2b543d Add class option for code block in RST reader
According to http://docutils.sourceforge.net/docs/ref/rst/directives.html#code,
the code directive supports the ":class:" option.
2016-05-01 21:42:58 -05:00
Jesse Rosenthal
99eac312fe Binary fmts throw PandocError on zip-archive fail
Commit 91dc3342 made `readDocx` throw PandocError if there was an
unarchiving error. This extends that fix to `readOdt` and `readEPUB`.
2016-05-01 18:27:20 -04:00
John MacFarlane
1fbe79db05 LaTeX writer: use {} around options containing special chars.
Closes #2892.
2016-05-01 11:20:26 -07:00
Jesse Rosenthal
91dc334249 Docx Reader: Throw PandocError on unzip failure
Previously, readDocx would error out if zip-archive failed. We change
the archive extraction step from `toArchive` to `toArchiveOrFail`, which
returns an Either value.
2016-05-01 12:17:12 -04:00
Ivo Clarysse
fd36e6b64a Docbook5 writer: Properly handle ulink/link 2016-04-29 16:06:55 -07:00
Ivo Clarysse
987ec3a752 Write out Docbook 5 namespace 2016-04-29 15:43:15 -07:00
John MacFarlane
aa4a1d527a HTML writer: ensure mathjax link is added when math appears in footnote.
Previously if a document only had math in a footnote,
the MathJax link would not be added.

Closes #2881.
2016-04-29 14:54:54 -07:00
Ivo Clarysse
271cb4d845 Add docbook5 writer support 2016-04-29 14:00:46 -07:00
John MacFarlane
32f1b0a5f1 Revert "LaTeX writer: Add \strut to fix multiline tables"
This reverts commit 4c684561ee.

See
https://groups.google.com/d/msg/pandoc-discuss/u6J-_aCProU/UufN3IYRAgAJ

This should fix uneven spacing issues in multiline tables.
2016-04-27 17:25:45 -07:00
John MacFarlane
ece215ed7d Merge pull request #2735 from mb21/patch-1
LaTeX Writer: fix polyglossia to babel env mapping
2016-04-26 23:09:02 -07:00
John MacFarlane
cc0527bf31 Merge pull request #2829 from adunning/patch-1
LaTeX writer: Add missing languages.
2016-04-26 23:08:15 -07:00
John MacFarlane
cc82851a6a Merge pull request #2876 from shosti/org-code-indent
Ignore leading space in org code blocks
2016-04-26 23:07:29 -07:00
John MacFarlane
1985164816 LaTeX writer: ignore --incremental unless -t beamer.
Closes #2843.
2016-04-26 21:50:37 -07:00
Emanuel Evans
1bfe39e24c
Ignore leading space in org code blocks
Fixes #2862

Also fix up tab handling for leading whitespace in code blocks.
2016-04-26 10:29:59 -07:00
Jesse Rosenthal
a385ee1d4f Docx Reader: parse moveTo and moveFrom
`moveTo` and `moveFrom` are track-changes tags that are used when a
block of text is moved in the document. We now recognize these tags and
treat them the same as `insert` and `delete`, respectively. So,
`--track-changes=accept` will show the moved version, while
`--track-changes=reject` will show the original version.
2016-04-15 14:09:18 -04:00
John MacFarlane
4b49f923cb Markdown reader: Fix pandoc title blocks with lines ending in 2 spaces.
Closes #2799.

Also added -s to markdown-reader-more test.
2016-04-10 09:13:53 -07:00
John MacFarlane
773bbb8fc7 Markdown + HTML readers: be more forgiving about unescaped &.
We are now more forgiving about parsing invalid HTML with
unescaped `&` as raw HTML.  (Previously any unescaped `&`
would cause pandoc not to recognize the string as raw HTML.)

Closes #2410.
2016-04-10 07:39:36 -07:00
Andrew Dunning
9765ef2ce6 LaTeX writer: Add missing languages.
Updates the list from the hyphenation files at <http://mirror.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/loadhyph/>.
2016-04-01 16:47:33 +01:00
Andrew Dunning
0c37a7c488 Recognize la-x-classic as Classical Latin.
This allows one to access the hyphenation patterns at <http://mirrors.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex/hyph-la-x-classic.tex>, using its private language tag.
2016-03-30 14:15:47 +01:00
John MacFarlane
f74498cb47 EPUB writer: set 'navpage' variable on nav page.
This allows templates to treat it differently.
2016-03-26 13:14:50 -07:00
John MacFarlane
9742c48647 Removed two superfluous lines. 2016-03-25 09:05:38 -07:00
John MacFarlane
f47b369f37 LaTeX writer: better positioning for hypertarget in figures.
Closes #2813.
2016-03-24 16:44:33 -07:00
John MacFarlane
bb6897a13e LaTeX writer: Fixed position of label in figures.
Partially addresses #2813.

This isn't perfect, because now the hypertarget is in the
wrong place -- when you link to the figure, the screen
is positioned with the caption at the top, and most of
the figure off screen.

So this needs a bit more tweaking.
2016-03-24 09:41:45 -07:00
John MacFarlane
499985c1a3 Updated copyright dates to include 2016. 2016-03-22 17:20:39 -07:00
John MacFarlane
b1ffdf3b01 Fixed bug in Markdown raw HTML parsing.
This was a regression, with the rewrite of `htmlInBalanced`
(from `Text.Pandoc.Readers.HTML`) in 1.17.

It caused newlines to be omitted in raw HTML blocks.

Closes #2804.
2016-03-22 16:56:10 -07:00
Mauro Bieg
44f95484a4 LaTeX Writer: fix polyglossia to babel env mapping
allow for optional argument in square brackets, closes #2728
2016-03-20 19:17:30 +01:00
John MacFarlane
3af753de47 Merge pull request #2637 from mb21/latex-figure-label
LaTeX writer: figure label
2016-03-19 13:56:14 -07:00
John MacFarlane
976e7e2054 ConTeXt writer: fix whitespace at line beginning in line blocks.
Add a `\strut` after `\crlf` before space.
Closes #2744, #2745.  Thanks to @c-foster.
This uses the fix suggested by @c-foster.

Mid-line spaces are still not supported, because of limitations
of the Markdown parser.
2016-03-18 16:36:56 -07:00
John MacFarlane
e821b05125 LaTeX writer: Avoid double toprule in headerless table with caption.
Closes #2742.
2016-03-18 16:16:18 -07:00
Jesse Rosenthal
28c7617f19 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`.
2016-03-18 09:38:26 -04:00
Jesse Rosenthal
855c8b43f0 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.
2016-03-16 12:50:32 -04:00
Jesse Rosenthal
5c055b4cf3 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`.
2016-03-15 12:52:51 -04:00
Jesse Rosenthal
68fd333ec4 Add a general ByteStringReader with warnings.
Have docx reader use it.
2016-03-12 17:08:20 -05:00
Jesse Rosenthal
ee03e954d0 Add readDocxWithWarnings
The regular readDocx just becomes a special case.
2016-03-12 17:08:20 -05:00
Jesse Rosenthal
102ba9ecb8 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.
2016-03-12 17:08:20 -05:00
John MacFarlane
a485c42d78 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.
2016-03-10 19:59:55 -08:00
mb21
139fa54d48 Docx Writer: handle image alt text
closes #2754
2016-03-10 08:56:08 +01:00
John MacFarlane
2b55b76ebe Markdown reader: Improved pipe table parsing.
Fixes #2765.
Added test case.
2016-03-09 11:46:00 -08:00
John MacFarlane
54a68616d7 Markdown reader: Clean up pipe table parsing. 2016-03-09 10:11:32 -08:00
John MacFarlane
6e950a8eb5 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.
2016-03-09 08:44:31 -08:00
John MacFarlane
4ed64835cb 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.
2016-03-09 08:33:13 -08:00
John MacFarlane
6bfaa5ad15 DokuWiki writer: use $$ for display math. 2016-03-08 10:08:14 -08:00
Jesse Rosenthal
0b9c54d9f3 Docx reader: update feature checklist.
The feature checklist in the source code was out of date. Update.
2016-03-08 00:36:13 -05:00
John MacFarlane
7c6a3c0f69 LaTeX reader: handle interior $ characters in math.
e.g. `$$\hbox{$i$}$$`.

Partially addresses #2743.
2016-02-28 11:14:03 -08:00
Jesse Rosenthal
a7a0b452a5 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.
2016-02-26 08:57:53 -05:00
John MacFarlane
f2bd6fd37c Make protocol-relative URIs work again.
Closes #2737.
2016-02-23 21:58:10 -08:00
John MacFarlane
04d1e40f37 Markdown reader: use htmlInBalanced for rawVerbatimBlock.
This should give better performance.

See #2730.
2016-02-21 07:56:41 -08:00
John MacFarlane
9693de7f59 Fixed some linter warnings. 2016-02-20 22:16:39 -08:00
John MacFarlane
29706ee02d Merge pull request #2646 from tarleb/org-figure-with-no-name
Prefix even empty figure names with "fig:"
2016-02-20 21:44:39 -08:00
John MacFarlane
649cfb61b8 Merge pull request #2668 from monofon/fix/yaml-metadata-block-bottom-line
Markdown writer: Use hyphens for yaml metadata block bottom line
2016-02-20 21:43:15 -08:00
John MacFarlane
e369e60fb4 Merge pull request #2691 from tarleb/org-image-file-links
Org reader: Refactor link-target processing
2016-02-20 21:42:12 -08:00
John MacFarlane
1534052dd9 HTML reader: rewrote htmlInBalanced.
This version avoids an exponential performance problem with `<script>` tags,
and it should be faster in general.

Closes #2730.
2016-02-20 15:00:31 -08:00
Jesse Rosenthal
4438ff17fb LaTeX writer: clean up options parser.
Make sure that we require the closing bracket.
2016-02-18 23:35:38 -05:00
Jesse Rosenthal
4112b321cd 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.
2016-02-18 22:32:38 -05:00
John MacFarlane
b8dadc608a HTML reader: properly handle an empty cell in a simple table.
Closes #2718.
2016-02-16 11:05:51 -08:00
John MacFarlane
bbc67dee36 Removed tex_math_single_backslash from markdown_github options.
Closes #2707.
2016-02-09 22:30:52 -08:00
John MacFarlane
a692bd2872 Custom writer: Pass attributes parameter to CaptionedImage.
Closes #2697.
2016-02-05 16:49:27 -08:00
John MacFarlane
6cb4991f6b 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 4229cf2d92.
2016-02-04 12:09:26 -08:00
John MacFarlane
93a05dffd3 HTML writer: don't include alignment attribute for default table columns.
Previously these were given "left" alignment.  Better to leave off
alignment attributes altogether.

Closes #2694.
2016-02-03 13:31:21 -08:00
Jesse Rosenthal
2ee7752d14 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
2016-02-02 14:40:09 -05:00
Albert Krewinkel
92e6ae47f6 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.
2016-01-31 23:23:09 +01:00
John MacFarlane
18745585c1 LaTeX reader: inlineCommand now gobbles an empty {} after any command.
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.
2016-01-31 10:52:46 -08:00
John MacFarlane
a02c26d9f4 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..
2016-01-29 11:51:01 -08:00
John MacFarlane
76983c31f2 Properly handle LaTeX "math" environment as inline math.
See #2171.
2016-01-29 10:11:45 -08:00
John MacFarlane
a1021bdda6 Textile reader: Support >, <, =, <> text alignment attributes.
Closes #2674.
2016-01-25 09:34:49 -08:00
John MacFarlane
11c5831a1f Make language extensions trigger highlighting.
For example, `py` will now work as well as `python`.
Closes jgm/highlighting-kate#83.
2016-01-24 14:15:06 -08:00
John MacFarlane
20170c328f Changed type of Shared.uniqueIdent argument from [String] to Set String.
This avoids performance problems in documents with many identically
named headers.

Closes #2671.
2016-01-22 10:16:47 -08:00
John MacFarlane
3b39b16a4b Merge pull request #2638 from c-forster/teiwriter
Add TEI Writer.
2016-01-21 15:23:50 -08:00
Henrik Tramberend
556d0c1810 Markdown writer: Use hyphens for yaml metadata block bottom line 2016-01-21 12:44:16 +01:00
Henrik Tramberend
7a18879a36 LaTeX writer: Allow more flexible table alignment 2016-01-20 13:21:26 +01:00
John MacFarlane
4d74a966c4 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.
2016-01-19 14:03:57 -05:00
csforste
25a9ca697a Add TEI Writer. 2016-01-19 14:03:57 -05:00
John MacFarlane
f2c0974a26 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.
2016-01-14 10:55:04 -08:00
John MacFarlane
f45a8e1d3b Org writer - pass through RawInline with format "org". 2016-01-13 23:01:51 -08:00
Albert Krewinkel
fabbd1aa79 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.
2016-01-11 22:23:59 +01:00
John MacFarlane
f34382ef2c Depend on deepseq rather than deepseq-generics.
See fpco/stackage#1096.
2016-01-11 12:49:28 -08:00
John MacFarlane
8611ac56a6 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.
2016-01-11 12:17:49 -08:00
mb21
1fde92053f LaTeX writer: figure label 2016-01-10 13:30:32 +01:00
John MacFarlane
1506e62f48 LaTeX writer: restore old treatment of Span.
A Span is rendered with surrounding {braces}.

This was a regression in 1.16.  Closes #2624.
2016-01-09 12:16:24 -08:00
John MacFarlane
729911ad74 Fixed shadowing warning. 2016-01-08 20:20:37 -08:00
John MacFarlane
5884ff6994 Work around tagsoup bug - not allowing uppercase x in hex entities.
Issue submitted at tagsoup.
2016-01-08 17:33:32 -08:00
John MacFarlane
12a5bd3c8d 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. `&lang;`.
2016-01-08 17:08:01 -08:00
John MacFarlane
9320d359a2 Merge pull request #2629 from tarleb/org-noexport-fix
Fix function dropping subtrees tagged :noexport:
2016-01-07 11:34:27 -08:00
Albert Krewinkel
b3b00da43d Fix function dropping subtrees tagged :noexport:
Continue scanning for comment subtrees beyond only the first block.

Note to self: when writing an recursive function, don't forget to, you
know, actually recurse.

Shout to @mrvdb for noticing this.

This fixes #2628.
2016-01-07 19:56:44 +01:00
John MacFarlane
c4fdf28815 Markdown reader: renormalize table column widths if they exceed 100%.
Closes #2626.
2016-01-07 10:40:30 -08:00
John MacFarlane
a796538d84 RST, Markdown writers: Fixed rendering of grid tables with blank rows.
Closes #2615.
2016-01-05 14:04:10 -08:00
John MacFarlane
4990350fc7 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.
2016-01-04 22:44:50 -08:00
John MacFarlane
97c9691696 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>
2016-01-02 22:34:06 -08:00
John MacFarlane
75695b1817 MediaWiki reader: interpret markup inside <tt>, <code>.
Closes #2607.
2016-01-02 12:26:16 -08:00
John MacFarlane
a68e072bac MediaWiki writer: fix spacing issues.
+ Start cell on new line unless it's a single Para or Plain.
+ For single Para or Plain, insert a space after the `|` to
  avoid problems when the text begins with a character like
  `-`.

Closes #2604, closes #2606.
2016-01-02 12:14:12 -08:00
John MacFarlane
b27783e2ec Use cmark 0.5.
Closes #2605.
2015-12-29 19:52:06 -08:00
John MacFarlane
297345098d ConTeXt writer: set default layout based on margin-left, etc.
This sets up `\setuplayout` based on the variables `margin-left`,
`margin-right`, `margin-bottom`, and `margin-top`, if no layout
is given.
2015-12-22 13:28:11 -08:00
John MacFarlane
f9202f5d39 LaTeX writer: create defaults for geometry using margin-left etc.
If `geometry` has no value, but `margin-left`, `margin-right`,
`margin-top`, and/or `-margin-bottom` are given, a default value
for `geometry` is created from these.

Note that these variables already affect PDF production via HTML5
with wkhtmltopdf.
2015-12-22 13:10:46 -08:00
John MacFarlane
35e0544977 LaTeX reader: allow blank space between braced arguments of commands.
For example

    \foo
    {bar}
    {baz}

Closes #2592.
2015-12-22 11:06:06 -08:00
John MacFarlane
46e38d0a0a Improved treatment of margins in wkhtmltopdf. 2015-12-21 23:47:03 -08:00
John MacFarlane
8b8bdca56a Allow setting margins from metadata variables for wkhtmltopdf.
Variables margin-top, margin-bottom, margin-left, margin-right.
Setting them with css inside @page doesn't seem to work, at least
with the released wkhtmltopdf.
2015-12-21 22:59:01 -08:00