Commit graph

5404 commits

Author SHA1 Message Date
Jesse Rosenthal
50b64bcf1c Powerpoint writer: Improve image handling.
We now determine image and caption placement by getting the dimensions
of the content box in a given layout. This allows for images to be
correctly sized and positioned in a different template.

Note that iamges without captions and headers are no longer
full-screened. We can't do this dependably in different layouts,
because we don't know where the header is (it could be to the side of
the content, for example).
2018-01-13 21:42:38 -05:00
John MacFarlane
44222e0373 LaTeX reader: allow macro definitions inside macros.
Previously we went into an infinite loop with

```
\newcommand{\noop}[1]{#1}
\noop{\newcommand{\foo}[1]{#1}}
\foo{hi}
```

See #4253.
2018-01-13 12:11:36 -08:00
Jesse Rosenthal
944ed5e098 Powerpoint writer: read presentation size from reference file.
Our presentation size is now dependent on the reference/template file
we use. This will make it easier to set different output sizes by
supplying different reference files. The alternative (allowing a user
to explicitly set output size regardless of the template) will lead to
too many thorny issues, as explicitly set sizes at the various level
of powerpoint layout would have to be reset.
2018-01-13 14:58:46 -05:00
Jesse Rosenthal
e08776b9d5 Powerpoint writer: code cleanup
Last commit accidentally left commented-out code in.
2018-01-13 09:34:03 -05:00
Jesse Rosenthal
a842d3ae7d Powerpoint writer: Handle (sub)headers above slidelevel correctly.
Above the slidelevel, subheaders will be printed in bold and given a
bit of extra space before them. Note that at the moment, no
distinction is made between levels of headers above the slide header,
though that can be changed. (It has to be changed in pandoc, since
PowerPoint has no concept of paragraph or character classes.)

This allows us to clean up the code as well: the code in
`blockToParagraphs` since it will only touch content blocks, and
therefore will not deal with headers at or below the slidelevel.
2018-01-13 09:08:28 -05:00
Jesse Rosenthal
194f08d17a Powerpoint writer: Check for required files
Since we now import from reference/dist file by glob, we need to make
sure that we're getting the files we need to make a non-corrupt
Powerpoint. This performs that check.

(In the process, this change also cleaned up a lot of commented-out
code left from the switch to the new reference-doc method.)
2018-01-13 07:37:02 -05:00
Jesse Rosenthal
a2870a1aeb Powerpoint writer: Improve templating using --reference-doc
Templating should work much more reliably now. There is still some
problem with image placement when we change sizes. A further commit
will address this.
2018-01-12 22:59:03 -05:00
Albert Krewinkel
8d5422f36b
Lua modules: add function pandoc.utils.run_json_filter
Runs a JSON filter on a Pandoc document.
2018-01-13 00:07:03 +01:00
Albert Krewinkel
5d49cbd35e
Move filter functions to separate module 2018-01-13 00:05:11 +01:00
Albert Krewinkel
6528082401
Lua filters: improve error messages
Provide more context about the task which caused an error.
2018-01-12 21:28:27 +01:00
Jesse Rosenthal
f130109b90 Powerpoint writer: Include Notes slide in TOC 2018-01-12 14:27:53 -05:00
Albert Krewinkel
5b852f8d2a
Lua filters: make PANDOC_READER_OPTIONS available
The options which were used to read the document are made available to
Lua filters via the `PANDOC_READER_OPTIONS` global.
2018-01-12 18:54:19 +01:00
Jesse Rosenthal
624abeec5c Powerpoint writer: allow setting toc-title in metadata.
Accompanying change in MANUAL.txt
2018-01-12 11:09:17 -05:00
Jesse Rosenthal
6d74b35751 Move metaValueToInlines to T.P.W.Shared
This will allow the Powerpoint writer to use it as well.
2018-01-12 11:06:03 -05:00
Jesse Rosenthal
1d9c2770e3 Powerpoint writer: Set notes slide header with slide-level
It used to be hardcoded to 2. This will set it to the appropriate
slide-level.
2018-01-12 10:48:28 -05:00
Jesse Rosenthal
021e5ac89d Powerpoint writer: Add table of contents
This is triggered by the `--toc` flag. Note that in a long slide deck
this risks overrunning the text box. The user can address this by
setting `--toc-depth=1`.
2018-01-12 10:43:02 -05:00
Jesse Rosenthal
4ce07c20d7 Powerpoint writer: Set notes slide number correctly
Previously, this hadn't been aware of a metadata slide. We also
clarify the logic for setting the startnumber of different slide
sections correctly.
2018-01-12 10:00:59 -05:00
Jesse Rosenthal
53c48dd2c9 Powerpoint writer: Ignore internal links without targets.
If the user entered an internal link without a corresponding anchor,
it would produce a corrupted file. Now we check the anchor map, and
make sure the target is in the file. If it isn't, we ignore it.
2018-01-12 09:45:01 -05:00
Jesse Rosenthal
0b66b56523 Powerpoint writer: Clean up adding metadata slide
We want to count the slide numbers correctly if it's in there.
2018-01-12 09:24:15 -05:00
Jesse Rosenthal
2afca42f77 Powerpoint writer: Add anchor links
For anchor-type links (`[foo](#bar)`) we produce an anchor link. In
powerpoint these are links to slides, so we keep track of a map
relating anchors to the slides they occur on.
2018-01-12 06:56:09 -05:00
Jesse Rosenthal
da72d0f412 Powerpoint writer: Make the slide number available to the blocks.
For anchors, block-processing functions need to know what slide number
they're in. We make the envCurSlideId available to blocks.
2018-01-12 06:56:09 -05:00
Jesse Rosenthal
206545c675 Powerpoint writer: move curSlideId to environment.
It really isn't a moving state, and that can be misleading.
2018-01-12 06:56:09 -05:00
John MacFarlane
c5ba3b8ee3 LaTeX reader: fix inconsistent column widths.
This fixes a bug whereby column widths for the body were
different from widths for the header in some tables.

Closes #4238.
2018-01-10 12:28:42 -08:00
John MacFarlane
49007ded7b RST reader: better handling for headers with an anchor.
Instead of creating a div containing the header, we put
the id directly on the header. This way header promotion
will work properly. Closes #4240.
2018-01-10 12:07:33 -08:00
newmana
6b40b8c27c Add header and footer parameters 2018-01-10 13:58:35 +10:00
John MacFarlane
e3f01235e9 HTML writer: Fixed footnote backlinks with --id-prefix.
Closes #4235.
2018-01-09 15:29:27 -08:00
John MacFarlane
ae6ba1533b Use latest skylighting and omit the 'missingincludes' check.
If you use a custom syntax definition that refers to a syntax
you haven't loaded, pandoc will now complain when it is highlighting
the text, rather than at the start.

This saves a huge performance hit from the `missingIncludes` check.

Closes #4226.
2018-01-07 19:24:08 -08:00
Albert Krewinkel
f5dec4bdc1
Lua: make pandoc-types version available as PANDOC_API_VERSION
The current pandoc-types version is made available to Lua programs in
the global PANDOC_API_VERSION. It contains the version as a list of
numbers.
2018-01-07 14:06:34 +01:00
Albert Krewinkel
043740d32b
Lua: make pandoc version available as PANDOC_VERSION
The current pandoc version is made available to Lua programs in the
global PANDOC_VERSION.  It contains the version as a list of numbers.
2018-01-07 13:43:03 +01:00
John MacFarlane
3a22907306 Don't use missingIncludes unless custom syntax defs have been given.
This avoids a huge performance sink that comes from evaluating
all the elements of the default syntax map.

Better just to have run-time errors for missing includes?

See #4226.
2018-01-06 00:33:34 -08:00
Albert Krewinkel
0d935bd081
Update copyright notices to include 2018 2018-01-05 20:39:12 +01:00
Albert Krewinkel
4f564b9203
data/pandoc.lua: fix attribute names of Citation
The fields were named like the Haskell fields, not like the documented,
shorter version.  The names are changed to match the documentation and
Citations are given a shared metatable to enable simple extensibility.

Fixes: #4222
2018-01-05 08:20:59 +01:00
Albert Krewinkel
856bc54526
Use hslua utils where possible
Some helper functions and types have been moved to hslua.

Change: minor
2018-01-04 23:15:28 +01:00
Jesse Rosenthal
7c8a6feaf2 Powerpoint writer: remove some code duplication. 2018-01-04 09:46:34 -05:00
Jesse Rosenthal
85f8d92850 Powerpoint writer: Ignore Notes div
For now, ignore notes div for parity with other slide outputs.
2018-01-03 22:07:07 -05:00
Jesse Rosenthal
bf15258d3b Powerpoint writer: Set default slidelevel correctly.
We had previously defaulted to slideLevel 2. Now we use the correct
behavior of defaulting to the highest level header followed by
content. We change an expected test result to match this behavior.
2018-01-03 21:58:39 -05:00
Jesse Rosenthal
41dc65b37f Powerpoint writer: Split blocks correctly for linked images
We treat links with an image as the first inline as an image with a
link picProp -- so we have to split on it the same as if it were an
image.
2018-01-03 20:52:48 -05:00
Jesse Rosenthal
101aece6cc Powerpoint writer: combine adjacent runs.
This will make the xml easier to read for debugging purposes. It
should also make links behave more consistently across numerous words.
2018-01-03 17:54:43 -05:00
Jesse Rosenthal
02d85469ab Powerpoint writer: Fix new replaceNamedChildren
Previous version replaced *each* element from the template with the
new elements -- leading to multiple overlapping frames. This only
replaces the first instance, and throws out the rest.
2018-01-03 16:55:33 -05:00
Jesse Rosenthal
6aae439980 PowerPoint writer: make inline code inherit code size.
Previously (a) the code size wasn't set when we force size, and (b)
the properties was set from the default, instead of inheriting. Both
of those problems were fixed.
2018-01-03 15:33:18 -05:00
Jesse Rosenthal
13990c0501 Powerpoint writer: simplify replaceNamedChildren function
A lot of work in the powerpoint writer is replacing XML from within
slidelayouts from templates. This function does a good deal of that
work, and this makes it preserve element order, as well as making it a
bit easier to understand.
2018-01-03 14:29:09 -05:00
Jesse Rosenthal
1ce736c2df Powerpoint writer: code cleanup
Remove commented-out functions and imports.
2018-01-03 13:36:12 -05:00
Jesse Rosenthal
143ec05bd9 Powerpoint writer: Allow linked images.
The following markdown:

    [![Image Title](image.jpg)](http://www.example.com)

will now produce a linked image in the resulting PowerPoint file.
2018-01-03 13:00:52 -05:00
Jesse Rosenthal
cd00225219 PowerPoint writer: Fix error with empty table cell.
We require an empty "<a:p>" tag, even if the cell contains no
paragraphs -- otherwise PowerPoint complains of corruption.
2018-01-03 11:56:41 -05:00
Jesse Rosenthal
2f5cca85fa Powerpoint writer: Fix compiler error (again)
The record syntax in a pattern match seems to be confusing the 8.X
compilers. Stop using it.
2018-01-03 11:17:24 -05:00
Jesse Rosenthal
576ed3f416 Powerpoint writer: Appease compiler 2018-01-03 11:00:49 -05:00
Jesse Rosenthal
dcc6e6b777 Powerpoint writer: Implement two-column slides.
This uses the columns/column div format described in the pandoc
manual. At the moment, only two columns (half the screen each) are
allowed. Custom widths are not supported.
2018-01-03 10:18:43 -05:00
John MacFarlane
7c7f3a89d1
Merge pull request #4219 from stalmon/master
fixes for docx writer
2018-01-02 11:34:30 -07:00
Jesse Rosenthal
a55a1e3a57 Docx reader: remove MultiWayIf
Different formatting rules across 7.X and 8.X. Use empty case
expression instead.
2018-01-02 11:45:22 -05:00
Jesse Rosenthal
2e90e2932c Docx reader: Allow for insertion/deletion of paragraphs.
If the paragraph has a deleted or inserted paragraph break (depending
on the track-changes setting) we hold onto it until the next
paragraph. This takes care of accept and reject. For this we introduce
a new state which holds the ils from the previous para if necessary.

For `--track-changes=all`, we add an empty span with class
`paragraph-insertion`/`paragraph-deletion` at the end of the paragraph
prior to the break to be inserted or deleted.

Closes #3927.
2018-01-02 11:31:20 -05:00