Commit graph

6687 commits

Author SHA1 Message Date
Albert Krewinkel
909083090a
Org reader: fix parsing of empty comment lines
Comment lines in Org-mode can be completely empty; both of these line
should produce no output:

    # a comment
    #

The reader used to produce a wrong result for the latter, but ignores
that line as well now.

Fixes: #5856
2019-10-27 23:00:30 +01:00
John MacFarlane
bef124c98c Beamer writer: fix regression with hrules separating slides. 2019-10-25 23:01:29 -07:00
Ole Martin Ruud
45479114e8 HTML reader/writer: Better handling of <q> with cite attribute (#5837)
* HTML reader: Handle cite attribute for quotes.  If a `<q>` tag has a `cite` attribute, we interpret it as a Quoted element with an inner Span.  Closes #5798

* Refactor url canonicalization into a helper function

* Modify HTML writer to handle quote with cite.

[0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
2019-10-24 22:27:49 -07:00
John MacFarlane
91c325c714 T.P.Readers.LaTeX.Parsing: add [Tok] parameter to rawLaTeXParser.
This allows us to avoid retokenizing multiple times in
e.g. rawLaTeXBlock.  (Unexported module, so not an API change.)
2019-10-23 09:42:46 -07:00
Amogh Rathore
d50f46d26d Add Reader support for HTML <samp> element (#5843)
The `<samp>` element is parsed as a Span with class `sample`.
Closes #5792.
2019-10-23 08:44:24 -07:00
Florian B
a933ad30fb Add support for reading & writing <mark> elements
Parse <mark> elements from HTML as HTML span like elements, with a
single class matching the tag name `mark`. Mark elements are rendered to
HTML using the native <mark> element.

Fixes https://github.com/jgm/pandoc/issues/5797.
2019-10-16 09:08:12 -07:00
Daniele D'Orazio
1425bf9a65 Add support for reading and writing <kbd> elements
* Text.Pandoc.Shared: export `htmlSpanLikeElements` [API change]

This commit also introduces a mapping of HTML span like elements that
are internally represented as a Span with a single class, but that are
converted back to the original element by the html writer. As of now,
only the kbd element is handled this way. Ideally these elements should
be handled as plain AST values, but since that would be a breaking
change with a large impact, we revert to this stop-gap solution.

Fixes https://github.com/jgm/pandoc/issues/5796.
2019-10-15 09:49:09 -07:00
Alexander Krotov
a1977dd2d6 Muse reader: do not allow closing asterisks to be followed by "*" 2019-10-15 16:36:05 +03:00
Alexander Krotov
d5c13dd438 Muse reader: do not split series of asterisks into symbols and emphasis
Fixes #5821
2019-10-15 01:55:32 +03:00
Alexander Krotov
13e0ac1104 Muse reader: do not terminate emphasis on "*" not followed by space 2019-10-15 01:02:54 +03:00
mb21
25cb84d8d9 change indentation of math part in Writers/HTML.hs 2019-10-14 08:47:40 -07:00
mb21
bfbff3106d KaTeX math: respect classoption=fleqn variable
closes #5815
2019-10-14 08:47:40 -07:00
mb21
b976486f1f Bump KaTeX version to 0.11.1 2019-10-14 08:47:40 -07:00
John MacFarlane
d9db76dcf4 LaTeX writer: fix horizontal rule.
We change to use 0.5pt rather than `\linethickness`, which
apparently only ever worked "by accident" and no longer works
with recent updates to texlive.

Closes #5801.
2019-10-12 23:20:57 -07:00
John MacFarlane
9e3e195dd4 Fix gfm_auto_identifiers behavior with emojis.
Closes #5813.

Note that we also now use emoji names for emojis
when `ascii_identifiers` is enabled.
2019-10-11 10:00:33 -07:00
John MacFarlane
7c2dd0359b Markdown writer: prefer pipe_tables to raw html...
...even when we must lose width information.

All in all this seems to be people's preferred behavior, even though it
is slightly lossier.

Closes #2608.
Closes #4497.
2019-10-11 09:46:58 -07:00
John MacFarlane
8a64bd0abf Allow output-file to be null in --defaults. 2019-10-11 08:57:34 -07:00
John MacFarlane
c468951d8e Remove redundant import. 2019-10-11 08:20:31 -07:00
John MacFarlane
7388cd3e7a Improve parsing of --defaults.
- Add FromYAML instances to Opt and to all subsidiary types.
- Remove the use of HsYAML-aeson, which doesn't give good
  position information on errors.
- Rename some fields in Opt to better match cli options or
  reflect what the ycontain [API change]:

  + optMetadataFile -> optMetadataFiles
  + optPDFEngineArgs -> optPDFEngineOpts
  + optWrapText -> optWrap
- Add IpynbOutput enumerated type to Text.Pandoc.App.Opts.
  Use this instead fo a string for optIpynbOutput.
- Add FromYAML instance for Filter in Text.Pandoc.Filters.

With these changes parsing of defaults files should be
complete and should give decent error messages.

Now (unlike before) we get an error if an unknown field
is used.
2019-10-10 23:21:18 -07:00
John MacFarlane
33f70e9819 Add -d as synonym for --defaults. 2019-10-10 10:12:23 -07:00
John MacFarlane
558b91801a Reorder options in --help. 2019-10-10 10:12:05 -07:00
John MacFarlane
a3cd74c29b --metadata-file: when multiple files specified, second takes precedence...
on conflicting fields.  This changes earlier behavior (but not in
a release), where first took precedence.

Note that this may seem inconsistent with the behavior of
multiple YAML blocks within a document, where the first takes
precedence.  Still, it is convenient to be able to override
defaults with options later on the command line.
2019-10-10 10:00:45 -07:00
John MacFarlane
68b09a6d81 Make some writers sensitive to 'unlisted' class on headings.
If this is present on a heading with the 'unnumbered' class,
the heading won't appear in the TOC.  This class has no
effect if 'unnumbered' is not also specified.

This affects HTML-based writers (including slide shows
and epub), LateX (including beamer), RTF, and PowerPoint.
Other writers do not yet support `unlisted`.

Closes #1762.
2019-10-10 09:15:40 -07:00
John MacFarlane
2b1361e738 Remove unnecessary import. 2019-10-10 08:36:27 -07:00
John MacFarlane
fcefcfec39 --defaults: add .yaml extension if absent, look in user data dir...
under "defaults" subdirectory.
2019-10-09 23:29:25 -07:00
John MacFarlane
ff1df241a9 T.P.App.Opt: rename optReader, optWriter as optFrom, optTo.
This will allow to: and from: in defaults.
2019-10-09 21:54:41 -07:00
John MacFarlane
070e098b48 Make sure that input-files works in --default files. 2019-10-09 17:51:33 -07:00
John MacFarlane
a3729ef2da RST writer: proper handling of :align: on figures, images.
When the image has the `align-right` (etc.) class, we now use
an `:align:` attribute.

Closes #4420.
2019-10-09 15:05:22 -07:00
zorkow
3c7f1bf96c Basic changes for MathJax 3. 2019-10-09 14:30:25 -07:00
John MacFarlane
83702404af Initial implementation of --defaults option.
Need documentation.
2019-10-09 12:44:09 -07:00
John MacFarlane
5419988f22 T.P.App.Opt: Changed optMetadata to Meta, to allow structured values.
[API change]

The current behavior of the `--metadata` option stays the same.
2019-10-09 11:46:20 -07:00
John MacFarlane
3aa069e1d5 Change optVariables from [(String, String)] to Context Text.
In Text.Pandoc.App.Opt [API change].
2019-10-09 11:01:33 -07:00
John MacFarlane
aceee9ca48 Options.WriterOptions: Change type of writerVariables to Context Text.
This will allow structured values.

[API change]
2019-10-09 11:01:33 -07:00
John MacFarlane
1b10b5cea9 Use th to derive json instance for LineEnding. 2019-10-08 08:02:24 -07:00
John MacFarlane
34c61fcad5 Text.Pandoc.Options: change To/FromJSON instances for...
HTMLMathMethod, CiteMethod, ObfuscationMethod, TrackChanges, WrapOption,
TopLevelDivision, ReferenceLocation, HTMLSlideVariant.

In each case we use lowercase (or hyphenated lowercase) for
constructors to line up more closely with command-line option
values.

This is a breaking change for those who manually decode or encode
JSON for these data types (e.g. for ReaderOptions or WriterOptions).

See #5790.
2019-10-07 22:23:51 -07:00
John MacFarlane
e4ccfeab8c Shored.camelCaseToHyphenated: handle ABCDef = abc-def. 2019-10-07 21:31:03 -07:00
John MacFarlane
8fb9a0d168 Remove derive_json_via_th flag; always use TH.
This cuts down on code duplication and reduces the chance
for errors.  See #4083.
2019-10-07 21:23:50 -07:00
John MacFarlane
3c58cc4f33 Remove redundant import. 2019-10-07 10:24:47 -07:00
John MacFarlane
da070bea47 Use typeMismatch. 2019-10-07 00:04:47 -07:00
John MacFarlane
6e537aeda8 T.P.App.Opt: custom FromJSON instance for LineEnding.
So either CRLF or crlf will work.
2019-10-06 23:48:34 -07:00
John MacFarlane
3ef0cdd8f9 Opt: Change optHighlightStyle to a Maybe String instead of Maybe Style.
Do the parsing/loading of themes later, after option parsing.
2019-10-06 23:15:52 -07:00
John MacFarlane
5f8254c4b9 Code cleanup 2019-10-06 22:26:26 -07:00
John MacFarlane
fcfdc8210f Text.Pandoc.App.Opt: Remove optBaseHeaderLevel from Opt.
We now just use optShiftHeadingLevelBy, to avoid redundancy.
2019-10-06 21:31:28 -07:00
John MacFarlane
cf1703396c Text.Pandoc.App.Opt: Change optShiftHeadingLevel to optShiftHeadingLevelBy...
to match the option.
2019-10-06 16:55:12 -07:00
John MacFarlane
2e35eafd12 Text.Pandoc.App.Opt: more convenient To/FromJSON instances.
Make the field names like `strip-empty-paragraphs` rather
than `optStripEmptyParagraphs`.
2019-10-06 16:25:05 -07:00
Alexander Krotov
6898445548 hlint Muse writer 2019-10-04 18:29:00 +03:00
Alexander Krotov
701ae8634e hlint FB2 reader 2019-10-04 18:28:45 +03:00
Alexander Krotov
8efc677368 Fix all hlint warnings in Muse reader 2019-10-04 18:22:05 +03:00
John MacFarlane
638c2ed460 Fix compiler warnings on ghc 8.8. 2019-10-04 07:20:51 -07:00
John MacFarlane
7caaa3d5d6 Minor ghc 8.8 fixups. 2019-10-03 22:41:24 -07:00