Commit graph

1371 commits

Author SHA1 Message Date
John MacFarlane
573214a06a Fixed round-trip HTML tests.
Exclude tables with cells with line breaks because they don't
currently round-trip.  (Table goes from being simple to having
explicit widths.)
2020-04-18 20:57:28 -07:00
John MacFarlane
9a809d4d01 Markdown writer: avoid unnecessary escapes before intraword _
when `intraword_underscores` extension is enabled.
Closes #6296.
2020-04-17 22:42:21 -07:00
John MacFarlane
0d2b8e3fe1
Merge pull request #6211 from tarleb/lua-pandocerror
API change: create PandocLua type, use PandocError for exceptions
2020-04-17 18:02:25 -07:00
John MacFarlane
8f40b4ba14 LaTeX reader: don't put surrounding Div around Table.
This reverts a change in the last release; the Div is
no longer needed, because we can now put the id right in
the Table's attributes.  However, writers may still need
to be modified to do something with the id in a Table
(e.g. create an anchor), so in the short term we may lose
the ability to link to tables in some writers.
2020-04-17 13:04:15 -07:00
Albert Krewinkel
fb54f3d679
API change: use PandocError for exceptions in Lua subsystem
The PandocError type is used throughout the Lua subsystem, all Lua
functions throw an exception of this type if an error occurs. The
`LuaException` type is removed and no longer exported from
`Text.Pandoc.Lua`. In its place, a new constructor `PandocLuaError` is
added to PandocError.
2020-04-17 21:52:48 +02:00
despresc
2fc11f3b1e Modify toLegacyTable to cut up cells, add tests
Now a cell with dimension (h, w) will be cut up into h*w cells of
dimension (1,1), all in the same grid position, with the upper-left
holding the original cell contents and the rest being empty.
2020-04-15 23:03:22 -04:00
despresc
c7814f31e1 Use the new builders, modify readers to preserve empty headers
The Builder.simpleTable now only adds a row to the TableHead when the
given header row is not null. This uncovered an inconsistency in the
readers: some would unconditionally emit a header filled with empty
cells, even if the header was not present. Now every reader has the
conditional behaviour. Only the XWiki writer depended on the header
row being always present; it now pads its head as necessary.
2020-04-15 23:03:22 -04:00
despresc
d368536a4e Adapt to the removal of the RowSpan, ColSpan, RowHeadColumns accessors 2020-04-15 23:03:22 -04:00
despresc
4e34d366df Adapt to the newest Table type, fix some previous adaptation issues
- Writers.Native is now adapted to the new Table type.

- Inline captions should now be conditionally wrapped in a Plain, not
  a Para block.

- The toLegacyTable function now lives in Writers.Shared.
2020-04-15 23:03:22 -04:00
despresc
7254a2ae0b Implement the new Table type 2020-04-15 23:03:22 -04:00
Nikolay Yakimov
83c1ce1d77
Markdown Reader: Fix inline code in lists (#6284)
Closes #6284.

Previously inline code containing list markers was sometimes parsed incorrectly.
2020-04-15 16:20:01 -07:00
John MacFarlane
71c4857464 JATS reader: handle "label" element in section title.
Closes #6288.
2020-04-15 09:23:04 -07:00
John MacFarlane
9187b4bca9 LaTeX writer: ensure that -M csquotes works even in fragment mode.
Closes #6265.
2020-04-11 10:40:59 -07:00
Tristan de Cacqueray
dd06d63540
HTML reader: support <bdo> (#6271)
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdo

Closes #5794
2020-04-11 09:57:59 -07:00
Albert Krewinkel
c09a3448d1
Jira reader: improve icon conversion
Icons are now converted as follows: `(/)` to ✔, `(x)` to , `(!)` to
, `(+)` to , `(-)` to , `(off)` to 🌙, and `(*)` to ☆. The new
icons render well in most fonts. Furthermore, the UTF-8 characters all
fit into 4-bytes.

Closes: #6264
2020-04-09 16:21:45 +02:00
John MacFarlane
11df2a3c0f LaTeX reader: better handling of \lettrine.
- SmallCaps instead of Span for the part after the initial capital.
- Ensure that both arguments are parsed, so that in Markdown both
  are treated as raw LateX. (Closes #6258.)
2020-04-07 09:25:52 -07:00
Vlad Hanciuta
8dbd4938f2
Vimwiki reader: Add nested syntax highlighting (#6257)
Nested syntaxes are specified like this:
{{{sql
SELECT * FROM table
}}}

The preformatted code block parser has been extended to check if the
first attribute of the block is not a `key=value` pair, and in that case
it will be considered as a class.

Closes #6256.
2020-04-06 16:41:28 -07:00
Albert Krewinkel
663a5a9b7f
test/writer.jira: fix links, skip alias if it equals the target 2020-04-04 15:03:13 +02:00
Albert Krewinkel
c3f539364a
Jira: support citations, attachment links, and user links
Closes: #6231
Closes: #6238
Closes: #6239
2020-04-04 14:27:27 +02:00
Albert Krewinkel
d867cac8ca
Jira reader: resolve parsing issues of blockquote, color
Parsing problems occurring with block quotes and colored text have been
resolved.

Fixes: #6233
Fixes: #6235
2020-04-03 13:25:52 +02:00
John MacFarlane
92e0801daa Add test fixes for docbook writer changes. 2020-04-01 23:09:14 -07:00
Albert Krewinkel
7df0710094
Jira reader: use span with class underline for inserted text
Jira text which is marked as `+inserted+` is converted into pandoc's
default representation for underlined text: a span with class
`underline`. Previously, the span was marked with the non-standard class
`inserted`.

Closes: #6237
2020-03-31 10:04:55 +02:00
Albert Krewinkel
ff9be6b384
Jira writer: convert spans with class underline to inserted text
Spans with class `underline` as converted into Jira text marked as
`+inserted+`, i.e. surrounded by plus-signs.
2020-03-31 09:57:59 +02:00
Albert Krewinkel
9a42bec7fc
Jira writer tests: update image in test/writer.jira 2020-03-31 08:18:41 +02:00
Albert Krewinkel
69a3fa5708
Jira reader: retain image attributes
Jira images attributes as in `!image.jpg|align=right!` are retained as
key-value pairs. Thumbnail images, such as `!example.gif|thumbnail!`,
are marked by a `thumbnail` class in their attributes.

Related to #6234.
2020-03-30 22:03:52 +02:00
Joseph C. Sible
7233a7a932
More cleanup (#6209)
* Simplify by collapsing a do block into a single <$>
* Remove an unnecessary variable: `all` takes any Foldable, so only blocksToInlines needs toList.
2020-03-28 22:48:47 -07:00
Albert Krewinkel
44f8c2725e
Jira reader: fix parsing of tables without preceding blankline
A bug was fixed which caused faulty parsing if a table was not preceded
by a newline and the first table cell had no space after the initial `|`
characters.

Fixes: #6198
2020-03-19 21:27:35 +01:00
Albert Krewinkel
81d46435f6
Jira reader: fix parsing of strikeout, emphasis
A bug was fixed which caused non-emphasized text containing digits and/or
non-special symbols (like dots) to sometimes be parsed incorrectly.

Fixes: #6196
2020-03-18 21:32:05 +01:00
Albert Krewinkel
11b5f1e40b
Update copyright year (#6186)
* Update copyright year

* Copyright: add notes for Lua and Jira modules
2020-03-13 09:52:47 -07:00
Albert Krewinkel
7eb9914841
Jira reader: support colored inline text, indented lists
* Support for colored inlines has been added.
* Lists are now allowed to be indented; i.e., lists are still recognized
  if list markers are preceded by spaces.

Closes: #6183, #6184
2020-03-13 09:52:28 +01:00
John MacFarlane
87875763c8 Ms writer: fix definition lists so indent even when...
paragraph indent is set to 0 (as is the default).

Also ensure indent for display math that falls back
to TeX.
2020-03-07 21:54:29 -08:00
John MacFarlane
2ab83a56e6 Ms writer: use .QS/.QE instead of .RS/.RE for block quotes. 2020-03-06 09:45:46 -08:00
John MacFarlane
aaf296508a Fix man reader test for previous change. 2020-03-05 19:34:17 -08:00
John MacFarlane
0edc084c50 Revert "Allow specifying string value in metadata using !!literal tag."
This reverts commit 3493d6afaa.

This might be worth considering in the future, but let's not do
it yet...the additional complexity needs a better justification.
2020-02-17 15:58:21 -08:00
John MacFarlane
3493d6afaa Allow specifying string value in metadata using !!literal tag.
This is experimental.  Normally metadata values are interpreted
as markdown, but if the !!literal tag is used they will be interpreted
as plain strings.

We need to consider whether this can still be implemented if
we switch back from HsYAML to yaml for performance reasons.
2020-02-17 09:53:36 -08:00
Ethan Riley
daf770c1e9
Fixes: group biblatex citations even with prefix and suffix (#6058)
Closes #5849.  Previously biblatex citations were only grouped if
there was no prefix.  This patch allows them to be grouped in
subgroups split by prefixes and suffixes, which allows better citation
sorting.
2020-02-14 08:44:40 -08:00
Lucas Escot
29c2670da2
Add highlight directive to the rST reader (#6140) 2020-02-13 10:27:34 -08:00
Albert Krewinkel
f5ea5f0aad
Introduce new format variants for JATS (#6067)
New formats:

- `jats_archiving` for the "Archiving and Interchange Tag Set",
- `jats_publishing` for the "Journal Publishing Tag Set", and
- `jats_articleauthoring` for the "Article Authoring Tag Set."

The "jats" output format is now an alias for "jats_archiving".

Closes: #6014
2020-02-12 20:36:02 -08:00
John MacFarlane
3a79f37d88 LaTeX reader: improve caption and label parsing.
- Don't emit empty Span elements for labels.
- Put tables with labels in a surrounding Div.
2020-02-12 17:43:55 -08:00
John MacFarlane
3fbee8c6ed LaTeX reader: resolve \ref to table numbers.
Closes #6137.
2020-02-11 22:28:06 -08:00
John MacFarlane
114d77c2ab Fix spurious dots in markdown_mmd metadata output
Closes #6133 (regression).
2020-02-10 09:00:21 -08:00
John MacFarlane
5f0bd52221 reveal.js: ensure that pauses work even in title slides.
Closes #5819.
2020-02-08 09:38:07 -08:00
Joseph C. Sible
12c75701be
Use <$> instead of >>= and return (#6128) 2020-02-08 09:12:01 -08:00
John MacFarlane
4c3db9273f Apply linter suggestions. Add fix_spacing to lint target in Makefile. 2020-02-07 09:08:22 -08:00
Joseph C. Sible
a5a3ac9946
Various minor cleanups and refactoring (#6117)
* Use concatMap instead of reimplementing it

* Replace an unnecessary multi-way if with a regular if

* Use sortOn instead of sortBy and comparing

* Use guards instead of lots of indents for if and else

* Remove redundant do blocks

* Extract common functions from both branches of maybe

Whenever both the Nothing and the Just branch of maybe do the same
function, do that function on the result of maybe instead.

* Use fmap instead of reimplementing it from maybe

* Use negative forms instead of negating the positive forms

* Use mapMaybe instead of mapping and then using catMaybes

* Use zipWith instead of mapping over the result of zip

* Use unwords instead of reimplementing it

* Use <$ instead of <$> and const

* Replace case of Bool with if and else

* Use find instead of listToMaybe and filter

* Use zipWithM instead of mapM and zip

* Inline lambda wrappers into the real functions

* We get zipWithM from Text.Pandoc.Writers.Shared

* Use maybe instead of fromMaybe and fmap

I'm not sure how this one slipped past me.

* Increase a bit of indentation
2020-02-07 08:38:24 +01:00
John MacFarlane
0a4f49d370 MediaWiki writer: prevent triple [[[.
This confuses mediawiki's parser.  So we insert a `<nowiki/>`
no-op between a literal `[` and a link.  Closes #6119.
2020-02-05 10:08:18 -08:00
John MacFarlane
9c4dc8b49b LaTeX reader: skip comments in more places where this is needed.
Closes #6114.
2020-02-05 09:48:42 -08:00
John MacFarlane
d9b1776336 Fix duplicate frame classes in LaTeX/Beamer output.
Close #6107.
2020-02-03 08:52:07 -08:00
John MacFarlane
fb3df6cf19 csv reader: allow empty cells. 2020-01-31 21:43:19 -08:00
John MacFarlane
f9514ccb9e Add Text.Pandoc.Readers.CSV (readCSV).
This adds csv as an input format.
The CSV table is converted into a pandoc simple table.

Closes #6100.
2020-01-31 21:14:21 -08:00
John MacFarlane
05a217091f Fix test suite for new skylighting.
Closes #6086.
2020-01-27 08:25:25 -08:00
Albert Krewinkel
672a4bdd1d Lua filters: allow filtering of element lists (#6040)
Lists of Inline and Block elements can now be filtered via `Inlines` and
`Blocks` functions, respectively. This is helpful if a filter conversion
depends on the order of elements rather than a single element.

For example, the following filter can be used to remove all spaces
before a citation:

    function isSpaceBeforeCite (spc, cite)
      return spc and spc.t == 'Space'
       and cite and cite.t == 'Cite'
    end

    function Inlines (inlines)
      for i = #inlines-1,1,-1 do
        if isSpaceBeforeCite(inlines[i], inlines[i+1]) then
          inlines:remove(i)
        end
      end
      return inlines
    end

Closes: #6038
2020-01-15 14:26:00 -08:00
John MacFarlane
157936c927 HTML writer: fix duplicate attributes on headings.
Another regression from 2.7.x. Closes #6062.
2020-01-12 15:18:37 -08:00
Albert Krewinkel
4ede11a75f
Lua: add methods insert, remove, and sort to pandoc.List
The functions `table.insert`, `table.remove`, and `table.sort` are added
to pandoc.List elements.  They can be used as methods, e.g.

    local numbers = pandoc.List {2, 3, 1}
    numbers:sort()     -- numbers is now {1, 2, 3}
2020-01-11 21:31:20 +01:00
Albert Krewinkel
e98921ae57
pandoc.List.lua: make pandoc.List a callable constructor
It is now possible to construct a new List via `pandoc.List()` instead of
`pandoc.List:new()`.
2020-01-11 19:38:27 +01:00
Albert Krewinkel
57637f8aae
Add tests for pandoc.List module 2020-01-11 17:42:32 +01:00
John MacFarlane
42b915e656 LaTeX reader: allow beamer overlays for all commands in all raw tex.
This affecs parsing of raw tex in LaTeX and in Markdown and
other formats.

Closes #6043.
2020-01-10 08:26:33 -08:00
John MacFarlane
fc78be1140 LaTeX reader: improve parsing of raw environments.
If parsing fails in a raw environment (e.g. due to special
characters like unescaped `_`), try again as a verbatim
environment, which is less sensitive to special characters.

This allows us to capture special environments that change
catcodes as raw tex when `-f latex+raw_tex` is used.

Closes #6034.
2020-01-08 08:43:51 -08:00
Albert Krewinkel
bef0133fe0
Jira writer: fix output of table headers
Headers were missing from tables.

Fixes: #6035
2020-01-07 22:11:51 +01:00
John MacFarlane
ad5f7ecfce Fix regression in handling of columns in beamer slides.
Columns in title slides were causing problems with
slide division.  Closes #6033.
2020-01-07 11:11:23 -08:00
John MacFarlane
2a67b7aea9 Reveal.js writer: restore old behavior for 2D nesting.
The fix to #6030 actually changed behavior, so that the
2D nesting occurred at slide level N-1 and N, instead of
at the top-level section.  This commit restores the 2.7.3 behavior.
If there are more than 2 levels, the top level is horizontal
and the rest are collapsed to vertical.

Closes #6032.
2020-01-07 10:11:46 -08:00
John MacFarlane
66bca029c7 Fix regression in beamer slide structure with certain slide levels.
Closes #6030.
2020-01-05 11:10:07 -08:00
John MacFarlane
0dff9b3cd2 Fix revealjs slide structure regression with certain slide levels.
Partially addresses #6030.
2020-01-05 09:42:35 -08:00
Albert Krewinkel
4914855275
Fix test/tables.org
Editor usage mistake caused a broken reference file.
2020-01-03 08:38:58 +01:00
Albert Krewinkel
c3a00c1fdc
Org writer: remove extra spaces from table cells
Closes: #6024
2020-01-03 00:00:57 +01:00
John MacFarlane
2c1a911bc1 LaTeX writer: properly handle unnumbered headings level 4+.
Closes #6018.

Previously the `\paragraph` command was used instead of
`\paragraph*` for unnumbered level 4 headings.
2020-01-01 22:32:27 -07:00
Arfon Smith
5847624124 Update JATS dtd (#6020)
The current DTD for the JATS writer template is for Journal Publishing (JATS-journalpublishing1.dtd), which does not permit ext-link as a valid child (https://jats.nlm.nih.gov/publishing/tag-library/1.1/element/publisher-name.html).

This update modifies the default output template to be the less restrictive JATS archiving and interchange DTD which systems like PubMed use internally to represent their articles.
2019-12-30 22:18:55 -08:00
John MacFarlane
82f44592ae Fix parsing bug affected indented code after raw HTML.
Closes #6009, #5360.
2019-12-27 13:08:22 -08:00
John MacFarlane
80a0e56a5d HTML reader tests: modify round-trip tests...
to avoid a special failure case involving makeSections.
2019-12-21 12:15:35 -08:00
Albert Krewinkel
2c13773be8
Jira writer: use jira-wiki-markup renderer
Pandoc's AST is translated into the Jira AST, which is then rendered by
the dedicated Jira printer.

The following improvements are included in this change:

- non-jira raw blocks are fully discarded instead of showing as blank
  lines;
- table cells can contain multiple blocks;
- unnecessary blank lines are removed from the output;
- markup chars within words are properly surrounded by braces;
- preserving soft linebreaks via `--wrap=preserve` is supported.

Note that backslashes are rendered as HTML entities, as there appears no
alternative to produce a plain backslash if it is followed by markup.
This may cause problems when used with confluence, where rendering seems
to fail in this case.

Closes: #5926
2019-12-20 17:12:46 +01:00
Albert Krewinkel
0a3cc7260c
Org reader: fix parsing problem for colons in headline
Fixed a problem where words surrounded by colons could causing parse
failures in some cases when they occurred in headers.

Fixes: #5993
2019-12-19 20:38:51 +01:00
Albert Krewinkel
5bd2d28b19
Org reader: wrap named table in div, using name as id
Closes: #5984
2019-12-18 22:28:26 +01:00
Albert Krewinkel
96c80b156d Add jira reader (#5913)
Closes #5556
2019-12-17 21:07:46 -08:00
John MacFarlane
5029233293 Adjust test to work with Windows (I hope). 2019-12-17 14:13:05 -08:00
John MacFarlane
d0918627ca Improved --toc generation. 2019-12-17 11:59:52 -08:00
John MacFarlane
20cf4e47b0 Improved makeSections so we don't get doubled attributes.
Closes #5986.
2019-12-17 11:59:52 -08:00
John MacFarlane
b0c5ecbb1a Added test for #5986. 2019-12-17 11:59:52 -08:00
John MacFarlane
204c7bb943 Add section-divs command test (failing). 2019-12-17 11:59:52 -08:00
Albert Krewinkel
75dc013036
Org reader: add table labels to caption if both are present
The table `#+NAME:` or `#+LABEL:` is added to the table's caption in the
form of an empty span with the label set as the span's ID.

Closes: #5984
2019-12-13 16:22:04 +01:00
Denis Maier
4e7ac069b9 ConTeXt template: Adjustments to title formatting (#5949)
Added `\setupinterlinespace` to `title`, `subtitle`, `date` and `author` elements.
Otherwise longer titles that run over multiple lines will look squashed as
`\tfd` etc. won't adapt the line spacing to the font size.
2019-12-11 08:28:11 -08:00
John MacFarlane
0b54d6282b Fix --toc-depth regression in 2.8.
Closes #5967.
2019-12-07 14:20:41 -08:00
Yihui Xie
ee44d44f20 Keep the \author{} command even if author is not specified (#5961)
Otherwise there will be a LaTeX warning "No \author given" when the .tex file is compiled.
This does not affect spacing in the title block.
2019-12-05 10:22:31 -08:00
John MacFarlane
992f77c17c Roll back part of of --shift-heading-level-by change.
With positive heading shifts, starting in 2.8 this option caused
metadata titles to be removed and changed to regular headings.
This behavior is incompatible with the old behavior of
`--base-header-level` and breaks old workflows, so with this
commit we are rolling back this change.

Now, there is an asymmetry in positive and negative heading
level shifts:

+ With positive shifts, the metadata title stays the same and
  does not get changed to a heading in the body.
+ With negative shifts, a heading can be converted into the
  metadata title.

I think this is a desirable combination of features, despite
the asymmetry.  One might, e.g., want to have a document
with level-1 section headigs, but render it to HTML with
level-2 headings, retaining the metadata title (which pandoc
will render as a level-1 heading with the default template).

Closes #5957.
Revises #5615.
2019-12-05 09:59:50 -08:00
John MacFarlane
64f78b3d5f HTML-based templates: Add CSS to suppress bullet on unordered task lists. 2019-12-05 09:36:34 -08:00
John MacFarlane
79a10388da HTML writer: add task-list class to ul if all elements are task list items.
This will allow styling unordered task lists in a way that omits
the bullet.
2019-12-05 09:32:40 -08:00
John MacFarlane
4489283b03 Fix makeSections so it doesn't turn column divs into sections. 2019-12-05 09:17:28 -08:00
John MacFarlane
ce0a4f8c47 RST writers: Use grid tables for 1-column tables.
With simple tables, we have a clash with heading syntax.
Closes #5936.
2019-11-25 07:31:28 -08:00
Albert Krewinkel
d948e13fea Jira writer: improve escaping of special chars (#5925)
Backslash-escaping is used instead of HTML entities, as escaped
characters are easier to read this way. Furthermore, Confluence, which
seems to use a subset of Jira markup, seems to get confused by HTML
entities.
2019-11-22 07:57:24 -08:00
John MacFarlane
c1b51b1282 Improve markdown escaping in list items.
Closes #5918.
2019-11-19 22:33:14 -08:00
Alexander Krotov
33d2a1a84f DokuWiki reader: parse markup inside monospace ('') (#5917)
Fixes #5916
2019-11-18 15:05:19 -08:00
John MacFarlane
16618f38fb Ms template: Use Palatino for default font.
This is less ugly than Times.
2019-11-16 19:32:59 -08:00
John MacFarlane
e9aea67032 Updaet ms writer test. 2019-11-16 19:22:51 -08:00
John MacFarlane
1bf17a7c87 Ms writer: boldface definition terms in DefinitionLists.
Like LaTeX, ConTeXt.
2019-11-16 19:01:53 -08:00
John MacFarlane
56543ec397 ms template: default to page numbers on bottom, no paragaraph indent.
To be more like the default LaTeX output.
2019-11-16 18:51:22 -08:00
John MacFarlane
1b42e05bd9 ConTeXt template: add a saner default for page numbers.
Previously they appeared centered at the top of the page;
now we put them centered at the bottom, unless the `pagenumbering`
variable is set (this gives users full control over page
number format and position,
https://wiki.contextgarden.net/Command/setuppagenumbering)
2019-11-16 18:38:05 -08:00
John MacFarlane
8683cb596d ConTeXt writer: use braces, not start/stop, for inline language tags.
This prevents unwanted gobbling of spaces.
2019-11-16 17:31:47 -08:00
John MacFarlane
41d1ae0fdd Change styles in reference.docx.
All headings now have a uniform color.

Level-1 headings no longer set `w:themeShade="B5"`.

Level-2 headings are now 14 point rather than 16 point.

Level-3 headings are now 12 point rather than 14 point.

Level-4 headings are italic rather than bold.

Closes #5820.
2019-11-16 09:48:05 -08:00
John MacFarlane
1f69162ffd RST writer: Improve spacing for tables with no width information.
If a simple table would be too wide, we use a grid table.
The code for generating grid tables has been adjusted to
give more intelligent column widths when widths aren't
given. (This also affects the markdown writer.)

Closes #5899.
2019-11-15 23:09:53 -08:00
John MacFarlane
e8de53ce4a Change reference.docx to use more normal block quotes.
Indented left and right, same font and size.
Previously it was unindented, smaller font and different
typeface.

See #5820.
2019-11-14 22:20:58 -08:00
John MacFarlane
81fae63a54 Change optInputFiles to a Maybe [FilePath].
`Nothing` means: nothing specified.
`Just []` means: an empty list specified (e.g. in defaults).
Potentially these could lead to different behavior: see #5888.
2019-11-14 18:42:55 -08:00