Commit graph

7312 commits

Author SHA1 Message Date
John MacFarlane
21ee2d80c2 EPUB writer: adjust internal links to images, links, and tables...
after splitting into chapters. Previously we only did this for
Div and Span and Header elements.  See #7000.
2021-01-03 11:27:01 -08:00
Dimitri Sabadie
57b1094152
Org reader: mark verbatim code with class "verbatim". (#6998)
* Replace org-mode’s verbatim from code to codeWith.

This adds the `"verbatim"` class so that exporters can apply a specific
style on it. For instance, it will be possible for HTML to add a CSS
rule for code + verbatim class.

* Alter test for org-mode’s verbatim change.

See previous commit for further detail on the new implementation.
2021-01-03 08:57:47 +01:00
John MacFarlane
260aaaacc6 LaTeX reader: put contents of unknown environments in a Div...
when `raw_tex` is not enabled. (When `raw_tex` is enabled,
the whole environment is parsed as a raw block.)
The class name is the name of the environment.
Previously, we just included the contents without the
surrounding Div, but having a record of the environment's
boundaries and name can be useful.

Closes #6997.
2021-01-02 08:19:00 -08:00
John MacFarlane
9a18cf4b59 LaTeX writer: revert table line height increase in 2.11.3.
In 2.11.3 we started adding `\addlinespace`, which produced less
dense tables.  This wasn't an intentional change; I misunderstood
a comment in the discussion leading up to the change. This commit
restores the earlier default table appearance.

Note that if you want a less dense table, you can use something like
`\def\arraystretch{1.5}` in your header.

Closes #6996.
2021-01-02 07:56:07 -08:00
Albert Krewinkel
17e3efc785
Org reader: restructure output of captioned code blocks
The Div wrapper of code blocks with captions now has the class
"captioned-content". The caption itself is added as a Plain block
inside a Div of class "caption". This makes it easier to write filters
which match on captioned code blocks. Existing filters will need to be
updated.

Closes: #6977
2021-01-01 11:18:36 +01:00
John MacFarlane
23f964b907 Mediawiki reader: allow space around storng/emph delimiters.
Closes #6993.
2020-12-30 21:31:28 -08:00
John MacFarlane
0782d5882c Undo the "Use fromRight" hlint hint. 2020-12-30 16:04:09 -08:00
John MacFarlane
419190213a Hlint fixes 2020-12-30 15:38:48 -08:00
John MacFarlane
49286a25df Ms writer: don't justify inside table cells. 2020-12-30 13:36:18 -08:00
John MacFarlane
3cd21c5f6e Improve fix to #6983.
If we have a paragraph then a bookmarkEnd, we don't need to
insert the empty paragraph (and in fact it alters the spacing).

Closes #6983.
2020-12-29 08:44:43 -08:00
John MacFarlane
55f9b59af1 Docx writer: fix nested tables with captions.
Previously we got unreadable content, because docx seems
to want a `<w:p>` element (even an empty one) at the end of
every table cell.  Closes #6983.
2020-12-28 14:41:28 -08:00
Albert Krewinkel
e837ed772e
HTML reader: use renderTags' from Text.Pandoc.Shared.
The `renderTags'` function was duplicated when the reader used `Text` as
its string type. The duplication is no longer necessary.

A side effect of this change is that empty `<col>` elements are written
as self-closing tags in raw HTML blocks.
2020-12-28 14:48:55 +01:00
John MacFarlane
99e1b67b74 Use meta-description instead of description in templates.
Since this is an attribute value, we need to prepare it
in the writer.
2020-12-27 23:19:14 -08:00
timo-a
668596cc89
Add support for writing nested tables to asciidoc (#6972)
Added field to WriterState that denotes the current nesting level for traversing tables.
Depending on the value of that field nested tables are recognized and written.
Asciidoc supports one level of nesting. If deeper tables are to be written, they are
omitted and a warning is issued.
2020-12-27 18:42:28 -08:00
Albert Krewinkel
dcd89413f3 Powerpoint writer: allow arbitrary OOXML in raw inline elements
The raw text is now included verbatim in the output. Previously is was parsed
into XML elements, which prevented the inclusion of partial XML snippets.
2020-12-27 23:18:54 +01:00
John MacFarlane
47f435276a Citeproc: fix handling of empty URL variables (DOI, etc.).
The `linkifyVariables` function was changing these to links
which then got treated as non-empty by citeproc, leading
to wrong results (e.g. ignoring nonempty URL when empty DOI is present).

Addresses part 2 of jgm/citeproc#41.
2020-12-24 09:56:20 -08:00
John MacFarlane
9cbbf18fe1 HTML writer: don't include p tags in CSL bibliography entries.
Fixes a regression in 2.11.3.
Closes #6966
2020-12-20 22:34:31 -08:00
Albert Krewinkel
8f402beab9
LaTeX writer: support colspans and rowspans in tables. (#6950)
Note that the multirow package is needed for rowspans.
It is included in the latex template under a variable,
so that it won't be used unless needed for a table.
2020-12-20 18:04:54 -08:00
John MacFarlane
914cf0b602 Fix citeproc regression with duplicate references.
- Use dev version of citeproc, which handles duplicate
  ids better, preferring the last one in the list
  and discarding the rest.
- Ensure that inline citations take priority over external
  ones.

See jgm/citeproc#36.

This restores the behavior of pandoc-citeproc.
2020-12-16 15:37:40 -08:00
John MacFarlane
57241e201a Support Lua marshalling of doctemplates BoolVal.
This updates T.P.Lua.Marshaling.Context for doctemplates >= 0.9.
2020-12-16 07:56:07 -08:00
John MacFarlane
b4b4e32307 Properly handle boolean values in writing YAML metadata.
(Markdown writer.)
This requires doctemplates >= 0.9.
Closes #6388.
2020-12-15 23:45:34 -08:00
John MacFarlane
87033b2856 Use fetchItem to get external bibliography.
This means that:

- a URL may be provided, and pandoc will fetch the resource.
- Pandoc will search the resource path for the bibliography
  if it is not found relative to the working directory.

Closes #6940.
2020-12-15 09:09:51 -08:00
John MacFarlane
7d799bfcda Allow both inline and external references to be used
with `--citeproc`.  This fixes a regression, since pandoc-citeproc
allowed these to be combined.

Closes #6951.
2020-12-15 08:51:43 -08:00
John MacFarlane
39153ea6e2 ImageSize: use exif width and height when available.
After the move to JuicyPixels, we were getting incorrect
width and heigh information for some images (see #6936, test-3.jpg).

The correct information was encoded in Exif tags that
JuicyPixels seemed to ignore. So we check these first
before looking at the Width and Height identified by
JuicyPixels.

Closes #6936.
2020-12-14 09:39:07 -08:00
John MacFarlane
c43e2dc0f4 RST writer: better image handling.
- An image alone in its paragraph (but not a figure) is now
  rendered as an independent image, with an `alt` attribute
  if a description is supplied.
- An inline image that is not alone in its paragraph will
  be rendered, as before, using a substitution.
  Such an image cannot have a "center", "left", or
  "right" alignment, so the classes `align-center`,
  `align-left`, or `align-right` are ignored.
  However, `align-top`, `align-middle`, `align-bottom`
  will generate a corresponding `align` attribute.

Closes #6948.
2020-12-13 15:25:46 -08:00
John MacFarlane
32902d0fad
Merge pull request #6941 from tarleb/docx-raw
Docx writer: keep raw openxml strings verbatim
2020-12-13 11:08:41 -08:00
John MacFarlane
c3aa90b57a ImageSize: use JuicyPixels to extract size...
...for png, jpeg, gif, instead of doing our own binary parsing.
See #6936.
2020-12-13 10:33:46 -08:00
John MacFarlane
ef62b70646 ImageSize: use JuicyPixels to determine png size. 2020-12-13 10:33:46 -08:00
Albert Krewinkel
00031fc809
Docx writer: keep raw openxml strings verbatim.
Closes: #6933
2020-12-13 14:09:59 +01:00
Albert Krewinkel
8cf58d96e0
Docx writer: use Content instead of Element. 2020-12-13 14:09:53 +01:00
John MacFarlane
3a7d97f02f
Merge pull request #6946 from mb21/icml-image-fit
ICML writer: fix image bounding box for custom widths/heights
2020-12-12 08:28:14 -08:00
Albert Krewinkel
ccd235e31f
LaTeX writer: extract table handling into separate module. 2020-12-12 16:48:28 +01:00
mb21
208cb96196 ICML writer: fix image bounding box for custom widths/heights
fixes #6936
2020-12-12 14:49:11 +01:00
John MacFarlane
fcd0658189 HTML reader: pay attention to lang attributes on body.
These (as well as lang attributes on html) should update
lang in metadata. See #6938.
2020-12-10 15:51:20 -08:00
John MacFarlane
0a502e5ff5 HTML reader: retain attribute prefixes and avoid duplicates.
Previously we stripped attribute prefixes, reading
`xml:lang` as `lang` for example. This resulted in
two duplicate `lang` attributes when `xml:lang` and
`lang` were both used.  This commit causes the prefixes
to be retained, and also avoids invald duplicate
attributes.

Closes #6938.
2020-12-10 15:44:10 -08:00
John MacFarlane
a3eb87b2ea Add sourcepos extension for commonmarke
* Add `Ext_sourcepos` constructor for `Extension`.
* Add `sourcepos` extension (only for commonmark).
* Bump to 2.11.3

With the `sourcepos` extension set set, `data-pos` attributes are added
to the AST by the commonmark reader. No other readers are affected.  The
`data-pos` attributes are put on elements that accept attributes; for
other elements, an enlosing Div or Span is added to hold the attributes.

Closes #4565.
2020-12-10 08:59:55 -08:00
John MacFarlane
8c9010864c Commonmark reader: refactor specFor, set input name to "". 2020-12-10 08:59:55 -08:00
John MacFarlane
5990cbb150 Parsing: Small code improvements. 2020-12-07 21:34:23 -08:00
John MacFarlane
0fa1023b9e Parsing: More minor performance improvements. 2020-12-07 18:57:09 -08:00
John MacFarlane
ce1791913d Small efficiency improvement in uri parser 2020-12-07 13:24:19 -08:00
John MacFarlane
2f9b684b3a Bibtex parser: avoid noneOf. 2020-12-07 13:01:30 -08:00
John MacFarlane
f2749ba6cd Parsing: in nonspaceChar use satisfy instead of oneOf.
For efficiency.
2020-12-07 12:56:03 -08:00
John MacFarlane
501ea7f0c4 Dokuwiki reader: handle unknown interwiki links better.
DokuWiki lets the user define his own Interwiki links.
Previously pandoc reacted to these by emitting a
google search link, which is not helpful. Instead,
we now just emit the full URL including the
wikilink prefix, e.g. `faquk>FAQ-mathml`.
This at least gives users the ability to
modify the links using filters.

Closes #6932.
2020-12-07 12:15:14 -08:00
John MacFarlane
810df00cf5
Merge pull request #6922 from jtojnar/db-writer-admonitions
Docbook writer: handle admonitions
2020-12-07 08:48:02 -08:00
Jan Tojnar
70c7c5703a
Docbook writer: Handle admonition titles from Markdown reader
Docbook reader produces a `Div` with `title` class for `<title>` element
within an “admonition” element. Markdown writer then turns this
into a fenced div with `title` class attribute. Since fenced divs
are block elements, their content is recognized as a paragraph
by the Markdown reader. This is an issue for Docbook writer because
it would produce an invalid DocBook document from such AST –
the `<title>` element can only contain “inline” elements.

Let’s handle this invalid special case separately by unwrapping
the paragraph before creating the `<title>` element.
2020-12-07 07:28:39 +01:00
Jan Tojnar
16ef877457
Docbook writer: Use correct id attribute consistently
DocBook5 should always use xml:id instead of id so let’s use it everywhere.
2020-12-07 06:23:25 +01:00
Jan Tojnar
dc6856530c
Docbook writer: handle admonitions
Similarly to d6fdfe6f2b,
we should handle admonitions.
2020-12-07 06:23:25 +01:00
Albert Krewinkel
acf932825b
Org reader: preserve targets of spurious links
Links with (internal) targets that the reader doesn't know about are
converted into emphasized text. Information on the link target is now
preserved by wrapping the text in a Span of class `spurious-link`, with
an attribute `target` set to the link's original target. This allows to
recover and fix broken or unknown links with filters.

See: #6916
2020-12-05 22:37:48 +01:00
Nils Carlson
c161893f44
OpenDocument writer: Allow references for internal links (#6774)
This commit adds two extensions to the OpenDocument writer,
`xrefs_name` and `xrefs_number`.

Links to headings, figures and tables inside the document are
substituted with cross-references that will use the name or caption
of the referenced item for `xrefs_name` or the number for `xrefs_number`.

For the `xrefs_number` to be useful heading numbers must be enabled
in the generated document and table and figure captions must be enabled using for example the `native_numbering` extension.

In order for numbers and reference text to be updated the generated
document must be refreshed.

Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-12-05 10:00:04 -08:00
John MacFarlane
ddb76cb356 LaTeX reader: don't apply theorem default styling to a figure inside.
If we put an image in italics, then when rendering to Markdown
we no longer get an implicit figure.

Closes #6925.
2020-12-05 09:53:39 -08:00
Jan Tojnar
6f35600204
Docbook writer: add XML namespaces to top-level elements (#6923)
Previously, we only added xmlns attributes to chapter elements,
even when running with --top-level-division=section.
Let’s add the namespaces to part and section elements too,
when they are the selected top-level divisions.

We do not need to add namespaces to documents produced with
--standalone flag, since those will already have xmlns attribute
on the root element in the template.
2020-12-04 21:00:21 -08:00
John MacFarlane
dc3ef5201f Markdown writer: ensure that a new csl-block begins on a new line.
This just looks better and doesn't affect the semantics.
See #6921.
2020-12-04 10:55:48 -08:00
John MacFarlane
68bcddeb21 LaTeX writer: Fix bug with nested csl- display Spans.
See #6921.
2020-12-04 10:14:19 -08:00
John MacFarlane
171d3db384 HTML writer: Fix handling of nested csl- display spans.
Previously inner Spans used to represent
CSL display attributes were not rendered as div tags.

See #6921.
2020-12-04 09:47:56 -08:00
John MacFarlane
7199d68ba0 EPUB writer: include title page in landmarks.
Closes #6919.

Note that the toc is also included if `--toc` is specified.
2020-12-03 21:39:44 -08:00
John MacFarlane
9c6cc79c11 EPUB writer: add frontmatter type on body element for nav.xhtml.
Closes #6918.
2020-12-03 21:24:27 -08:00
John MacFarlane
5bbd5a9e80 Docx writer: Support bold and italic in "complex script."
Previously bold and italics didn't work properly in LTR
text.  This commit causes the w:bCs and w:iCs attributes
to be used, in addition to w:b and w:i, for bold and
italics respectively.

Closes #6911.
2020-12-03 09:51:23 -08:00
John MacFarlane
7b11cdee49 Citeproc: ensure that BCP47 lang codes can be used.
We ignore the variants and just use the base lang code
and country code when passing off to citeproc.
2020-12-02 10:46:23 -08:00
John MacFarlane
bff9c129c3 LaTeX reader: don't parse \rule with width 0 as horizontal rule. 2020-11-29 10:35:20 -08:00
Tassos Manganaris
83d63b72e1 Fix a tiny Typo in the CSV reader module
Header comment in the CSV reader module says "RST" instead of "CSV".
2020-11-28 09:40:15 +01:00
Albert Krewinkel
8c38390038
HTML reader tests: improve test coverage of new features 2020-11-27 21:21:25 +01:00
Albert Krewinkel
a9c766291f
HTML reader: support body headers, row head columns
Closes: #6312
2020-11-27 10:36:13 +01:00
John MacFarlane
db2db54f80 Added some explicit imports. 2020-11-26 12:44:01 -08:00
cholonam
5f4deb5455 Docx writer: Fix bullets/lists indentation
Fix appearance of bullets/numbered lists (the first level is slightly
indented to the right instead of right on the margin).

New golden files have been tested using Word 2010 on Windows 10.
2020-11-26 12:11:26 -08:00
Igor Pashev
630b1bff2b
LaTeX reader: preserve center environment (#6852)
The contents of the `center` environment are put in a `Div`
with class `center`.
2020-11-26 12:04:31 -08:00
Albert Krewinkel
07919e1b22
HTML reader: improve support for table headers, footer, attributes
- `<tfoot>` elements are no longer added to the table body but used as
  table footer.
- Separate `<tbody>` elements are no longer combined into one.
- Attributes on `<thead>`, `<tbody>`, `<th>`/`<td>`, and `<tfoot>`
  elements are preserved.
2020-11-26 07:22:01 +01:00
Albert Krewinkel
3e01ae405f
HTML reader: allow finer grained options for tag omission 2020-11-26 07:22:01 +01:00
John MacFarlane
7c4d7db9c7 LaTeX writer: improve longtable output.
- Don't create minipages for regular paragraphs.
- Put width and alignment information in the longtable column
  descriptors.
- Closes #6883.
2020-11-25 15:42:44 -08:00
John MacFarlane
b50ac3a95b LaTeX tables: Fix calculation of column spacing.
See #6883.
2020-11-25 14:41:28 -08:00
John MacFarlane
815976d537 Fix truncation of [Citation] list in Cite inside footnotes...
This affected author-in-text citations in footnotes.
It didn't cause problems for the printed output, but for
filters that expected the citation id and other information.

Closes #6890.
2020-11-25 09:10:10 -08:00
Albert Krewinkel
c6f2663a23
HTML reader: simplify list attribute handling
This removes the `foldOrElse` function from the internal Text.Pandoc.CSS
module.
2020-11-25 17:55:42 +01:00
Albert Krewinkel
c9f98e2bf5
HTML reader: support row or column-spanning table cells 2020-11-24 14:17:35 +01:00
Albert Krewinkel
446ef27a3f
HTML reader: support blocks in caption 2020-11-24 14:17:35 +01:00
Albert Krewinkel
41237fcc0e
HTML reader: extract table parsing into separate module 2020-11-24 14:17:35 +01:00
John MacFarlane
2f110265ff ImageSize: default to DPI 72 if the format specifies DPI of 0.
This shouldn't happen, in general, but it can happen with
JPEGs that don't conform to the spec.  Having a DPI of 0
will blow up size calculations (division by 0).

Closes #6880.
2020-11-23 09:39:48 -08:00
Albert Krewinkel
f9258371dd HTML reader: extract submodules
Reducing module size should reduce memory use during compilation.

This is preparatory work to tackle support for more table features.
2020-11-23 10:12:20 +01:00
Nils Carlson
75c881e2d9
OpenDocument Writer: Implement Div and Span ident support (#6755)
Spans and Divs containing an ident in the Attr will become bookmarks
or sections with idents in OpenDocument format.
2020-11-22 22:23:30 -08:00
John MacFarlane
b5b5ef92cb LaTeX writer: Improve table spacing.
+ Remove the `\strut` that was added at the end of minipage
  environments in cells.

+ Replace `\tabularnewline` with `\\ \addlinespace`.

Closes #6842, closes #6860.
2020-11-22 10:54:42 -08:00
Albert Krewinkel
5344dab8eb
Org reader: parse #+LANGUAGE into lang metadata field
Fixes: #6845
2020-11-22 12:53:05 +01:00
Nils Carlson
ae52918faa
OpenDocument writer: Table text width support (#6792)
Support for table width as a percentage of text width by summing
width of columns and verifying that the sum is > 0 and <= 1.
2020-11-21 12:42:43 -08:00
John MacFarlane
7db2cf5d2f LaTeX reader: more robust parsing of bracketed options.
Improves on 9a40976.  Closes #6873.
2020-11-21 12:24:37 -08:00
John MacFarlane
fec8223d3a Citeproc BibTeX parser: revert change in getRawField...
which was made (for reasons forgotten) when transferring
this code from pandoc-citeproc.  The change led to `--` in
URLs being interpreted as en-dashes, which is unwanted.

Closes #6874.
2020-11-21 12:07:28 -08:00
Nils Carlson
56ceaf49dc
DocBook reader: Table text width support (#6791)
Table width in relation to text width is not natively supported
by docbook but is by the docbook fo stylesheets through an XML
processing instruction, <?dbfo table-width="50%"?> .
Implement support for this instruction in the DocBook reader.
2020-11-20 16:05:56 -08:00
John MacFarlane
9a4097640f Improve LaTeX option parsing...
in cases where we run into trouble parsing inlines til the
closing `]`, e.g. quotes, we return a plain string with the
option contents. Previously we mistakenly included the brackets
in this string.

Closes #6869.
2020-11-20 13:40:26 -08:00
John MacFarlane
c647948ff1 commonmark_x: replace auto_identifiers with gfm_auto_identifiers.
`commonmark_x` never actually supported `auto_identifiers` (it
didn't do anything), because the underlying library implements
gfm-style identifiers only.

Attempts to add the `autolink_identifiers` extension to
`commonmark` will now fail with an error.

Closes #6863.
2020-11-20 09:17:14 -08:00
Albert Krewinkel
d286242131 JATS writer: support advanced table features 2020-11-19 22:09:52 +01:00
John MacFarlane
c1fbe7b91a --self-contained: increase coverage.
Previously we only self-contained attributes for
certain tag names (`img`, `embed`, `video`, `input`, `audio`,
`source`, `track`, `section`).  Now we self-contain any
occurrence of `src`, `data-src`, `poster`, or `data-background-image`,
on any tag; and also `href` on `link` tags.

Closes #6854 (which specifically asked about
`asciinema-player` tags).
2020-11-19 10:08:43 -08:00
John MacFarlane
e16df8d271 DocBook reader: drop period in formalpara title...
...and put it in a div with class `formalpara-title`, so that
people can reformat with filters.

Closes #6562.

Thanks to rdmuller.
2020-11-19 09:33:29 -08:00
John MacFarlane
0962b30d84 Man reader: improve handling of .IP.
We now better handle `.IP` when it is used with non-bullet,
non-numbered lists, creating a definition list.

We also skip blank lines like groff itself.

Closes #6858.
2020-11-18 22:44:32 -08:00
Albert Krewinkel
023468ea2d
JATS writer: wrap all tables
All `<table>` elements are put inside `<table-wrap>` elements, as the
former are not valid as immediate child elements of `<body>`.
2020-11-18 18:10:17 +01:00
TEC
0306eec5fa Replace org #+KEYWORDS with #+keywords
As of ~2 years ago, lower case keywords became the standard (though they
are handled case insensitive, as always):
13424336a6

Upper case keywords are exclusive to the manual:
- https://orgmode.org/list/871s50zn6p.fsf@nicolasgoaziou.fr/
- https://orgmode.org/list/87tuuw3n15.fsf@nicolasgoaziou.fr/
2020-11-18 14:48:56 +01:00
TEC
224a501b29 Update org supported languages and identifiers
according to the current list contained in
https://orgmode.org/worg/org-contrib/babel/languages/index.html
2020-11-18 14:48:56 +01:00
John MacFarlane
efa34a8de6 Bibtex reader: fall back on en-US if locale for LANG not found.
This reproduces earlier pandoc-citeproc behavior.

Closes jgm/citeproc#26.
2020-11-17 23:12:32 -08:00
John MacFarlane
bf3fea0a8c Markdown reader: fix regression with example list references.
This affects example list references followed by dashes.
Introduced by commit b8d17f7.
Closes #6855.
2020-11-17 20:36:59 -08:00
Albert Krewinkel
94c9028819 JATS writer: move Table handling to separate module
This makes it easier to split the module into smaller parts.
2020-11-17 09:46:30 +01:00
John MacFarlane
c9ada73cac Move getNextNumber from Readers.LaTeX to Readers.LaTeX.Parsing. 2020-11-16 22:36:10 -08:00
John MacFarlane
ee34c4fef8 Only use filterIpynbOutput if input format is ipynb.
Closes #6841.
2020-11-16 18:21:30 -08:00
John MacFarlane
98bedd7631 When checking reader/writer name, check base name...
now that we permit extensions on formats other
than markdown.
2020-11-16 17:49:23 -08:00
John MacFarlane
5271c6b3fb Improve fix to siunitx numbers with minus.
- use real minus sign
- use tests contributed by Igor Pashev.
2020-11-16 16:36:16 -08:00
John MacFarlane
734b4c26a9 LaTeX reader: Fix negative numbers in siunitx commands.
The commit a157e1a broke negative numbers, e.g.
`\SI{-33}{\celcius}` or `\num{-3}`. This fixes the regression.
2020-11-16 14:08:29 -08:00
John MacFarlane
d7f905fb63 Markdown reader: fix detection of locators following in-text citations.
Prevously, if we had `@foo [p. 33; @bar]`, the `p. 33` would be
incorrectly parsed as a prefix of `@bar` rather than a suffix
of `@foo`.
2020-11-15 17:51:03 -08:00
John MacFarlane
f8225140a5 Text.Pandoc.PDF: Fix changePathSeparators for Windows.
Previously a path beginning with a drive, like
`C:\foo\bar`, was translated to `C:\/foo/bar`, which
caused problems.

With this fix, the backslashes are removed.

Closes #6173.
2020-11-15 10:43:43 -08:00
Albert Krewinkel
26f946af20
Remove redundant bracket in App.Opt 2020-11-15 12:08:15 +01:00
John MacFarlane
b5d066f167 Revise deprecation warning for --atx-headers. 2020-11-14 21:41:50 -08:00
Aner Lucero
f63b76e169 Markdown writer: default to using ATX headings.
Previously we used Setext (underlined) headings by default.
The default is now ATX (`##` style).

* Add the `--markdown-headings=atx|setext` option.
* Deprecate `--atx-headers`.
* Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change].
* Support `markdown-headings` in defaults files.
* Document new options in MANUAL.

Closes #6662.
2020-11-14 21:33:32 -08:00
John MacFarlane
b8d17f7ae8 Markdown reader: don't increment stateNoteNumber for example refs.
Background:  syntactically, references to example list items
can't be distinguished from citations; we only know which they
are after we've parsed the whole document (and this is resolved
in the `runF` stage).

This means that pandoc's calculation of `citationNoteNum`
can sometimes be wrong when there are example list references.

This commit partially addresses #6836, but only for the case
where the example list references refer to list items defined
previously in the document.
2020-11-14 15:00:17 -08:00
John MacFarlane
68b298ed9a Improve period suppression algorithm for citations in notes...
in note citation styles.  See #6835.
2020-11-13 10:52:21 -08:00
gison93
fec695c77a
Fix error when extension output is doc (#6834) 2020-11-13 09:07:31 -08:00
John MacFarlane
7d298d13d9 Remove redundant bracket. 2020-11-10 10:34:46 -08:00
John MacFarlane
7d01887dda Fix corner case in YAML metadata parsing.
Previously YAML metadata would sometimes not get recognized if a
field ended with a newline followed by spaces.  Closes #6823.
2020-11-10 09:47:24 -08:00
John MacFarlane
08ce3addde Hlint suggestions. 2020-11-07 10:53:07 -08:00
Albert Krewinkel
527346cc7e
Lint code in PRs and when committing to master (#6790)
* Remove unused LANGUAGE pragmata

* Apply HLint suggestions

* Configure HLint to ignore some warnings

* Lint code when committing to master
2020-11-07 10:38:03 -08:00
Albert Krewinkel
0ed3436588
doc/filters.md: describe technical details of filter invocations (#6815) 2020-11-06 15:37:24 -08:00
John MacFarlane
535bd607de Support nocase spansn for csljson output 2020-11-06 09:16:24 -08:00
John MacFarlane
06d3071090 LaTeX reader: better handling of \\ inside math in table cells.
Previously this confused the table parser.  Closes #6811.
2020-11-05 16:13:35 -08:00
John MacFarlane
090b0877bc Citeproc: improve punctuation in in-text note citations.
Previously in-text note citations inside a footnote
would sometimes have the final period stripped, even
if it was needed (e.g. on the end of 'ibid').

See #6813.
2020-11-05 11:15:23 -08:00
John MacFarlane
efe74746d8 DokuWiki writer: translate language names for code elements...
...and improve whitespace.  Closes #6807.
2020-11-04 22:38:53 -08:00
John MacFarlane
08134388ad MediaWiki writer: use syntaxhighlight tag...
instead of deprecated source, for highlighted code.

Also support `startFrom` attribute and `numberLines`.

Closes #6810.
2020-11-04 21:20:41 -08:00
John MacFarlane
0bd6fb4745 Simplified idpred in citeproc. 2020-11-04 11:10:49 -08:00
John MacFarlane
8f75a53542 Properly support optional cite argument for \blockquote.
(LaTeX reader)

Closes #6802.
2020-11-03 10:25:56 -08:00
John MacFarlane
6cbe5efd56 LaTeX reader: fix bug parsing macro arguments.
If `\cL` is defined as `\mathcal{L}`, and `\til` as `\tilde{#1}`,
then `\til\cL` should expand to `\tilde{\mathcal{L}}`, but pandoc
was expanding it to `\tilde\mathcal{L}`.  This is fixed by
parsing the arguments in "verbatim mode" when the macro expands
arguments at the point of use.

Closes #6796.
2020-11-02 15:04:16 -08:00
Albert Krewinkel
1175b0a008
T.P.Filter: allow shorter YAML representation of Citeproc
The map-based YAML representation of filters expects `type` and `path`
fields. The path field had to be present for all filter types, but is
not used for citeproc filters. The field can now be omitted when type
is "citeproc", as described in the MANUAL.
2020-11-02 15:14:19 +01:00
John MacFarlane
6051c751ce Citeproc: use comma for in-text citations inside footnotes.
When an author-in-text citation like `@foo` occurs in a footnote,
we now render it with:  `AUTHOR NAME + COMMA + SPACE + REST`.

Previously we rendered: `AUTHOR NAME + SPACE + "(" + REST + ")"`.

This gives better results.  Note that normal citations are still
rendered in parentheses.
2020-11-01 10:48:47 -08:00
John MacFarlane
01f2d81168 Improve deNote. 2020-11-01 10:48:47 -08:00
Andy Morris
f1f2728259 Fix duplicate "class" attribute in HTML writer 2020-10-30 16:38:59 +01:00
John MacFarlane
3e6d009c6b Use new citeproc; do note capitalization here, not in citeproc. 2020-10-29 21:53:02 -07:00
John MacFarlane
bc3f16b0c1 Allow citation-abbreviations in defaults file. 2020-10-29 15:54:50 -07:00
John MacFarlane
bd7c9eb32b LaTeX writer: Improved calculation of table column widths.
We now have LaTeX do the calculation, using `\tabcolsep`.
So we should now have accurate relative column widths no
matter what the text width.

The default template has been modified to load the calc
package if tables are used.
2020-10-29 12:10:05 -07:00
John MacFarlane
95c9f3da63 Remove obsolete comment 2020-10-27 21:05:59 -07:00
John MacFarlane
3190ce95c2 Citeproc: properly handle csl field with data: URI.
This is used with the JATS writer, so this fixes a regression
in pandoc 2.11 with JATS output and citeproc.

Closes #6783.
2020-10-27 21:04:24 -07:00
John MacFarlane
3d93414e5d Add PandocBibliographyError and use it in parsing bibliographies.
This ensures that bibliography parsing errors generate messages
that include the bibliography file name -- otherwise it can be
quite mysterious where it is coming from.

[API change] New PandocBibliographyError constructor on
PandocError type.
2020-10-26 14:46:53 -07:00
Nils Carlson
dd3d920ba0
DocBook Reader: fix duplicate bibliography bug (#6773)
Also add unit test to ensure the behavior stays consistent.
2020-10-26 12:49:03 -07:00
John MacFarlane
9ab04a92f8 HTML reader: Parse contents of iframes.
See #6770.
2020-10-23 23:31:36 -07:00
John MacFarlane
4bf171e11d HTML reader: parse inline svg as image...
...unless `raw_html` is set in the reader (in which case
the svg is passed through as raw HTML).

Closes #6770.
2020-10-23 22:09:39 -07:00
John MacFarlane
efc6994c8a Commonmark writer: fix regression with fenced divs.
Starting with 2.10.1, fenced divs no longer render with
HTML div tags in commonmark output.  This is a regression
due to our transition from cmark-gfm.  This commit fixes it.

Closes #6768.
2020-10-23 09:25:07 -07:00
John MacFarlane
f9c6167ad1 citeproc - improved removal of final period...
...in citations inside notes in note-based styles.
These citations are put in parentheses, but the final
period must be removed.

See jgm/citeproc#20
2020-10-21 22:23:21 -07:00
John MacFarlane
76315d99ca More refinements to --version output.
Add ipynb version.  Put user data directory on same line as
heading "User data directory" (dropping "default").
2020-10-19 17:12:36 -07:00
John MacFarlane
1a2f8733b6 Normalize rewritten image paths with --extract-media.
This change will avoid mixed paths like this one when
`--extract-media` is used with a Word file:
`![](C:\Git\TIJ4\Markdown/media/image30.wmf)`

Instead we'll get
`![](C:\Git\TIJ4\Markdown`media`image30.wmf)`.

Closes #6761.
2020-10-19 16:32:39 -07:00
John MacFarlane
9ecea0bc62 Modify --version output.
Use space more efficiently and report the citeproc version along
with skylighting, texmath, and pandoc-types.
2020-10-19 16:32:39 -07:00
Nils Carlson
2332a08f1e
DocBook reader: bibliomisc and anchor support (#6754)
Also do some minor refactoring - bibliodiv without
a title no longer results in an empty Header.
2020-10-16 23:52:19 -07:00
John MacFarlane
eb3307da4e Fix handling of xdata in bibtex/biblatex bibliographies.
Closes #6752.
2020-10-15 17:41:45 -07:00
Michael Hoffmann
988d381aad
Fix some small typos in the API documentation (#6751)
While reading the docs I found a couple of small typos.
2020-10-15 17:09:29 -07:00
Albert Krewinkel
90af138443
Fix typos in comments, doc strings, error messages, and tests
Typos reported by
https://fossies.org/linux/test/pandoc-master.tar.gz/codespell.html

See: #6738
2020-10-14 22:26:51 +02:00
John MacFarlane
0b3b77415f Modify fix to #6742 to use stringToLaTeX. 2020-10-14 10:22:15 -07:00
John MacFarlane
e0da02623e LaTeX reader: support more acronym commands.
`\acl`, `\aclp`, and capitalized versions of already
supported commands.

Closes #6746.
2020-10-13 21:00:02 -07:00
John MacFarlane
a55fb5f29d LaTeX writer: escape option values in lstlistings environment.
Closes #6742.
2020-10-13 20:53:39 -07:00
John MacFarlane
ef6627f645 LaTeX writer: fix handling of pt-BR.
For polyglossia we now use
`\setmainlanguage[variant=brazilian]{portuguese}`
and for babel
`\usepackage[shorthands=off,main=brazilian]{babel}`.

Closes #2953.
2020-10-12 21:35:36 -07:00
John MacFarlane
12ff835a8a Commonmark reader: add pipe_table extension after defaults.
Otherwise we get bad results for non-table, non-paragraph
lines containing pipe characters.

Closes #6739.

See also jgm/commonmark-hs#52.
2020-10-12 21:24:26 -07:00
John MacFarlane
2007cff203 Markdown writer: Fix autolinks rendering for gfm.
Previously, autolinks rendered as raw HTML, due to the
`class="uri"` added by pandoc's markdown reader.

Closes #6740.
2020-10-12 18:57:04 -07:00
John MacFarlane
0b5e2601f5 LaTeX reader: allow blank lines inside \author. 2020-10-10 16:28:52 -07:00
Kolen Cheung
0166b8f857
Options.hs: defaultMathJaxURL: use tex-chtml-full instead of tex-mml-chtml (#6600)
Closes #6599

c.f. https://docs.mathjax.org/en/latest/web/components/combined.html

Note that while this use the full variant of the js, this drops the mathml support.
That should be okay, because pandoc renders math in HTML as TeX when using
mathjax.

This change reduces latency.
2020-10-10 11:11:58 -07:00
John MacFarlane
e7adc2917b In fetching parent of dependent CSL style, first...
look locally, and only do an HTTP request if it's not
found locally.
2020-10-09 13:35:53 -07:00
John MacFarlane
9a6c42590f LaTeX reader: Fix parsing of "show name" in newtheorem.
Previously we were just treating it as a string and
ignoring  accents and formatting.  See #6734.
2020-10-08 22:47:32 -07:00
John MacFarlane
2d4214fa31 Extend fix to #6719 to JATS reader 2020-10-08 21:36:08 -07:00
John MacFarlane
f19286cf12 DocBook reader: don't squelch space at end of emphasis element.
Instead, include it after the emphasis.  Closes #6719.

Same fix was made for other inline elements, e.g. strikethrough.
2020-10-08 21:27:52 -07:00
John MacFarlane
dd3c4000ff Small improvements to BibTeX parser. 2020-10-08 20:48:19 -07:00
John MacFarlane
480f582664 Export ParseError from T.P.Parsing. 2020-10-08 18:55:20 -07:00
John MacFarlane
641849b70a Be less aggressive about using quotes for YAML values.
We need quotes if `[` or `{` or `'` is at the beginning of
the line, but not otherwise.
2020-10-08 10:54:53 -07:00
John MacFarlane
2566ff6624 Qualify some uses of fail to avoid ambiguity. 2020-10-08 09:12:29 -07:00
John MacFarlane
1be0f0fba8 Use double quotes for YAML metadata.
Closes #6727.
2020-10-07 23:05:51 -07:00
John MacFarlane
6f2019ac08 Remove redundant import. 2020-10-07 16:01:30 -07:00
John MacFarlane
5b4a606265 Remove redundant import. 2020-10-07 16:01:10 -07:00
John MacFarlane
428f8b4d20 Raise informative errors when YAML metadata parsing fails.
Closes #6730.

Previously the command would succeed, returning empty metadata,
with no errors or warnings.

API changes:

- Remove now unused CouldNotParseYamlMetadata constructor for
  LogMessage (T.P.Logging).

- Add 'Maybe FilePath' parameter to yamlToMeta in T.P.Readers.Markdown.
2020-10-07 13:12:32 -07:00
John MacFarlane
69b030c7df Cleaner solution to #6723. 2020-10-07 11:29:05 -07:00
John MacFarlane
1742821c3e Fix URL prefixes in citations also when they occur in notes.
Update chicago-fullnote-bibliography.csl and adjust tests.

Closes #6723.
2020-10-07 11:23:28 -07:00
John MacFarlane
d2e4a83dc6 Use latest citeproc.
Better solution to the problem of entities in CSL JSON output.
2020-10-07 09:31:44 -07:00
John MacFarlane
fd3809c33f Unescape entities in writing CSL JSON.
The renderCslJson function escapes `<`, `>`, and `&` as entities.
This is appropriate when generating HTML, but in CSL JSON
these are supposed to appear unescaped.

Closes jgm/citeproc#17.
2020-10-06 22:29:25 -07:00
Diego Balseiro
eda5540719
DOCX reader: Allow empty dates in comments and tracked changes (#6726)
For security reasons, some legal firms delete the date from comments and
tracked changes.

* Make date optional (Maybe) in tracked changes and comments datatypes
* Add tests
2020-10-06 21:03:00 -07:00
John MacFarlane
a27a0b5419 Incorporate https://doi.org/ prefix added by CSL style...
...into linked DOI, and similarly for other URLs linked in the
bibliography.  We want to avoid having a URL in which only the latter
part is linked.  Closes #6723.
2020-10-06 19:20:00 -07:00
John MacFarlane
a78fd5dbc0 Fix URL for "short DOIs" in citations. See #6723.
Short DOIs begin 10/abcd and should be links to
`https://doi.org/abcd` (omitting the `10/`).
2020-10-06 17:33:25 -07:00
John MacFarlane
97695a2bcc Fixed regresison in last commit.
Parsing of YAML bibliographies was broken; this fixes it.
2020-10-05 23:57:38 -07:00
John MacFarlane
3e7ca707c9 Removed the idpred from metaValueToReference.
This isn't really necessary; we do filtering at other points now.
2020-10-05 21:15:20 -07:00
John MacFarlane
6a32ea71ea Add yamlToRefs, yamlBsToRefs.
T.P.Readers.Markdown now exports yamlToRefs. [API change]

T.P.Readers.Metadata exports yamlBsToRefs. [API change]

These allow specifying an id filter so we parse only references
that are used in the document.  Improves timing with a 3M
yaml references file from 36s to 17s.
2020-10-05 21:07:47 -07:00
John MacFarlane
89e4f1bf9a Improve searching for CSL files...
...and CSL abbreviation files.  Use resource path to search
in both USERDATADIR/csl and USERDATADIR/csl/dependent.

Also, add .csl or .json extension as needed, so you can just
do --csl zoology.
2020-10-05 17:23:50 -07:00
John MacFarlane
4dac62ef3a Use yamlToMeta for yaml bibliography
This speeds up parsing of external yaml bibliographies considerably
(in one test 36s -> 17s).
2020-10-05 16:58:58 -07:00
John MacFarlane
128991d4a4 Add filtering to metaValueToReference, and check other-ids field too. 2020-10-05 16:35:51 -07:00
Albert Krewinkel
01a6b071fa
Sort languages in --list-highlight-languages output (#6718)
Languages appear to be sorted by their long name, which leads to
unexpected results: e.g., the long name of *m4* is *GNU m4*, so it is
listed between *gnuassembler* and *go*.
2020-10-04 08:03:42 -07:00
Michael Hoffmann
74bd5a4f47
Docx writer: better handle list items whose contents are lists (#6522)
If the first element of a bulleted or ordered list is another list,
then that first item will disappear if the target format is docx. This
changes the docx writer so that it prepends an empty string for those
cases. With this, no items will disappear.

Closes #5948.
2020-10-02 09:30:05 -07:00
John MacFarlane
27b4c21f72 Update to lastest citeproc 2020-10-01 22:07:55 -07:00
niszet
7d97bf7a8c
Syntax highlight for inline code of OpenDocument (#6711)
To implement Syntax highlighting for OpenDocument, inlineToOpenDocument in OpenDocument Writer is updated based on Docx Writer.
This commit is only for inline Code because update of CodeBlock needs structual change of output document.
Currently, styles are not generated automatically in styles.xml. To implement it, additional commit for ODT Writer is needed.
Although styles are not included in styles.xml, output file can be shown in LibreOffice(7.0.0.3) like normal characters.
2020-10-01 09:55:16 -07:00
John MacFarlane
5e70f774ec Fix redundant import warning. 2020-09-27 23:32:45 -07:00
John MacFarlane
eff6b8f27d Use latest citeproc. 2020-09-27 16:03:31 -07:00
Nils Carlson
ae4dcc0d4a
OpenDocument Writer: Implement table cell alignment (#6700)
Co-authored-by: Mauro Bieg <mb21@users.noreply.github.com>
2020-09-27 11:21:53 -07:00
John MacFarlane
a822067903 Fix short-title.
We were getting null short-titles generated, and that
was creating wrong citations in some cases.

Close #6702.
2020-09-26 14:28:28 -07:00
John MacFarlane
5a388ab2f5 Allow gfm_auto_identifiers, ascii_identifiers extensions for docx. 2020-09-25 09:53:56 -07:00
John MacFarlane
188c444990 RST reader: apply .. class:: directly to following Header.
rather than creating a surrounding Div.

Closes #6699.
2020-09-25 09:06:15 -07:00
Albert Krewinkel
6119125a8b
Org reader: fix HLint warnings 2020-09-25 09:44:00 +02:00
Nils Carlson
1ad7a047d5
DocBook reader: Implement table cell alignment (#6698) 2020-09-24 17:43:43 -07:00
John MacFarlane
a331c69b49 Slight improvement to last commit.
We now add a space only if there isn't already one.
(Some styles add a space at the end of the left-margin
div.)
2020-09-24 10:03:04 -07:00
John MacFarlane
810ea6fdf8 Citeproc: Insert space after csl-left-margin span contents...
if they come before csl-right-inline.  This ensures that
the citation number or label will be separated from the
rest by a space, even in formats (like plain) that don't yet have
special handling for the display spans.
2020-09-24 09:57:55 -07:00
Nils Carlson
4f13c0e25e
OpenDocument writer: New table cell support with row and column spans (#6682)
Unit tests only verify column spans at this point.

Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-09-24 09:31:47 -07:00
niszet
1f707da40f
Support toc-depth option for ODT writer (#6697)
To support `--toc-depth` option for ODT, writer and template are
updated.  Closes #6696.
2020-09-24 09:28:38 -07:00
John MacFarlane
e0984a43a9 Add built-in citation support using new citeproc library.
This deprecates the use of the external pandoc-citeproc
filter; citation processing is now built in to pandoc.

* Add dependency on citeproc library.
* Add Text.Pandoc.Citeproc module (and some associated unexported
  modules under Text.Pandoc.Citeproc).  Exports `processCitations`.
  [API change]
* Add data files needed for Text.Pandoc.Citeproc:  default.csl
  in the data directory, and a citeproc directory that is just
  used at compile-time.  Note that we've added file-embed as a mandatory
  rather than a conditional depedency, because of the biblatex
  localization files. We might eventually want to use readDataFile
  for this, but it would take some code reorganization.
* Text.Pandoc.Loging: Add `CiteprocWarning` to `LogMessage` and use it
  in `processCitations`. [API change]
* Add tests from the pandoc-citeproc package as command tests (including
  some tests pandoc-citeproc did not pass).
* Remove instructions for building pandoc-citeproc from CI and
  release binary build instructions.  We will no longer distribute
  pandoc-citeproc.
* Markdown reader: tweak abbreviation support.  Don't insert a
  nonbreaking space after a potential abbreviation if it comes right before
  a note or citation.  This messes up several things, including citeproc's
  moving of note citations.
* Add `csljson` as and input and output format. This allows pandoc
  to convert between `csljson` and other bibliography formats,
  and to generate formatted versions of CSL JSON bibliographies.
* Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`. [API
  change]
* Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`. [API
  change]
* Added `bibtex`, `biblatex` as input formats.  This allows pandoc
  to convert between BibLaTeX and BibTeX and other bibliography formats,
  and to generated formatted versions of BibTeX/BibLaTeX bibliographies.
* Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and
  `readBibLaTeX`. [API change]
* Make "standalone" implicit if output format is a bibliography format.
  This is needed because pandoc readers for bibliography formats put
  the bibliographic information in the `references` field of metadata;
  and unless standalone is specified, metadata gets ignored.
  (TODO: This needs improvement. We should trigger standalone for the
  reader when the input format is bibliographic, and for the writer
  when the output format is markdown.)
* Carry over `citationNoteNum` to `citationNoteNumber`.  This was just
  ignored in pandoc-citeproc.
* Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter.
  [API change] This runs the processCitations transformation.
  We need to treat it like a filter so it can be placed
  in the sequence of filter runs (after some, before others).
  In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`,
  so this special filter may be specified either way in a defaults file
  (or by `citeproc: true`, though this gives no control of positioning
  relative to other filters).  TODO: we need to add something to the
  manual section on defaults files for this.
* Add deprecation warning if `upandoc-citeproc` filter is used.
* Add `--citeproc/-C` option to trigger citation processing.
  This behaves like a filter and will be positioned
  relative to filters as they appear on the command line.
* Rewrote the manual on citatations, adding a dedicated Citations
  section which also includes some information formerly found in
  the pandoc-citeproc man page.
* Look for CSL styles in the `csl` subdirectory of the pandoc user data
  directory.  This changes the old pandoc-citeproc behavior, which looked
  in `~/.csl`.  Users can simply symlink `~/.csl` to the `csl`
  subdirectory of their pandoc user data directory if they want
  the old behavior.
* Add support for CSL bibliography entry formatting to LaTeX, HTML,
  Ms writers.  Added CSL-related CSS to styles.html.
2020-09-21 10:15:50 -07:00
John MacFarlane
a59ae96062 Markdown reader: Set citationNoteNum accurately in citations.
This also changes stateLastNoteNumber -> stateNoteNumber.
2020-09-21 10:10:37 -07:00
John MacFarlane
b2f3074988 Parsing: add stateInNote and stateLastNoteNumber to ParserState.
These will be used to populate note numbers for citations.
2020-09-21 10:10:30 -07:00
John MacFarlane
39f357027a Sort YAML metadata keys in Markdown output case-insensitive.
Use caseFold.
2020-09-21 10:10:12 -07:00
John MacFarlane
045dd212a7 Remove duplicate tshow definition. 2020-09-21 10:09:59 -07:00
Albert Krewinkel
acbea6b8c6
Lua filters: add SimpleTable for backwards compatibility (#6575)
A new type `SimpleTable` is made available to Lua filters. It is
similar to the `Table` type in pandoc versions before 2.10;
conversion functions from and to the new Table type are provided.

Old filters using tables now require minimal changes and can use,
e.g.,

    if PANDOC_VERSION > {2,10,1} then
      pandoc.Table = pandoc.SimpleTable
    end

and

    function Table (tbl)
      tbl = pandoc.utils.to_simple_table(tbl)
      …
      return pandoc.utils.from_simple_table(tbl)
    end

to work with the current pandoc version.
2020-09-20 15:48:31 -07:00
John MacFarlane
26ed7fb4f9 Command line options: use normalizePath in more places.
See #5127.  It is now used everywhere a file argument can be used.

Closes #5127.
2020-09-19 22:35:50 -07:00
argent0
ba9bedef23
Asciidoctor images (#6671)
Support `Asciidoctor`'s block figures.

Closes #6538.
2020-09-19 18:22:52 -07:00
Mauro Bieg
caa225ad82
Add CSS to default HTML template (#6601) 2020-09-19 16:13:50 -07:00
John MacFarlane
d5a7abd47f Change deprecated Builder.isNull to null. 2020-09-19 16:00:22 -07:00
John MacFarlane
a26ec96d89 LaTeX writer: fix spacing issue with list in definition list.
When a list occurs at the beginning of a definition list definition,
it can start on the same line as the label, which looks bad.

Fix that by starting such lists with an `\item[]`.
2020-09-15 17:59:03 -07:00
Christian Despres
a2d343420f
LaTeX reader: fix improper empty cell filtering (#6689) 2020-09-15 13:36:11 -07:00
Albert Krewinkel
34151e8da8
HTML writer: support intermediate table headers
Closes: #6314
2020-09-13 23:23:11 +02:00
Albert Krewinkel
8711640512
HTML writer: support attributes on all table elements
Add attributes to tbody and tr elements.
2020-09-13 20:26:06 +02:00
Christian Despres
cae155b095
Fix hlint suggestions, update hlint.yaml (#6680)
* Fix hlint suggestions, update hlint.yaml

Most suggestions were redundant brackets. Some required
LambdaCase.

The .hlint.yaml file had a small typo, and didn't ignore camelCase
suggestions in certain modules.
2020-09-13 07:48:14 -07:00
Albert Krewinkel
a400d0dc62
HTML writer: render table footers if present
Part of: #6314
2020-09-12 21:49:01 +02:00
Christian Despres
22babd5382
[API change] Rename Writers.Tables and its contents (#6679)
Writers.Tables is now Writers.AnnotatedTable. All of the types and
functions in it have had the "Ann" removed from them. Now it is
expected that the module be imported qualified.
2020-09-12 08:50:36 -07:00
Joseph C. Sible
6fda8cfa28
Use the original tail instead of deconstructing and reconstructing it (#6678) 2020-09-11 13:49:01 -07:00
Leonard Rosenthol
55e5ad2d8f
Changed default link state to invisible (#6676) 2020-09-10 22:58:53 -07:00
John MacFarlane
623ce89e0e Improved uncertainty handling in slunitx. 2020-09-10 14:48:35 -07:00
John MacFarlane
a03160fb0d LaTeX reader: support parenthesized uncertainties in siunitx. 2020-09-10 13:07:31 -07:00
Albert Krewinkel
9423b4b7d9
Support colspans and rowspans in HTML tables (#6644)
* HTML writer: add support for row headers, colspans, rowspans
* Add planet table tests

See #6312
2020-09-10 09:47:40 -07:00
Leonard Rosenthol
ef4f514359
Implement support for internal document links in ICML (#6606)
Closes #5541.
2020-09-10 09:40:35 -07:00
Nils Carlson
96a0f3c7af
docbook reader: Implement column span support for tables (#6492)
Implement column span support for tables in the DocBook reader.

Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-09-10 09:11:52 -07:00
Albert Krewinkel
9cad5499c4
Reader.LaTeX.hs: remove trailing whitespace 2020-09-08 10:33:49 +02:00
Christian Despres
10c6c411f9
Add Writers.Tables helper functions and types, add tests for those (#6655)
Add Writers.Tables helper functions and types, add tests for those

The Writers.Tables module contains an AnnTable type that is a pandoc
Table with added inferred information that should be enough for
writers (in particular the HTML writer) to operate on without having
to lay out the table themselves.

The toAnnTable and fromAnnTable functions in that module convert
between AnnTable and Table. In addition to producing an AnnTable with
coherent and well-formed annotations, the toAnnTable function also
normalizes its input Table like the table builder does.

Various tests ensure that toAnnTable normalizes tables exactly like
the table builder, and that its annotations are coherent.
2020-09-05 14:36:51 -07:00
John MacFarlane
a157e1a6e0 Support numrange, numlist for siunitx.
See #6658.
2020-09-02 17:00:13 -07:00
John MacFarlane
83f0acab47 Support some missing siunitx commands. 2020-09-02 16:49:10 -07:00
John MacFarlane
321658fe4d LaTeX reader: Support siunitx \ang.
See #6658.
2020-09-02 16:16:06 -07:00
John MacFarlane
16c44cd2a9 Skip opts for \si. 2020-09-02 16:01:32 -07:00
John MacFarlane
e3e66ba47f LaTeX reader: support \si and improve other siunitx commands. 2020-09-02 15:44:36 -07:00
John MacFarlane
0a98648c1a LaTeX reader: support \num from siunitx. 2020-09-02 13:05:34 -07:00
John MacFarlane
529eb696dc LaTeX reader: Support squared, cubed, tothe in siunitx.
Closes #6657.
2020-09-02 11:06:26 -07:00
John MacFarlane
81fe8ebf36 LaTeX reader: Factored out siunitx stuff into separate module. 2020-09-02 10:10:55 -07:00
John MacFarlane
93e3d463fd Docx writer: separate adjacent tables.
Word combines adjacent tables, so to prevent this we insert
an empty paragraph between two adjacent tables.

Closes #4315.
2020-08-24 09:31:39 -07:00
John MacFarlane
49e810b4ed HTML writer: Fix addition of doc-biblioentry role. 2020-08-21 12:22:33 -07:00
Laurent P. René de Cotret
482a2e5079
[Latex Reader] Fixing issues with \multirow and \multicolumn table cells (#6608)
* Added test to replicate (#6596)

* Table cell reader not consuming spaces correctly (#6596)

* Prevented wrong nesting of \multicolumn and \multirow table cells (#6603)

* Parse empty table cells (#6603)

* Support full prototype for multirow macro (#6603)

Closes #6603
2020-08-15 11:40:10 -07:00
Emerson Harkin
6cfb31bbe2
Change SIRange to SIrange (#6617) 2020-08-14 11:30:17 -07:00
John MacFarlane
5d4932d7ef DocBook reader: Update list of block level tags.
This fixes #6610.
2020-08-11 09:45:12 -07:00
John MacFarlane
a9da64cc3a Remove fenced_code_blocks and backtick_code_blocks from...
commonmark/gfm extensions.  These shouldn't really be counted
as extensions, because they can't be disabled in commonmark.

Adjust markdown writer to check for commonmark variant in addition
to extensions.
2020-08-09 11:12:59 -07:00
Laurent P. René de Cotret
499fc11fca
[Latex Reader] Table cell parser not consuming spaces correctly (#6597)
* Added test to replicate (#6596)

* Table cell reader not consuming spaces correctly (#6596)
2020-08-07 22:45:47 -07:00
John MacFarlane
d8ad766d17 Options: Add /tex-mml-chtml.js to defaultMathJaxURL.
Previously we added this in processing command line options,
but not in processing defaults files, which was inconsistent.

Cloess #6593.
2020-08-06 14:42:26 -07:00
Albert Krewinkel
6b08a37bbd
Org writer: don't force blank line after headers
Closes: #6554
2020-07-31 16:04:18 +02:00
John MacFarlane
2077739a35 Add extensions to gfm and commonmark:
`fenced_code_blocks`, `backtick_code_blocks`, `fenced_code_attributes`.

These can't really be disabled in the reader, but they need to
be enabled in the writer or we just get indented code.
2020-07-29 18:13:15 -07:00
Albert Krewinkel
aff582d9b5
Writers/Shared: add missing function docs
Ensure that all functions in the module have a haddock comment.
2020-07-29 18:33:08 +02:00
Albert Krewinkel
44c4660a31
Lua filters: make attr argument optional in Table constructor
This changes the Lua API. It is highly unlikely for this change to
affect existing filters, since the documentation for the new Table
constructor (and type) was incomplete and partly wrong before.

The Lua API is now more consistent, as all constructors for elements
with attributes now take attributes as the last parameter.
2020-07-25 20:37:57 +02:00
John MacFarlane
3f2bb78f6b Make sure proper set of extensions is recognized for commonmark_x. 2020-07-24 21:52:11 -07:00
John MacFarlane
8c8d3bacb8 Markdown writer: use numerical labels for refs...
...that are longer than 999 characters or contain
square brackets. For conformity with commonmark.

Closes #6560
2020-07-23 18:26:29 -07:00
John MacFarlane
48fb6d947d Add raw_markdown extension affecting ipynb reader.
Specifying `-f ipynb+raw_markdown` will cause Markdown cells
to be represented as raw Markdown blocks, instead of being
parsed.  This is not what you want when going from `ipynb`
to other formats, but it may be useful when going from `ipynb`
to Markdown or to `ipynb`, to avoid semantically insignificant
changes in the contents of the Markdown cells that might
otherwise be introduced.

Closes #5408.
2020-07-23 17:47:02 -07:00
Emerson Harkin
1b8f161198
Minimal support for SIRange in LaTeX reader (#6418)
Add support for `\SIRange{firstnumber}{secondnumber}{unit}` provided by siunitx.

An en-dash is used instead of localized "to".
2020-07-23 16:47:32 -07:00
Laurent P. René de Cotret
8c3b5dd3ae
Col-span and row-span in LaTeX reader (#6470)
Add multirow and multicolumn support in LaTex reader.
Partially addresses #6311.
2020-07-23 11:23:21 -07:00
John MacFarlane
a0e3172a0b Further improvements to ams theorem support, and a test.
See #1608.
2020-07-23 11:11:28 -07:00
John MacFarlane
98c922ad43 LaTeX reader: Add identifier in divs for ams theorem environments. 2020-07-23 10:44:05 -07:00
John MacFarlane
ff0e130560 LaTeX reader: SUpport ams \theoremstyle. 2020-07-22 23:52:28 -07:00
John MacFarlane
cdaaaa3f63 Implement first optional argument for \newtheorem.
This allows groups of theorem environments to be
put in the same numbering sequence.
2020-07-22 23:30:41 -07:00
John MacFarlane
f014d71a2f LaTeX reader: Don't boldface alt title in theorems. 2020-07-22 22:59:28 -07:00
John MacFarlane
9d07d180f0 LaTeX reader: support theorem environments and \newtheorem.
Includes numbering and labels and refs.

Note that numbering support is not complete; we don't
reset numbers with sections for example.
2020-07-22 16:30:10 -07:00
John MacFarlane
65865b3186 LaTeX reader: support ams proof environment. 2020-07-22 14:23:26 -07:00