Commit graph

1402 commits

Author SHA1 Message Date
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
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
Nils Carlson
1ad7a047d5
DocBook reader: Implement table cell alignment (#6698) 2020-09-24 17:43:43 -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
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
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
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
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
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
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
529eb696dc LaTeX reader: Support squared, cubed, tothe in siunitx.
Closes #6657.
2020-09-02 11:06:26 -07:00
Albert Krewinkel
3c07b1d9b6
Fix tests for skylighting 0.10 2020-08-31 21:22:03 +02: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
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
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
Albert Krewinkel
6b08a37bbd
Org writer: don't force blank line after headers
Closes: #6554
2020-07-31 16:04:18 +02: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
1e84178431 Docx writer: support --number-sections.
Closes #1413.
2020-07-22 11:53:31 -07:00
John MacFarlane
942e3ee1f9 RST reader: fix csv tables with multiline cells.
Closes #6549.
2020-07-21 10:20:15 -07:00
John MacFarlane
d6b7b1dc77 Remove use of cmark-gfm for commonmark/gfm rendering.
Instead rely on the markdown writer with appropriate extensions.

Export writeCommonMark variant from Markdown writer.
This changes a few small things in rendering markdown,
e.g. w/r/t requiring backslashes before spaces inside
super/subscripts.
2020-07-19 22:51:59 -07:00
John MacFarlane
8ede05161f
Merge pull request #6495 from tarleb/html5-figure-accessiblity
HTML writer: improve alt-text/caption handling for HTML5
2020-07-19 11:24:54 -07:00
Albert Krewinkel
36fede2b02
Jira writer: keep image caption as alt attribute
Fixes #6529
2020-07-17 16:02:40 +02:00
John MacFarlane
06d834caaa Use selnolig to selectively suppress ligatures with lualatex.
Closes #6534
2020-07-15 13:28:44 -07:00
John MacFarlane
c3b170be1c
Merge pull request #6513 from brisad/master
Escape starting periods in ms writer code blocks
2020-07-12 17:02:06 -07:00
Michael Hoffmann
09ea10e2b1 Escape starting periods in ms writer code blocks
If a line of ms code block output starts with a period (.), it should
be prepended by '\&' so that it is not interpreted as a roff command.

Fixes #6505
2020-07-08 23:52:28 +02:00
Nikolay Yakimov
48cef91d18 [Docx Reader] Refactor/update smushInlines 2020-07-07 09:04:38 +03:00
John MacFarlane
804e8eeed2 Revert "Ipnyb: allow lossless round-tripping of markdown cell content."
This reverts commit efbc205031.
2020-07-02 09:03:56 -07:00
Albert Krewinkel
b894de6426
HTML writer: improve alt-text/caption handling for HTML5
Screen readers read an image's `alt` attribute and the figure caption,
both of which come from the same source in pandoc. The figure caption is
hidden from screen readers with the `aria-hidden` attribute. This
improves accessibility.

For HTML4, where `aria-hidden` is not allowed, pandoc still uses an
empty `alt` attribute to avoid duplicate contents.

Closes: #6491
2020-07-01 14:54:52 +02:00
Albert Krewinkel
ccf9889c2c
Org reader: respect tables-excluding export setting
Tables can be removed from the final document with the `#+OPTION:
|:nil` export setting.
2020-07-01 09:28:24 +02:00
Albert Krewinkel
d6711bd7d9
Org reader: respect export setting disabling footnotes
Footnotes can be removed from the final document with the `#+OPTION:
f:nil` export setting.
2020-06-30 22:30:15 +02:00
John MacFarlane
efbc205031 Ipnyb: allow lossless round-tripping of markdown cell content.
The reader now parses the contents of the markdown cell to a Pandoc
structure, but *also* stores the raw markdown in a `source`
attribute on the cell Div.  When we convert back to markdown,
this attribute is stripped off and the original source is used.
When we convert to other formats, the attribute is usually
ignored (though it will come through in HTML as a `data-source`
attribute, not unhelpfully).

I'll note some potential drawbacks of this approach:

- It makes it impossible to use pandoc to clean up or
  change the contents of markdown cells, e.g.
  going from `+smart` to `-smart`.

- There may be formats where the addition of the `source`
  attribute is problematic.  I can't think of any, though.

Closes #5408.
2020-06-30 12:32:44 -07:00
Albert Krewinkel
7c207c3051
Org reader: respect export setting which disables entities
MathML-like entities, e.g., `\alpha`, can be disabled with the
`#+OPTION: e:nil` export setting.
2020-06-30 11:39:32 +02:00