Commit graph

7312 commits

Author SHA1 Message Date
Albert Krewinkel
295d93e96b
ConTeXt writer: support blank lines in line blocks.
Fixes: #6564

Thanks to @denismaier.
2021-05-07 17:17:47 +02:00
Albert Krewinkel
8357b835d9
App: allow tabs expansion even if file-scope is used
Tabs in plain-text inputs are now handled correctly, even if the
`--file-scope` flag is used.

Closes: #6709
2021-05-05 19:09:21 +02:00
Albert Krewinkel
ddbf83f62c
Docx writer: support colspans and rowspans in tables
See: #6315
2021-05-01 18:52:24 +02:00
Albert Krewinkel
3da919e35d
Add new internal module Text.Pandoc.Writers.GridTable 2021-05-01 18:52:24 +02:00
tecosaur
6b16f3bb0d
Org writer: inline latex envs need newlines (#7259)
Closes #7252

As specified in https://orgmode.org/manual/LaTeX-fragments.html, an
inline \begin{}...\end{} LaTeX block must start on a new line.
2021-04-30 10:23:28 +02:00
mbrackeantidot
b6a65445e1
Docx reader: add handling of vml image objects (jgm#4735) (#7257)
They represent images, the same way as other images in vml format.
2021-04-29 09:11:44 -07:00
John MacFarlane
d14c5f94df Further improvements in smart quotes.
Improves heuristic for detection of an "open double quote."
Closes #2103.
2021-04-29 08:48:49 -07:00
John MacFarlane
80e2e88287 Smarter smart quotes.
Treat a leading " with no closing " as a left curly quote.
This supports the practice, in fiction, of continuing
paragraphs quoting the same speaker without an end quote.
It also helps with quotes that break over lines in line
blocks.

Closes #7216.
2021-04-28 23:32:37 -07:00
Albert Krewinkel
85f379e474
JATS writer: use either styled-content or named-content for spans.
If the element has a content-type attribute, or at least one class, then
that value is used as `content-type` and the span is put inside a
`<named-content>` element. Otherwise a `<styled-content>` element is
used instead.

Closes: #7211
2021-04-28 22:21:34 +02:00
Albert Krewinkel
0921b82d98
Docx writer: autoset table width if no column has an explicit width. 2021-04-27 13:27:20 +02:00
John MacFarlane
3a98f7a0c7 Minor code reformatting.
Also taking this opportunity to note, for the record, that
the commit for #7241 should be marked [API change].
It changes the type of `languagesByExtension` in Highlighting,
adding a parameter for a `SyntaxMap`.
2021-04-25 12:22:04 -07:00
Jan Tojnar
c56d080a25
Writers: Recognize custom syntax definitions (#7241)
Languages defined using `--syntax-definition` were not recognized by `languagesByExtension`.
This patch corrects that, allowing the writers to see all custom definitions.

The LaTeX still uses the default syntax map, but that's okay in that context, since
`--syntax-definition` won't create new listings styles.
2021-04-25 12:19:07 -07:00
Jan Tojnar
e9c0f9f97b
Markdown writer: Cleaner (code)blocks with single class (#7242)
When a block only has a single class and no other attributes,
it is not necessary to wrap the class attribute in curly braces –
the class name can be placed after the opening mark as is.

This will result in bit cleaner output when pandoc is used
as a markdown pretty-printer.
2021-04-25 10:36:06 -07:00
John MacFarlane
547bc2cdf8 Add quotes properly in markdown YAML metadata fields.
This fixes a bug, which caused the writer to look at the LAST
rather than the FIRST character in determining whether quotes
were needed.  So we got spurious quotes in some cases and
didn't get necessary quotes in others.

Closes #7245.  Updated a number of test cases accordingly.
2021-04-25 10:31:33 -07:00
Albert Krewinkel
dc0ba7294d
Docx writer: add missing file 2021-04-20 13:38:16 +02:00
Albert Krewinkel
0b74bbbdaa
Docx writer: extract Table handling into separate module 2021-04-20 10:57:54 +02:00
John MacFarlane
16d372abcb Issue error message when reader or writer format is malformed.
Previously we exited with an error status but (due to a bug)
no message.

Closes #7231.
2021-04-19 08:38:31 -07:00
John MacFarlane
73d394ca2a Use MetaInlines not MetaBlocks for multimarkdown metadata fields.
This gives better results in converting to e.g. pandoc markdown.

Ref: <https://groups.google.com/d/msgid/pandoc-discuss/9728d1f4-040e-4392-aa04-148f648a8dfdn%40googlegroups.com>
2021-04-18 22:01:12 -07:00
John MacFarlane
a478a5c4c8 Update to released unicode-collation, latest citeproc dev version.
Update citeproc test.
2021-04-17 16:15:14 -07:00
John MacFarlane
7a7fefce5e Use document's lang for the lang parameter of citeproc...
even if it differs from localeLanguage.  (It is designed
to be possible to override the locale language, and this
is especially useful when one wants to use the unicode
extension syntx, e.g. fr-u-kb.)
2021-04-17 16:15:14 -07:00
John MacFarlane
aecbf8156e Remove Text.Pandoc.BCP47 module.
[API change]

Use Lang from UnicodeCollation.Lang instead.
This is a richer implementation of BCP 47.
2021-04-17 16:15:14 -07:00
John MacFarlane
7ba8c0d2a5 Move getLang from BCP47 -> T.P.Writers.Shared.
[API change]
2021-04-17 16:15:13 -07:00
Albert Krewinkel
5f79a66ed6
JATS writer: reduce unnecessary use of <p> elements for wrapping
The `<p>` element is used for wrapping in cases were the contents would
otherwise not be allowed in a certain context. Unnecessary wrapping is
avoided, especially around quotes (`<disp-quote>` elements).

Closes: #7227
2021-04-16 22:47:37 +02:00
Albert Krewinkel
2d60524de4
JATS writer: convert spans to <named-content> elements
Spans with attributes are converted to `<named-content>` elements
instead of being wrapped with `<milestone-start/>` and `<milestone-end>`
elements. Milestone elements are not allowed in documents using the
articleauthoring tag set, so this change ensures the creation of valid
documents.

Closes: #7211
2021-04-10 11:49:18 +02:00
Albert Krewinkel
051b7ffeaf
JATS writer: add footnote number as label in backmatter
Footnotes in the backmatter are given the footnote's number as a label.
The articleauthoring output is unaffected from this change, as footnotes
are placed inline there.

Closes: #7210
2021-04-10 10:57:06 +02:00
John MacFarlane
20cd33e5a4 Fix regression in grid tables for wide characters.
In the translation from String to Text, a char-width-sensitive
splitAt' was dropped.  This commit reinstates it.
Closes #7214.
2021-04-08 14:48:29 -07:00
Albert Krewinkel
e227496d3a
Lua filter: respect Inlines/Blocks filter functions in pandoc.walk_* 2021-04-08 22:14:47 +02:00
John MacFarlane
60974538b2 Commonmark writer: Use backslash escapes for < and |...
instead of entities.  Closes #7208.
2021-04-05 23:29:22 -07:00
John MacFarlane
21fed4a9c2 SelfContained: remove unneeded imports. 2021-04-05 23:26:54 -07:00
Albert Krewinkel
038261ea52
JATS writer: escape disallows chars in identifiers
XML identifiers must start with an underscore or letter, and can contain
only a limited set of punctuation characters. Any IDs not adhering to
these rules are rewritten by writing the offending characters as Uxxxx,
where `xxxx` is the character's hex code.
2021-04-05 21:55:54 +02:00
John MacFarlane
65a9d3a878 SelfContained: use application/octet-stream for unknown mime types...
instead of halting with an error.
Closes #7202.
2021-04-05 08:49:03 -07:00
John MacFarlane
935d10769d Fix "phrase" in DocBook: take classes from "role" not "class".
Closes #7195.  Revises #6438.
2021-04-02 17:07:18 -07:00
tecosaur
4371223d13
Org writer: Use LaTeX style maths deliminators (#7196)
Org works better with LaTeX-style delimiters.
2021-04-01 23:36:02 +02:00
niszet
40da6c402b
Treat tabs as spaces in ODT Reader. (#7185) 2021-03-31 16:44:34 -07:00
John MacFarlane
e22d1fbb14 Powerpoint writer: allow monofont to be specified in metadata...
...not just using `--variable` on the command line (as in
other writers).  Closes #7187.
2021-03-29 14:56:44 -07:00
John MacFarlane
56ce1fc126 Fix DocBook reader mathml regression...
...caused by the switch in XML libraries.
Also fixed a similar issue in JATS.
Closes #7173.
2021-03-24 12:04:33 -07:00
John MacFarlane
052056289f Simplify T.P.Asciify and export toAsciiText [API change].
Instead of encoding a giant (and incomplete) map, we now
just use unicode-transforms to normalize the text to
a canonical decomposition, and manipulate the result.

The new `toAsciiText` is equivalent to the old
`T.pack . mapMaybe toAsciiChar . T.unpack` but should be faster.
2021-03-21 23:40:19 -07:00
John MacFarlane
c389211e2f Support yaml_metadata_block extension form commonmark, gfm.
This is a bit more limited than with markdown, as documented
in the manual:

- The YAML block must be the first thing in the input.
- The leaf notes are parsed in isolation from the rest of
  the document.  So, for example, you can't use reference
  links if the references are defined later in the document.

Closes #6537.
2021-03-20 15:58:33 -07:00
John MacFarlane
2274eb88a4 Move yamlMetaBlock from Markdown reader to T.P.Readers.Metadata. 2021-03-20 15:58:33 -07:00
John MacFarlane
bea86f394e Markdown reader: export yamlMetaBlock.
[API change]

This will allow us to parse YAML metadata blocks in other
readers, potentially.
2021-03-20 15:58:33 -07:00
John MacFarlane
ce418667ae Text.Pandoc.Parsing: remove F type synonym.
Muse and Org were defining their own F anyway, with their
own state.  We therefore move this definition to the Markdown
reader.
2021-03-20 15:58:32 -07:00
John MacFarlane
4d041953f5 T.P.Readers.Metadata: made yamlBsToMeta, yamlBsToRefs polymorphic...
on the parser state, instead of requiring ParserState.
[API change]
2021-03-20 15:58:32 -07:00
John MacFarlane
84d8f3efd8 RST writer: use NonEmpty for init, last. 2021-03-20 15:58:32 -07:00
Erik Rask
82e8c29cb0 Include Header.Attr.attributes as XML attributes on section
Add key-value pairs found in the attributes list of Header.Attr as
XML attributes on the corresponding section element.

Any key name not allowed as an XML attribute name is dropped, as
are keys with invalid values where they are defined as enums in
DocBook, and xml:id (for DocBook 5)/id (for DocBook 4) to not
intervene with computed identifiers.
2021-03-20 21:29:17 +01:00
John MacFarlane
a1a57bce4e T.P.Shared: remove backslashEscapes, escapeStringUsing.
[API change]

These are inefficient association list lookups.
Replace with more efficient functions in the writers that
used them (with 10-25% performance improvements in
haddock, org, rtf, texinfo writers).
2021-03-20 00:24:49 -07:00
John MacFarlane
eacead3eb3 Fix fallback to default partials on templates.
If the directory containing a template does not contain
the partial, it should be sought in the default data files.
Closes #7164.
2021-03-19 22:57:48 -07:00
John MacFarlane
7678c48122 Hlint suggestion. 2021-03-19 14:43:42 -07:00
John MacFarlane
005f0fbcd5 T.P.Shared: Remove ToString, ToText typeclasses [API change].
T.P.Parsing: revise type of readWithM so that it takes a Text
rather than a polymorphic ToText value.

These typeclasses were there to ease the transition from String
to Text. They are no longer needed, and they may clash with
more useful versions under the same name.

This will require a bump to 2.13.
2021-03-19 12:36:04 -07:00
John MacFarlane
4002c35a91 Protect partial uses of maximum with NonEmpty. 2021-03-19 11:55:59 -07:00
John MacFarlane
8d5116381b Use NonEmpty instead of minimumDef. 2021-03-19 10:30:32 -07:00