These commands take optional arguments with () and [],
which can lead to problems if the content of the table
cell begins with these characters.
Closes#8001.
Refactor for readability.
Co-authored-by: Ola Wolska <A.k.wolska@student.tudelft.nl@gmail.com>
Co-authored-by: Ivar de Bruin <ivardb@gmail.com>
Co-authored-by: Jaap de Jong <jaapdejong15@gmail.com>
Previously when generating JATS with the `element_citations`
extension enabled, the references were put in a doubly-nested
ref-list element (`<ref-list><ref-list>...`). This is now fixed.
Closes#7990.
Grid table parsing in Markdown and rst are updated use the same
functions. Functions are generalized to meet requirements for both
formats.
This change also lays the ground for further generalizations in table
parsers, including support for advanced table features.
API changes in Text.Pandoc.Parsing:
- Parse results of functions `tableWith'` and `gridTableWith'` are now a
`mf TableComponents` instead of a quadruple of alignments, column
widths, header rows and body rows.
Additional exports from Text.Pandoc.Parsing:
- `tableWith'`
- `TableComponents`
- `TableNormalization`
- `toTableComponents`
- `toTableComponents'`
Citeproc adopted the BibTeX convention to use the author name "others"
when there are additional authors that are not named. JATS uses the
`<etal>` element for this.
This modifies `processCitations` so that pandoc will look not just
in the document body but in metadata for a Div with id `refs` in
which to place the formatted bibliography.
Thus, one can include a metadata field, say `refs`, whose content
is an empty div with id `refs`, and the formatted bibliography
will be put into this metadata field. It may then be interpolated
into a template using the variable `refs`.
Closes#7969.
Closes#526 by providing a way to interpolate references into
a template.
This allows `<div>` to be suppressed using `-raw_html`.
Previously `native_divs` was enabled but could
not be suppressed, because it was not in the list of
available extensions for commonmark-based formats.
Closes#7965.
If the package is local but causes parse errors, parse
everything up to the error and skip the rest. Issue a
CouldNotParseIncludeFile warning indicating that parsing
failed at that point.
T.P.Logging: add CouldNotParseIncludeFile constructor.
that keeps track of whether macros are expanded. This allows
us to improve performance a bit by avoiding unnecessary
runs of the macro expansion code (e.g. from 24 ms to 20 ms on
our standard benchmark).
Docbook, EPUB, FB2, HTML4, S5, Slidy, Slideous,
ICML, ODT, TEI writers.
Thus, if you convert `[anchor]{#1} and [link to](#1)`,
`id_1` will be used instead of `1` for the identifier.
This function changes identifiers that don't start
with letters, and internal links to these identifiers,
making them compatible with XML standards. The change
is simple: we add `id_` to the front. There is potential
for duplication if there are already `id_...` identifiers
defined, but this seems rare enough not to worry too much
about.
If scrreport is now chosen as the latex documentclass chapters will be used instead of sections. This behaviour is intended as scrreport is an alias for scrreprt which already created chapters
Looking at the definition of `org-element-latex-environment-parser`, one
sees that Org allows arbitrary arguments to LaTeX environments. In fact,
it parses every char just after `\begin{xxx}` until `\end{xxx}` as
content for the environment, so all the following examples are valid
environments:
```org
\begin{equation} e = mc^2 \end{equations}
```
```org
\begin{tikzcd}[ampersand replacement=\&]
A \& B \\
C \& D
\arrow[from=1-1, to=1-2]
\arrow["f", from=2-1, to=2-2]
\end{tikzcd}
```
Lua 5.4 is used by default after this is merged. Packagers may still include Lua 5.3
instead by building pandoc with `--constraint='hslua <2.2'`.
Differences between 5.3 and 5.4 should not generally affect pandoc Lua filters.
See list of incompatible changes here <https://www.lua.org/manual/5.4/manual.html#8.1>
Previously we used the markdown writer to render metadata.
This had some undesirable consequences (e.g. en dash expanded
to `--` when `smart` enabled), so now we use the plain writer.
This addresses #7928, but I think a more elegant fix is possible.
...so that, when the input format is not markdown or a markdown
variant, pandoc's markdown is used. When the input format is
a markdown variant, the same format is used. Reason for the change:
it doesn't make sense to run the markdown parser with a set of
extensions designed for a non-markdown format, and this dramatically
limits what people can do in metadata files.
Refines #6832. Closes#7926.
Perhaps this can be reconsidered if we come up with a way
of specifying an arbitrary format for the metadata file (#5914).
Footnotes in `<fn-group>` elements are collected and re-inserted into
the document as proper footnotes in the place where they are referenced.
Fixes: #6348
Closes#5202.
Within each cell, determine the cell alignment as per
https://www.dokuwiki.org/wiki:syntax#tables. The current approach, as
per the issue treats the first row's alignment as determining
that of the entire column. Given this, it wastes some work in
determining an alignment for every cell.
This change ensures that example list items all belong to a single
number sequence, so that if items are added or deleted in a word
processor, the other items will renumber automatically.
when parsing `<a epub:type="noteref">` and the identifier
doesn't correspond to anything in the note table.
Previously we just silently skipped these cases.
See #7884.
The Org Manual page at https://orgmode.org/manual/Property-Syntax.html
says (as of 2022-02-03):
"Property blocks defined before first headline needs to be located at
the top of the buffer, allowing only comments above."
This commit allows comments above.
Any non-space character is allowed as property drawer key, including ":"
itself (so it is not really a delimiter). The real delimiter is a space
character, so in a drawer like
:PROPERTIES:
::k:ey:: value
:END:
":k:ey:" is a key with value "value".
This usage can be seen in the Org Manual at
https://orgmode.org/manual/Using-Header-Arguments.html,
where the Org snippet
* Heading
:PROPERTIES:
:header-args:clojure: :session *clojure-1*
:header-args:R: :session *R*
:END:
is listed as an example.
Links without text contents are converted to `<xref>` elements. DocBook
processors will generate appropriate cross-reference text when presented
with an xref element.
New input format: endnotexml
New reader module: Text.Pandoc.Readers.EndNote, exporting
`readEndNoteXML` and `readEndNoteXMLReferences`. [API change]
This reader is still a bit rudimentary, but it should get
be good enough to be helpful.
These are supported in the same way as Zotero citations,
using the same code. As with Zotero, enable the `citations`
extension on `docx` to parse these as native citations.
Closes#7840.
Previously we used System.FilePath's isRelative to
determine when paths are relative (since absolute
paths need to get a new name based on the sha1 hash).
But this has an OS-specific behavior and actually
returns True on Windows for paths like `/media/file.png`.
This ought to fix#7881.
When enabled, Zotero citations are parsed as native pandoc
citations. (When disabled, the Zotero-generated citation
text is passed through as regular text.) In addition, the
Zotero-generated bibliography is suppressed.
Locators still need some work.
- Add docxReferences to state, so we can accumulate
references for metadata.
- Add a clause for ZoteroItem to parPartToInlines'.
So far it doesn't do anything except add a surrounding Cite element.
See #7840.
This reverts commit 545c0911aa.
Fixes regression in 2.17.1.
The original commit was completely misguided, and caused
problems finding defaults files in the default user data
directory.
Attribute key-value pairs are marshaled as AttributeList, i.e., as a
userdata type that behaves both like a list and a map. This allows to
preserve the order of key-value pairs.
Closes: #7489
If a file path does not exist relative to the working directory, but
it does exist relative to the user data directory, and it exists outside
of the user data directory, do not read it. This applies to readDataFile
and readMetadataFile in PandocMonad and, by extension, any module that
uses these by passing them relative paths.
Adding a pair of braces around the second argument of `\def`
prevents LaTeX from an emergency stop with: Closes#6096.
```
pandoc -f markdown -o test.pdf
\newif\ifepub
\epubtrue
\ifepub
hi
\fi
^D
```
If files specified with `--metadata-file` are not found in the working
directory, look in `$DATADIR/metadata`.
Expose new `readMetadataFile` function from Text.Pandoc.Class
[API change].
Expose new `PandocCouldNotFindMetadataFileError` constructor for
`PandocError` from Text.Pandoc.Error [API change].
Closes#5876.
This was causing serious problems with `newif` commands.
See #6096. And it didn't seem to make any difference for
the tests; I assume that, unless there's some untested
behavior, this is something that has now become unnecessary.
If speaker notes (a Div with class 'notes') occur right
after a section heading, but above slide level, the
resulting `\note{..}` caommand should not be wrapped in
a frame, as that will cause a spurious blank slide.
Closes#7857.
With the new (default) line wrapping of HTML, in
conjunction with the default CSS which includes
`code { whitespace: pre-wrap; }`, spurious line
breaks could be introduced into inline code.
Closes#7858.
Otherwise we'll sometimes get two copies of things, one
from the `citationPrefix` or `citationSuffix` and another
from the embedded fallback text.
When there is no fallback text, we'll get no content.
However, it really isn't an alternative to just rely
on the result of running `query` on the embedded `Citation`s;
this will result in a jumble of text rather than anything
structured.
Closes#7855.
So far this just adds a constructor for FieldInfo;
we'll need to adjust the rest of the reader code to
parse the JSON and do something with it.
See #7840.
If a table has explicit column width information *and* the
content extends beyond the `--columns` width, we need to
adjust the widths of the pipe separators to encode this width
information.
Closes#7847.
Adjacent docx tables need to be separated by an empty paragraph. If
there's a RawBlock between tables which renders to nothing, be sure to
still insert the empty paragraph so that they will not collapse
together.
Fixes#7724
Previously we would (also) search the default user data directory
for a defaults file, even if a different user data directory
was specified using `--data-dir`. This was a mistake; if
`--data-dir` is used, the default user data directory should
not be searched.
If the XDG data directory is not defined (e.g. because
it's not supported in the OS or HOME isn't defined), we
return the empty string instead of raising an exception.
Closes#7842.
The V font is defined conditionally, so that it renders
like CB in output formats that support that, and like B
in those that don't (e.g. the terminal).
We could just redefine C, but this would affect code
blocks, too, and putting them all in boldface looks ugly,
I think.
Possible drawback: fragments created by pandoc's man
writer will presuppose a nonstandard V font.
Closes#7506.
Supersedes 253467a549.