Commit graph

6355 commits

Author SHA1 Message Date
Jesse Rosenthal
da802c1a2e PowerPoint writer: Make default placeholder type for template lookup
This is the first step toward making templating work better. It seems
that content shapes have a default ph type. In other words, shapes
with *NO PH TYPE* should be considered to have an "obj" ph type, and
used as content shapes.

see https://github.com/scanny/python-pptx/blob/master/docs/dev/analysis/placeholders/slide-placeholders/placeholders-in-new-slide.rst
2019-04-01 14:45:56 -04:00
Mauro Bieg
0fa6951dc1 Dokuwiki Reader fix: parse single curly brace (#5417)
fixes #5416
2019-04-01 11:36:47 -06:00
Jesse Rosenthal
f72a67efdd Pptx writer: Apply speaker snotes to metadata slide if applicable.
If the slide deck has a metadata slide (with author, title, etc) and
has speaker notes before any body content, the speaker notes will be
applied to the metadata slide. If there is no metadata slide, pandoc
will behave as before.
2019-03-31 17:09:00 -04:00
Jesse Rosenthal
dda5f0a572 Pptx writer: Correctly handle notes after section-title header
Previously, if notes came after a section-title header (ie, a level-1
header in a slide-level=2 presentation), they would go on the next
slide. This keeps them on the slide with the header.
2019-03-30 22:44:55 -04:00
John MacFarlane
79c82a2550 ipynb reader/writer: use format 'ipynb' for raw cell where no format given.
According to nbformat docs, this is supposed to render in every
format.  We don't do that, but we at least preserve it as a raw
block in markdown, so you can round-trip.
2019-03-30 09:57:43 -07:00
John MacFarlane
acab2087bb ipynb writer - consolidate adjacent raw blocks.
Sometimes pandoc creates two HTML blocks, e.g. one for
the open tag and one for a close tag.  If these aren't
consolidated, only one will show up in output cell.
2019-03-29 21:08:00 -07:00
John MacFarlane
93ee73e1dc LaTeX writer: Avoid inadvertently creating ? or ! ligatures.
These are upside down ? and !, resp.

Closes #5407.
2019-03-29 10:04:22 -07:00
John MacFarlane
1595860059 HTML writer: Don't add data- prefix to RDFa attributes.
Closes #5403.
2019-03-28 21:01:24 -07:00
John MacFarlane
40865958ce Markdown reader: fenced div takes priority over setext header.
For

    ::: {.cell}
    ---
    :::
2019-03-28 17:39:22 -07:00
John MacFarlane
261ad9fb3d Ipynb reader: use html for a raw cell with no format.
The nbformat spec says that when no format is specified,
the raw cell will be rendered in every markup format.
Pandoc doesn't have a construct that works this way,
so we just fall back to `html`.
2019-03-28 17:18:11 -07:00
John MacFarlane
83ea529cf3 Ipynb writer: fixed carry-over of nbformat from metadata.
Previously we wrongly assumed it would be in a MetaString.
It's an a MetaInlines.
2019-03-28 17:12:44 -07:00
John MacFarlane
2b0a0bba9c Shared - improve metaToJSON with numbers.
We now do a better job marshalling numbers from MetaString
OR MetaInlines into JSON Number.
2019-03-28 17:01:32 -07:00
John MacFarlane
4c9a68e83f Markdown writer: better rendering of numbers.
If the number is integral, we render it as an integral
not a float.

Closes #5398.
2019-03-28 16:20:39 -07:00
John MacFarlane
ba613b2e9e Markdown writer: proper rendering of empty map in YAML metadata.
Should be `{}` not empty string.

Partially addresses #5398.
2019-03-28 14:10:00 -07:00
John MacFarlane
7fa5fbed9e Use strict instead of lazy sum.
sum is lazy; replace with `foldl' (+) 0` to avoid stack
overflow in Text.Pandoc.Pretty with very long strings.

Closes #5401.
2019-03-28 13:51:15 -07:00
John MacFarlane
612e6555a9 ipynb writer: preserve nbformat_minor if it's given.
This helps with round-tripping.
2019-03-27 18:04:20 -07:00
John MacFarlane
6157f7ec4f Writers.Shared.metaValueToJSON: use Number Values for integers.
Pandoc's MetaValue doesn't have a distinguished number type,
so numbers are put in MetaStrings.  If the MetaString consists
entirely of digits, we convert it to a Number.

We should probably consider adding a MetaNumber constructor
to MetaValue, for better round-tripping with JSON etc.

This change aids round-tripping in ipynb metadata fields,
like `toc_depth`.
2019-03-27 17:11:14 -07:00
John MacFarlane
2138ef8239 ipynb reader: avoid introducing spurious .0 on integers in metadata. 2019-03-27 16:52:17 -07:00
John MacFarlane
3ecc8d154b Drop support for ghc < 8. 2019-03-27 11:38:24 -07:00
John MacFarlane
542272a52a JATS writer: Ensure that plain strings go inside <pub-id> tag.
See #5397.
2019-03-26 21:43:59 -07:00
John MacFarlane
052684712b HTML reader: read data-foo attribute into foo.
The HTML writer adds the `data-` prefix for HTML5
for nonstandard attributes.  But the attributes are
represented in the AST without the `data-` prefix,
so we should strip this when reading HTML.

Closes #5392.
2019-03-25 08:43:59 -07:00
John MacFarlane
1e60776226 LaTeX writer: Fix footnotes in table caption and cells.
This fixes a bug wherein footnotes appeared in the wrong
order, and with duplicate numbers, when in table captions
and cells.

We now use regular `\footnote` commands, even in the table
caption and the minipages containing cells. Apparently
longtable knows how to handle this.

Closes #5367.
2019-03-22 11:55:41 -07:00
John MacFarlane
97acf152e0 fetchItem: don't treat UNC paths as protocol-relative URLs.
These are paths beginning `//?/UNC/...`.  Closes #5127.
2019-03-22 11:22:21 -07:00
richarddavis
567a43ace3 Improve pdfSize in ImageSize by ignoring all whitespace in /MediaBox command (#5383)
This fix ignores all whitespace in the PDF /MediaBox line so that a wider range of PDF sizes can be read. This improves fix to #4322.
2019-03-21 10:43:56 -06:00
John MacFarlane
66e5f0ff8d Docx writer: Use w:br without attributes for line breaks.
We previously added the attribute `type="textWrapping"`, but
this causes problems on Word Online.

Closes #5377.
2019-03-21 09:28:16 -07:00
John MacFarlane
957314143f Improve pdfSize in ImageSize.
Improves fix to #4322.
2019-03-20 12:25:09 -07:00
John MacFarlane
6be8f4e953 Improved fix to #5340 and added test. 2019-03-18 16:53:36 -07:00
John MacFarlane
c57649956d Improve autolink detection in LaTeX reader.
This determines whether `\url` or `\href` is used.
Closes #5340.
2019-03-18 16:41:06 -07:00
John MacFarlane
3880a23de9 Properly escape attributes in Markdown writer.
Closes #5369.
2019-03-17 18:15:47 -07:00
John MacFarlane
8632526fc2 Markdown writer: be sure implicit figures work in list contexts.
Previously they would sometimes not work: e.g., when they
occured in final paragraphs in lists that were originally
parsed as Plain and converted later using PlainToPara.

Closes #5368.
2019-03-14 21:43:25 -07:00
John MacFarlane
b7cbd7b8c9 docx writer: avoid extra copy of abstractNum and num elements...
...in numbering.xml.  This caused pandoc-produced docx files to
be uneditable using Word Online.

The problem was that recent versions of reference.docx include
samples of various kinds of text, including lists.  The
numering elements for these were getting copied over to
the new docx, where they clashed with the autogenerated
elements produced by pandoc.  This didn't confuse Desktop
Word, but it did confuse Word Online.

Closes #5358.
2019-03-11 22:09:21 -07:00
Paul Tilley
f7ebd5107d LaTeX reader: support \underline, \ul, \uline (#5359)
These are parsed as a Span with class `underline`, as with other readers.
2019-03-10 13:31:25 -06:00
John MacFarlane
73c5b50042 ipynb reader: removed vestigial ReaderOptions param. 2019-03-10 12:29:28 -07:00
John MacFarlane
2476d5f284 ipynb reader: remove sensitivity to raw_html, raw_tex extensions.
We now include every output format. Pruning is handled by
`--ipynb-output=`.
2019-03-09 16:52:15 -08:00
John MacFarlane
00ec47b3f9 Markdown writer: improve handling of raw blocks/inline.
We now emit raw content using `raw_attribute` when no more
direct method is available.
2019-03-09 16:31:39 -08:00
John MacFarlane
873f342f11 Ipynb reader/writer: better handling of cell metadata.
We now handle even complex cell metadata in the Div's attributes.
Simple metadata fields are rendered as a plain string, and complex ones
as JSON.
2019-03-09 14:27:34 -08:00
John MacFarlane
bf4a164a6f Allow -o/--output to be used with --print-*.
`--print-default-data-file`
`--print-highlighting-style`
`--print-default-template`

Note that `-o` must occur BEFORE the `--print*` command on the command line
(this is documented).

Closes #5357.
2019-03-08 08:44:45 -08:00
John MacFarlane
536161df2d Add inNote to Footcite and Footcites 2019-03-07 16:17:33 -08:00
Cormac Relf
d638873433 Add tectonic as an option for --pdf-engine. (#5346)
Closes #5345

Runs tectonic on STDIN instead of a temporary .tex file, so that it
looks in the working directory for `\include` and `\input` like the rest
of the engines.

Allows overriding the output directory without messing up the args
with `--pdf-engine-opt=--outdir --pdf-engine-opt="$DIR"`.
2019-03-07 10:16:40 -07:00
John MacFarlane
449910bf40 filterIpynbOutput - go back to just including one block per format.
In the end we need a 1-1 map of mime types to output blocks.
2019-03-06 11:17:51 -08:00
John MacFarlane
d68b300dca Fixed mistake in filterIpynbOutput (prefer lower, not higher rank!) 2019-03-06 10:49:59 -08:00
John MacFarlane
5863e5c75d Improve filterIpynbOutput.
- Ensure that images are prioritized over text.
- Allow multiple RawBlocks for same format.
2019-03-06 10:36:03 -08:00
John MacFarlane
1c4c384a62 ipynb writer: recurse into native divs for output cell data.
See #5354.
2019-03-06 10:09:34 -08:00
John MacFarlane
707eef34b7 Shared.filterIpynbOutput: 'best' should include everything for ipynb. 2019-03-06 10:00:18 -08:00
Andrew Dunning
186b50e263 LaTeX writer: Add classes for frontmatter support (#5353)
Remove frontmatter from scrreprt
The KOMA-Script `scrreprt` class follows the pattern of `report`, and does not support `\frontmatter`.
Use frontmatter for more classes
2019-03-04 18:47:42 -07:00
John MacFarlane
ebdcf75276 LaTeX writer/template: better handling of front/main/backmatter.
In pandoc 2.7 we assumed that every class with chapters would
accept `\frontmatter`, `\mainmatter`, and `\backmatter`.
This is not so (e.g. report does not).  So pandoc 2.7
breaks on report class by including an unsupported command.

So we replace the book-class variable in the template with
two variables, has-chapters and has-frontmatter, and set
these intelligently in the writer.

Closes #5348.
2019-03-04 11:29:41 -08:00
John MacFarlane
b083a3c384 JATS reader: Support fig-group block element (#5317). 2019-03-02 16:52:19 -08:00
John MacFarlane
4ef0e13c47 Shared: remove withTempDir. 2019-03-02 15:12:33 -08:00
John MacFarlane
0bed0ab5a3 Use XDG data directory for user data directory.
Instead of `$HOME/.pandoc`, the default user data directory is
now `$XDG_DATA_HOME/pandoc`, where `XDG_DATA_HOME` defaults to
`$HOME/.local/share` but can be overridden by setting the environment
variable.

If this directory is missing, then `$HOME/.pandoc` is searched
instead, for backwards compatibility.  However, we recommend
moving local pandoc data files from `$HOME/.pandoc` to
`$HOME/.local/share/pandoc`.

On Windows the default user data directory remains the same.

Closes #3582.
2019-03-02 15:03:59 -08:00
John MacFarlane
a99423b59c Add new exported function defaultUserDataDirs 2019-03-02 15:03:51 -08:00