Commit graph

7248 commits

Author SHA1 Message Date
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
John MacFarlane
7faa9d9064 Moved more from LaTeX reader to LaTeX.Parsing. 2020-07-22 12:05:35 -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
fe315a8290 Move some code from T.P.R.LaTeX. to T.P.R.LaTeX.Parsing.
We need to reduce the size of the LaTeX reader to ease
compilation on resource-limited systems.  More can be done
in this vein.
2020-07-20 23:36:54 -07:00
John MacFarlane
490f34dee5 Markdown writer: move asciify out of escapeString.
Otherwise unsmartify doesn't catch quotes that have
already been turned to entities.
2020-07-19 22:51:59 -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
a63105ffff Markdown writer: use unicode super/subscript characters...
when possible if the superscript or subscript extension or
raw_html aren't available.
2020-07-19 22:51:59 -07:00
John MacFarlane
8d0676ec4d Markdown writer: render caption as following paragraph...
when `Ext_table_caption` not enabled.
2020-07-19 22:51:59 -07:00
John MacFarlane
0aed9dd589 Add commonmark_x output format...
commonmark with a number of useful extensions (more than gfm).
2020-07-19 22:51:59 -07:00
John MacFarlane
3a22fbd11b Trim down githubMarkdownExtensions.
Previously it included all of the following, which make
sense for the legacy markdown_github but not for gfm,
since they are part of base commonmark and thus
can't be turned off in gfm:

- `Ext_all_symbols_escapable`
- `Ext_backtick_code_blocks`
- `Ext_fenced_code_blocks`
- `Ext_space_in_atx_header`
- `Ext_intraword_underscores`
- `Ext_lists_without_preceding_blankline`
- `Ext_shortcut_reference_links`
`
These have been removed from `githubMarkdownExtensions`, though
they're still turned on for legacy `markdown_github`.
2020-07-19 22:51:59 -07:00
John MacFarlane
8d523d80d4 Add generic attributes extension.
This allows attributes to be added to any block or inline
element, in principle.  (Though in many cases this will be
done by adding a Div or Span container, since pandoc's
AST doesn't have a slot for attributes for most elements.)

Currently this is only possible with the commonmark and gfm
readers.

Add `Ext_attributes` constructor for `Extension` [API change].
2020-07-19 22:51:59 -07:00
John MacFarlane
0db4702042 Use commonmark-hs to parse commonmark/gfm...
...instead of cmark-gfm (a wrapper around a C library).

We can now support many more pandoc extensions for
commonmark and gfm.

Add fenced_code_attributes to gfm/commonmark extensions.
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
John MacFarlane
3b563cfe8f DocBook reader: parse releaseinfo as metadata.
Closes #6542.

Note that you'll need to put releaseinfo somewhere in your
template if you want this to be part of the converted output.
2020-07-18 12:32:31 -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
302543af08 Docbook reader: remove misleading comment...
suggesting that releaseinfo is handled. It isn't.
2020-07-14 10:10:43 -07:00
John MacFarlane
2cc0d68ca0
Merge pull request #6527 from lierdakil/fix-6514
[Docx Reader] Only use bCs/iCs on runs with rtl or cs property
2020-07-13 10:57:04 -07:00
Nikolay Yakimov
22c373370c [Docx Reader] Only use bCs/iCs on runs with rtl or cs property
Fixes #6514
2020-07-13 19:50:06 +03: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
John MacFarlane
7be86b148e
Merge pull request #6509 from lierdakil/docx-smush-inlines-refactor
[Docx Reader] Refactor/update Text.Pandoc.Readers.Docx.Combine.smushInlines
2020-07-12 16:55:35 -07:00
John MacFarlane
9ae792b0d4 Ms writer: fix code highlighting with blank lines.
Previously blank lines were simply omitted from highligted code.
2020-07-12 14:51:21 -07:00
John MacFarlane
e3217c3862 RST reader: fix spurious newlines in some attributes from directives. 2020-07-12 14:42:41 -07:00
John MacFarlane
37e68a818b RST reader: avoid extra newline in included code blocks. 2020-07-12 13:53:10 -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
f09e18753b [Docx Reader] Use null instead of isEmpty in Readers.Docx.Combine 2020-07-07 14:50:26 +03:00
Nikolay Yakimov
5a1e1db526 [Docx Reader] Remove unused LANGUAGE from Readers.Docx.Combine 2020-07-07 13:23:14 +03:00
Nikolay Yakimov
1ae4d76d42 [Docx Reader] Remove no-op stack/unstackInlines in Readers.Docx.Combine 2020-07-07 12:28:38 +03:00
Nikolay Yakimov
27465638a1 [Docx Reader] Get rid of unused NullModifier in Readers.Docx.Combine 2020-07-07 11:32:17 +03: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
John MacFarlane
9afa192c3a Revert "Ipynb reader: fix duplication of 'source' attribute."
This reverts commit 2d009366ce.
2020-07-02 09:03:26 -07:00
John MacFarlane
2d009366ce Ipynb reader: fix duplication of 'source' attribute.
See #5408.
2020-07-02 09:01:06 -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
John MacFarlane
f1a5295082
Merge pull request #6328 from lierdakil/defaults-meta-parse
Unify defaults metadata and markdown metadata parsers
2020-06-29 12:38:49 -07:00
Albert Krewinkel
5ef315cc6d
Org reader: keep unknown keyword lines as raw org
The lines of unknown keywords, like `#+SOMEWORD: value` are no longer
read as metadata, but kept as raw `org` blocks. This ensures that more
information is retained when round-tripping org-mode files;
additionally, this change makes it possible to support non-standard org
extensions via filters.
2020-06-29 21:19:34 +02:00
Albert Krewinkel
90ac70c79c
Org reader: unify keyword handling
Handling of export settings and other keywords (like `#+LINK`) has been
combined and unified.
2020-06-29 20:53:25 +02:00
Albert Krewinkel
1480606174
Org reader: support LATEX_HEADER_EXTRA and HTML_HEAD_EXTRA settings
These export settings are treated like their non-extra counterparts,
i.e., the values are added to the `header-includes` metadata list.
2020-06-29 17:04:29 +02:00
Albert Krewinkel
d17b257c89
Org reader: allow multiple #+SUBTITLE export settings
The values of all lines are read as inlines and collected in the
`subtitle` metadata field.
2020-06-29 17:03:33 +02:00
Nikolay Yakimov
42e7f1e976 Clean up T.P.R.Metadata 2020-06-29 17:07:12 +03:00
Nikolay Yakimov
34e54d3020 Handle errors in yamlToMeta 2020-06-29 17:06:29 +03:00
Nikolay Yakimov
f26923b9e4 Unify defaults and markdown metadata parsers 2020-06-29 17:06:29 +03:00
Nikolay Yakimov
11dc9f84f5
Remove obsolete RelaxedPolyRec extension (#6487) 2020-06-28 22:35:33 -07:00
John MacFarlane
8a1690dec1 PDF: all verbose output now goes to stderr, not stdout.
Closes #6483.
2020-06-28 12:11:23 -07:00
Albert Krewinkel
19175af811
JATS reader: parse abstract element into metadata field of same name (#6482)
Closes: #6480
2020-06-28 10:35:50 -07:00
Albert Krewinkel
d2d5eb8a99
Org reader: read #+INSTITUTE values as text with markup
The value is stored in the `institute` metadata field and used in the
default beamer presentation template.
2020-06-28 19:25:57 +02:00
Albert Krewinkel
e3a6d651e1
Org reader: update behavior of author, keywords export settings
The behavior of the `#+AUTHOR` and `#+KEYWORD` export settings has
changed: Org now allows multiple such lines and adds a space between the
contents of each line. Pandoc now always parses these settings as meta
inlines; setting values are no longer treated as comma-separated lists.
Note that a Lua filter can be used to restore the previous behavior.
2020-06-28 18:01:30 +02:00
Albert Krewinkel
54f6faa10f
Org reader: refactor export setting handling 2020-06-28 15:41:56 +02:00
Albert Krewinkel
8dce28d949
Org reader: read description lines as inlines
`#+DESCRIPTION` lines are treated as text with markup. If multiple such
lines are given, then all lines are read and separated by soft
linebreaks.

Closes: #6485
2020-06-27 09:11:00 +02:00
Albert Krewinkel
9e6e9a7221
Org reader: honor tex export option
The `tex` export option can be set with `#+OPTION: tex:nil` and allows
three settings:

 - `t` causes LaTeX fragments to be parsed as TeX or added as raw TeX,
 - `nil` removes all LaTeX fragments from the document, and
 - `verbatim` treats LaTeX as text.

The default is `t`.

Closes: #4070
2020-06-25 20:31:33 +02:00
John MacFarlane
52ac585967 Remove redundant pattern match in pptx writer. 2020-06-23 13:04:42 -07:00
John MacFarlane
9b7282bb0f LaTeX reader: Retain the Div around tables with attributes.
We'll need this to store table attributes until all writers
are adjusted to react to attributes on the Table element.
2020-06-23 11:12:40 -07:00
John MacFarlane
ee782ccfec Markdown reader: Don't require blank line after grid table.
This fixes #6481, allowing grid tables to be enclosed
in fenced divs with no intervening blank lines.
2020-06-23 08:24:45 -07:00
John MacFarlane
7f8105159c Handle native Underline in Powerpoint writer.
(Instead of old Span with underline class.
Spans with `underline` will no longer be rendered
as underlined text.)
2020-06-22 17:56:28 -07:00
John MacFarlane
b1561d8e47 Use native Underline instead of Span in Jira 2020-06-22 17:55:57 -07:00
John MacFarlane
76fc51f2ba Use --enable-local-file-access in invoking wkhtmltopdf.
wkhtmltopdf changed in recent versions to require this for
access to local files.

This fixes PDF via HTML5 with `--css`.

Closes #6474.
2020-06-22 16:33:20 -07:00
Albert Krewinkel
f5d7d41cbd
Recognize images with uppercase extensions
Fixes: #6472
2020-06-20 18:14:18 +02:00
John MacFarlane
9d0506e404 LaTeX writer: escape ^ specially for listings.
Closes #6460.
2020-06-17 10:12:55 -07:00
John MacFarlane
a8b3117e04 RST reader: pass arbitrary attributes through in code blocks.
Exceptions: name (which becomes the id), class (which becomes the
classes), and number-lines (which is treated specially to fit
with pandoc highlighting).

Closes #6465.
2020-06-17 09:57:56 -07:00
Michael Reed
bf95282436
Fix MIME type for TrueType fonts in EPUBs (#6464)
Per the EPUB 3.2 spec, "application/x-font-truetype" is no longer a
valid identifier for TrueType (.ttf) fonts [1]. This fixes warnings when
validating pandoc-generated EPUBs using `epubcheck` [2].

References [3].

[1]: https://www.w3.org/publishing/epub3/epub-spec.html#sec-core-media-types
[2]: https://github.com/w3c/epubcheck
2020-06-17 09:15:50 -07:00
Mathieu Boespflug
bbf04df900
Docbook reader: implement <procedure> (#6442)
A `<procedure>` contains a sequence of `<step>`'s, or `<substeps>`
that themselves contain `<step>`'s.
2020-06-14 10:45:52 -07:00
Mathieu Boespflug
89bbe76ace
Docbook reader: implement <phrase> (#6438)
A `<phrase>` has no semantic meaning. It is only useful to hang an
`id` or other attributes around a piece of text.
2020-06-14 10:45:19 -07:00
Mathieu Boespflug
390bd51fdc
Docbook reader: treat envar and systemitem like code (#6435) 2020-06-14 10:44:22 -07:00
Mathieu Boespflug
e321843f32
Docbook: implement <replaceable> (#6437)
A `<replaceable>` is a placeholder that a user is instructed to
replace with a value of their own, like
`<replaceable>prefix</replacable>/bin/foo`. In the standard Docbook
toolchain, this typically appears emphasized, and no other adornement.
But a `<replaceable>` is nearly always in a code element, where
emphasis won't work. So we do the same thing as for `<optional>`:
decorate the content with brackets.
2020-06-14 10:43:53 -07:00
Mathieu Boespflug
12a35dd0d0
Docbook: map <simplesect> to unnumbered section (#6436)
A <simplesect> is a section like any other, except that it never
contains an subsection, and is typically rendered unnumbered.
2020-06-14 10:40:00 -07:00
dbecher-ito
a0559d952b
Distinguish between single and double quotes when using enquote package (#6457) 2020-06-14 10:02:17 -07:00
John MacFarlane
fa6ffcaf02 Textile reader: support "pre." for code blocks.
Cloess #6454.
2020-06-13 10:59:02 -07:00
John MacFarlane
de4fb05dcc Ipynb reader: handle application/pdf output as image.
Closes #6430.
2020-06-09 09:47:26 -07:00
John MacFarlane
8d07940828 Ipynb reader: properly handle image/svg+xml as an image.
Partially addresses #6430.
2020-06-09 09:41:34 -07:00
John MacFarlane
7c6dbd37eb Change default revealjs-url to use CDN version of revealjs v4.
See #6408.
2020-05-30 12:10:27 -07:00
Lucas Escot
de0df52998
Fixed Katex standalone script (#6399)
Global macros are now persistent when using the HTML Writer with the --katex
option.
2020-05-28 11:31:23 -07:00
John MacFarlane
4b5d2aa485 FB2 writer: properly handle cover-image containing spaces.
Closes #6391.
2020-05-21 14:08:08 -07:00
John MacFarlane
f6dfacf9d6 Add "summary" to list of block-level HTML tags.
Closes #6385.  (The summary element needs to be the first
child of details and should not be enclosed by p tags.)

NOTE:  you need to include a blank line before the closing
`</details>`, if you want the last part of the content to
be parsed as a paragraph.
2020-05-20 07:45:14 -07:00
John MacFarlane
311d4c9dfc LaTeX reader: don't parse beyond \end{document}.
This required some internal changes to `\subfile` handling.

Closes #6380.
2020-05-19 15:17:00 -07:00
Lila
f4185fcef0
Use CSS in favor of <br> for display math (#6372)
Some CSS to ensure that display math is
displayed centered and on a new line is now included
in the default HTML-based templates; this may be
overridden if the user wants a different behavior.
2020-05-18 22:45:44 -07:00
Albert Krewinkel
1d3a3a027a
Org writer: clean-up Div handling 2020-05-17 21:55:11 +02:00
John MacFarlane
5a20cc07dd Docx writer: enable column and row bands for tables.
This change will not have any effect with the default style.
However, it enables users to use a style (via a reference.docx)
that turns on row and/or column bands.

Closes #6371.
2020-05-16 15:50:59 -07:00
John MacFarlane
bde3d7622d OpenDocument writer: add custom-style "Abstract" in metadata abstract.
This ensures that the abstract is rendered with style Abstract.
2020-05-16 14:39:20 -07:00
John MacFarlane
a2ce28fa4d OpenDocument/ODT writer: enable custom-style attribute on a Div.
This allows you to apply a custom style to contained paragraphs.
2020-05-16 14:37:33 -07:00
John MacFarlane
6082e73927 DocBook writer: add id of figure to enclosed image. 2020-05-14 21:23:47 -07:00
John MacFarlane
8c026d5ec0 Fix underline in RTF writer.
It should be `\ul` not `\pnul`.
2020-05-14 09:44:44 -07:00
John MacFarlane
be9e93d4ae LaTeX writer: create hypertarget for links with identifier.
Closes #6360.
2020-05-12 14:37:07 -07:00
Albert Krewinkel
9c76c52e9b
Lua: fix regression in package searcher
This caused `require 'module'` to fail for third party packages.

Fixes: #6361
2020-05-12 17:10:30 +02:00
John MacFarlane
8fc57664f8 Implement implicit_figures extension for commonmark reader.
Closes #6350.
2020-05-08 07:56:54 -07:00
John MacFarlane
83880b0dbc Shared.makeSections: omit number attribute when unnumbered class...
...is present.  Previously the attribute was included but given
an empty value, and this caused the table of contents creation
functions in T.P.Writers.Shared to think these items had numbers,
which meant that they were included in the TOC even if the `unlisted`
class was used.

Closes #6339.
2020-05-05 14:31:48 -07:00
Joseph C. Sible
6fad52b057
Avoid unnecessary guard (#6340) 2020-05-05 08:46:35 -07:00
John MacFarlane
680793803a Fix mediawiki reader with gfm_auto_identifiers.
Previously the `-` was being replaced by `_`.
Closes #6335.
2020-05-04 09:20:27 -07:00
andrebauer
97fe2ea16c
LaTeX Writer: Add support for customizable alignment of columns in beamer (#6331)
Add support for customizable alignment of columns in beamer.
Closes #4805, closes #4150.
2020-05-02 17:08:16 -07:00
Albert Krewinkel
0fafe9dd32
Lua filters: improve error messages for failing filters (#6332)
Print the Lua error properly instead of displaying their `show` string.
2020-05-02 16:12:42 -07:00
Jesse Rosenthal
9e7572da1f PowerPoint writer: write math input verbatim in speaker notes.
OMML in speaker notes would lead to corrupt PowerPoint output. We now
output the OMML verbatim as LaTeX in the speaker notes.

Closes #6301.
2020-04-30 10:12:52 -04:00
Vaibhav Sagar
9c2b659eeb
Support new Underline element in readers and writers (#6277)
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-28 07:53:06 -07:00
John MacFarlane
f268ae3035 RST writer: properly handle images with same alt text.
Previously we created duplicate references for these
in rendering RST.  Closes #6194.
2020-04-24 16:54:52 -07:00
John MacFarlane
6baacb51bb AsciiDoc writer: add blank line after Div.
Closes #6308.
2020-04-22 23:04:43 -07:00
Joe Hermaszewski
fd5994cc5e Haddock Writer: Support Haddock tables
See this PR on Haddock for details on the table format:
https://github.com/haskell/haddock/pull/718
2020-04-20 13:57:36 +08:00
John MacFarlane
f0c6411ede Fix round-trip bug with HTML tables....
introduced by parsing of table attributes.  (The writer
always added a style with width, and we would get multiple
such styles through successive round trips.)
2020-04-18 12:06:41 -07:00
John MacFarlane
37cadd5a02 HTML reader: parse attributes into table attributes. 2020-04-18 10:52:56 -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
Albert Krewinkel
62cf21cbaa
API change: use new type PandocLua for all pandoc Lua operations
The new type `PandocLua` is an instance of the `PandocMonad` typeclass
and can thus be used in a way similar to `PandocIO`.
2020-04-17 23:05:44 +02:00
Albert Krewinkel
eceb8eaf47
Class: generalize PandocIO functions to MonadIO 2020-04-17 23:05:31 +02: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
John MacFarlane
906305de78
Merge pull request #6224 from despresc/better-tables 2020-04-17 10:04:39 -07:00
John MacFarlane
a9ef15bbd5 Revert 0e48a02 and dependency on base-noprelude...
which hasn't been updated for ghc 8.10.
See discussion at #6187.
2020-04-17 09:50:55 -07:00
John MacFarlane
40397b5905 Shared: renderTags': use self-closing tag for col element.
Closes #6295.
2020-04-16 22:26:00 -07:00
despresc
d1521af8fb Markdown reader: Remove unnecessary qualification 2020-04-15 23:03:22 -04:00
Albert Krewinkel
f1bd06eb4a Lua: support new tables 2020-04-15 23:03:22 -04: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
f8ce38975b Remove the onlySimpleCellBodies function from 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
Cédric Couralet
34775b4128
Add an option to disable certificate validation (#6156)
This commit adds the option `--no-check-certificate`, which disables certificate
checking when resources are fetched by HTTP.

Co-authored-by: Cécile Chemin <cecile.chemin@insee.fr>
Co-authored-by: Juliette Fourcot <juliette.fourcot@insee.fr>
2020-04-13 14:58:42 -07:00
John MacFarlane
bf583c3d9c RST reader: handle "date::" directive.
Closes #6276.
2020-04-12 10:32:38 -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
c3f539364a
Jira: support citations, attachment links, and user links
Closes: #6231
Closes: #6238
Closes: #6239
2020-04-04 14:27:27 +02:00
John MacFarlane
792f1a6b57 HTML reader: fix parsing unclosed th elements in a table.
Closes #6247.
2020-04-02 07:58:52 -07:00
John MacFarlane
8ec3f6fc46 Docbook writer: Add personname element to docbook author.
Closes #6244.
2020-04-01 09:05:13 -07:00
John MacFarlane
247d8e8001 Markdown writer: ensure consistent padding for pipe tables.
Previously there was no space between text and bar in right-aligned
table cells.

This commit also ensures space on both sides for centered cells.

Closes #6240.
2020-03-31 22:34:00 -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
e8e6c82aae
Jira writer: add image attributes
Image attributes are added to the output as image parameters. If the
image has a class "thumbnail", then a thumbnail image is generated; all
other attributes are discarded in this case.

Closes: #6234
2020-03-30 22:21:29 +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
Albert Krewinkel
0069773364
Jira reader: read (?) icon as "small questionmark" character
Closes: #6236
2020-03-30 21:34:25 +02:00
Joseph C. Sible
4f41ac3269
Fix #6228 (#6230)
UUID: Remove `getUUID`, fix `getRandomUUID` and make it polymorphic in PandocMonad.
2020-03-30 12:03:29 -07:00
Joseph C. Sible
a465e2c059
Clean up and simplify Text.Pandoc.Readers.Docx (#6225)
* Simplify resolveDependentRunStyle

* Simplify runToInlines

* Simplify isAnchorSpan

* Simplify parStyleToTransform

* Only call getStyleName once

* Simplify ils''

* Use case matching to simplify bodyPartToBlocks

* Simplify key expiration
2020-03-29 21:24:42 -07:00
Joseph C. Sible
693159bf38
Clean up and simplify Text.Pandoc.Writers.Docx (#6229)
* Use <|> to simplify the Semigroup instance

* Use map instead of reimplementing it

* Simplify isValidChar

* Remove an unnecessary nested do block

* Simplify pgContentWidth

* Simplify addLang

* Simplify newStyles

* Avoid an unnecessary fmap in headerFooterEntries

* Remove unnecessary monadicity from mkNumbering and mkAbstractNum

* Use randomRs instead of constantly messing with the RNG state

* Lift common functions out of ifs

* Hoist not

* Clarify withTextPropM and withParaPropM
2020-03-29 21:18:31 -07:00
Joseph C. Sible
377efd0ce7
Clean up some fmaps (#6226)
* Avoid fmapping when we're just binding right after anyway

* Clean up unnecessary fmaps in the LaTeX reader
2020-03-29 21:11:05 -07:00
Joseph C. Sible
40fd20d43f
Split the RNG so they don't end up equal again after 1 call to next (#6227) 2020-03-29 21:10:50 -07:00
John MacFarlane
c12bf49e59 Docx reader: better error messages.
Distinguish between docx parsing and docx container
unpacking errors.
2020-03-29 10:59:18 -07: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
Joseph C. Sible
c812ff7e89
Simplify fixAuthors (#6223) 2020-03-28 22:47:24 -07:00
Albert Krewinkel
f2b337768e
Finer grained imports of Text.Pandoc.Class submodules (#6203)
This should speed-up recompilation after changes in `Text.Pandoc.Class`,
as the number of modules affected by a change will be smaller in
general. It also offers faster insights into the parts of `T.P.Class`
used within a module.
2020-03-22 12:28:45 -07:00
Albert Krewinkel
2a042ff711
Text.Pandoc.Class: extract submodules PandocIO, PandocPure 2020-03-22 14:59:38 +01:00
Albert Krewinkel
66375f3fc4
Class: fix missing import when data files are not embedded 2020-03-21 16:26:24 +01:00
John MacFarlane
7601953205 Add to html5 attributes.
Add: allow, autocapitalize, decoding, enterkeyhint,
imagesizes, imagesrcset, loading.
2020-03-19 16:10:51 -07:00
Albert Krewinkel
a5fa55969f
Use implicit Prelude (#6187)
* Use implicit Prelude

The previous behavior was introduced as a fix for #4464. It seems that
this change alone did not fix the issue, and `stack ghci` and `cabal
repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded
for these versions. Given this, it seems cleaner to revert to the
implicit Prelude.

* PandocMonad: remove outdated check for base version

Only base versions 4.9 and later are supported, the check for
`MIN_VERSION_base(4,8,0)` is therefore unnecessary.

* Always use custom prelude

Previously, the custom prelude was used only with older GHC versions, as
a workaround for problems with ghci. The ghci problems are resolved by
replacing package `base` with `base-noprelude`, allowing for consistent
use of the custom prelude across all GHC versions.
2020-03-15 09:45:44 -07:00
Albert Krewinkel
76705dfeb0
PandocMonad: remove outdated check for base version
Only base versions 4.9 and later are supported, the check for
`MIN_VERSION_base(4,8,0)` is therefore unnecessary.
2020-03-15 09:55:34 +01:00
Albert Krewinkel
ec49643d64
Subdivide Text.Pandoc.Class into small modules (#6106)
* Extract CommonState into submodule

* Extract PandocMonad into submodule

* PandocMonad: ensure all functions have Haddock documentation
2020-03-14 20:49:36 -07: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
24da280000
Lua marshalling: Remove unused language extensions 2020-03-13 09:52:28 +01: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
4faac2bf9b Fix parsing of \' in man/ms readers.
It was being parsed as a backtick.
Closes #6175.
2020-03-05 19:29:14 -08:00
John MacFarlane
4eb0c1eec1 Fix parsing of \. in man/ms readers.
Previously due to a typo it was being parsed as `` ` ``.

Closes #6175.
2020-03-05 19:22:41 -08:00
John MacFarlane
c78b30bd28 EPUB writer: fix regression on detection of front/back/bodymatter.
This bug caused sections with epub:type "dedication" to be
misplaced in bodymatter instead of frontmatter as specified
in the manual.  The same problem would affect other epub:types.

The pattern matching needed to be changed with the use of
`makeSection`.  Closes #6170.
2020-03-04 08:42:57 -08:00
John MacFarlane
43711ade22 PDF via wkhtmltopdf: put user-specified options last.
Certain options (e.g. "cover") need to come after flags on
the command line.  Closes #6171.
2020-03-02 15:26:11 -08:00
John MacFarlane
2c09b15b8d Fix table alignment when heading begins with t.
Due to a typo (`t` instead of `\t`) we were center
aligning column headings that begin with a lowercase t!
Closes #6153.
2020-02-21 08:06:19 -08:00
John MacFarlane
984a82a9b8 Text.Pandoc.App: set resource path at the beginning...
...so it can affect things like include-in-header.

See #5982.
2020-02-19 16:56:20 -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
Ryan Scott
6a01386cd1
Remove redundant otherwise guard in inlineToAsciiDoc (#6146)
The `RawInline` case in `inlineToAsciiDoc` currenty looks like this:

```hs
inlineToAsciiDoc _ il@(RawInline f s)
  | f == "asciidoc" = return $ literal s
  | otherwise         = do
      report $ InlineNotRendered il
      return empty
  | otherwise       = return empty
```

Notice how there are there are two overlapping `otherwise` guards.
The second `otherwise` guard is completely unreachable, so this patch
removes it.
2020-02-17 08:03:50 -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
Joseph C. Sible
652ed0b82c
A bit more cleanup (#6141)
* Remove unnecessary fmaps and only do toMilliseconds once

* Share the input tuple intead of making a new one

* Lift return out of if

* Simplify case statements

* Lift DottedNum out of the case statements

* Use st instead of mbs

* Use setState instead of updateState now that we have the whole state around
2020-02-13 22:52:51 -08:00
Lucas Escot
29c2670da2
Add highlight directive to the rST reader (#6140) 2020-02-13 10:27:34 -08:00
John MacFarlane
3a181f0a97 Add Text.Pandoc.Image with unexported svgToPng. 2020-02-12 21:57:00 -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
1433aaa4c3 HTML reader: don't parse data-id as id attribute.
And similarly don't parse any `data-X` as `X` when `X`
is a valid HTML attribute.

Reported in comment on #5415.
2020-02-12 08:47:32 -08:00
John MacFarlane
fae8ea36f0 Moved html5Attributes, html4Attributes, rdfaAttributes...
from T.P.Writers.HTML (where they were unexported) to
T.P.XML (where they are now exported).

[API change: new exported functions]

This allows these sets to be used elsewhere, e.g.
in the HTML reader.
2020-02-12 08:45:59 -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
Albert Krewinkel
689cb7128f
Org reader: simplify parsing of sub- and superscripts
Speeds up parsing of single-word, markup-less sub- and superscripts.

Fixes: #6127
2020-02-08 21:07:57 +01: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
f2f559003e Factor out a findM function (#6125)
This adds a new function to the API: Text.Pandoc.Shared.findM.
2020-02-08 09:12:30 -08:00
Joseph C. Sible
12c75701be
Use <$> instead of >>= and return (#6128) 2020-02-08 09:12:01 -08:00
Joseph C. Sible
e97a99616e Clean up after "hlint --refactor" (#6129)
HLint's automatic refactoring isn't quite perfect, so some of its
changes were overcomplicated, wrong, or created new findings.
Clean these up.
2020-02-08 09:11:00 -08:00
Joseph C. Sible
02ff42b178
More cleanup (#6130)
* Use an infix operator normally instead of immediately applying an operator section

* Use M.fromList
2020-02-08 09:09:33 -08:00
John MacFarlane
4c3db9273f Apply linter suggestions. Add fix_spacing to lint target in Makefile. 2020-02-07 09:08:22 -08:00
Albert Krewinkel
6cd77d4c63
Resolve HLint warnings
All warnings are either fixed or, if more appropriate, HLint is
configured to ignore them. HLint suggestions remain.

  * Ignore "Use camelCase" warnings in Lua and legacy code
  * Fix or ignore remaining HLint warnings
  * Remove redundant brackets
  * Remove redundant `return`s
  * Remove redundant as-pattern
  * Fuse mapM_/map
  * Use `.` to shorten code
  * Remove redundant `fmap`
  * Remove unused LANGUAGE pragmas
  * Hoist `not` in Text.Pandoc.App
  * Use fewer imports for `Text.DocTemplates`
  * Remove redundant `do`s
  * Remove redundant `$`s
  * Jira reader: remove unnecessary parentheses
2020-02-07 10:17:24 +01:00
Joseph C. Sible
60a3158bf9
More in-depth refactoring and cleanup (#6123)
* Avoid duplicating the dash case

* Pull common functions out of case branches

* Make sure list lengths are only calculated once

* Use unless

* Simplify parseURIReference' and avoid an unnecessary call to length

* Use <$> instead of reimplementing it

* Use swap instead of reimplementing it

* Remove eta-expansion that's been unnecessary since 90f5dd8

* Use tailDef instead of reimplementing it

* Use second instead of fmap, per @tarleb
2020-02-07 08:42:46 +01: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
Joseph C. Sible
013a1647a7
Use traverse instead of reimplementing it (#6124) 2020-02-06 23:10:09 -08:00
Joseph C. Sible
30c8980883
Simplify an overcomplicated filtering function (#6115)
There's no need to use `catMaybes`, `uncurry`, `bool`, etc., just
to get elements where the second element of a tuple is True.
2020-02-05 17:22:53 -08:00
John MacFarlane
9c12024e07 Fix --number-offset with HTML TOC.
Eventually it would be worth adding a parameter to
makeSections so this could be done at that level;
then it would also affect other writers that construct
TOC manually.
2020-02-05 17:20:52 -08: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
Joseph C. Sible
b018028ee9
Remove our bool function (#6116)
Data.Bool already provides a bool function identical to this one.
2020-02-04 22:38:49 -08:00
John MacFarlane
fd9c03febe Add timing info for filters in --verbose mode.
+ Add RunningFilter, FilterCompleted constructors to LogMessage
+ When verbose mode is specified (verbosity == INFO), print a
  notice when running a filter and when a filter completes (including
  timing).

Closes #6112.
2020-02-04 09:38:53 -08:00
John MacFarlane
30962e2e9d Allow & in LaTeX citation keys.
Closes #6110.
2020-02-03 20:38:49 -08:00
Joseph C. Sible
1ea5b18020
Swap suboptimal uses of maybe and fromMaybe (#6111)
Anywhere "maybe" is used with "id" as its second argument, using
"fromMaybe" instead will simplify the code. Conversely, anywhere
"fromMaybe" is used with the result of "fmap" or "<$>" as its second
argument, using "maybe" instead will simplify the code.
2020-02-03 20:31:05 -08:00
John MacFarlane
d9b1776336 Fix duplicate frame classes in LaTeX/Beamer output.
Close #6107.
2020-02-03 08:52:07 -08:00
Joseph C. Sible
6371ec241d
Clean up overcomplicated maybe logic (#6105)
We're using maybe in redundant ways. Remove it altogether in one case and
simplify it to fromMaybe in another.
2020-02-03 08:26:00 -08:00
Joseph C. Sible
8d6fac1253
Clean up a confusing triple negative (#6102)
There's currently `unless`, `not`, and `notParaOrPlain` in the same
expression, which is a rather confusing triple negative. Replace
`notParaOrPlain` with `paraOrPlain` and switch to `all` from `any`
to clean this up.
2020-02-03 08:14:22 -08:00
John MacFarlane
b47a3cdcb6 Text.Pandoc.Readers.CSV - reuse CSV parser from Text.Pandoc.CSV. 2020-02-01 07:34:15 -08:00
John MacFarlane
4b1f8584a5 Fix bug in Text.Pandoc.CSV.
Previously an extra blank record would sometimes be inserted at the
end.
2020-02-01 07:33:55 -08:00
John MacFarlane
22f484e9a9 Support 'bibliography' and 'csl' fields in defaults file.
Move addMeta from T.P.App.CommandLineOptions to T.P.App.Opt.
(not an api change because modules not exported)
2020-01-31 21:56:28 -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
e6399d162a Added a try that was needed for the commit fc78be1.
The intent of that commit was to parse unknown LaTeX
enivronments as verbatim if they can't be parsed normally,
avoiding crashes on environments that allow unescaped
underscores and the like.  But the fix didn't completely
work: it worked for raw TeX in markdown but not when
reading LaTeX. This change fixes that.

See #6034. Closes #6093.
2020-01-28 21:32:30 -08:00
John MacFarlane
ff4dd2b1dd
Docx writer: fix regression with Compact style on tight lists. (#6073)
Starting in 2.8, the docx writer no longer distinguishes
between tight and loose lists, since the Compact style is
omitted.

This is a side-effect of the fix to #5670, as explained
in the changelog:

    + Preserve built-in styles in DOCX with custom style (Ben Steinberg,
      #5670).  This change prevents custom styles on divs and spans
      from overriding styles on certain elements inside them, like
      headings, blockquotes, and links. On those elements, the
      "native" style is required for the element to display correctly.
      This change also allows nesting of custom styles; in order to do so,
      it removes the default "Compact" style applied to Plain blocks,
      except when inside a table.

This patch fixes the problem by extending the exception currently
offered to Plain blocks inside tables to Plain blocks inside list
items.

Closes #6072.
2020-01-19 18:24:32 -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
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
5b902abe87 Change setVariable to use Text instead of String.
This avoids some unnecessary unpacking.
(This is only an internal module so it's not an API change.)
2020-01-08 09:05:24 -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
John MacFarlane
b96febddef Added a needed pragma. 2020-01-04 10:07:26 -08:00
John MacFarlane
8ed749702f Add type annotations to assist ghci. 2020-01-04 09:55:15 -08:00
John MacFarlane
c5b6321b21 Remove unneeded import. 2020-01-04 09:47:44 -08:00
John MacFarlane
82f0b2755b HTML writer: Add newlines to make slide show output more readable. 2020-01-04 09:36:01 -08:00
John MacFarlane
f391560c1a PDF: fix runTeXProgram so that the input source is always overwritten.
Previously it wasn't overridden if the file already existed,
which led to bad results on subsequent runs when
`pdf-engine-opt=-output-directory=` was used to specify
an explicit temp dir.

Closes #6027.
2020-01-03 21:57:15 -08: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
John MacFarlane
4affd40194 BCP47: change getLang so it can handle block-level contents.
Some readers (e.g. RST) will populate the `lang` metadata field
with block-level content.  `getLang` has been modified to handle
this.  Previously in these cases the LaTeX writer would not properly
set the "main language" of the document.

Closes #6008.
2019-12-30 23:21:22 -07: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
b8bd845542 Add a needed try. 2019-12-27 10:37:01 -08:00
Felix Yan
1ff732269e Use HTTPS in copyright message (#6010)
Since the website now redirect to https automatically, it would be nice to just use https in the help text.
2019-12-26 12:26:24 -08:00
John MacFarlane
71fab252d5 Ensure that later default file values for variable replace earlier ones.
The semigroup instance for doctemplates Context does a left-biased
union on the underlying Map.  That means that if you union
`{a: 1}` and `{a: 2}`, you get `{a: 1}`.  This commit causes
pandoc to do the operation in the opposite order, so that later
default files take precedence in the values they assign to
keys.

See #5988.
2019-12-22 22:01:30 -08:00
John MacFarlane
eca39d6cf1 HTML writer: more tweaks to avoid round-trip failures...
having to do with makeSections.
2019-12-21 12:26:29 -08:00
John MacFarlane
42f0b0cdab Fix regression with --number-sections.
Starting with 2.8, `--number-sections` also had the
effect of `--section-divs`, even if `--section-divs` was
not specified.
2019-12-21 09:20:07 -08:00
Jared Lander
e77c218fbc Added glsl mime type for WebGL maps (#6000)
Added glsl mime type for WebGL maps
2019-12-20 22:01:18 -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
b06124e43a
Org reader: report errors properly
Errors during parsing are now returned in full and no longer replaced by
a custom message.
2019-12-19 20:39:29 +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
d0918627ca Improved --toc generation. 2019-12-17 11:59:52 -08:00
John MacFarlane
80728c8b31 PDF: Ensure UTF8 when printing source in --verbose mode.
This may fix #5997.
2019-12-17 11:59:52 -08:00
John MacFarlane
01b89d87f4 Templates: strip directory before trying to find partial in data files.
Closes #5987.
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
11bab77120 HTML reader: Add "nav" to list of block-level tags. 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
John MacFarlane
2af13ef05a Change misleading module comment. 2019-12-12 11:16:40 -08:00
John MacFarlane
817d2048da Improved template API and fixed a bug. Closes #5979.
* Text.Pandoc.Templates [API change]

  + Add Monad wrappers `WithDefaultPartials` and `WithPartials`.
    Wrapping these around an instance of `PandocMonad` gives
    us different instances of `TemplateMonad`, with different
    search behavior in retrieving partials.
    To compile a template and limit partial search to pandoc's
    data files, use `runWithDefaultPartials (compileTemplate ...)`.
    To compile a template and allow partials to be found locally
    (either on the file system or via HTTP, in the event that
    the main template has an absolute URL), ue
    `runWithPartials (compileTemplate ...)`.

  + Export `getTemplate`, which seeks a template locally,
    or via HTTP if the template has an absolute URL, falling
    back to the data files if not found.

  + Export `compileDefaultTemplate` -- does `getDefaultTemplate`
    and compiles the result, raising an error on failure.

* Text.Pandoc.Class [API change]

  + Remove `TemplateMonad` instances for `PandocIO` and `PandocPure`.
    These were too limiting and caused a bug whereby a local
    partial could be used even when the default template was requested.
    We now rely on instances provided in the Templates module.

Text.Pandoc.App.OutputSettings

  + Simplify template retrieval code.
2019-12-11 10:53:24 -08:00
John MacFarlane
a6297d252e More informative JSON parse error.
Closes #5973.
2019-12-09 07:25:37 -08:00
John MacFarlane
0bfe478a69 Use external emojis package.
Moved the emoji-specified code into an external package
we can depend on.
2019-12-08 17:27:18 -08:00
John MacFarlane
8d00331115 Fix --toc-depth regression in 2.8.
Closes #5967.
2019-12-07 15:15:55 -08:00
John MacFarlane
0b54d6282b Fix --toc-depth regression in 2.8.
Closes #5967.
2019-12-07 14:20:41 -08:00
John MacFarlane
d96f1fdc40 Avoid deprecation warning for minimumDef using CPP. 2019-12-05 10:35:16 -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
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
28a2a6e534 Fix regression with behavior of --variable.
Previously -Vfoo=1 -Vfoo=2 would produce a list value for foo;
with 2.8 it produced just '2'.  This commit restores the earlier
beahvior.

Closes #5962.
2019-12-04 17:49:12 -08:00
John MacFarlane
6c435a17cd Move data/emoji.json to emoji.json, add to extra-source-files.
This doesn't really belong in data-files as it's not loaded
dynamically.
2019-12-03 16:38:19 -08:00
John MacFarlane
67f5d65cd5 Add ascii_identifiers as a supported extension for markdown.
This fixes a regression in 2.8.
2019-11-29 11:27:05 -08:00
John MacFarlane
36b4c04ffd Use [|..|] syntax to simplify Emoji.TH. 2019-11-27 21:50:55 -08:00
John MacFarlane
14ed6fa141 Remove redundant import. 2019-11-27 21:32:00 -08:00
John MacFarlane
0d0ec98dd5 Generate Emoji module with TH.
- Add Text.Pandoc.Emoji.TH.
- Replace long literal list in Text.Pandoc.Emoji with one-liner
  generating it from data/emoji.json using TH.
- Add Makefile target to download data/emoji.json.
- Remove tools/emoji.hs.
2019-11-27 21:31:53 -08:00
John MacFarlane
8a42ca41cf LaTeX writer - hlint. 2019-11-27 10:04:00 -08:00
John MacFarlane
982d2f6cd3 HTML writer: hlint improvements. 2019-11-27 09:52:11 -08:00
John MacFarlane
3accc2a5cd Removed useless cpp for old versions of blaze. 2019-11-27 09:45:00 -08:00
John MacFarlane
0f800b9d37 Removed unneeded pragma. 2019-11-27 09:40:24 -08:00
John MacFarlane
b4f434ae0d Add pdf to list of output formats (--list-output-formats).
Closes #5938.
2019-11-26 09:28:05 -08:00
John MacFarlane
421ae44cdf EPUB writer: Fix regression with `--css option.
Closes #5937.
2019-11-25 17:50:27 -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
John MacFarlane
659ee98176 Add unexported Text.Pandoc.Readers.Metadata.
For YAML metadata parsing. A step in the direction of #5914.
No API change.
2019-11-24 11:50: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
Jose Luis Duran
ff8d143836 LaTeX reader: parse \micro siunitx unit command (#5921)
This was somehow missed in 884aef31c5.
2019-11-21 09:22:53 -08:00