Commit graph

4397 commits

Author SHA1 Message Date
John MacFarlane
e180a2efa6 Ms writer: fixed hard line breaks. 2017-03-23 14:48:09 +01:00
John MacFarlane
dd1ac8f48f Writers.Shared.gridTable: defensive coding around 'maximum'. 2017-03-23 14:33:49 +01:00
John MacFarlane
1ae38fde4d MS writer: updated TODO comment. 2017-03-23 13:00:14 +01:00
John MacFarlane
d20d3a5dbb Ms writer: Super/subscript support.
Also added some macro definitions to default template
to support subscripts + better superscripts.
2017-03-23 12:59:19 +01:00
John MacFarlane
1af6faf2d4 Ms writer: support for fake smallcaps. 2017-03-23 12:45:23 +01:00
John MacFarlane
8cf5c55e5e Ms. writer: don't render links in footnotes as footnotes. 2017-03-23 12:05:41 +01:00
John MacFarlane
1809f64a4c Ms writer: Improved footnotes. 2017-03-23 11:56:13 +01:00
John MacFarlane
da0aae9c8f Ms writer: fixed strong/emph combination.
Perhaps something similar is needed in the man writer.
2017-03-23 11:48:01 +01:00
John MacFarlane
6c204ea2bd Initial addition of groff ms writer.
* New module: Text.Pandoc.Writers.Ms.
* New template: default.ms.
* The writer uses texmath's new eqn writer to convert math
  to eqn format, so a ms file produced with this writer
  should be processed with `groff -ms -e` if it contains
  math.
2017-03-23 10:14:16 +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
9437ab449c Revert "Experimental change to charWidth in Pretty."
This reverts commit c59e317224.
2017-03-22 16:08:09 +01:00
John MacFarlane
c59e317224 Experimental change to charWidth in Pretty.
Hunch that this might help with #3526.
2017-03-22 15:37:08 +01:00
John MacFarlane
cf306f34e5 Plain writer: use _(..) or ^(..) for super/subscript...
...unless unicode super/subscripted characters are available.
2017-03-21 15:41:58 +01:00
John MacFarlane
430e2db9ba Improve rendering of superscript in plain output.
We now handle a few non digit characters (+, -, =, parentheses)
for which there are superscripted unicode characters.

Closes #3518.
2017-03-21 14:43:14 +01:00
John MacFarlane
daf8d1db18 RST writer: improve grid table output, fix bug with empty rows.
Uses the new gridTable in Writers.Shared, which is here
improved to better handle 0-width cells.

Closes #3516.
2017-03-21 14:16:46 +01:00
John MacFarlane
d3798a044d Reuse Writers.Shared.gridTable in Haddock writer. 2017-03-21 10:20:18 +01:00
John MacFarlane
e6cdf21fa5 Moved more gridTable calculations to Writers.Shared. 2017-03-21 10:16:11 +01:00
John MacFarlane
e7336b1feb Moved gridTable from Markdown writer to Writers.Shared. 2017-03-21 10:02:30 +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
Albert Krewinkel
f2f6851713 Lua filters (#3514)
* Add `--lua-filter` option.  This works like `--filter` but takes pathnames of special lua filters and uses the lua interpreter baked into pandoc, so that no external interpreter is needed.  Note that lua filters are all applied after regular filters, regardless of their position on the command line.
* Add Text.Pandoc.Lua, exporting `runLuaFilter`.  Add `pandoc.lua` to data files.
* Add private module Text.Pandoc.Lua.PandocModule to supply the default lua module.
* Add Tests.Lua to tests.
* Add data/pandoc.lua, the lua module pandoc imports when processing its lua filters.
* Document in MANUAL.txt.
2017-03-20 15:17:03 +01:00
Mauro Bieg
b010a8c5e7 docx writer: lang meta, see #1667 (#3515) 2017-03-20 10:06:24 +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
c93d069d49 Add default abbreviations file (data/abbreviations).
This contains a list of strings that will be recognized by pandoc's
Markdown parser as abbreviations.  (A nonbreaking space will
be inserted after the period, preventing a sentence space in
formats like LaTeX.)

Users can override the default by putting a file abbreviations
in their user data directory (`~/.pandoc` on *nix).
2017-03-16 22:16:41 +01:00
John MacFarlane
2fe806e9ac Added --abbreviations=FILE option for custom abbreviations file. 2017-03-16 21:45:50 +01:00
John MacFarlane
38c3a68346 LaTeX/Beamer writer: allow hyperlinks to frames.
Previously you could link to a header above or below slide
level but not TO slide level.  This commit changes that.
Hypertargets are inserted inside frame titles; technically
the reference is to just after the title, but in normal
use (where slides are viewed full screen in a slide show),
this does not matter.

Closes #3220.
2017-03-16 10:15:14 +01:00
John MacFarlane
482e5b78a0 OpenDocument writer: use more widely available bullet characters.
The old characters weren't available in some font sets.
These seem to work well on Windows and Linux versions of LibreOffice.

Closes #1400.
2017-03-15 17:19:28 +01:00
John MacFarlane
0b4ae3af66 Removed unused symbol. 2017-03-13 22:21:50 +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
John MacFarlane
4de4816b99 RST writer: convert to PandocMonad, report on unrendered raw items. 2017-03-13 21:32:58 +01:00
John MacFarlane
db37b71d9a Highlighting: highlighting now returns an Either rather than Maybe.
This allows us to display error information returned by the
skylighting library.

Display a warning if the highlighting library throws an error.
2017-03-13 11:38:19 +01:00
John MacFarlane
efcb51bcb0 Put TEI writer inside PandocMonad. Added warnings for omitted raw elements.
Also added identifiers on `<div>` elements.  These were commented
out before, not sure why?
2017-03-13 11:08:17 +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
1012e668cf Converted DokuWiki writer to use PandocMonad. 2017-03-12 23:15:22 +01:00
John MacFarlane
df7a443f67 MediaWiki writer: use PandocMonad. 2017-03-12 23:09:00 +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
c8b906256d Improved behavior of auto_identifiers when there are explicit ids.
Previously only autogenerated ids were added to the list
of header identifiers in state, so explicit ids weren't taken
into account when generating unique identifiers.  Duplicated
identifiers could result.

This simple fix ensures that explicitly given identifiers are
also taken into account.

Fixes #1745.

Note some limitations, however.  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.  Fixing this would be much more
difficult, because we need to run `registerHeader` before
we have the complete parse tree (so we can't get a complete
list of identifiers from the document by walking the tree).

However, it might be worth issuing warnings for duplicate
header identifiers; I think we can do that.  It is not
common for headers to have the same text, and the issue
can always be worked around by adding explicit identifiers,
if the user is aware of it.
2017-03-12 21:30:04 +01:00
John MacFarlane
3765f08304 Revert "Shared: export extractIds."
This reverts commit 0ef1e51211.
2017-03-12 21:18:19 +01:00
John MacFarlane
0ef1e51211 Shared: export extractIds.
This will be used to help with #1745.
2017-03-12 12:42:03 +01:00
John MacFarlane
d66b046c8a Markdown writer: fixed bugs in simple/multiline list output.
* Previously we got overlong lists with `--wrap=none`.  This is fixed.
* Previously a multiline list could become a simple list (and would
  always become one with `--wrap=none`).

Closes #3384.
2017-03-11 23:24:14 +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
ac15b0443f ConTeXt writer: converted to use PandocMonad. 2017-03-10 20:54:52 +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
9862d7c359 Shared.normalizeSpaces: strip off leading/trailing line breaks...
...not just spaces.
2017-03-10 20:33:14 +01:00
Alexander Krotov
d037c5019d Add Muse writer (#3489)
* Add Muse writer

* Advertise new Muse writer

* Muse writer: add regressions tests
2017-03-10 10:16:27 +01:00
John MacFarlane
21ae5db20c Use pMacroDefinition in macro (for more direct parsing).
This is newly exported in texmath 0.9.3.

Note that this means that `macro` will now parse one
macro at a time, rather than parsing a whole group together.
2017-03-10 10:12:51 +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
John MacFarlane
1ec6a19223 Changed display format for messages. 2017-03-09 10:30:57 +01:00