Commit Graph
10211 Commits
Author SHA1 Message Date
Albert Krewinkel b70079fbfa data/pandoc.lua: split type and behavior tables
Clearly distinguish between a type and the behavioral properties of an instance
of that type. The behavior of a type (and all its subtypes) can now be amended
by adding methods to that types `behavior` object, without exposing the type
objects internals.

E.g.:

    pandoc.Inline.behavior.frob = function () print'42' end
    local str = pandoc.Str'hello'
    str.frob() -- outputs '42'
2018-01-06 23:25:08 +01:00
Albert Krewinkel a2e327f0db data/pandoc.lua: rename Element to AstElement
This avoids confusion with the Element type from Text.Pandoc.Shared.

Change: minor
2018-01-06 23:25:08 +01:00
Albert Krewinkel 5942da4ff7 data/pandoc.lua: remove dead code
A `Element:new` method was a left-over was never called.

Change: minor
2018-01-06 23:25:08 +01:00
Albert Krewinkel f492f5a6dd data/pandoc.lua: fix Element inheritance
Extending all elements of a given type (e.g., all inline elements) was
difficult, as the table used to lookup unknown methods would be reset
every time a new element of that type was created, preventing recursive
property lookup. This is was changed in that all methods and attributes
of supertypes are now available to their subtypes.
2018-01-06 23:25:08 +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
Albert Krewinkel bdb911550c Bump hslua version to 0.9.5
This version fixes a bug that made it difficult to handle failures while
getting lists or a Map from Lua. A bug in pandoc, which made it
necessary to always pass a tag when using MetaList or MetaBlock, is
fixed as a result. Using the pandoc module's constructor functions for
these values is now optional (if still recommended).
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
John MacFarlane 5af89c5e86 Use latest pandoc-citeproc. 2018-01-03 09:48:37 -08: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 ff6fd1a9b0 Use latest pandoc-citeproc. 2018-01-02 22:48:19 -08:00
John MacFarlane 11834216ef Use latest pandoc-citeproc. 2018-01-02 11:49:58 -08: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 06a672dd4f MANUAL.txt: add information about paragraph insertion/deletion 2018-01-02 11:56:53 -05:00
Jesse Rosenthal 10238f059b Revert "MANUAL.txt: add information about paragraph insertion/deletion."
This reverts commit 09e132726d.
2018-01-02 11:52:03 -05: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 09e132726d MANUAL.txt: add information about paragraph insertion/deletion. 2018-01-02 11:32:48 -05:00
Jesse Rosenthal a5b71a3c7f Docx reader: Add tests for paragraph insertion/deletion. 2018-01-02 11:32:48 -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
Jesse Rosenthal 2746f73093 Docx reader: Parse track changes info into paragraph props.
This will tell us whether a paragraph break was inserted or
deleted. We add a generalized track-changes parsing function, and use
it in `elemToParPart` as well.
2018-01-02 10:47:33 -05:00
Jesse Rosenthal f6fde0ae5e Docx reader: Extract tracked changes type from parpart.
We're going to want to use it elsewhere as well, in upcoming tracking
of paragraph insertion/deletion.
2018-01-02 07:50:08 -05:00
Sebastian Talmon 053a1dcd10 firstRow table definition compatibility for Word 2016
Word 2016 seems to use a default value of "1" for table headers, if there is no firstRow definition (although a default value of 0 is documented), so all tables get the first Row formatted as header.
Setting the parameter to 0 if the table has no header row fixes this for Word 2016
2018-01-02 09:43:04 +01:00
John MacFarlane b9d73428c7 Docx writer: Fix custom styles with spaces in the name.
Custom styles with spaces worked for divs but not for spans.
This commit fixes the problem.  Closes #3290.
2018-01-01 21:44:06 -08:00
John MacFarlane 509e88374b Revert "Travis: try running tests single-threaded."
This reverts commit 84a4d3685c.
2018-01-01 21:17:19 -08:00
John MacFarlane 84a4d3685c Travis: try running tests single-threaded.
This should ensure continuous output, so we don't have 10m blank
spots which cause travis to kill.
2018-01-01 20:22:03 -08:00
John MacFarlane 5733183b3d Markdown reader: rewrite inlinesInBalancedBrackets.
The rewrite is much more direct, avoiding parseFromString.
And it performs significantly better; unfortunately, parsing
time still increases exponentially.

See #1735.
2018-01-01 16:42:19 -08:00
stalmon 4f43a1d250 Removed redundant subtitle in title
subtitle is allready used to create a subtitle for the document
appending the subtitle to the main title leads to double subtitle in the document
2018-01-02 01:14:36 +01:00
John MacFarlane ecc46e229f Lua.Module.Utils: make stringify work on MetaValues.
I'm sure this was intended in the first place, but currently
only Meta is supported.
2018-01-01 14:11:49 -08:00
Jesse Rosenthal e6b04fa0cf Docx reader: minor cleanup. 2017-12-31 10:18:03 -05:00
Jesse Rosenthal 3f30455b49 Docx reader: tests for overlapping targets (anchor spans). 2017-12-31 09:36:42 -05:00
Jesse Rosenthal 836153de43 Docx Reader: Combine adjacent anchors.
There isn't any reason to have numberous anchors in the same place,
since we can't maintain docx's non-nesting overlapping. So we reduce
to a single anchor, and have all links pointing to one of the
overlapping anchors point to that one. This changes the behavior from
commit e90c714c7 slightly (use the first anchor instead of the last)
so we change the expected test result.

Note that because this produces a state that has to be set after every
invocation of `parPartToInlines`, we make the main function into a
primed subfunction `parPartToInlines'`, and make `parPartToInlines` a
wrapper around that.
2017-12-31 09:29:51 -05:00
John MacFarlane a274e15f0d Markdown reader: Avoid parsing raw tex unless \ + letter seen.
This seems to help with the performance problem, #4216.
2017-12-30 23:33:03 -08:00
John MacFarlane d6d4388f6f LaTeX reader: Simplified a check for raw tex command. 2017-12-30 22:43:46 -08:00
Jesse Rosenthal 475b0dcb66 Docx reader: tests for removing unused anchors. 2017-12-30 22:43:33 -05:00
Jesse Rosenthal e90c714c73 Docx reader: Remove unused anchors.
Docx produces a lot of anchors with nothing pointing to them -- we now
remove these to produce cleaner output. Note that this has to occur at
the end of the process because it has to follow link/anchor rewriting.

Closes #3679.
2017-12-30 22:17:06 -05:00
John MacFarlane e0cf8e64b5 Improve benchmarks.
Previously we weren't setting the default extensions
properly, so e.g. 'markdown' wasn't being tested with
pandoc markdown extensions.
2017-12-30 14:26:13 -08:00