Commit graph

1932 commits

Author SHA1 Message Date
schrieveslaach
49d72444d7 LaTeX reader: add support for LaTeX subfiles package.
Closes #3530.
2017-03-27 21:20:27 +02:00
John MacFarlane
6dd7be7250 Revert "LaTeX reader: be more picky about beamer angle arguments."
This reverts commit b98a05d604.
2017-03-24 16:31:34 +01:00
John MacFarlane
b98a05d604 LaTeX reader: be more picky about beamer angle arguments.
We now only allow them if they contain only numbers,
spaces, `-`, and `,`.
2017-03-24 16:25:31 +01:00
John MacFarlane
f4ac0edf2a Markdown reader: allow latex macro definitions indented 1-3 spaces.
Previously they only worked if nonindented.
2017-03-22 21:19:50 +01:00
John MacFarlane
48c88d566d Add space_in_atx_header extension.
This is enabled by default in pandoc and GitHub markdown but not the
other flavors.

This requirse a space between the opening #'s and the header
text in ATX headers (as CommonMark does but many other implementations
do not).  This is desirable to avoid falsely capturing things ilke

    #hashtag

or

    #5

Closes #3512.
2017-03-20 21:55:30 +01:00
John MacFarlane
34412cf57c RST reader: recurse into bodies of unknown directives.
In most cases it's better to preserve the content than
to emit it.  This isn't guaranteed to have good results;
it will fail spectacularly for unknown raw or verbatim
directives.

See #3432.
2017-03-19 21:55:38 +01:00
John MacFarlane
87f99f3fdf HTML reader: Better sanity checks on raw HTML.
This also affects the Markdown reader.

Closes #3257.
2017-03-18 22:43:57 +01:00
John MacFarlane
6bf3f89d69 Better handling of \part in LaTeX.
Closes #1905.

Removed stateChapters from ParserState.

Now we parse chapters as level 0 headers, and parts as level -1 headers.
After parsing, we check for the lowest header level, and if it's
less than 1 we bump everything up so that 1 is the lowest header level.
So `\part` will always produce a header; no command-line options
are needed.
2017-03-13 22:11:10 +01:00
Albert Krewinkel
0196ca893d
Org reader: interpret more meta value as inlines
The values of the following meta variables are now interpreted using
org-markup instead of treating them as pure strings:

- *keywords*: comma-separated list of inlines
- *subtitle*: inline values
- *nocite*: inline values; using it multiple times accumulates the
    values.
2017-03-12 23:29:39 +01:00
John MacFarlane
2f8f8f0da6 Issue warning for duplicate header identifiers.
As noted in the previous commit, an autogenerated identifier
may still coincide with an explicit identifier that is given
for a header later in the document, or with an identifier on
a div, span, link, or image. This commit adds a warning
in this case, so users can supply an explicit identifier.

* Added `DuplicateIdentifier` to LogMessage.
* Modified HTML, Org, MediaWiki readers so their custom
  state type is an instance of HasLogMessages.  This is necessary
  for `registerHeader` to issue warnings.

See #1745.
2017-03-12 22:07:28 +01:00
John MacFarlane
be733385c9 Markdown reader: optimized nonindentSpaces.
Makes the benchmark go from 40 to 36 ms.
2017-03-11 18:42:39 +01:00
John MacFarlane
ba78b75146 Removed normalizeSpaces from Text.Pandoc.Shared.
Rewrote functions in RST reader and writer to avoid the need
for it.

Closes #1530.
2017-03-10 20:45:21 +01:00
John MacFarlane
a197dc9d3f Docx reader: more efficient trimSps.
Replacing trimLineBreaks.  This does the work of
normalizeSpaces as well, so we avoid the need for that
function here.

See #1530.
2017-03-10 20:34:25 +01:00
John MacFarlane
c46febaaee Expand \newenvironment macros.
Closes #987.

Depends on still unreleased texmath 0.9.3.
2017-03-10 09:46:32 +01:00
John MacFarlane
a088d67f0d LaTeX reader: Treat {{xxx}} the same as {xxx}.
Closes #2115.
2017-03-09 21:03:54 +01:00
Albert Krewinkel
c91f168fc9 Org reader: disallow tables on list marker lines
Fixes: #3499
2017-03-08 15:45:00 +01:00
John MacFarlane
410991ec6e Org reader: don't allow tables inside list items.
Closes #3499.
2017-03-08 12:28:13 +01:00
John MacFarlane
8c55b7b564 Markdown reader: Treat certain environments as inline
when they occur without space surrounding them.

E.g. equation, math.

This avoids incorrect vertical space around equations.

Closes #3309.
Closes #2171.
See also rstudio/bookdown#358.
2017-03-07 15:00:32 +01:00
John MacFarlane
9e87114234 LaTeX reader: allow newpage, clearpage, pagebreak in inline contexts
as well as block contexts.

Closes #3494.
2017-03-06 21:49:06 +01:00
John MacFarlane
ddc2b9024f LaTeX reader: support all \textXX commands.
where XX = rm, tt, up, md, sf, bf.

Spans with a class are used when there is nothing better.

Closes #3488.
2017-03-05 20:21:29 +01:00
John MacFarlane
e20f55618f Markdown reader: fixed internal header links.
Closes #2397.

This patch also adds `shortcut_reference_links` to the list
of mmd extensions.
2017-03-05 16:34:47 +01:00
John MacFarlane
6530bc4471 LaTeX reader: small improvements in parsing arguments. 2017-03-05 11:17:03 +01:00
John MacFarlane
3ff41fe7f4 LaTeX reader: Handle spaces before \cite arguments. 2017-03-05 11:10:11 +01:00
John MacFarlane
95f2726ee7 Added readerAbbreviations to ParserState.
Markdown reader now consults this to determine what is an
abbreviation.

Eventually it will be possible to specify a custom list
(see #256).
2017-03-05 10:24:39 +01:00
John MacFarlane
7fc6919f90 Markdown reader: Fixed regression on left-biased union for metadata.
When multiple YAML metadata blocks are used, and two define
the same field, the value defined first takes precedence,
according to the manual.  This was changed briefly in
ba3ee62323.  This commit
reverts to the original behavior and adds a test case.
2017-03-05 09:28:44 +01:00
John MacFarlane
ba3ee62323 Parse YAML metadata in a context that sees footnotes...
defined in the body of the document.

Closes #1279.
2017-03-05 01:36:40 +01:00
John MacFarlane
0517cf0bc0 Fixed some loose ends in #1592.
Added test cases.

Fixed HTML reader to parse a span with class "smallcaps" as
SmallCaps.

Fixed Markdown writer to render SmallCaps as a native span
when native spans are enabled.
2017-03-04 23:01:29 +01:00
John MacFarlane
0795244458 Markdown reader: treat span with class smallcaps as SmallCaps.
This allows users to specify small caps in Markdown this way:

    [my text]{.smallcaps}

See #1592.
2017-03-04 14:38:09 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
John MacFarlane
fb47d1d909 RST reader: support RST-style citations.
The citations appear at the end of the document as a definition
list in a special div with id `citations`.

Citations link to the definitions.

Added stateCitations to ParserState.

Closes #853.
2017-03-03 22:23:01 +01:00
John MacFarlane
4d25bba5f7 RST reader: Handle multiline cells in simple tables.
Closes #1166.
2017-03-02 16:48:53 +01:00
John MacFarlane
fa59e2ef28 Markdown reader: when splitting pipe table cells, skip tex math.
You might have a `|` character inside math.
(Or for that matter something that the parser might mistake
for raw HTML.)

See #3481.
2017-03-02 10:25:12 +01:00
John MacFarlane
d21c7fee66 LaTeX reader: don't drop contents of \hypertarget. 2017-03-01 21:05:29 +01:00
John MacFarlane
d1b50a6c5d RST reader: implemented implicit internal header links.
Cloess #3475.
2017-02-28 10:32:36 +01:00
John MacFarlane
1d17dbd3ae LaTeX reader: Handle komascript \dedication.
It now adds a `dedication` field to metadata.
It is up to the user to supply a template that uses this
variable.

Closes #1845.
2017-02-27 14:16:05 +01:00
John MacFarlane
4fb9976a9a Minor cleanups in LaTeX reader. 2017-02-27 00:40:33 +01:00
John MacFarlane
99b39ffc17 RST reader: support scale and align attributes of images.
Closes #2662.
2017-02-26 23:40:31 +01:00
John MacFarlane
7d0082aa0b LaTeX reader: allow hspace and vspace to count as raw block or inline.
Previously we would refuse to parse anything as raw inline if
it was in the blockCommands list.  Now we allow exceptions
if they're listed under ignoreInlines in inlineCommands.

This should make it easier e.g. to include an \hspace
between two side-by-side raw LaTeX tables.
2017-02-25 12:43:00 +01:00
John MacFarlane
f1cf8273d5 Revert "LaTeX reader: don't treat \vspace and \hspace as block commands."
This reverts commit 2873cd8288.
2017-02-25 12:43:00 +01:00
John MacFarlane
0448b7d1fc Implemented \graphicspath in LaTeX reader.
Closes #736.
2017-02-24 15:34:41 +01:00
John MacFarlane
6936747794 EPUB reader: minor refactoring, avoiding explicit MediaBag handling.
This all works behind the scenes in CommonState plumbing.
2017-02-24 13:39:20 +01:00
John MacFarlane
f4a452f891 When parsing raw LaTeX commands, include trailing space.
Otherwise things like `\noindent foo` break and turn into
`\noindentfoo`.

Affects `-f latex+raw_tex` and `-f markdown` (and other formats
that allow `raw_tex`).

Closes #1773.
2017-02-22 21:15:25 +01:00
John MacFarlane
5d71e37f26 MediaWiki reader: ensure that list starts begin at left margin.
Including when they're in tables or other list items.

Closes #2606.
2017-02-21 23:41:32 +01:00
John MacFarlane
5269724ad3 MediaWiki reader: fixed more table issues.
Closes #2649.
2017-02-21 21:28:24 +01:00
John MacFarlane
1d06e8c5a5 MediaWiki reader: Allow blank line after table start.
See #2649.
2017-02-21 18:34:21 +01:00
John MacFarlane
598ffa3a94 MediaWiki tables: allow extra hyphens after |- in tables.
I didn't see this documented anywhere, but it seems to be allowed
(and common).

See #2649.  This addresses some of the cases there, but not all.
2017-02-21 17:30:13 +01:00
John MacFarlane
547c32939b Tighten up HasQuoteContext instance in HTML reader.
We constrain it to the state used in the HTML reader.
Otherwise we can get overlap with the general instance
for ParserState m.
2017-02-20 15:51:49 +01:00
John MacFarlane
1e43e3767e Markdown reader: Use logMessage instead of report. 2017-02-17 19:59:54 +01:00
John MacFarlane
a3412354a4 Fixed repeated log messages in RST reader.
See #3447.  To complete fixes on this issue, we need to
do the same for the other readers.  Note that the changes
required are minimal -- add reportLogMessages to the end
of the main parser, and replace report with logMessage.
(except for trace)
2017-02-17 13:01:55 +01:00
John MacFarlane
575014975e Fix indirect hyperlink targets. Closes #512. 2017-02-15 17:36:16 +01:00