Commit graph

5232 commits

Author SHA1 Message Date
John MacFarlane
9daf22fa61 LaTeX reader: Refactored inlineCommand. 2017-12-22 18:03:51 -08:00
Albert Krewinkel
23edb958db
Lua modules: add stringify function to pandoc.utils
The new function `pandoc.utils.stringify` converts any AST element to a
string with formatting removed.
2017-12-22 20:09:37 +01:00
Albert Krewinkel
9ddf84072b
Lua.Util: avoid altering the stack if peeking fails
The stack now remains unaltered if `getRawInt` or `getTable` fail.  This
is important when those functions are used in an operation that is part
of an Alternative.

Change: minor
2017-12-22 20:08:45 +01:00
John MacFarlane
9758720a24 RST writer: fix anchors for headers.
We were missing an `_`.
See #4188.
2017-12-22 10:36:37 -08:00
Jesse Rosenthal
279c254007 PowerPoint writer: Treat lists inside BlockQuotes as lists
We don't yet produce incremental lists in PowerPoint, but we should at
least treat lists inside BlockQuotes as lists, for compatibility with
other slide formats.
2017-12-22 05:32:23 -05:00
John MacFarlane
af04881655
Merge pull request #4177 from stencila/jats-xml-reader
Add Basic JATS reader based on DocBook reader
2017-12-21 23:16:03 -07:00
John MacFarlane
32f9dbbae5 Merge branch 'master' of github.com:jgm/pandoc 2017-12-21 21:45:35 -08:00
John MacFarlane
239cfb7f00 Docx writer: ensure that distArchive is the one that comes with pandoc.
Previously a `reference.docx` in `~/.pandoc` (or the user data dir)
would be used instead, and this could cause problems because a
user-modified docx sometimes lacks vital sections that we count
on the `distArchive` to supply.

Closes #4182.
2017-12-21 21:44:13 -08:00
Hamish Mackenzie
a5d7be075d JATS writer: Make <p> optional in <td> and <th> (#4178)
If the contents are single `Plain` block then do not wrap them with
a <p> element.
2017-12-21 22:30:22 -07:00
Hamish Mackenzie
de8c47eae8 jats writer: Self closing tags for empty xref (#4187) 2017-12-21 22:29:03 -07:00
Hamish Mackenzie
d853571397 Improve support for code language in JATS 2017-12-22 15:24:54 +13:00
Jesse Rosenthal
3c10951023 Change notes to a smaller size.
This will allow more to fit on a single slide, and will probably look better.
2017-12-21 17:01:11 -05:00
Jesse Rosenthal
5b2c38a07d PowerPoint writer: Add ability to force size.
This replaces the more specific blockQuote runProp, which only
affected the size of blockquotes. We can use this for notes, etc.
2017-12-21 17:00:59 -05:00
Albert Krewinkel
bd3ea72371
Lua modules: added pandoc.utils module
A new module `pandoc.utils` has been created. It holds utility functions
like `sha1`, which was moved from the main `pandoc` module.
2017-12-21 22:42:59 +01:00
Albert Krewinkel
5ad719c1fb
Lua modules: make a Haskell module for each Lua module
Definitions for the `pandoc.mediabag` modules are moved to a separate
Haskell module.

Change: minor
2017-12-21 22:42:59 +01:00
Albert Krewinkel
ab3c506584
Lua modules: move to dedicated submodule
The Haskell module defining the Lua `pandoc` module is moved to
Text.Pandoc.Lua.Module.Pandoc.

Change: minor
2017-12-21 22:42:59 +01:00
John MacFarlane
685e90cd4f LaTeX reader: Fixed subtle bug in tokenizer.
Material following `^^` was dropped if it wasn't a character
escape.  This only affected invalid LaTeX, so we didn't see it
in the wild, but it appeared in a QuickCheck test failure
https://travis-ci.org/jgm/pandoc/jobs/319812224
2017-12-21 11:50:55 -08:00
Jesse Rosenthal
c4f58684ee PowerPoint writer: Implement notes
This currently prints all notes on a final slide.

Note that at the moment, there is a danger of text overflowing the
note slide, since there is no logic for adding further slides. A
future commit will shrink the font size on these notes, but that won't
take care of the problem altogether. (We might have to implement some
sort of clumsy page-breaking logic here based on font size and
text-box dimensions, though that seems like a can of worms.)
2017-12-21 12:11:58 -05:00
Jesse Rosenthal
f76b4fc497 PowerPoint writer: Register notes to state.
When we encounter a note, we write it to the state directory of notes,
and input a superscript.
2017-12-21 11:45:08 -05:00
Jesse Rosenthal
d6c9e4f243 Add Note state to PowerPoint writer.
First step toward implementing notes in pptx writer.
2017-12-21 11:35:00 -05:00
Jesse Rosenthal
4d0cb0b2fc Implement basic definition list functionality to PowerPoint writer.
These are currently implemented in terms of a Bold para for the terms,
and then blockquotes for the definitions. THis can be refined a bit in
the future.
2017-12-21 11:09:05 -05:00
Jesse Rosenthal
4e53c7bf55 Don't look for default template file for Powerpoint.
When using readerStandalone, this keeps us from looking for a
non-existent template pptx file.

Closes #4181
2017-12-21 10:35:51 -05:00
Jesse Rosenthal
3c8f0269f9 Add pptx to isTextFormat list
This is used to check standalone and not writing to the terminal.
2017-12-21 10:22:58 -05:00
Alexander Krotov
d035689a06 Org writer: do not wrap "-" to avoid accidental bullet lists
Also add TODO for ordered lists.
2017-12-21 16:36:29 +03:00
Alexander Krotov
0405c5b461 Muse reader: parse anchors immediately after headings as IDs 2017-12-21 15:52:10 +03:00
Albert Krewinkel
5d3573e780
Lua modules: turn pipe, read into full Haskell functions
The `pipe` and `read` utility functions are converted from hybrid
lua/haskell functions into full Haskell functions. This avoids the need
for intermediate `_pipe`/`_read` helper functions, which have dropped.
2017-12-20 22:24:41 +01:00
Albert Krewinkel
e45f87a3be
Org reader: fix asterisks-related parsing error
A parsing error was fixed which caused the org reader to fail when
parsing a paragraph starting with two or more asterisks.

Fixes: #4180
2017-12-20 18:04:50 +01:00
Alexander Krotov
b5e62a5c09 Muse reader: require that note references does not start with 0 2017-12-20 14:00:30 +03:00
Hamish Mackenzie
5d3c9e5646 Add Basic JATS reader based on DocBook reader 2017-12-20 13:54:02 +13:00
Alexander Krotov
1e21cfb251 Muse writer: don't wrap note references to the next line
Closes #4172.
2017-12-19 13:30:48 +03:00
Alexander Krotov
ef8430e702 Fix for #4171 fix: don't wrap note references after SoftBreak 2017-12-19 13:30:48 +03:00
Alexander Krotov
f6abf15832 Muse reader: parse empty comments correctly 2017-12-19 04:23:32 +03:00
John MacFarlane
c0cc9270cb Org writer: don't allow fn refs to wrap to beginning of line.
Otherwise they can be interpreted as footnote definitions.

Closes #4171.
2017-12-18 16:33:52 -08:00
Albert Krewinkel
70dc5834da
Lua filters: perform minor code clean-up
Change: minor
2017-12-18 18:10:08 +01:00
John MacFarlane
808f6d3fa1 OPML reader: enable raw HTML and other extensions by default for notes.
This fixes a regression in 2.0.

Note that extensions can now be individually disabled, e.g.
`-f opml-smart-raw_html`.

Closes #4164.
2017-12-17 09:52:53 -08:00
John MacFarlane
bba7646340 LaTeX writer: use \renewcommand for \textlatin with babel.
This avoids a clash with a deprecated \textlatin command defined
in Babel.  Closes #4161.
2017-12-15 12:21:41 -08:00
John MacFarlane
3a3d661408 LaTeX reader: export tokenize, untokenize.
Mainly so they can be tested.
2017-12-15 10:13:16 -08:00
John MacFarlane
044d58bb24 Fixed regression in LateX tokenization.
This mainly affects the Markdown reader when parsing
raw LaTeX with escaped spaces.  Closes #4159.
2017-12-15 09:45:29 -08:00
John MacFarlane
b94f1e2045 RST reader: more accurate parsing of references.
Previously we erroneously included the enclosing
backticks in a reference ID (closes #4156).

This change also disables interpretation of
syntax inside references, as in docutils.
So, there is no emphasis in

    `my *link*`_
2017-12-14 12:48:43 -08:00
John MacFarlane
3361f85f8e
Merge pull request #4148 from stencila/jats-figures
fig, table-wrap & caption Divs for JATS writer
2017-12-14 13:45:23 -07:00
John MacFarlane
7888f49342 Markdown reader: be pickier about table captions.
A caption starts with a `:` which can't be followed
by punctuation.  Otherwise we can falsely interpret
the start of a fenced div, or even a table header line
like `:--:|:--:`, as a caption.
2017-12-14 12:03:14 -08:00
Hamish Mackenzie
fa0241592c Deduplicate JATS writer image mime type code 2017-12-14 18:39:45 +13:00
John MacFarlane
935b16b38a Removed whitespace at ends of line. 2017-12-13 20:48:24 -08:00
John MacFarlane
52a8116e71
Merge pull request #4153 from tarleb/unify-lua-init
Unify lua initalization
2017-12-13 21:42:06 -07:00
Jesse Rosenthal
3c7a3d378c Docx writer: Continue lists after interruption.
Docx expects that lists will continue where they left off after an
interruption and introduces a new id if a list is starting again. So
we keep track of the state of lists and use them to define a "start"
attribute, if necessary.

Closes #4025
2017-12-13 15:16:17 -05:00
Albert Krewinkel
4c64af4407
Custom writer: use init file to setup Lua interpreter
The same init file (`data/init`) that is used to setup the Lua
interpreter for Lua filters is also used to setup the interpreter of
custom writers.lua.
2017-12-13 21:15:41 +01:00
Albert Krewinkel
f9d0e1c89c
Lua filters: drop unused code, language extensions 2017-12-13 19:54:57 +01:00
Albert Krewinkel
0abb9bdc54
Custom writer: define instances for newtype wrapper
The custom writer used its own `ToLuaStack` instance definitions, which
made it difficult to share code with Lua filters, as this could result
in conflicting instances. A `Stringify` wrapper is introduced to avoid
this problem.
2017-12-13 19:54:50 +01:00
John MacFarlane
d9cdce4281 Markdown reader: always use four space rule for example lists.
It would be awkward to indent example list contents to the
first non-space character after the label, since example
list labels are often long.

Thanks to Bernhard Fisseni for the suggestion.
2017-12-13 10:20:57 -08:00
John MacFarlane
7093a3b44c Markdown: Improved computation of relative cell widths in pipe tables. 2017-12-12 15:36:29 -08:00