Commit graph

5060 commits

Author SHA1 Message Date
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
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
Alexander Krotov
debc6d13aa Muse reader: automatically translate #cover into #cover-image
Amusewiki uses #cover directive to specify cover image.
2017-12-31 00:30:26 +03:00
Alexander Krotov
bbfb6f0c3c Muse writer: don't escape URIs from AST 2017-12-30 20:32:16 +03:00
Jesse Rosenthal
4fc3f51186 Docx reader: Read multiple children of w:sdtContents`
Previously we had only read the first child of an sdtContents tag. Now
we replace sdt with all children of the sdtContents tag.

This changes the expected test result of our nested_anchors test,
since now we read docx's generated TOCs.
2017-12-30 08:21:42 -05:00
Albert Krewinkel
f42839ee2c
Lua filters: stop exporting pushPandocModule
The function `pushPandocModule` was exported by Text.Pandoc.Lua to
enable simpler testing. The introduction of `runPandocLua` renders
direct use of this function obsolete. (API change)
2017-12-29 10:11:45 +01:00
Albert Krewinkel
9be2c7624c
data/pandoc.lua: drop function pandoc.global_filter
The function `global_filter` was used internally to get the implicitly
defined global filter. It was of little value to end-users, but caused
unnecessary code duplication in pandoc. The function has hence been
dropped. Internally, the global filter is now received by interpreting
the global table as lua filter.

This is a Lua API change.
2017-12-29 10:04:55 +01:00
John MacFarlane
ac8e72a95d
Merge pull request #4170 from oltolm/opendocument
improve formatting of formulas in OpenDocument
2017-12-28 22:30:25 -07:00
John MacFarlane
da64e5baa4 Class: make FileTree opaque.
This forces uses to interact with it using
`insertInFileTree` and `getFileInfo`, which normalize
file names.
2017-12-28 16:39:52 -08:00
John MacFarlane
8b575dbf84 Filter changes.
* Previously we ran all lua filters before JSON filters.
* Now we run filters in the order they are presented on the
  command line, whether lua or JSON.
* The type of `applyFilters` has changed (incompatible API change).
* `applyLuaFilters` has been removed (incompatible API change).
* Bump version to 2.1.

See #4196.
2017-12-28 16:39:52 -08:00
oltolm
19bab48dcc improve formatting of formulas in OpenDocument 2017-12-28 22:10:04 +01:00
John MacFarlane
98fd9a978a Alphabetical order Extension constructors.
This makes them appear in order in `--list-extensions`.
2017-12-28 12:23:46 -08:00
John MacFarlane
e10864d9d5 Changed format of --list-extensions.
Now the + or - occurs first.
2017-12-28 12:12:22 -08:00
John MacFarlane
3494b6efd3 Powerpoint writer tests: use IO.
Otherwise we can't find the data files when compiled
with -embed_data_files.
2017-12-28 12:06:38 -08:00
John MacFarlane
d5770b7496 Moved makeCanoncial definition out of ifdef!
Also added slide2 to the default pptx, and reordered
the data files in pandoc.cabal.
2017-12-28 11:03:53 -08:00
John MacFarlane
60ace79b03 Class: use makeCanonical for normalization in FileTree and data files. 2017-12-28 10:47:09 -08:00
John MacFarlane
ddd6a89247 Text.Pandoc.Class: add insertInFileTree (API change).
This gives a pure way to insert an ersatz file into a FileTree.

In addition, we normalize paths both on insertion and on
lookup, so that "foo" and "./foo" will be judged equivalent.
2017-12-28 10:23:09 -08:00
John MacFarlane
90296d7e96 LaTeX writer: Use \endhead after \toprule in headerless tables.
Closes #4207.
2017-12-28 08:53:54 -08:00
John MacFarlane
3c93ac5cf0 LaTeX reader: be more tolerant of & character.
This allows us to parse unknown tabular environments
as raw LaTeX.  Closes #4208.
2017-12-28 08:41:53 -08:00
Albert Krewinkel
e5c8b65004
Org reader: support minlevel option for includes
The level of headers in included files can be shifted to a higher level
by specifying a minimum header level via the `:minlevel` parameter. E.g.
`#+include: "tour.org" :minlevel 1` will shift the headers in tour.org
such that the topmost headers become level 1 headers.

Fixes: #4154
2017-12-28 14:16:04 +01:00
Alexander Krotov
0fd7ed0cab FB2 writer: add cover image specified by "cover-image" meta
Fixes #4195
2017-12-28 16:03:18 +03:00
Jesse Rosenthal
52a4cf6699 PowerPoint writer: Obey slide level option 2017-12-28 07:47:07 -05:00
John MacFarlane
ba6c193457 Fix warning. 2017-12-27 13:38:44 -08:00
John MacFarlane
f688086979 Small improvement to figcaption parsing. #4184. 2017-12-27 12:38:04 -08:00
John MacFarlane
acfa846aab
Merge pull request #4184 from mb21/html-reader-figcaption
HTML Reader: be more forgiving about figcaption
2017-12-27 13:33:00 -07:00
John MacFarlane
a888083ee1 HTML reader: parse div with class line-block as LineBlock.
See #4162.
2017-12-27 12:26:15 -08:00
John MacFarlane
cc9e3a9172 Allow --list-extensions to take an optional FORMAT argument.
This lists the extensions set by default for the selected
FORMAT.
2017-12-27 12:25:48 -08:00
John MacFarlane
8a35b44aaf Allow lenient decoding of *latex error logs.
These sometimes aren't properly UTF8 encoded, and it's
confusing if we get an encoding error due to the error
log.

Closes #4200.
2017-12-27 11:37:35 -08:00
Albert Krewinkel
2953983e9e
Fix regression of DefinitionLists in custom writer
Pairs where serialized as two-element lists instead, and are now pushed
again as a table with a single key/value pair.

Fixes: #4202
2017-12-27 18:48:52 +01:00
Jesse Rosenthal
dc3ee500a0 Docx Reader: preprocess Document body to unwrap "w:sdt" elements
We walk through the document (using the zipper in
Text.XML.Light.Cursor) to unwrap the sdt tags before doing the rest of
the parsing of the document. Note that the function is generically
named `walkDocument` in case we need to do any further preprocessing
in the future.

Closes #4190
2017-12-27 10:03:00 -05:00
Albert Krewinkel
7e8cfc0990
Fix custom writer regression
An additional `Lua.call` was left in during refactoring, which caused an
exception "attempt to call a nil value".

Fixes: #4202
2017-12-27 09:16:33 +01:00
John MacFarlane
b52cbb71c2 LaTeX writer: Allow fragile=singleslide attribute in beamer slides.
Closes #4169.
2017-12-26 11:17:32 -08:00
John MacFarlane
b5ae537321 Add opus to MIME type table as audio/ogg.
See #4198.
2017-12-26 11:03:03 -08:00
John MacFarlane
9e1d86638c LaTeX reader: support \foreignlanguage from babel. 2017-12-26 10:57:57 -08:00
John MacFarlane
718b2c5837 HTML writer: Use br elements in line blocks...
instead of relying on CSS.  Closes #4162.  HTML-based templates have had
the custom CSS for div.line-block removed.  Those maintaining custom
templates will want to remove this too.

We still enclose line blocks in a div with class line-block.
2017-12-26 08:40:33 -08:00
John MacFarlane
ee5fe9bf2c RST reader: allow empty list items (as docutils does).
Closes #4193.
2017-12-24 13:02:18 -08:00
John MacFarlane
c7e5543c29 JATS reader: handle author-notes. 2017-12-23 22:28:43 -08:00
John MacFarlane
4612a9a8c1 JATS reader: code refactoring. 2017-12-23 21:54:06 -08:00
John MacFarlane
0d1546328e Plain writer: don't linkify table of contents. 2017-12-23 21:30:10 -08:00
John MacFarlane
dd3ec34a34 Fixed bug: when target is PDF, writer extensions were being ignored.
E.g. `-t latex-smart -o file.pdf` would produce a different
latex intermediate than `-t latex-smart -o file.tex`.

Thanks to Bernhard Fisseni for pointing this out.

This is a regression since pandoc 2.0 (introduced in commit
c7e3c1ec).
2017-12-23 21:10:33 -08:00
Albert Krewinkel
59a4745457
Lua modules: add function pandoc.utils.hierarchicalize
Convert list of Pandoc blocks into (hierarchical) list of Elements.
2017-12-23 23:29:24 +01:00
John MacFarlane
790dc2546b JATS reader: include institute metadata. 2017-12-23 10:20:13 -08:00
John MacFarlane
6b63b63f30 JATS reader: process author metadata. 2017-12-23 10:03:13 -08:00
Albert Krewinkel
2c66a42ab8
Lua modules: add function pandoc.utils.normalize_date
The function parses a date and converts it (if possible) to "YYYY-MM-DD"
format.
2017-12-23 13:43:22 +01:00
Albert Krewinkel
35f0567a8f
Lua modules: add function pandoc.utils.to_roman_numeral
The function allows conversion of numbers below 4000 into roman
numerals.
2017-12-23 13:42:35 +01:00
John MacFarlane
dd39959453 JATS reader: better citation handling.
We now convert a ref-list element into a list of
citations in metadata, suitable for use with pandoc-citeproc.

We also convert references to pandoc citation elements.

Thus a JATS article with embedded bibliographic information
can be processed with pandoc and pandoc-citeproc to produce
a formatted bibliography.
2017-12-23 00:46:48 -08:00
mb21
9b54b94612 HTML Reader: be more forgiving about figcaption
fixes #4183
2017-12-23 09:42:04 +01:00
John MacFarlane
e3c1449ae6
Merge pull request #4189 from mb21/export-blocksToInlines
API change: export blocksToInlines' from Text.Pandoc.Shared
2017-12-22 19:05:29 -07:00
John MacFarlane
28b736bf95 latex_macros extension changes.
Don't pass through macro definitions themselves when `latex_macros`
is set.  The macros have already been applied.

If `latex_macros` is enabled, then `rawLaTeXBlock` in
Text.Pandoc.Readers.LaTeX will succeed in parsing a macro definition,
and will update pandoc's internal macro map accordingly, but the
empty string will be returned.

Together with earlier changes, this closes #4179.
2017-12-22 18:03:51 -08:00