14363 Commits

Author SHA1 Message Date
John MacFarlane eb474bf717 Org reader: Resolve org includes relative to ...
...the directory containing the file containing the
INCLUDE directive.  Closes #5501.
2021-05-09 18:44:30 -06:00
John MacFarlane bad3985a4e Update doc/using-the-pandoc-api.md for new reader types. 2021-05-09 17:25:55 -06:00
John MacFarlane edd4876446 RST reader: use insertIncludedFile from T.P.Parsing...
instead of reproducing much of its code.
2021-05-09 16:29:43 -06:00
John MacFarlane 8d879f4d7a T.P.Parsing: improve include file functions.
Remove old `insertIncludedFileF`. [API change]
Give `insertIncludedFile` a more general type, allowing it
to be used where `insertIncludedFileF` was.
2021-05-09 16:29:43 -06:00
John MacFarlane a9cd3a7350 Change reader types, allowing better tracking of source positions.
Previously, when multiple file arguments were provided, pandoc
simply concatenated them and passed the contents to the readers,
which took a Text argument.

As a result, the readers had no way of knowing which file
was the source of any particular bit of text.  This meant that
we couldn't report accurate source positions on errors or
include accurate source positions as attributes in the AST.
More seriously, it meant that we couldn't resolve resource
paths relative to the files containing them
(see e.g. #5501, #6632, #6384, #3752).

Add Text.Pandoc.Sources (exported module), with a `Sources` type
and a `ToSources` class.  A `Sources` wraps a list of `(SourcePos,
Text)` pairs. [API change] A parsec `Stream` instance is provided for
`Sources`.  The module also exports versions of parsec's `satisfy` and
other Char parsers that track source positions accurately from a
`Sources` stream (or any instance of the new `UpdateSourcePos` class).

Text.Pandoc.Parsing now exports these modified Char parsers instead of
the ones parsec provides.  Modified parsers to use a `Sources` as stream
[API change].

The readers that previously took a `Text` argument have been
modified to take any instance of `ToSources`. So, they may still
be used with a `Text`, but they can also be used with a `Sources`
object.

In Text.Pandoc.Error, modified the constructor PandocParsecError
to take a `Sources` rather than a `Text` as first argument,
so parse error locations can be accurately reported.

T.P.Error: showPos, do not print "-" as source name.
2021-05-09 09:34:50 -06:00
John MacFarlane 56a0d874c7 Add instructions for installing pandoc-types before compiling filter. 2021-04-30 08:35:52 -07: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
Albert Krewinkel dc0e482da7 INSTALL: add note that parallel installations should be avoided. (#7147)
Closes: #6865
2021-04-29 18:54:36 -07:00
Florian Kohrt 96d384ac9e Support toc-title in revealjs (#7171)
* Support toc-title in revealjs
* Add semantic HTML "nav" tag

Closes #7170.

As with default.html5
2021-04-29 18:49:17 -07:00
badumont b9b22e3ce4 Update default.latex (#7234)
Fix bad vertical spacing after the bibliography.
2021-04-29 18:47:23 -07: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
Julien Dutant 8fe7e8dd5c list of figures before list of tables in LaTeX and ConTeXt templates (#7235) 2021-04-28 19:06:13 -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 d0d8bb9818 Add unicode-collation to list of libraries developed to support pandoc. 2021-04-26 09:29:47 -07:00
Charanjit Singh b159daa8e9 docs/org.md: Add note about default export behavior of org-mode in (#7238)
Since it seem to be a common source of confusion, this commit adds a note in
org-mode documentation referring users to consult org-mode's export
documentation when they find themselves in a pinch.
2021-04-26 11:54:25 +02:00
John MacFarlane 853f24f5ca Fixed another typo in cabal.project. 2021-04-25 23:11:53 -07:00
John MacFarlane 1f72a50627 Fix typo in cabal.project. 2021-04-25 22:52:07 -07:00
John MacFarlane 16b64bda38 Use dev texmath, citeproc. 2021-04-25 21:56:54 -07: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
John MacFarlane 7f4850c9de Remove biblatex-nussbaum.md test.
It is basically the same as biblaetx-quotes.md.
2021-04-25 10:29:03 -07:00
John MacFarlane ac62b082ee stack.yaml - use latest unicode-collation. 2021-04-20 14:59:59 -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 3ab08fe2fb Fix nightly build. 2021-04-19 12:59:11 -07: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 8d584b5826 CI: Use cabal 2.4 even with ghc 8.0.2 2021-04-18 21:58:55 -07:00
John MacFarlane 9d6c3fa41f Use lastest citeproc. 2021-04-18 11:35:09 -07:00
John MacFarlane b7a2632184 Use lastest unicode-collation. 2021-04-18 11:34:12 -07:00
John MacFarlane 4f858a6a49 MANUAL: Add information about lang and bibliography sorting. 2021-04-18 09:09:53 -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 099ac9985b Use BCP47 language codes in citeproc tests. 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
John MacFarlane ff5a504809 Use new citeproc + unicode-collation.
Add command test for unicode-collation.
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
John MacFarlane 2e7fee9c3c Use latest xml-conduit. 2021-04-15 14:30:33 -07: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