Commit graph

1377 commits

Author SHA1 Message Date
John MacFarlane
7caaa3d5d6 Minor ghc 8.8 fixups. 2019-10-03 22:41:24 -07:00
Nils Carlson
8028de3322 odt: Add external option for native numbering
This adds an external options +native_numbering to the
ODT writer enabling enumeration of figures and tables in
ODT output.
2019-09-24 15:23:59 -07:00
John MacFarlane
f223196c35 Man writer: suppress non-absolute link URLs.
Motivation: in a man page there's not much use for relative URLs,
which you can't follow.  Absolute URLs are still useful.  We previously
suppressed relative URLs starting with '#' (purely internal links),
but it makes sense to go a bit farther.

Closes #5770.
2019-09-23 17:46:39 -07:00
John MacFarlane
e99050283e ConTeXt unit tests - tweak code property.
Inline code will never have two consecutive newlines.
We get a counterexample in this case

https://pipelines.actions.githubusercontent.com/bMXCpShstkkHbFPgw9hBRMWw2w9plyzdVM8r7CRPFBHFvidaAG/5cf52d2d-3804-412d-ae65-4f8c059b0fb7/_apis/pipelines/1/runs/116/signedlogcontent/39?urlExpires=2019-09-23T17%3A38%3A05.8358735Z&urlSigningMethod=HMACV1&urlSignature=Qtd6vnzqgSwXpAkIyp9DJY4Kn7GJzYMR8UDkLR%2FsMQY%3D

so for simplicity we just weed out code with newlines.
2019-09-23 15:03:26 -07:00
John MacFarlane
ba14649945 Improve test #5753 2019-09-22 22:00:20 -07:00
John MacFarlane
9abed45879 RST reader: Fixed parsing of indented blocks.
We were requiring consistent indentation, but this
isn't required by RST, as long as each nonblank
line of the block has *some* indentation.

Closes #5753.
2019-09-22 12:01:45 -07:00
John MacFarlane
d247e9f72e Make plain output plainer.
Previously we used the following Project Gutenberg conventions
for plain output:

- extra space before and after level 1 and 2 headings
- all-caps for strong emphasis `LIKE THIS`
- underscores surrounding regular emphasis `_like this_`

This commit makes `plain` output plainer. Strong and Emph
inlines are rendered without special formatting.  Headings
are also rendered without special formatting, and with only
one blank line following.

To restore the former behavior, use `-t plain+gutenberg`.

API change: Add `Ext_gutenberg` constructor to `Extension`.

See #5741.
2019-09-22 11:33:09 -07:00
Nikolay Yakimov
5c5d1a65d9 [Docx Reader] Update tests
Notice this commit updates lists.docx. The old test file contained
references to "ListParagraph" style, which should never leak
outside of pandoc, so I'm not sure what that was supposed to test
for exactly.
2019-09-21 11:37:21 -07:00
Nikolay Yakimov
c113ca6717 [Docx Reader] Use style names, not ids, for assigning semantic meaning
Motivating issues: #5523, #5052, #5074

Style name comparisons are case-insensitive, since those are
case-insensitive in Word.

w:styleId will be used as style name if w:name is missing (this should
only happen for malformed docx and is kept as a fallback to avoid
failing altogether on malformed documents)

Block quote detection code moved from Docx.Parser to Readers.Docx

Code styles, i.e. "Source Code" and "Verbatim Char" now honor style
inheritance

Docx Reader now honours "Compact" style (used in Pandoc-generated docx).
The side-effect is that "Compact" style no longer shows up in
docx+styles output. Styles inherited from "Compact" will still
show up.

Removed obsolete list-item style from divsToKeep. That didn't
really do anything for a while now.

Add newtypes to differentiate between style names, ids, and
different style types (that is, paragraph and character styles)

Since docx style names can have spaces in them, and pandoc-markdown
classes can't, anywhere when style name is used as a class name,
spaces are replaced with ASCII dashes `-`.

Get rid of extraneous intermediate types, carrying styleId information.
Instead, styleId is saved with other style data.

Use RunStyle for inline style definitions only (lacking styleId and styleName);
for Character Styles use CharStyle type (which is basicaly RunStyle with styleId
and StyleName bolted onto it).
2019-09-21 11:18:15 -07:00
Ben Steinberg
7389919bb4 Preserve built-in styles in DOCX with custom style (#5670)
This commit prevents custom styles on divs and spans from overriding
styles on certain elements inside them, like headings, blockquotes,
and links. On those elements, the "native" style is required for the
element to display correctly. This change also allows nesting of
custom styles; in order to do so, it removes the default "Compact"
style applied to Plain blocks, except when inside a table.
2019-09-20 22:13:29 -07:00
John MacFarlane
5a85789185 Remove admonition-title remnants.
Completes 8e01ccb41d
2019-09-19 16:09:38 -07:00
Albert Krewinkel
d0261d7387 Lua filters: allow passing of HTML-like tables instead of Attr (#5750)
Attr values can now be given as normal Lua tables; this can be used as a
convenient alternative to define Attr values, instead of constructing
values with `pandoc.Attr`. Identifiers are taken from the *id* field,
classes must be given as space separated words in the *class* field. All
remaining fields are included as misc attributes.

With this change, the following lines now create equal elements:

    pandoc.Span('test', {id = 'test', class = 'a b', check = 1})
    pandoc.Span('test', pandoc.Attr('test', {'a','b'}, {check = 1}))

This also works when using the *attr* setter:

    local span = pandoc.Span 'text'
    span.attr = {id = 'test', class = 'a b', check = 1}

Furthermore, the *attributes* field of AST elements can now be a plain
key-value table even when using the `attributes` accessor:

    local span = pandoc.Span 'test'
    span.attributes = {check = 1}   -- works as expected now

Closes: #5744
2019-09-15 12:11:58 -07:00
John MacFarlane
45b7636307 Revert "FB2 reader test: better diagnostics on failure."
This reverts commit c65af7d1a2.
2019-09-15 10:27:19 -07:00
John MacFarlane
c65af7d1a2 FB2 reader test: better diagnostics on failure. 2019-09-15 09:06:38 -07:00
John MacFarlane
88a0327579 FB2 reader test: Another attempt to fix test failure on GitHub CI. 2019-09-14 10:37:19 -07:00
John MacFarlane
7ecae69e27 Revert "FB2 reader test: filter CRs."
This reverts commit e35147d715.
2019-09-13 22:08:42 -07:00
John MacFarlane
e35147d715 FB2 reader test: filter CRs.
This may help with the test failure on GitHub CI.

b59e6d0376/checks
2019-09-13 16:50:00 -07:00
John MacFarlane
88dc6fac5d Add --shift-heading-level-by option.
Deprecate --base-heading-level.

The new option does everything the old one does, but also
allows negative shifts.  It also promotes the document
metadata (if not null) to a level-1 heading with a +1 shift,
and demotes an initial level-1 heading to document metadata
with a -1 shift. This supports converting documents that
use an initial level-1 heading for the document title.

Closes #5615.
2019-09-10 23:16:13 -07:00
John MacFarlane
4778d03473 LaTeX reader: Fix parsing of optional arguments that contain braced text.
Closes #5740.
2019-09-09 21:33:16 -07:00
Brian Leung
0558ea9836 Org reader: modify handling of example blocks. (#5717)
* Org reader: allow the `-i` switch to ignore leading spaces.

* Org reader: handle awkwardly-aligned code blocks within lists.

Code blocks in Org lists must have their #+BEGIN_ aligned in a
reasonable way, but their other components can be positioned otherwise.
2019-09-08 22:34:10 -07:00
John MacFarlane
9f984ff26a Replace Element and makeHierarchical with makeSections.
Text.Pandoc.Shared:

+ Remove `Element` type [API change]
+ Remove `makeHierarchicalize` [API change]
+ Add `makeSections` [API change]
+ Export `deLink` [API change]

Now that we have Divs, we can use them to represent the structure
of sections, and we don't need a special Element type.
`makeSections` reorganizes a block list, adding Divs with
class `section` around sections, and adding numbering
if needed.

This change also fixes some longstanding issues recognizing
section structure when the document contains Divs.
Closes #3057, see also #997.

All writers have been changed to use `makeSections`.
Note that in the process we have reverted the change
c1d058aeb1
made in response to #5168, which I'm not completely
sure was a good idea.

Lua modules have also been adjusted accordingly.
Existing lua filters that use `hierarchicalize` will
need to be rewritten to use `make_sections`.
2019-09-08 22:20:19 -07:00
John MacFarlane
1ccff3339d Revert changes to hierarchicalizeWithIds.
Revert "hierarchicalize: ensure that sections get ids..."
This reverts commit 212406a61d.

Revert "Improve detection of headings in Divs by hierarchicalize."
This reverts commit 6e2cfd6c97.

Revert "Shared.hierarchicalize: improve handling of div and section structure."
This reverts commit 345b33762e.
2019-09-08 21:56:42 -07:00
John MacFarlane
212406a61d hierarchicalize: ensure that sections get ids...
even if they're in divs.  Improves #3057.
2019-09-06 09:05:52 -07:00
John MacFarlane
6e2cfd6c97 Improve detection of headings in Divs by hierarchicalize.
The structure

```
<h1>one</h1>
<div>
<h1>two</h1>
</div>
```

should create two coordinate sections, not a section with
a subsection.  Now it does.

Extends #3057.
2019-09-06 08:44:59 -07:00
John MacFarlane
345b33762e Shared.hierarchicalize: improve handling of div and section structure.
Previously Divs were opaque to hierarchicalize, so headings
inside divs didn't get into the table of contents, for
example (#3057).

Now hierarchicalize treats Divs as sections when appropriate.
For example, these structures both yield a section and a
subsection:

``` html
<div>
<h1>one</h1>
<div>
<h2>two</h2>
</div>
</div>
```
``` html
<div>
<h1>one</h1>
<div>
<h1>two</h1>
</div>
</div>
```

Note that

``` html
<h1>one</h1>
<div>
<h2>two</h2>
</div>
<h1>three</h1>
```

gets parsed as the structure

    one
      two
    three

which may not always be desirable.

Closes #3057.
2019-09-05 22:37:13 -07:00
John MacFarlane
381654a704 Add div.hanging-indent CSS to HTML templates. 2019-09-05 12:42:23 -07:00
John MacFarlane
bb362fd76c Add partial styles.html in HTML5 template.
Avoid duplication in HTML templates by using styles.html partial.
Change indentation of styles in template.
2019-09-05 12:39:50 -07:00
John MacFarlane
0e31483d43 asciidoc writer: don't include + in code blocks for regular asciidoc.
This is asciidoctor-specific.

Amends 98ee6ca289.
2019-09-04 14:57:22 -07:00
John MacFarlane
e4cca4cf67 Roff readers: better parsing of groups.
We now allow groups where the closing `\\}` isn't at the
beginning of a line.

Closes #5410.
2019-09-04 09:24:42 -07:00
John MacFarlane
513058a24e XML: change toEntities to emit numerical hex character references.
Previously decimal references were used.
But Polyglot Markup prefers hex.  See #5718.

This affects the output of pandoc with `--ascii`.
2019-09-03 11:28:20 -07:00
John MacFarlane
6b286a1d74 LaTeX reader: don't try to parse includes if raw_tex is set.
When the `raw_tex` extension is set, we just carry through
`\usepackage`, `\input`, etc. verbatim as raw LaTeX.

Closes #5673.
2019-09-02 21:03:05 -07:00
John MacFarlane
d79242796b HTML writer: use numeric character references with --ascii.
Previously we used named character references with html5 output.
But these aren't valid XML, and we aim to produce html5 that is
also valid XHTML (polyglot markup).  (This is also needed for
epub3.)

Closes #5718.
2019-09-02 20:36:57 -07:00
John MacFarlane
5e708eb8ce LaTeX reader: properly handle optional arguments for macros.
Closes #5682.
2019-09-02 18:48:37 -07:00
John MacFarlane
fba1296fd1 LaTeX reader: fix \\ in \parbox inside a table cell.
Closes #5711.
2019-08-27 10:48:02 -07:00
John MacFarlane
167fc4bc87 Markdown reader: Headers: don't parse content over newline boundary.
Closes #5714.
2019-08-27 10:15:00 -07:00
Jesse Rosenthal
4a7dad18b1 PowerPoint writer: Start numbering at appopriate numbers.
Starting numbers for ordered lists were previously ignored. Now we
specify the number if it is something other than 1.

Closes: #5709
2019-08-27 01:24:41 -04:00
John MacFarlane
180f534d21 Add test for issue #5708. 2019-08-26 15:20:22 -07:00
John MacFarlane
1ee6e0e087 Use new doctemplates, doclayout.
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change]
+ Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON'
  [API change].
+ Text.Pandoc.Writers.Shared: modify `addVariablesToContext`,
  `defField`, `setField`, `getField`, `resetField` to work with
  Context rather than JSON values. [API change]
+ Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API
  change].
+ Use new templates and doclayout in writers.
+ Use Doc-based templates in all writers.
+ Adjust three tests for minor template rendering differences.
+ Added indentation to body in docbook4, docbook5 templates.

The main impact of this change is better reflowing of content
interpolated into templates.  Previously, interpolated variables
were rendered independently and intepolated as strings, which could lead
to overly long lines.  Now the templates interpolated as Doc values
which may include breaking spaces, and reflowing occurs
after template interpolation rather than before.
2019-08-25 14:24:31 -07:00
Owen McGrath
92debe4b9e Change optMetadataFile type from Maybe to List (#5702)
Changed optMetadataFile from `Maybe FilePath` to `[FilePath]`. This allows
for multiple YAML metadata files to be added. The new default value has
been changed from `Nothing` to `[]`.

To account for this change in `Text.Pandoc.App`, `metaDataFromFile` now
operates on two `mapM` calls (for `readFileLazy` and `yamlToMeta`) and a fold.

Added a test (command/5700.md) which tests this functionality and
updated MANUAL.txt, as per the contributing guidelines.

With the current behavior, using `foldr1 (<>)`, values within files
specified first will be used over those in later files. (If the reverse
of this behavior would be preferred, it should be fixed by changing
foldr1 to foldl1.)
2019-08-24 09:41:25 -07:00
John MacFarlane
9d581428f9 Add test for #5690. 2019-08-23 10:15:42 -07:00
John MacFarlane
1c71bd1ff5 Ensure proper nesting when we have long ordered list markers.
Closes #5705.
2019-08-23 09:16:54 -07:00
Albert Krewinkel
2712d3e869
Lua: traverse nested blocks and inlines in correct order
Traversal methods are updated to use the new Walk module such that
sequences with nested Inline (or Block) elements are traversed in the
order in which they appear in the linearized document.

Fixes: #5667
2019-08-16 20:52:15 +02:00
John MacFarlane
79a3449eeb LaTeX reader: improve withRaw so it can handle cases where...
the token string is modified by a parser (e.g. accent when
it only takes part of a Word token).

Closes #5686.  Still not ideal, because we get the whole
`\t0BAR` and not just `\t0` as a raw latex inline command.
But I'm willing to let this be an edge case, since you
can easily work around this by inserting a space, braces,
or raw attribute.  The important thing is that we no longer
drop the rest of the document after a raw latex inline
command that gobbles only part of a Word token!
2019-08-14 14:34:44 -07:00
John MacFarlane
eb23527121 Rename test for 5685 -> 5684 (typo in last commit).
Closes #5684. (Note that #5685 is NOT closed by previous commit.)
2019-08-14 11:13:18 -07:00
John MacFarlane
0b2fb9b8f9 Add thin space when needed in LaTeX quote ligatures.
Closes #5685.
2019-08-14 11:07:02 -07:00
Jan-Otto Kröpke
a0a41c7a8e JIRA writer: Remove escapeStringForJira for code blocks 2019-08-11 21:57:12 +02:00
John MacFarlane
1afea63308 Update muse template to handle multiple authors better. 2019-07-28 19:25:44 -07:00
John MacFarlane
b35fae6511 Use doctemplates 0.3, change type of writerTemplate.
* Require recent doctemplates.  It is more flexible and
  supports partials.
* Changed type of writerTemplate to Maybe Template instead
  of Maybe String.
* Remove code from the LaTeX, Docbook, and JATS writers that looked in
  the template for strings to determine whether it is a book or an
  article, or whether csquotes is used. This was always kludgy and
  unreliable.  To use csquotes for LaTeX, set `csquotes` in your
  variables or metadata. It is no longer sufficient to put
  `\usepackage{csquotes}` in your template or header includes.
  To specify a book style, use the `documentclass` variable or
  `--top-level-division`.
* Change template code to use new API for doctemplates.
2019-07-28 19:25:45 -07:00
Philip Pesca
01a52e2300 HTML writer: ensure TeX formulas are rendered correctly (#5658)
The web service passed in to `--webtex` may render formulas using inline
or display style by default. Prefixing formulas with the appropriate
command ensures they are rendered correctly.

This is a followup to the discussion in #5656.
2019-07-24 10:10:36 -07:00
Philip Pesca
bc508534a6 HTML writer: render inline formulas correctly with --webtex (#5656)
We add `\textstyle` to the beginning of the formula to ensure it will be rendered in inline style.
Closes #5655.
2019-07-23 12:21:31 -07:00
John MacFarlane
db5f6dd4fe Fix error introduced in change to test for 4669. 2019-07-22 15:32:49 -07:00
John MacFarlane
d9960244d8 LaTeX reader: support tex \tt command.
Closes #5654.
2019-07-22 15:29:07 -07:00
Albert Krewinkel
63c65c89da
Org reader: accept ATTR_LATEX in block attributes
Attributes for LaTeX output are accepted as valid block attributes;
however, their values are ignored.

Fixes: #5648
2019-07-22 08:12:22 +02:00
John MacFarlane
91d4283263 LaTeX writer: fix line breaks at start of paragraph.
Previously we just omitted these. Now we render them
using `\hfill\break` instead of `\\`.  This is a revision
of a PR by @sabine (#5591) who should be credited with the
idea.

Closes #3324.
2019-07-20 17:12:53 -07:00
John MacFarlane
465eeece6b LaTeX reader: search for image with list of extensions...
like latex does, if an extension is not provided.

Closes #4933.
2019-07-20 10:17:49 -07:00
John MacFarlane
339392bf54 Markdown: Ensure that expanded latex macros end with space if original did.
Closes #4442.
2019-07-19 10:32:59 -07:00
Agustín Martín Barbero
bd69218451 Change order of ilvl and numId in document.xml (#5647)
Workaround for Word Online shortcomming. Fixes #5645

Also, make list para properties go first.

This reordering of properties shouldn't be necessary but
it seems Word Online does not understand the docx correctly otherwise.
2019-07-19 09:32:43 -07:00
John MacFarlane
28cad16517 Markdown writer: prefer using raw_attribute when enabled.
The `raw_attribute` will be used to mark raw bits, even HTML
and LaTeX, and even when `raw_html` and `raw_tex` are enabled,
as they are by default.

To get the old behavior, disable `raw_attribute` in the writer.

Closes #4311.
2019-07-18 22:31:03 -07:00
John MacFarlane
5c655e86d5 HTML writer: ensure that line numbers in code blocks get id-prefix.
Closes #5650.
2019-07-18 22:08:37 -07:00
John MacFarlane
0d72237e27 Dokuwiki writer: handle mixed lists without HTML fallback.
Closes #5107.
2019-07-16 13:14:37 -07:00
Karl Pettersson
5303791bc4 Customizable type of PDF/A for the ConTeXt writer (issue #5608) (#5610)
* Let the user choose type of PDF/A generated with ConTeXt (closes #5608)
* Updated ConTeXt test documents for changes in tagging
* Updated color profile settings in accordance with ConTeXt wiki
* Made ICC profile and output intent for PDF/A customizable
* Read pdfa variable from meta (and updated manual)
2019-07-15 11:55:04 -07:00
John MacFarlane
968d2046a3 Update test for new skylighting. 2019-07-14 10:48:14 -07:00
Alexander Krotov
0713cb65bc Muse: add RTL support
Closes #5551
2019-07-14 18:22:52 +03:00
Vasily Alferov
f6c92c7523 Fix #4499: add mbox and hbox handling to LaTeX reader (#5586)
When `+raw_tex` is enabled, these are passed through literally.
Otherwise, they are handled in a way that emulates LaTeX's behavior.
2019-07-13 16:55:41 -07:00
John MacFarlane
7bc9eab846
Merge pull request #5589 from blmage/fix-3992
Add support for EPUB2 covers (fix #3992)
2019-07-13 16:48:09 -07:00
John MacFarlane
4a5e727c8c Man writer: Improved definition list term output.
Now we boldface code but not other things. This matches the
most common style in man pages (particularly option lists).

Also, remove a regression in the last commit in which 'nowrap'
was removed.
2019-07-13 16:41:43 -07:00
John MacFarlane
d0bf7efe95 Man writer: fixed boldfacing of definition terms.
Previously the bold-facing would be interrupted by
other formatting, because we used `.B`.

Closes #5620.
2019-07-13 16:12:28 -07:00
John MacFarlane
a16311c225
Merge pull request #5606 from blmage/odt-frames
Improve the parsing of frames in ODT documents
2019-07-13 15:53:58 -07:00
John MacFarlane
1784161946 LaTeX reader: Properly handle \providecommand and environment...
They are now ignored if the corresponding command or environment
is already defined.

Closes #5635.
2019-07-13 15:51:33 -07:00
mb21
6cf5c3f6ac fix filename and issue reference of previous commit 2019-07-13 12:03:45 +02:00
John MacFarlane
6d30d3e0b3 Pass through aria- attributes to HTML5.
Also document addition of data- prefix to unknown attributes.

Closes #5646.
2019-07-12 17:03:01 -07:00
Brian Leung
1d9ff85b45 RST reader: keep name property in imgAttr. (#5637)
Closes #5619.
2019-07-10 18:35:01 -07:00
Arfon Smith
020e2a06d5 Updating JATS template to v1.1dtd (#5632)
* Updating JATS template to v1.1dtd

* Update writer.jats
2019-07-06 23:31:02 +02:00
Brian Leung
9c4ba81357 Markdown reader: handle inline code more eagerly within lists. (#5628)
Closes #5627.
2019-07-06 23:14:21 +02:00
Pete Ryland
24c781039f Fix redundant constraint warnings. (#5625) 2019-07-02 10:29:34 +02:00
martinfrancois
4b73544087 add tests for EPUB2 and EPUB3 cover reader 2019-06-22 22:07:26 +02:00
oquechy
f0edf60364 Support epigraph command in LaTeX Reader.
Closes #3523.
2019-06-21 18:27:26 +02:00
blmage
449c133406 Add a test for MathML formulas in ODT documents 2019-06-20 21:55:31 +02:00
Jeroen de Haas
e67f4c58f2 Powerpoint code formatting is now context dependent (#5573)
This commit alters the way in which the Powerpoint writer treats
inline code and code blocks.

- Inline code is now formatted at the same size as the surrounding
  text.
- Code blocks are now given a margin and font size according to their
  level.
- Furthermore this commit allows changing the font with which code is
  formatted via the `monofont` option.

Tested in
- PowerPoint 365 for Windows - 1808 (Build 10730.20344 Click-to-Run)
- PowerPoint 365 for Mac - 16.26 (19060901)
2019-06-14 08:42:06 -07:00
John MacFarlane
2cd1c7b30f Update test for skylighting 0.8.1.1. 2019-06-13 19:33:52 -07:00
John MacFarlane
fa50da3030 OpenDocument writer: Avoid duplicate attributes.
We use the innermost attribute in nested cases.

Closes #4634.
2019-06-12 21:51:09 -07:00
Albert Krewinkel
11bb862767 Lua: add a clone() method to all AST elements (#5572)
Closes: #5568
2019-06-12 09:58:38 -07:00
John MacFarlane
bec95c97ac LaTeX writer: Don't highlight code in headings.
This causes compilation errors, and I don't know how
to work around them.  Closes #5574.
2019-06-11 20:47:29 -07:00
John MacFarlane
9725522a7f Revert "JATS template: don't include journal-meta unless 'journal'..."
This reverts commit 193b5cceba.

journal-meta is required.  Better to include it even if it
doesn't validate through lack of required fields.
2019-06-11 17:31:52 -07:00
John MacFarlane
193b5cceba JATS template: don't include journal-meta unless 'journal'...
...is set in metadata.

Otherwise we get validation errors.
2019-06-11 17:08:40 -07:00
John MacFarlane
5bbaedac57 JATS writer: ensure validity of pub-date.
We try to parse the date and convert to year, month, day,
as expected in pub-date.  We also add an iso-8601-date attribute
if possible.
2019-06-11 17:01:36 -07:00
John MacFarlane
f7c0d2fb3f JATS writer: don't use break element for LineBreak.
It's only allowed in a few special contexts, and not in
p elements.
2019-06-11 16:19:12 -07:00
John MacFarlane
bb68c183b3 JATS writer: don't embed string-name in string.
That's illegal with this DTD.
2019-06-11 16:16:05 -07:00
Albert Krewinkel
6704b66c33
test/lua/module/pandoc.lua: fix non-determinism in test 2019-06-11 21:17:06 +02:00
Albert Krewinkel
7f9b32e36a
data/pandoc.lua: fix deletion of nonexistent attributes
Fixes: #5569
2019-06-11 19:48:00 +02:00
Albert Krewinkel
03b9f3d5f3
Lua pandoc module: better tests for Attr and AttributeList 2019-06-11 19:48:00 +02:00
John MacFarlane
550d949b9e JATS writer: wrap elements with p when needed.
The JATS spec restricts contents of certain
elements (fn, list-item); this patch wraps
elements that can't go in these contexts inside
p elements with specific-use "wrapper", so the
documents will conform.

Closes #5570.
2019-06-11 10:36:34 -07:00
John MacFarlane
3febd81cbc LaTeX writer: Use mbox to get proper behavior inside \sout.
Closes #5529.
2019-06-10 15:02:48 -07:00
John MacFarlane
59529e408b Asciidoc writer: use doubled ## when necessary for spans.
Closes #5566.
2019-06-10 14:47:04 -07:00
John MacFarlane
2e12106a90 Asciidoc writer: ensure correct nesting strong/emph.
Closes #5565.
2019-06-10 14:42:08 -07:00
Alexander Krotov
814c3af4df Muse reader: test that links inside image descriptions work 2019-06-09 14:08:37 +03:00
John MacFarlane
05ae9f265f Roll back automatic figure/table numbering in ODT/OpenDocument.
This was added in pandoc 2.7.2, but it makes it impossible
to use pandoc-crossref. So this has been rolled back for now,
until we find a good solution to make this behavior optional
(or a creative way to let pandoc-crossref and this feature
to coexist).

See #5474.
2019-06-08 14:17:52 -07:00
John MacFarlane
d1df2b2783 LaTeX reader: pass through unknown listings language as class.
Previously if the language was not in the list of listings-
supported languages, it would not be added as a class, so
custom syntax highlighting could not be used.

Closes #5540.
2019-06-08 12:25:34 -07:00
John MacFarlane
d8b4e45be0 LaTeX writer: Include inline code attributes with --listings.
Closes #5420.
2019-06-07 10:03:10 -07:00
Albert Krewinkel
1c36857465 Add jira writer (#5548)
This adds support for Atlassian's jira markup.

Closes #2497
2019-06-05 17:52:23 -04:00
John MacFarlane
10615420de Include trailing {}s in raw latex commands.
Change is in rawLaTeXInline in LaTeX reader, but
it affects the markdown reader and other readers
that allow raw LaTeX.

Previously, trailing `{}` would be included for
unknown commands, but not for known commands.
However, they are sometimes used to avoid a trailing
space after the command.  The chances that a `{}`
after a LaTeX command is not part of the command
are very small.

Closes #5439.
2019-06-04 21:20:11 -07:00
John MacFarlane
f82d91eb49 Markdown reader: don't create implicit reference for empty header.
Closes #5549.
2019-06-04 08:39:54 -07:00
John MacFarlane
928681ca04 Avoid unwanted interpretation of def list term as other kind of block,
e.g. ordered list item, in Markdown writer.

Closes #554.
2019-06-03 09:51:19 -07:00
Albert Krewinkel
7db3d9ab04
Textile writer: fix closing tag for math output
Opening and closing tag for math output match now.
2019-06-01 10:16:00 +02:00
Albert Krewinkel
f7222370af
Lua modules: test pandoc.mediabag 2019-05-30 08:44:40 +02:00
Albert Krewinkel
3c3e9a12cd
Lua Version type: shorten "version too old" message 2019-05-29 22:59:45 +02:00
John MacFarlane
e871d65b67
Merge pull request #5526 from tarleb/richer-version-type
Lua: add Version type to simplify comparisons
2019-05-29 12:05:04 -04:00
John MacFarlane
1de7b20ebb
Merge pull request #5497 from mb21/html-writer-video-audio
Output HTML5 video and audio elements
2019-05-29 12:01:12 -04:00
John MacFarlane
970b820f47 HTML reader: misc. epub related fixes.
- With epub extensions, check for epub:type in addition to type.
- Fix problem with noteref parsing which caused block-level
  content to be eaten with the noteref.
- Rename pAnyTag to pAny.
- Refactor note resolution.
2019-05-29 08:15:50 -07:00
Albert Krewinkel
505f5bf5d9
Lua: add Version type to simplify comparisons
Version specifiers like `PANDOC_VERSION` and `PANDOC_API_VERSION` are
turned into `Version` objects. The objects simplify version-appropriate
comparisons while maintaining backward-compatibility.

A function `pandoc.types.Version` is added as part of the newly
introduced module `pandoc.types`, allowing users to create version
objects in scripts.
2019-05-29 10:07:43 +02:00
mb21
a58304e00e HTML writer: output video and audio elements
depending on file extension of the image path
2019-05-29 09:43:50 +02:00
John MacFarlane
2ad5dacf87 Remove command test for #5517.
We need a better test that works cross-platform.
Until then, removing this.

Closes #5528.
2019-05-28 12:45:31 -07:00
Mauro Bieg
3f57f49033 HTML writer: emit empty alt tag in figures (#5518)
The same text is already in the <figcaption> and
screen-readers would read it twice, see #4737
2019-05-28 12:31:41 -04:00
John MacFarlane
8a5b9ac868 Add test for relative file: URI to #5517. 2019-05-28 09:05:28 -07:00
Mauro Bieg
214da7217b Fix handling of file: URL scheme in downloadOrRead (#5522)
Move up the pattern match to be reachable, closes #5517.

Previously `file:/` URLs were handled wrongly and pandoc attempted
to make HTTP requests, which failed.
2019-05-28 11:51:21 -04:00
John MacFarlane
3593dcda61 Use skylighting 0.8. 2019-05-27 12:15:43 -07:00
Mauro Bieg
d07ed83d70 consolidate simple-table detection (#5524)
add `onlySimpleTableCells` to `Text.Pandoc.Shared`

[API change]

This fixes an inconsistency in the HTML reader, which did not treat tables with `<p>` inside cells as simple.
2019-05-27 13:53:19 -04:00
Alexander Krotov
f807f5b383 Muse reader: allow images inside link descriptions 2019-05-25 19:17:16 +03:00
Alexander Krotov
7514277454 HTML reader: trim definition list terms 2019-05-25 18:36:56 +03:00
Alexander Krotov
19f9eed0bb Muse writer: do not escape empty line after <br> 2019-05-25 17:54:31 +03:00
John MacFarlane
aef71894ce Markdown writer: Ensure the code fence is long enough.
Previously too few backticks were used when the code block
contained an indented line of backticks.  (Ditto tildes.)

Cloess #5519.
2019-05-22 15:21:15 -07:00
Jesse Rosenthal
ed73bd28e5 Markdown writer: Handle labels with integer names
Previously if labels had integer names, it could produce a conflict
with auto-labeled reference links. Now we test for a conflict and find
the next available integer.

Note that this involves adding a new state variable `stPrevRefs` to
keep track of refs used in other document parts when using
`--reference-location=block|section`

Closes #5495
2019-05-21 12:19:59 -04:00
Albert Krewinkel
6208d4e7fc Improve output of Lua tests (#5499)
This makes use of tasty-lua, a package to write tests in Lua
and integrate the results into Tasty output. Test output becomes
more informative: individual tests and test groups become visible
in test output. Failures are reported with helpful error messages.
2019-05-20 12:52:28 -04:00
John MacFarlane
e87b54dcad JATS writer: properly handle footnotes.
"Best Practice: When footnotes are grouped at the end of an article,
wrap them in a `<fn-group>` and use an `<xref>` element in the text, as
usual, to tie each footnote in the list to a particular location in the
text."

Closes #5511.
2019-05-16 21:39:03 -07:00
Alexander Krotov
2e13c0a451 FB2 writer: do not wrap note references into <sup> and brackets
Existing FB2 readers, such as FBReader, already display links with type="note" as a superscript.
2019-05-15 13:31:07 +03:00
Albert Krewinkel
8b00bc6029
Org reader: fix planning elements in headers level 3 and higher
Planning info is now always placed before the subtree contents.
Previously, the planning info was placed after the content if the
header's subtree was converted to a list, which happens with headers of
level 3 and higher per default.

Fixes: #5494
2019-05-13 22:55:13 +02:00
Albert Krewinkel
00ef03827e
Org reader: omit, but warn about unknown export options
Unknown export options are properly ignored and omitted from the output.
2019-05-13 22:25:04 +02:00
Mauro Bieg
1d033a2691 add test/tables.xwiki to git and pandoc.cabal (#5498) 2019-05-12 10:37:37 -04:00
Albert Krewinkel
da9638e6a3
Org writer: always indent src blocks content by 2 spaces
Emacs always uses two spaces when indenting the content of src blocks,
e.g., when exiting a `C-c '` edit-buffer. Pandoc used to indent contents
by the space-equivalent of one tab, but now always uses two spaces, too.

Closes: #5440
2019-05-12 14:49:52 +02:00
Alexander Krotov
5c7ad59ffe FB2 reader: add notes parsing test 2019-05-11 12:10:20 +00:00
John MacFarlane
98ee6ca289 Asciidoc writer: use ` +...+ ` form for inline code.
The old `` `a__b__c` `` yields emphasis inside code in asciidoc.
To get a pure literal code span, use `` `+a__b__c+` ``.
2019-05-05 21:57:30 -07:00
John MacFarlane
5affa30e8a Asciidoc writer: use proper smart quotes with asciidoctor.
Asciidoctor has a different format for smart quotes.
Closes #5487.
2019-05-05 21:47:15 -07:00
Albert Krewinkel
33e2d46dbe
Org reader: prefer plain symbols over math symbols
Symbols like `\alpha` are output plain and unemphasized, not as math.

Fixes: #5483
2019-05-05 14:48:37 +02:00
Albert Krewinkel
7e7bc3493e
Org reader: recognize emphasis after TODO/DONE keyword
Fixes: #5484
2019-05-05 13:53:11 +02:00
Albert Krewinkel
786594b23b Lua: add pandoc.system module (#5468)
The `system` Lua module provides utility functions to interact with the
operating- and file system. E.g.

    print(pandoc.system.get_current_directory())

or

    pandoc.system.with_temporary_directory('tikz', function (dir)
      -- write and compile a TikZ file with pdflatex
    end)
2019-05-04 01:06:30 -04:00
John MacFarlane
a20323033e Fix footnote in image caption.
Regression!  The fix for #4683 broke this case.
2019-05-01 16:56:37 -07:00
John MacFarlane
f11d0c9dc8 HTML: prevent gratuitious emojification on iOS.
iOS chooses to render a number of Unicode entities,
including '↩', as big colorful emoji.  This can be
defeated by appending Unicode
VARIATION SELECTOR-15'/'VARIATION SELECTOR-16'.
So we now append this character when escaping
strings, for both '↩' and '↔'.

If other characters prove problematic, they can
simply be added to needsVariationSelector.

Closes #5469.
2019-04-30 22:32:52 -07:00
Alexander Krotov
2b2d9baaa8 Muse writer tests: compare Text without converting to [Char] 2019-04-28 03:21:14 +03:00
John MacFarlane
e409509a68 RST writer: treat Span as transparent.
Previously an Emph inside a Span was being treated as
nested markup and ignored.  With this patch, the Span
is just ignored.

Closes #5446.
2019-04-15 09:48:11 -07:00
John MacFarlane
6d19c08e9f LaTeX template: Add pdflang to hypersetup if lang is set.
Closes #5443.
2019-04-11 16:58:36 -07:00
John MacFarlane
4f572ddf69 Vimwiki reader: improve handling of internal links.
1) Don't append `.html`
2) Add `wikilink` title

This mirrors behavior of other wiki readers.  Generally the
`.html` extension is not wanted.  It may be important for
output to HTML in certain circumstances, but it can always
be added using a filter that matches on links with title
`wikilink`.

Note that if you have a workflow that uses pandoc to convert
vimwiki to readable HTML pages, you may need to add such a
filter to reproduce current behavior.

Here is a filter that does the job:

```lua
function Link(el)
    if el.title == 'wikilink' then
      el.target = el.target .. ".html"
    end
    return el
end
```

Save this as `fixlinks.lua` and use with `--lua-filter fixlinks.lua`.

Closes #5414.
2019-04-05 10:04:28 -07:00
Jesse Rosenthal
ab5c701343 PowerPoint writer: expand builtin reference doc to model all layouts
The previous built-in reference doc had only title and content
layouts. Add in a section-header slide and a two-content slide, so
users can more easily modify it to build their own templates.

Golden files needed to be regenerated. Checked on MS PowerPoint 2013.
2019-04-05 08:50:39 -04:00
Jesse Rosenthal
7ac860be74 PowerPoint tests: Regenerate golden files
Due to viewProps change in 61dc0f9f.

Golden files checked on PowerPoint 2013 (Win 10 on virtualbox).
2019-04-04 10:46:30 -04:00
John MacFarlane
23df94e30a Update command test #5416 to make it windows friendly 2019-04-02 17:59:47 -07:00
Andrew Dunning
3d1409347a LaTeX template: Ensure correct heading/table order (#5421)
Improve the workaround for #1658, adapting a solution by @u-fischer in
<https://github.com/latex3/latex2e/issues/131> that works whether or not
the `indent` variable is enabled.

Remove `subparagraph` variable in LaTeX template.  The default is now
to use run-in style for level 4 and 5 headings (`\paragraph` and `\subparagraph`).
To get the previous default behavior (where these were formatted as blocks,
like `\subsubsection`), set the `block-headings` variable.

An example is given in the manual of reformatting the appearance of headings
more thoroughly using KOMA-Script.

Closes #5365.
2019-04-02 18:18:36 -06:00
John MacFarlane
40b60a911c Actually run the xwiki writer tests. 2019-04-02 17:11:35 -07:00
Derek Chen-Becker
45944b51a0 Add XWiki Support (#4167)
Add XWiki Support

Closes #1800
2019-04-02 17:27:02 -06:00
Mauro Bieg
0fa6951dc1 Dokuwiki Reader fix: parse single curly brace (#5417)
fixes #5416
2019-04-01 11:36:47 -06:00
Jesse Rosenthal
0d1fc7dfff PowerPoint writer: add test for speaker notes after metadata. 2019-03-31 17:09:00 -04:00
Jesse Rosenthal
efa6304eee Pptx writer: test for speaker notes after breaking header. 2019-03-30 22:52:31 -04:00
John MacFarlane
93ee73e1dc LaTeX writer: Avoid inadvertently creating ? or ! ligatures.
These are upside down ? and !, resp.

Closes #5407.
2019-03-29 10:04:22 -07:00
John MacFarlane
40865958ce Markdown reader: fenced div takes priority over setext header.
For

    ::: {.cell}
    ---
    :::
2019-03-28 17:39:22 -07:00
Andrew Dunning
c21db81efd LaTeX template: Add pandoc to PDF metadata (#5388)
Credits pandoc in content creator metadata (the default is 'LaTeX with hyperref').
2019-03-25 22:36:14 -06:00
John MacFarlane
052684712b HTML reader: read data-foo attribute into foo.
The HTML writer adds the `data-` prefix for HTML5
for nonstandard attributes.  But the attributes are
represented in the AST without the `data-` prefix,
so we should strip this when reading HTML.

Closes #5392.
2019-03-25 08:43:59 -07:00
Andrew Dunning
e91af0a8a3 LaTeX template: Group graphics-related code (#5389)
* LaTeX template: Group graphics-related code

The default figure placement was added in <f3ab4bc2b9>; there does not appear to have been a reason for placing it at the end of the preamble.

* Update tests
2019-03-22 22:35:55 -06:00
John MacFarlane
1e60776226 LaTeX writer: Fix footnotes in table caption and cells.
This fixes a bug wherein footnotes appeared in the wrong
order, and with duplicate numbers, when in table captions
and cells.

We now use regular `\footnote` commands, even in the table
caption and the minipages containing cells. Apparently
longtable knows how to handle this.

Closes #5367.
2019-03-22 11:55:41 -07:00
John MacFarlane
66e5f0ff8d Docx writer: Use w:br without attributes for line breaks.
We previously added the attribute `type="textWrapping"`, but
this causes problems on Word Online.

Closes #5377.
2019-03-21 09:28:16 -07:00
John MacFarlane
6be8f4e953 Improved fix to #5340 and added test. 2019-03-18 16:53:36 -07:00
John MacFarlane
3880a23de9 Properly escape attributes in Markdown writer.
Closes #5369.
2019-03-17 18:15:47 -07:00
John MacFarlane
ebd7035a2a Add test case for #5368. 2019-03-17 18:02:59 -07:00
John MacFarlane
5b385d2e66 Tests.Old: specify --data-dir=../data.
Remove old pandoc_datadir environment variable, which
doesn't do anything.
2019-03-13 17:44:07 -07:00
Andrew Dunning
bbe2da390e LaTeX template: Improve readability (#5363)
+ LaTeX template: Improve template readability
  Use `hidelinks` option for hyperref, which has the same effect as `pdfborder={0 0 0}`,
  but its purpose is clearer. Use a simpler conditional for Polyglossia/Babel. Format
  comments more consistently.
+ Update tests
+ Remove hyperref breaklinks option.  According to the documentation, hyperref
  sets this automatically as appropriate to the driver.
2019-03-13 18:22:28 -06:00
Andrew Dunning
8d58c61702 LaTeX reader test: Allow compilation of file (#5364)
The test could not compile in LaTeX due to missing `setspace` package. Remove redundant packages.
2019-03-13 18:21:00 -06:00
John MacFarlane
b7cbd7b8c9 docx writer: avoid extra copy of abstractNum and num elements...
...in numbering.xml.  This caused pandoc-produced docx files to
be uneditable using Word Online.

The problem was that recent versions of reference.docx include
samples of various kinds of text, including lists.  The
numering elements for these were getting copied over to
the new docx, where they clashed with the autogenerated
elements produced by pandoc.  This didn't confuse Desktop
Word, but it did confuse Word Online.

Closes #5358.
2019-03-11 22:09:21 -07:00
John MacFarlane
e405d7b532 Include execution output in ipynb test. 2019-03-09 16:53:53 -08:00
John MacFarlane
873f342f11 Ipynb reader/writer: better handling of cell metadata.
We now handle even complex cell metadata in the Div's attributes.
Simple metadata fields are rendered as a plain string, and complex ones
as JSON.
2019-03-09 14:27:34 -08:00
Andrew Dunning
d7f56f8189 LaTeX template: Robust section numbering removal (#5351)
Ensures that section numbering does not reappear with custom section levels. See <https://tex.stackexchange.com/questions/473653/>.

Update tests
2019-03-04 16:58:20 -07:00
John MacFarlane
0bed0ab5a3 Use XDG data directory for user data directory.
Instead of `$HOME/.pandoc`, the default user data directory is
now `$XDG_DATA_HOME/pandoc`, where `XDG_DATA_HOME` defaults to
`$HOME/.local/share` but can be overridden by setting the environment
variable.

If this directory is missing, then `$HOME/.pandoc` is searched
instead, for backwards compatibility.  However, we recommend
moving local pandoc data files from `$HOME/.pandoc` to
`$HOME/.local/share/pandoc`.

On Windows the default user data directory remains the same.

Closes #3582.
2019-03-02 15:03:59 -08:00
Jesse Rosenthal
a908129d93 Powerpoint writer: add tests for underline. 2019-02-27 09:30:50 -05:00
John MacFarlane
ba05e1ea02 Shared.compactify: Avoid mixed lists.
This improves on the original fix to #5285 by preventing
other mixed lists (lists with a mix of Plain and Para
elements) that were allowed given the original fix.
2019-02-25 17:33:54 -08:00
John MacFarlane
38c028bd50 JATS reader: fix parsing of figures.
This ensures that a figure containing a single image
is parsed as a pandoc "implicit figure" (i.e., a
Para with a single Image whose title attribute begins
with `fig:`).  More complex figures will still be parsed
as divs.

Closes #5321.
2019-02-23 15:40:06 -07:00
John
c75b558cbc Add section identifiers support for FB2 writer (#5315)
Closes #5229.
2019-02-22 00:43:43 -07:00
Jesse Rosenthal
83d2a5131d Docx reader tests: fix test file with trailing space.
This failed due to the fix of #5273.
2019-02-18 15:49:36 -05:00
Jesse Rosenthal
9a1a3fe482 Docx reader: add tests for trimming last inline. 2019-02-18 15:49:00 -05:00
Alexander Krotov
c4814ea965 Muse reader: add secondary note support 2019-02-18 15:21:32 +03:00
Alexander Krotov
2c7c8a6f40 Muse writer: escape secondary notes 2019-02-18 15:21:32 +03:00
John MacFarlane
d7d1c9c8e4 Markdown reader: fix bug parsing fenced code blocks.
Previously parsing would break if the code block
contained a string of backticks of sufficient length
followed by something other than end of line.

Closes #5304.
2019-02-15 22:34:32 -08:00
Jesse Rosenthal
332e2ba5b6 Docx reader: Add test for reading sdts in footnotes. 2019-02-12 17:26:37 -05:00
John MacFarlane
b6cf490efd Use latest skylighting. 2019-02-10 08:06:53 -08:00
Mauro Bieg
d0a5f2aded JATS writer: wrap figure caption in <p> to fix validation (#5292)
closes #5290
2019-02-10 07:22:12 -08:00
John MacFarlane
1cdbb896f6 Added simple ipynb reader/writer tests.
Closes #5274.
2019-02-09 14:53:30 -08:00
John MacFarlane
4543543063 Fixed asciidoc display math in list contexts. 2019-02-09 11:02:19 -08:00
TG
8c2e2435f9 Asciidoctor writer sets the stem attribute if it contains latexmath 2019-02-09 08:21:53 -08:00
TG
568b25d33a Adds Asciidoctor sprcific writer and tests 2019-02-09 08:21:53 -08:00
TG
8fdeae2872 AsciiDoc Writer: DisplayMath as asciidoc latexmath block 2019-02-09 08:20:56 -08:00
John MacFarlane
47537d26db Improve tight/loose list handling.
Closes #5285. Previously the algorithm allowed list items
with a mix of Para and Plain, which is never wanted.

compactify in T.P.Shared has been modified so that, if
a list's items contain (at the top level) Para elements
(aside from perhaps at the very end), ALL Plains are
converted to Paras.
2019-02-08 23:16:01 -08:00
Jesse Rosenthal
1847bdbb83 Docx reader: Tests for alternate document.xml 2019-02-06 21:14:46 -05:00
Alexander Krotov
59fa4eb17e Muse reader: test that block level markup does not break <verbatim> 2019-02-06 02:25:24 +03:00
Albert Krewinkel
37a82b0b11 Add missing copyright notices and remove license boilerplate (#5112)
Quite a few modules were missing copyright notices.

This commit adds copyright notices everywhere via haddock module
headers.  The old license boilerplate comment is redundant with this and has
been removed.

Update copyright years to 2019.

Closes #4592.
2019-02-04 13:52:31 -08:00
John MacFarlane
ccf4e23ee1 Markdown reader: add newline when parsing blocks in YAML.
Otherwise last block gets parsed as a Plain rather than
a Para.

This is a regression in pandoc 2.x.  This patch restores
pandoc 1.19 behavior.

Closes #5271.
2019-02-04 10:22:02 -08:00
John MacFarlane
b74267406b Update test for last commit. 2019-02-02 16:20:06 -08:00
John MacFarlane
b062117ef4 HTML5 writer: implement WAI-ARIA roles for (end)notes.
See #4213.
2019-02-02 16:14:58 -08:00
John MacFarlane
633a9ecfec LaTeX writer: avoid {} after control sequences when escaping.
`\ldots{}.` doesn't behave as well as `\ldots.` with the latex
ellipsis package.  This patch causes pandoc to avoid emitting
the `{}` when it is not necessary.  Now `\ldots` and other
control sequences used in escaping will be followed by either
a `{}`, a space, or nothing, depending on context.

Thanks to Elliott Slaughter for the suggestion.
2019-02-01 21:17:46 -08:00
John MacFarlane
e752669e50 LaTeX reader: don't let \egroup match {.
`braced` now actually requires nested braces.
Otherwise some legitimate command and environment
definitions can break (see test/command/tex-group.md).
2019-01-31 22:50:51 -08:00
John MacFarlane
7c424b315c Tests: avoid calling findPandoc multiple times. 2019-01-31 20:56:20 -08:00
John MacFarlane
fdf7f07f62 Old tests: remove need for temp files by using pipeProcess. 2019-01-31 17:25:36 -08:00
leungbk
ac83b9c37c Org reader: add support for #+SELECT_TAGS. 2019-01-30 18:27:38 +01:00
Agustín Martín Barbero
9894d05fe3 Improve writing metadata for docx, pptx and odt (#5252)
* docx writer: support custom properties.  Solves the writer part of #3024.
  Also supports additional core properties:  `subject`, `lang`, `category`,
  `description`.

* odt writer: improve standard properties, including the following core properties:
  `generator` (Pandoc/VERSION), `description`, `subject`, `keywords`,
  `initial-creator` (from authors), `creation-date` (actual creation date).
  Also fix date.

* pptx writer: support custom properties.  Also supports additional core
  properties: `subject`, `category`, `description`.

* Includes golden tests.

* MANUAL: document metadata support for docx, odt, pptx writers
2019-01-26 16:14:35 -08:00
John MacFarlane
a5ac58f82f MediaWiki reader: use _ instead of - in auto-identifiers.
Partially addresses #4731.
We may not still be exactly matching mediawiki's algorithm
for identifiers.
2019-01-25 17:10:49 -08:00
John MacFarlane
7ccaa77797 LaTeX template: Set default listings language for lua, assembler.
Otherwise we get an error when trying to compile code
with lua or assembler code.

To change the default dialect (currenty 5.3 for lua
and x86masm for assembler), you can use `--include-in-header`
to inject something like

    \lstset{defaultdialect=[5.2]Lua}

Closes #5227.
2019-01-25 16:22:56 -08:00
John MacFarlane
5ddd7b121e LaTeX reader: support \endinput. Closes #5233. 2019-01-22 21:39:26 -08:00
Andrew Dunning
3ad2255717 LaTeX template: Respect numbersections for books (#5235)
Ensure that `\part` and `\chapter` are only numbered if `numbersections` is set. To return to the previous behaviour, use `-V numbersections -V secnumdepth=0`.

Notes on secnumdepth:

1 = Number `\section`
0 = Number `\chapter`
-1 = Number `\part`
-2 = No numbering
2019-01-22 21:11:13 -08:00
John MacFarlane
f86ac89383 HTML and markdown: treat textarea as a verbatim environment.
We don't want to parse its contents as Markdown or HTML.

Closes #5241.
2019-01-21 20:54:12 -08:00
Albert Krewinkel
bbf37dee8e Fix tests for sample custom writer tables 2019-01-16 13:30:16 +01:00
Albert Krewinkel
42a7b80c04
data/pandoc.lua: auto-fix nested constructor arguments
Incorrect types to pandoc element constructors are automatically
converted to the correct types when possible. This was already done for
most constructors, but conversions are now also done for nested
types (like lists of lists).
2019-01-13 17:14:10 +01:00
Andrew Dunning
96892ea8d7 LaTeX template: Simplify fontspec usage (#5218)
Simplify the approach of #5212, ensuring that `mainfont` is used as the base font for scaling and that LuaLaTeX does not display the mono font with TeX ligatures (as it does not use the `Mapping=tex-ansi` option).

With a modified version of `\defaultfontfeatures`, fontspec will continue to report scaling against the old default font in the log, but it nonetheless displays main font at the specified size. Using this rather than setting `Scale=MatchLowercase` for each family individually means that users will not lose scaling when upgrading to the new template if they were using other font options. Scaling can be disabled for an individual family by adding the option `Scale=1` to `sansfontoptions`, `monofontoptions`, etc.

Remove the `\setromanfont` command added in #4665, as this is not documented in the fontspec manual and appears to be a deprecated alias for `\setmainfont`.

For the release notes, I should also add that one can imitate the previous appearance with `-V mainfontoptions="Scale=MatchLowercase"`.
2019-01-12 17:39:47 -08:00
Andrew Dunning
666bf8ac5c LaTeX template: Prevent scaling of main font (#5212)
When `Scale=MatchLowercase` is set as a default font option, this scales `mainfont` against the old default, meaning that it resizes whatever is set as the main font to match the metrics of Latin Modern. This can result, for example, in a document set to 12pt appearing in 11pt or 13pt. Setting this option for individual families allows everything to scale against the main font, and permits the user to override the setting if desired. Note that it is not necessary to specify `Ligatures=TeX`, as this is already set by default for the appropriate families. See the `fontspec` manual: <https://ctan.org/pkg/fontspec>.

Those who specify font-options in metadata may need to add `Scale=MatchLowercase`, which will now only be provided if `(roman|sans|math|mono)fontoptions` aren't given explicitly.
2019-01-10 11:24:27 -08:00
Brian Leung
35971495ab RST reader: change treatment of number-lines directives. (#5207)
Directives of this type without numeric inputs should not have a
`startFrom` attribute; with a blank value, the writers can produce
extra whitespace.
2019-01-09 22:19:26 -08:00
John MacFarlane
8673eb079b Removed superfluous sourceCode class on code blocks.
* These were added by the RST reader and, for literate Haskell,
  by the Markdown and LaTeX readers.  There is no point to
  this class, and it is not applied consistently by all readers.
  See #5047.

* Reverse order of `literate` and `haskell` classes on code blocks
  when parsing literate Haskell. Better if `haskell` comes first.
2019-01-08 11:36:33 -08:00
John MacFarlane
599327bee1 Asciidoc writer: shorter delimiters for tables, blockquotes.
This matches asciidoctor reference docs.

Closes #4364.
2019-01-07 22:10:34 -08:00
Brian Leung
9dbcf16161 Org reader: handle minlevel option differently. (#5190)
When `minlevel` exceeds the original minimum level observed in the
file to be included, every heading should be shifted rightward.
2019-01-07 20:28:47 -08:00
Alexander
40c30a9d88 Add DokuWiki reader (#5108)
Closes #1792
2019-01-06 15:06:32 -08:00
John MacFarlane
4ac036fe13 Cleaned up findPandoc. 2019-01-04 20:14:24 -08:00
John MacFarlane
fc87925b77 Tests: Fix findPandoc to work with Windows. 2019-01-04 18:36:15 -08:00
John MacFarlane
ae4a5f4858 Fix findPandoc so it works with cabalv2. 2019-01-04 17:44:26 -08:00
John MacFarlane
9746938d06
LaTeX Template: Improve package selections (#5193)
* Use Babel for LuaTeX.  There are a number of bugs in Polyglossia under LuaLaTeX with common languages, e.g. <https://github.com/reutenauer/polyglossia/issues/182>.

* Load xcolor. The `xcolor` package must be loaded before the `footnote` package, which we load to fix foonotes in tables. Closes #4861.

* Load xurl if available. This breaks URLs in more locations. Only available with TeX Live 2018 and later.

* Remove obsolete fixltx2e package

* Reindent. Use two spaces to be consistent internally and with other templates.

* Use `bookmark` if available. The `bookmark` package can sometimes correct the levels of headings where `hyperref` cannot: see <https://komascript.de/release3.26>.

* Update LaTeX tests
2019-01-03 10:47:48 -08:00
Andrew Dunning
f3709ccba3 LaTeX template: Require xcolor 2019-01-02 22:34:17 -05:00
Mauro Bieg
f1d83aea12 Implement task lists (#5139)
Closes #3051
2019-01-02 11:36:37 -08:00
John MacFarlane
ea8af33dab Commonmark writer: fix handling of SoftBreak with hard_line_breaks.
This should be rendered as a space.
Closes #5195.
2019-01-02 10:31:13 -08:00
Andrew Dunning
2c0af6e3a3 Update LaTeX tests 2019-01-01 17:47:02 -05:00
damien clochard
4ab2a46bdc Zimwiki writer: remove automatic colon prefix before internal images (#5183)
* FIX #5183 : zimwiki : remove automatic colon prefix before internal images

![](foo.png) should be converted to {{foo.png}} (relative path)
![](/foo.png] should be converted to {{/foo.png}} (absolute path)

Therefore the ':' prefix is useless and must be removed.

I never used the zimwiki, but i submitted the similar dokuwiki fix.

1. The zimwiki syntax is inspired by dokuwiki
2. The zimwiki documentation does not mention the colon character for images
3. The pandoc zimwiki writer seems to be a copy-paste for the dokuwiki writer

If the PR #5184 is applied, I think this one should be applied too.
2019-01-01 14:08:38 -08:00
damien clochard
814e97df92 Dokuwiki writer: remove automatic ':' prefix before internal image links (#5183)
* FIX #5183 : remove automatic ':' prefix before internal image links

`![](foo.png)` should be converted to `{{foo.png}}` (relative path)
`![](/foo.png]` should be converted to `{{/foo.png}}` (absolute path)

Therefore the ':' prefix is useless and must be removed.
It blocks users from making relative image links.

Update tests for DokuWiki Writer : external images
2019-01-01 14:07:26 -08:00
Albert Krewinkel
2f92261d87
Org reader: fix self-link parsing regression
Fixes a regression introduced by the previous commit.
2019-01-01 22:06:44 +01:00
Albert Krewinkel
c0caaaeabb
Org reader: fix treatment of links to images
Links with descriptions which are pointing to images are no longer read
as inline images, but as proper links.

Fixes: #5191
2019-01-01 21:03:38 +01:00
John MacFarlane
ffc2192caf Simplify/fix reading of --metadata values on command line.
Previously we used HsYAML's decodeStrict to recognize
boolean values (treating everything else as a string).
This caused problems relating to hvr/HsYAML#7.

We now just check for the recognized boolean values
`true|True|TRUE|false|False|FALSE`, and avoid using
HsYAML.

Closes #5177.
2018-12-31 21:20:56 -08:00
leungbk
c998b937c1 Org writer: preserve line-numbering for example and code blocks. 2018-12-28 15:07:05 +01:00
Alexander Krotov
5101f4324b Muse reader tests: test #cover directive 2018-12-25 15:23:02 +03:00
John MacFarlane
9fe6d91a1a Remove unnecessary type="text/css" on style and link for HTML5.
Closes #5146.
2018-12-14 11:29:35 -08:00
John MacFarlane
ee60ba5252 Man/Ms writers: don't escape - as \-.
For discussion see
https://groups.google.com/forum/#!msg/pandoc-discuss/B-oiCXcQOVo/WO-BXVpICAAJ

The `\-` gets rendered in HTML and PDF as a unicode minus sign.
2018-12-13 11:24:51 -08:00
Enno
dc8caf10df template:latex: make @ letter before using it (#5145)
This fixes the previous commit for parskip and KOMA classes.
2018-12-11 16:21:45 -05:00
Enno
84147eeff1 Let KOMA document class handle parskip when applicable (#5143)
This is just a change to the default latex template.
2018-12-11 13:22:31 -05:00
Jesse Rosenthal
0f736d778f Docx: add test for lists with level overrides. 2018-12-10 19:24:56 -05:00
John MacFarlane
d5e68d43be RST writer: don't wrap simple table header lines.
Closes #5128.
2018-12-05 17:10:33 -08:00
John MacFarlane
38200c0291 Strip out illegal XML characters in escapeXMLString.
Closes #5119.
2018-12-04 09:24:15 -08:00
John MacFarlane
4060df6891 Markdown writer: include needed whitespace after HTML figure.
We use HTML for a figure in markdown dialects that can't
represent it natively.

Closes #5121.
2018-12-03 15:10:13 -08:00
John MacFarlane
049a773b5b Fix custom tests. 2018-11-29 11:04:08 -08:00
John MacFarlane
77a40d6f34 MediaWiki writer: fix caption, use 'thumb' instead of 'frame'.
Captions used to have the word 'caption' prepended; this
has been removed.

Also, 'thumb' is used instead of 'frame' to allow images
to be resized.

Closes #5105.
2018-11-27 14:45:39 -08:00
John MacFarlane
83c0789205 Added test for #5053.
Note that the fix for #5099 also fixes #5053, a pandoc 2.4
regression in parsing underscore emphasis after symbols.
2018-11-25 22:50:16 -08:00
John MacFarlane
edc651059e Fix parsing of citations and quotes after parentheses.
Starting with pandoc 2.4, citations and quoted inlines
were no longer recognized after parentheses.  This is
because of commit 9b0bd4ec6f,
which is reverted here.

The point of that commit was to allow relocation of
soft line breaks to before an abbreviation, so that
a nonbreaking space could be added after the
abbreviation.  Now we simply leave the soft line
break in place, even though this means that
we won't get a nonbreaking space after "Mr."
at the end of a line (and in LaTeX this may
result in a longer intersentential space).
Those who care about this issue should take care
not to end lines with an abbreviation, or to
insert nonbreaking spaces manually.

Closes #5099.
2018-11-25 22:29:54 -08:00
John MacFarlane
c9691b91df OpenDocument writer: small amendment to #5095.
Level one lists should start at 0.5in rather than 0.75in.
(At least this is how LibreOffice behaves for me with a new
document.)
2018-11-22 22:02:08 -05:00
Nils Carlson
eb82fd6b5e ODT writer: Fix list indentation
Previously lists were indented by half an inch on the first line
for each level of nesting. This resulted in lists that looked like
this:

1.      The first line of the list point text
the second line of the same list point.

Fix this and bring style into line with libreoffice standards:

    1.  The first line of the list point text
        the second line of the list point text.
2018-11-22 17:18:09 +00:00
John MacFarlane
191141f27f Fix markdown-citations test for new abbreviations changes. 2018-11-20 23:56:13 -05:00
John MacFarlane
d333c283cc Docx writer: Fix bookmarks to headers with long titles.
Word has a 40 character limit for bookmark names.  In
addition, bookmarks must begin with a letter.  Since
pandoc's auto-generated identifiers may not respect
these constraints, some internal links did not work.

With this change, pandoc uses a bookmark name based
on the SHA1 hash of the identifier when the identifier
isn't a legal bookmark name.

Closes #5091.
2018-11-20 23:43:21 -05:00
John MacFarlane
a5910c0a31 AsciiDoc writer: improve ordered lists.
Use `.`+ as list markers to support nested ordered lists.  Closes #5087.
Support list number styles.  Closes #5089.
2018-11-19 13:17:33 -08:00
John MacFarlane
d532eb14eb HTML reader: allow tfoot before body rows.
Closes #5079.
2018-11-16 11:29:15 -08:00
John MacFarlane
e61f632531 HTML reader: parse <small> as a Span with class "small".
Closes #5080.
2018-11-15 22:36:01 -08:00
John MacFarlane
e61d1d0da9 Asciidoc writer: Render Spans using [#id .class]#contents#.
See #5080.
2018-11-15 22:29:15 -08:00
Alexander Krotov
367e8cac18 Muse reader: trim whitespace before parsing grid table cells 2018-11-14 19:17:05 +03:00
Alexander Krotov
c61b67410a Muse reader: add grid tables support 2018-11-14 17:58:44 +03:00
Alexander Krotov
195b3af8b6 Muse writer: indent simple tables only on the top level 2018-11-14 15:10:38 +03:00