Commit graph

504 commits

Author SHA1 Message Date
Alexander
c7d4fd8cf1 Muse reader: do not allow closing tags with EOF (#3863)
This behavior is compatible to Amusewiki
2017-08-22 16:34:18 -07:00
Albert Krewinkel
41baaff327
Text.Pandoc.Lua: support Inline and Block catch-alls
Try function `Inline`/`Block` if no other filter function of the
respective type matches an element.

Closes: #3859
2017-08-22 23:30:48 +02:00
Albert Krewinkel
56fb854ad8
Text.Pandoc.Lua: respect metatable when getting filters
This change makes it possible to define a catch-all function using lua's
metatable lookup functionality.

    function catch_all(el)
      …
    end

    return {
      setmetatable({}, {__index = function(_) return catch_all end})
    }

A further effect of this change is that the map with filter functions
now only contains functions corresponding to AST element constructors.
2017-08-22 22:56:51 +02:00
John MacFarlane
6cba21b4d3 Small improvement to #3855 - move lang attribute up.
So we don't have a dangling line with the closing `>` when
`lang` is not set.
2017-08-21 21:16:55 -07:00
Jens Getreu
9375e50b96 docbook5 template: use lang and subtitle variables (#3855) 2017-08-21 21:10:41 -07:00
Alexander
0a839cbdc9 Muse reader: add definition list support (#3860) 2017-08-21 21:08:44 -07:00
John MacFarlane
d70b89c0d9 Use pandoc-types 1.17.1. Tests updated for new simpleTable behavior...
with empty headers.
2017-08-20 23:24:51 -07:00
John MacFarlane
9cc128b579 LaTeX reader: Set identifiers on Spans used for \label. 2017-08-20 16:52:03 -07:00
John MacFarlane
a31241a08b Markdown reader: use CommonMark rules for list item nesting.
Closes #3511.

Previously pandoc used the four-space rule: continuation paragraphs,
sublists, and other block level content had to be indented 4
spaces.  Now the indentation required is determined by the
first line of the list item:  to be included in the list item,
blocks must be indented to the level of the first non-space
content after the list marker. Exception: if are 5 or more spaces
after the list marker, then the content is interpreted as an
indented code block, and continuation paragraphs must be indented
two spaces beyond the end of the list marker.  See the CommonMark
spec for more details and examples.

Documents that adhere to the four-space rule should, in most cases,
be parsed the same way by the new rules.  Here are some examples
of texts that will be parsed differently:

    - a
      - b

will be parsed as a list item with a sublist; under the four-space
rule, it would be a list with two items.

    - a

          code

Here we have an indented code block under the list item, even though it
is only indented six spaces from the margin, because it is four spaces
past the point where a continuation paragraph could begin.  With the
four-space rule, this would be a regular paragraph rather than a code
block.

    - a

            code

Here the code block will start with two spaces, whereas under
the four-space rule, it would start with `code`.  With the four-space
rule, indented code under a list item always must be indented eight
spaces from the margin, while the new rules require only that it
be indented four spaces from the beginning of the first non-space
text after the list marker (here, `a`).

This change was motivated by a slew of bug reports from people
who expected lists to work differently (#3125, #2367, #2575, #2210,
 #1990, #1137, #744, #172, #137, #128) and by the growing prevalance
of CommonMark (now used by GitHub, for example).

Users who want to use the old rules can select the `four_space_rule`
extension.

* Added `four_space_rule` extension.
* Added `Ext_four_space_rule` to `Extensions`.
* `Parsing` now exports `gobbleAtMostSpaces`, and the type
  of `gobbleSpaces` has been changed so that a `ReaderOptions`
  parameter is not needed.
2017-08-19 15:45:01 -07:00
John MacFarlane
5ab1162def Markdown reader: fixed parsing of fenced code after list...
...when there is no intervening blank line.

Closes #3733.
2017-08-18 21:46:55 -07:00
John MacFarlane
bfbdfa646a LaTeX reader: implement \newtoggle, \iftoggle, \toggletrue|false
from etoolbox.

Closes #3853.
2017-08-18 10:13:41 -07:00
John MacFarlane
d1444b4ecd RST reader/writer: support unknown interpreted text roles...
...by parsing them as Span with "role" attributes.
This way they can be manipulated in the AST.

Closes #3407.
2017-08-17 16:01:44 -07:00
John MacFarlane
b1f6fb4af5 HTML reader: support column alignments.
These can be set either with a `width` attribute or
with `text-width` in a `style` attribute.

Closes #1881.
2017-08-17 12:08:32 -07:00
John MacFarlane
db715ca847 LaTeX reader: use Link instead of Span for \ref.
This makes more sense semantically and avoids unnecessary
Span [Link] nestings when references are resolved.
2017-08-16 10:56:12 -07:00
schrieveslaach
cf4b40162d LaTeX reader: add Support for glossaries and acronym package (#3589)
Acronyms are not resolved by the reader, but acronym and glossary information is put into attributes on Spans so that they can be processed in filters.
2017-08-16 10:24:46 -07:00
John MacFarlane
68434957d6 Fixed command test #2994 on Windows. 2017-08-16 09:47:25 -07:00
John MacFarlane
892a4edeb1 Implement multicolumn support for slide formats.
The structure expected is:

    <div class="columns">
      <div class="column" width="40%">
        contents...
      </div>
      <div class="column" width="60%">
        contents...
      </div>
    </div>

Support has been added for beamer and all HTML slide formats.

Closes #1710.

Note:  later we could add a more elegant way to create
this structure in Markdown than to use raw HTML div elements.
This would come for free with a "native div syntax" (#168).
Or we could devise something specific to slides
2017-08-14 23:17:44 -07:00
John MacFarlane
9c577b17b7 Update tests for changes to LaTeX template. 2017-08-14 13:19:54 -07:00
John MacFarlane
38578ad06c Test fixes so we can find data files.
In old tests & command tests, we now set the environment variable
pandoc_datadir.

In lua tests, we set the datadir explicitly.
2017-08-14 13:03:26 -07:00
John MacFarlane
319d7ed6ff Changed command test for #2994 so it actually tests the writer. 2017-08-14 00:00:50 -07:00
John MacFarlane
c7cbd3ddc2 Fixed command tests to set local path.
Previously we just tacked on a directory to the command
line, but that didn't work when we e.g. used a pipe for round tripping,
with two invocations of pandoc.
2017-08-13 23:59:38 -07:00
schrieveslaach
2845ab5976 Put content of \ref, \label commands into span… (#3639)
* Put content of `\ref` and `\label` commands into Span elements so they can be used in filters.
* Add support for `\eqref`
2017-08-13 10:58:45 -07:00
John MacFarlane
8f65590ce9 CommonMark writer: prefer pipe tables to HTML tables...
...even if it means losing relative column width information.
See #3734.
2017-08-13 10:43:43 -07:00
John MacFarlane
506866ef73 Markdown writer: Use pipe tables if raw_html disabled...
and `pipe_tables` enabled, even if the table has relative
width information.

Closes #3734.
2017-08-13 10:37:24 -07:00
Albert Krewinkel
2dc3dbd68b Use hslua >= 0.7, update Lua code 2017-08-13 14:23:54 +02:00
John MacFarlane
418bda8128 Docx writer: pass through comments.
We assume that comments are defined as parsed by the
docx reader:

    I want <span class="comment-start" id="0" author="Jesse Rosenthal"
    date="2016-05-09T16:13:00Z">I left a comment.</span>some text to
    have a comment <span class="comment-end" id="0"></span>on it.

We assume also that the id attributes are unique and properly
matched between comment-start and comment-end.

Closes #2994.
2017-08-12 22:59:53 -07:00
John MacFarlane
be9957bddc Escape MetaString values (as added with --metadata flag).
Previously they would be transmitted to the template without
any escaping.

Note that `--M title='*foo*'` yields a different result from

    ---
    title: *foo*
    ---

In the latter case, we have emphasis; in the former case, just
a string with literal asterisks (which will be escaped
in formats, like Markdown, that require it).

Closes #3792.
2017-08-12 20:27:42 -07:00
John MacFarlane
0ab8670a0e LaTeX reader: Fixed space after \figurename etc. 2017-08-12 13:40:28 -07:00
John MacFarlane
467ca2a1ad Fixed data-dir on translations tests. 2017-08-12 10:39:25 -07:00
John MacFarlane
dbb81f513c More translation tests. 2017-08-11 23:59:27 -07:00
John MacFarlane
9abb688f29 Added simple test for translations. 2017-08-11 23:57:28 -07:00
John MacFarlane
7892dcd353 Command tests; print stderr when a test fails. 2017-08-11 22:09:15 -07:00
John MacFarlane
83d856ee6c Fixed writer tests not to use writerUserDataDir. 2017-08-10 23:51:42 -07:00
John MacFarlane
dee4cbc854 RST reader: implement csv-table directive.
Most attributes are supported, including `:file:` and `:url:`.
A (probably insufficient) test case has been added.

Closes #3533.
2017-08-10 15:01:14 -07:00
John MacFarlane
ac18ff90b2 Org reader: use org-language attribute rather than data-org-language. 2017-08-09 09:45:17 -07:00
John MacFarlane
96933c6043 Org reader: use tag-name attribute instead of data-tag-name. 2017-08-09 09:26:57 -07:00
John MacFarlane
09b7df472d LaTeX reader: Use label instead of data-label for label in caption.
See d441e656db, #3639.
2017-08-09 09:15:50 -07:00
bucklereed
db55f7c1b2 HTML reader: parse <main> like <div role=main>. (#3791)
* HTML reader: parse <main> like <div role=main>.

* <main> closes <p> and behaves like a block element generally
2017-08-09 09:10:12 -07:00
Alexander
81224a3a73 Muse writer: update test results (#3845) 2017-08-08 16:43:50 -07:00
Alexander
b50de96502 Muse writer: insert two blanklines between lists of the same type (#3844) 2017-08-08 14:05:49 -07:00
John MacFarlane
1ad9679dc9 CommonMark writer: avoid excess blank lines at end of output. 2017-08-08 14:00:13 -07:00
John MacFarlane
3752298d91 Thread options through CommonMark reader.
This is more efficient than doing AST traversals for
emojis and hard breaks.

Also make behavior sensitive to `raw_html` extension.
2017-08-08 13:55:19 -07:00
John MacFarlane
b6f7c4930b CommonMark writer: support hard_line_breaks, smart.
Add tests.
2017-08-08 13:18:27 -07:00
John MacFarlane
2c0e989f9d Markdown reader: fixed spurious parsing as citation as reference def.
We now disallow reference keys starting with `@` if the
`citations` extension is enabled.  Closes #3840.
2017-08-07 21:00:57 -07:00
John MacFarlane
c806ef1b15 LaTeX reader: Support simple \def macros.
Note that we still don't support macros with fancy parameter
delimiters, like

    \def\foo#1..#2{...}
2017-08-07 16:06:19 -07:00
John MacFarlane
9e6b9cdc5f LaTeX reader: Support \let.
Also, fix regular macros so they're expanded at the
point of use, and NOT also the point of definition.
`\let` macros, by contrast, are expanded at the
point of definition.  Added an `ExpansionPoint`
field to `Macro` to track this difference.
2017-08-07 13:38:15 -07:00
Alexander
1b5bfced55 Muse reader: debug indented paragraph support (#3839)
Take only first line indentation into account
and do not start new paragraph on indentation change.
2017-08-06 21:43:59 -07:00
Jesse Rosenthal
a67a96b932 Docx reader: Add tests for avoiding zero-level header. 2017-08-06 19:36:25 -07:00
Alexander
8164a005c0 Muse reader: debug list and list item separation rules (#3837) 2017-08-06 13:19:59 -07:00
bucklereed
685788cd4b LaTeX reader: plainbreak, fancybreak et al from the memoir class (#3833) 2017-08-05 10:03:31 -07:00
Alexander Krotov
7a3a8790de Muse reader: do not allow headers in blockquotes (#3831) 2017-08-03 15:41:45 -07:00
John MacFarlane
ced834076d DokuWiki reader: better handling for code block in list item.
Closes #3824.
2017-08-02 10:33:08 -07:00
John MacFarlane
b8afec05e0 Markdown writer: better escaping of < and >.
If `all_symbols_escapable` is set, we backslash escape these.
Otherwise we use entities as before.
2017-07-30 13:45:22 -07:00
John MacFarlane
7f9e950d8d Class: Removed unnecessary withMedia, improved haddocks. 2017-07-30 07:43:55 -07:00
John MacFarlane
303d10d07b Small tweak in test (add --wrap=preserve). 2017-07-26 12:55:15 +02:00
John MacFarlane
e0ab09611a HTML writer: render raw inline environments when --mathjax used.
We previously did this only with raw blocks, on the assumption
that math environments would always be raw blocks. This has changed
since we now parse them as inline environments.

Closes #3816.
2017-07-26 12:50:36 +02:00
John MacFarlane
d441e656db HTML writer: insert data- in front of unsupported attributes.
Thus, a span with attribute 'foo' gets written to HTML5
with 'data-foo', so it is valid HTML5.

HTML4 is not affected.

This will allow us to use custom attributes in pandoc without
producing invalid HTML.
2017-07-25 13:13:24 +02:00
John MacFarlane
2b039acb4e Merge branch 'textcolor-support' of https://github.com/schrieveslaach/pandoc into schrieveslaach-textcolor-support 2017-07-25 11:42:10 +02:00
John MacFarlane
329b61ff5c LaTeX reader: support etoolbox's ifstrequal. 2017-07-24 11:20:59 +02:00
John MacFarlane
439ffc2e7f Added a test case with markdown-latex_macros. 2017-07-24 00:02:55 +02:00
John MacFarlane
be14e2b501 LaTeX reader: some improvements in macro parsing.
Fixed applyMacros so that it operates on the whole
string, not just the first token!

Don't remove macro definitions from the output,
even if Ext_latex_macros is set, so that macros will
be applied.  Since they're only applied to math in
Markdown, removing the macros can have bad effects.
Even for math macros, keeping them should be harmless.
2017-07-24 00:02:55 +02:00
Mauro Bieg
7d9b782f73 HTML Reader: parse figure and figcaption (#3813) 2017-07-22 19:22:56 +02:00
rlpowell
2ae75e23dd Added TikiWiki reader (#3800)
Added TikiWiki reader, including tests and documentation.

It's probably not *complete*, but it works pretty well, handles all
the basics (and some not-so-basics).
2017-07-21 10:09:54 +02:00
Alexander Krotov
335a1c7f48 Muse reader: fix reading of lists inside tags (#3802) 2017-07-21 10:04:13 +02:00
John MacFarlane
7191fe1f29 LaTeX reader: handle optional args in raw \titleformat.
Closes #3804.
2017-07-21 09:28:36 +02:00
John MacFarlane
56f63af3f6 LaTeX reader: fixed regression with starred environment names.
Closes #3803.
2017-07-19 17:30:22 +02:00
John MacFarlane
4e8f7a1796 Fix docx writer test for ghc 8.2.1.
Workaround for different behavior of Data.Unique in different ghc
versions.
2017-07-15 11:39:01 +02:00
John MacFarlane
3871a73e0f Rearrange docx writer roundtrip test.
I'm hoping this gives reproducible results on ghc 8.2.1.
2017-07-15 09:14:17 +02:00
John MacFarlane
4e9e1bae7c Refactored compareOutput in docx writer test 2017-07-14 23:39:33 +02:00
schrieveslaach
911b63dfc3 Add LaTeX xspace support (#3797) 2017-07-13 20:56:59 +02:00
Marc Schreiber
f93d7d06f6 Merge branch 'master' of https://github.com/jgm/pandoc into textcolor-support 2017-07-13 11:51:40 +02:00
Yuchen Pei
8b502dd50f Fixed #3760. (#3784)
Using the same solution as in the LaTeX reader:
equation -> displaymath
align -> displaymath \begin{aligned} ... \end{aligned}
etc..
2017-07-12 17:19:49 +02:00
Alexander Krotov
de117fbd9e Muse writer: indent lists inside <quote> with at least one space (#3795) 2017-07-12 17:16:02 +02:00
John MacFarlane
013fd1c6b6 Make sure \write18 is parsed as raw LaTeX.
The change is in the LaTeX reader's treatment of raw commands,
but it also affects the Markdown reader.
2017-07-12 14:50:49 +02:00
John MacFarlane
41209ea676 HTML reader: Ensure that paragraphs are closed properly...
when the parent block element closes, even without `</p>`.

Closes #3794.
2017-07-11 15:52:38 +02:00
John MacFarlane
0feb7504b1 Rewrote LaTeX reader with proper tokenization.
This rewrite is primarily motivated by the need to
get macros working properly.  A side benefit is that the
reader is significantly faster (27s -> 19s in one
benchmark, and there is a lot of room for further
optimization).

We now tokenize the input text, then parse the token stream.

Macros modify the token stream, so they should now be effective
in any context, including math. Thus, we no longer need the clunky
macro processing capacities of texmath.

A custom state LaTeXState is used instead of ParserState.
This, plus the tokenization, will require some rewriting
of the exported functions rawLaTeXInline, inlineCommand,
rawLaTeXBlock.

* Added Text.Pandoc.Readers.LaTeX.Types (new exported module).
  Exports Macro, Tok, TokType, Line, Column.  [API change]
* Text.Pandoc.Parsing: adjusted type of `insertIncludedFile`
  so it can be used with token parser.
* Removed old texmath macro stuff from Parsing.
  Use Macro from Text.Pandoc.Readers.LaTeX.Types instead.
* Removed texmath macro material from Markdown reader.
* Changed types for Text.Pandoc.Readers.LaTeX's
  rawLaTeXInline and rawLaTeXBlock.  (Both now return a String,
  and they are polymorphic in state.)
* Added orgMacros field to OrgState.  [API change]
* Removed readerApplyMacros from ReaderOptions.
  Now we just check the `latex_macros` reader extension.
* Allow `\newcommand\foo{blah}` without braces.

Fixes #1390.
Fixes #2118.
Fixes #3236.
Fixes #3779.
Fixes #934.
Fixes #982.
2017-07-07 12:36:00 +02:00
John MacFarlane
fa43c0feaa Updated jats tests for new texmath version. 2017-06-30 20:50:37 +02:00
John MacFarlane
e574d50b1c Markdown writer: Ensure that + and - are escaped properly...
so they don't cause spurious lists.  Previously they were only
if succeeded by a space, not if they were at end of line.

Closes #3773.
2017-06-30 17:41:25 +02:00
John MacFarlane
5e00cf8086 Added parameter for user data directory to runLuaFilter.
in Text.Pandoc.Lua.  Also to pushPandocModule.

This change allows users to override pandoc.lua with a file
in their local data directory, adding custom functions, etc.

@tarleb, if you think this is a bad idea, you can revert this.
But in general our data files are all overridable.
2017-06-29 17:13:19 +02:00
John MacFarlane
0f658eb46c data/pandoc.lua: regularize constructors.
We now use Pandoc instead of Doc (though Doc remains a deprecated
Synonym), and we deprecate DoubleQuoted, SingleQuoted,
InlineMath, and DisplayMath.
2017-06-29 17:08:59 +02:00
John MacFarlane
780a65f8a8 Lua filters: Remove special treatment of Quoted, Math.
No more SingleQuoted, DoubleQuoted, InlineMath, DisplayMath.
This makes everything uniform and predictable, though it does
open up a difference btw lua filters and custom writers.
2017-06-29 15:47:27 +02:00
Alexander Krotov
79cc56726c Muse reader: parse indented blockquotes (#3769) 2017-06-28 14:32:53 +02:00
John MacFarlane
33a29fbf87 RST reader: support anchors.
E.g.

    `hello`

    .. _hello:

    paragraph

This is supported by putting "paragraph" in a Div with
id `hello`.

Closes #262.
2017-06-27 15:03:16 +02:00
John MacFarlane
563c9c8687 RST reader: Handle chained link definitions.
For example,

    .. _hello:
    .. _goodbye: example.com

Here both `hello` and `goodbye` should link to `example.com`.

Fixes the first part of #262.
2017-06-27 14:35:03 +02:00
bucklereed
460b6c470b HTML reader: Use the lang value of <html> to set the lang meta value. (#3765)
* HTML reader: Use the lang value of <html> to set the lang meta value.

* Fix for pre-AMP environments.
2017-06-27 10:19:37 +02:00
Alexander Krotov
fa515e46f3 Muse writer: fix hlint errors (#3764) 2017-06-26 15:07:45 +02:00
Alexander Krotov
492b3b1291 Muse reader: fix horizontal rule parsing (#3762)
Do not parse 3 dashes as horizontal rule and allow whitespace after rule
2017-06-26 08:41:17 +02:00
Alexander Krotov
f8877516e0 Muse reader: Require space before and after '=' for code (#3758) 2017-06-25 10:01:43 +02:00
John MacFarlane
5812ac0390 Markdown reader: interpret YAML metadata as Inlines when possible.
If the metadata field is all on one line, we try to interpret
it as Inlines, and only try parsing as Blocks if that fails.

If it extends over one line (including possibly the `|` or
`>` character signaling an indented block), then we parse as
Blocks.

This was motivated by some German users finding that

    date: '22. Juin 2017'

got parsed as an ordered list.

Closes #3755.
2017-06-23 22:31:08 +02:00
John MacFarlane
2b34337a9c Text.Pandoc.Extensions: Added Ext_raw_attribute.
Documented in MANUAL.txt.

This is enabled by default in pandoc markdown and multimarkdown.
2017-06-23 00:37:13 +02:00
Alexander Krotov
2192528424 Muse reader: check that headers start at the first column (#3749) 2017-06-20 14:48:00 +02:00
John MacFarlane
6a077ac9c7 Fixed footnotes in table captions.
Note that if the table has a first page header and a
continuation page header, the notes will appear only
on the first occurrence of the header.

Closes #2378.
2017-06-20 11:21:32 +02:00
Alexander Krotov
4929d027dc Muse reader: fix list item continuation parsing (#3747) 2017-06-19 22:16:21 +02:00
Yuchen Pei
564c77964d Added Vimwiki reader (#3705).
* New module Text.Pandoc.Readers.Vimwiki, exporting readVimwiki [API change].
* New input format `vimwiki`.
* New data file, `data/vimwiki.css`, for displaying the HTML produced by this reader and pandoc's HTML writer in the style of vimwiki's own HTML export.
2017-06-19 22:15:12 +02:00
Alexander Krotov
a91b9b2a1d Add Muse reader (#3620) 2017-06-19 10:46:02 +02:00
schrieveslaach
635f299b44 Merge branch 'master' into textcolor-support 2017-06-12 15:52:29 +02:00
John MacFarlane
8a000e3ecc Markdown writer: don't allow soft break in header.
Closes #3736.
2017-06-12 09:23:30 +02:00
John MacFarlane
b466152d61 Don't allow backslash + newline to affect block structure.
Note that as a result of this change, the following,
which formerly produced a header with two lines separated
by a line break, will now produce a header followed by a
paragraph:

    # Hi\
    there

This may affect some existing documents that relied on
this undocumented and unintended behavior.

This change makes pandoc more consistent with other
Markdown implementations, and with itself (since the two-space
version of a line break doesn't work inside ATX headers, and
neither version works inside Setext headers).

Closes #3730.
2017-06-11 22:24:20 +02:00
John MacFarlane
f5d2d77ed9 Revert "Command tests: small change to try to fix appveyor failures."
This reverts commit 0ab26ac9eb.

Failed experiment.
2017-06-11 21:18:42 +02:00
John MacFarlane
0ab26ac9eb Command tests: small change to try to fix appveyor failures. 2017-06-11 11:52:53 +02:00
schrieveslaach
f36de77a25 Support for \faCheck and \faClose (#3727) 2017-06-11 07:47:42 +02:00
John MacFarlane
fa719d0264 Switched Writer types to use Text.
* XML.toEntities: changed type to Text -> Text.
* Shared.tabFilter -- fixed so it strips out CRs as before.
* Modified writers to take Text.
* Updated tests, benchmarks, trypandoc.

[API change]

Closes #3731.
2017-06-11 00:46:31 +02:00
John MacFarlane
94b3dacb4e Changed all readers to take Text instead of String.
Readers: Renamed StringReader -> TextReader.

Updated tests.

API change.
2017-06-10 18:26:44 +02:00
John MacFarlane
8218bdb95c HTML writer: Avoid two class attributes when adding 'uri' class.
Closes #3716.
2017-06-01 18:41:54 +02:00
John MacFarlane
c366fab2cb Markdown writer: Avoid inline surround-marking with empty content.
E.g. we don't want `<strong></strong>` to become `****`.
Similarly for emphasis, super/subscript, strikeout.

Closes #3715.
2017-06-01 12:30:58 +02:00
John MacFarlane
9396f1fb67 LaTeX reader: handle some width specifiers on table columns.
Currently we only handle the form `0.9\linewidth`.
Anything else would have to be converted to a percentage,
using some kind arbitrary assumptions about line widths.

See #3709.
2017-06-01 12:08:28 +02:00
Marc Schreiber
181c56d400 Add \colorbox support 2017-06-01 09:50:51 +02:00
Albert Krewinkel
e1a0666689
Org reader: respect export option for tags
Tags are appended to headlines by default, but will be omitted when the
`tags` export option is set to nil.

Closes: #3713
2017-05-31 21:26:07 +02:00
Albert Krewinkel
33a1e4ae1a
Org reader: include tags in headlines
The Emacs default is to include tags in the headline when exporting.
Instead of just empty spans, which contain the tag name as attribute,
tags are rendered as small caps and wrapped in those spans.
Non-breaking spaces serve as separators for multiple tags.
2017-05-31 20:43:30 +02:00
Albert Krewinkel
7852cd5603
Org reader: recognize babel result blocks with attributes
Babel result blocks can have block attributes like captions and names.
Result blocks with attributes were not recognized and were parsed as
normal blocks without attributes.

Fixes: #3706
2017-05-31 20:01:04 +02:00
John MacFarlane
5ec384eb60 LaTeX reader: handle escaped & inside table cell.
Closes #3708.
2017-05-29 22:47:04 +02:00
Herwig Stuetz
bfd5c6b172 Org reader: Fix cite parsing behaviour
Until now, org-ref cite keys included special characters also at the
end. This caused problems when citations occur right before colons or
at the end of a sentence.

With this change, all non alphanumeric characters at the end of a cite
key are ignored.

This also adds `,` to the list of special characters that are legal
in cite keys to better mirror the behaviour of org-export.
2017-05-28 18:08:11 +02:00
John MacFarlane
8614902234 Markdown writer: changes to --reference-links.
With `--reference-location` of `section` or `block`, pandoc
will now repeat references that have been used in earlier
sections.

The Markdown reader has also been modified, so that *exactly*
repeated references do not generate a warning, only
references with the same label but different targets.

The idea is that, with references after every block,
one  might want to repeat references sometimes.

Closes #3701.
2017-05-27 23:18:45 +02:00
Albert Krewinkel
bf93c07267
Org reader: subject full doc tree to headline transformations
Emacs parses org documents into a tree structure, which is then
post-processed during exporting. The reader is changed to do the same,
turning the document into a single tree of headlines starting at
level 0.

Fixes: #3695
2017-05-27 15:38:08 +02:00
John MacFarlane
cb7b0a6985 Allow em for image height/width in HTML, LaTeX.
- Export `inEm` from ImageSize [API change].
- Change `showFl` and `show` instance for `Dimension` so
  extra decimal places are omitted.
- Added `Em` as a constructor of `Dimension` [API change].
- Allow `em`, `cm`, `in` to pass through without conversion
  in HTML, LaTeX.

Closes #3450.
2017-05-25 22:48:27 +02:00
John MacFarlane
708973a33a Added spaced_reference_links extension.
This is now the default for pandoc's Markdown.
It allows whitespace between the two parts of a
reference link:  e.g.

    [a] [b]

    [b]: url

This is now forbidden by default.

Closes #2602.
2017-05-25 12:57:31 +02:00
John MacFarlane
e34131502a Update command tests to include stderr output. 2017-05-25 11:52:09 +02:00
John MacFarlane
895866222c Test.Command: put stderr output at front, so it can be tested. 2017-05-25 11:51:50 +02:00
John MacFarlane
41db9e826e MediaWiki reader: don't do curly quotes inside <tt> contexts.
Even if `+smart`.

See #3585.
2017-05-25 09:35:25 +02:00
John MacFarlane
b9a30ef959 Markdown reader: fixed smart quotes after emphasis.
E.g. in

    *foo*'s 'foo'

Closes #2228.
2017-05-24 23:23:08 +02:00
John MacFarlane
bc6aac7b47 Parsing: Provide parseFromString'.
This is a verison of parseFromString specialied to
ParserState, which resets stateLastStrPos at the end.
This is almost always what we want.

This fixes a bug where `_hi_` wasn't treated as emphasis in
the following, because pandoc got confused about the
position of the last word:

    - [o] _hi_

Closes #3690.
2017-05-24 22:41:47 +02:00
Marc Schreiber
b1d0c61f2d Add another test to make sure that textcolor parsing is working in the inside of a paragraph 2017-05-23 17:36:27 -03:00
Marc Schreiber
29a4bdc681 Add suggestions of @jgm: parse bracketed stuff as inlines 2017-05-23 17:31:42 -03:00
keiichiro shikano
c0c54b7906 RST Reader: parse list table directive (#3688)
Closes #3432.
2017-05-23 20:53:04 +02:00
Marc Schreiber
03cb05f4c6 Improve SVG image size code.
The old code made some unwise assumptions about
how the svg file would look.

See #3580.
2017-05-20 23:09:08 +02:00
John MacFarlane
ca77f0a95e RST writer: add empty comments when needed...
to avoid including a blocquote in the indented content
of a preceding block.

Closes #3675.
2017-05-19 21:05:15 +02:00
Albert Krewinkel
7a09b7b21d
Org reader: fix smart parsing behavior
Parsing of smart quotes and special characters can either be enabled via
the `smart` language extension or the `'` and `-` export options. Smart
parsing is active if either the extension or export option is enabled.
Only smart parsing of special characters (like ellipses and en and em
dashes) is enabled by default, while smart quotes are disabled.

This means that all smart parsing features will be enabled by adding the
`smart` language extension. Fine-grained control is possible by leaving
the language extension disabled. In that case, smart parsing is
controlled via the aforementioned export OPTIONS only.

Previously, all smart parsing was disabled unless the language extension
was enabled.
2017-05-18 23:25:11 +02:00
John MacFarlane
917612747d Test updates for latex template changes. 2017-05-18 22:46:58 +02:00
John MacFarlane
818d5c2f35 Markdown: allow attributes in reference links to start on next line.
This addresses a subsidiary issue in #3674.
2017-05-18 13:20:32 +02:00
John MacFarlane
7b3aaee15a Markdown writer: Fixed duplicated reference links
with `--reference-links` and `--reference-location=section`.
Also ensure that there are no empty link references `[]`.

Closes #3674.
2017-05-17 16:23:33 +02:00
Albert Krewinkel
af4bf91c59
Org reader: add basic file inclusion mechanism
Support for the `#+INCLUDE:` file inclusion mechanism was added.
Recognized include types are *example*, *export*, *src*, and normal org
file inclusion.  Advanced features like line numbers and level selection
are not implemented yet.

Closes: #3510
2017-05-14 12:45:31 +02:00
John MacFarlane
fbce4228a5 Merge pull request #3671 from WUUUGI/horizont-spacing
Added support for horizontal spacing in LaTeX
2017-05-16 09:18:57 +02:00
John MacFarlane
37189667cc Textile reader: fix bug for certain links in table cells.
Closes #3667.
2017-05-15 20:36:11 +02:00
Henri Werth
2de5208311 Added support for horizontal spacing in LaTeX: parse \, to \8198 (six-per-em space) 2017-05-15 16:37:08 +02:00
Alexander Krotov
c14c8a1a68 Replace repeat' and take' with `replicate' 2017-05-12 07:36:03 +02:00
Albert Krewinkel
4b9fb7a128 Combine grid table parsers
The grid table parsers for markdown and rst was combined into one single
parser, slightly changing parsing behavior of both parsers:

- The markdown parser now compactifies block content cell-wise: pure
  text blocks in cells are now treated as paragraphs only if the cell
  contains multiple paragraphs, and as plain blocks otherwise. Before,
  this was true only for single-column tables.

- The rst parser now accepts newlines and multiple blocks in header
  cells.

Closes: #3638
2017-05-11 00:17:56 +02:00
Václav Haisman
7bdf38ef2e LaTeX: Load parskip before hyperref. (#3654)
* LaTeX: Load `parskip` before `hyperref`.

According to `hyperref` package's `README.pdf`, page 22, `hyperref` package
should be loaded after `parskip` package.

* Adjust tests for previous change.
2017-05-09 22:09:10 +02:00
Alexander Krotov
69110cde81 Muse writer: Indent tables with one space (#3649)
It is required to trigger Muse table rendering.
2017-05-07 21:41:38 +02:00
John MacFarlane
de0fd90051 Use fewer quickcheck tests for lua tests, to speed things up. 2017-05-07 11:45:06 +02:00
John MacFarlane
82cc7fb0d4 Markdown reader: improved parsing of indented raw HTML blocks.
Previously we inadvertently interpreted indented HTML as
code blocks.  This was a regression.

We now seek to determine the indentation level of the contents
of an HTML block, and (optionally) skip that much indentation.

As a side effect, indentation may be stripped off of raw
HTML blocks, if `markdown_in_html_blocks` is used. This
is better than having things interpreted as indented code
blocks.

Closes #1841.
2017-05-06 22:56:16 +02:00
John MacFarlane
f20c89e243 LaTeX reader: Better handling of comments inside math environments.
This solves a problem with commented out `\end{eqnarray}` inside
an eqnarray (among other things).

Closes #3113.
2017-05-06 22:16:43 +02:00
schrieveslaach
ddf2524477 Fix keyval funtion: pandoc did not parse options in braces correctly.… (#3642)
* Fix keyval funtion: pandoc did not parse options in braces correctly. Additionally, dot, dash, and colon were no valid characters

* Add | as possible option value

* Improved code
2017-05-06 15:09:29 +02:00
John MacFarlane
2f3d62cb86 ConTeXt template: improved font handling.
simplefonts is now obsolete in ConTeXt.

This patch comes from Pablo Rodríguez via jgm/pandoc-templates#247.
2017-05-06 14:58:32 +02:00
Albert Krewinkel
da8c153a68
Org reader: support macros
Closes: #3401
2017-05-06 11:00:32 +02:00
Marc Schreiber
4ed6d91656 \textcolor will be parse as span at the beginning of a paragraph 2017-05-04 16:48:27 +02:00
Alexander Krotov
430e6be1f4 Muse writer: omit automatic header identifiers (#3633) 2017-05-04 11:36:52 +02:00
Albert Krewinkel
57cba3f1d5
Org reader: support table.el tables
Closes #3314
2017-05-03 22:43:34 +02:00
Marc Schreiber
1728d4e609 \textcolor works as inline and block command 2017-05-03 13:39:38 +02:00
Marc Schreiber
d9439808f2 Add block version of \textcolor 2017-05-03 12:00:30 +02:00
David A Roberts
79855ef934 Markdown writer: better escaping for links (#3628)
Previously the Markdown writer would sometimes create links where there
were none in the source.  This is now avoided by selectively escaping bracket
characters when they occur in a place where a link might be created.

Closes #3619.
2017-05-03 12:19:45 +02:00
schrieveslaach
6e55e6837a LaTeX reader: Add support for tabularx environment (#3632) 2017-05-03 12:16:48 +02:00
Mauro Bieg
e02cfcdeac Markdown Writer: put space before reference link definitions
Fixes #3630 (#3631).

Previously the attributes in link reference definitions did not have a space preceding.
2017-05-03 12:13:25 +02:00
Marc Schreiber
49336ee6ee Add basic \textcolor support to LaTeX reader 2017-05-02 10:48:57 +02:00
David A Roberts
c0192132cf Markdown writer: Case-insensitive reference links. (#3616)
Ensure that we do not generate reference links
whose labels differ only by case.

Also allow implicit reference links when the link
text and label are identical up to case.

Closes #3615.
2017-05-02 09:00:37 +02:00
Albert Krewinkel
ae21a8bb2a
Lua filter: fall-back to global filters when none is returned
The implicitly defined global filter (i.e. all element filtering
functions defined in the global lua environment) is used if no filter is
returned from a lua script. This allows to just write top-level
functions in order to define a lua filter. E.g

    function Emph(elem) return pandoc.Strong(elem.content) end
2017-04-30 17:06:54 +02:00
John MacFarlane
730796ee31 LaTeX writer: Fix problem with escaping in lstinline.
Previously the LaTeX writer created invalid LaTeX
when `--listings` was specified and a code span occured
inside emphasis or another construction.

This is because the characters `%{}\` must be escaped
in lstinline when the listinline occurs in another
command, otherwise they must not be escaped.

To deal with this, adoping Michael Kofler's suggestion,
we always wrap lstinline in a dummy command `\passthrough`,
now defined in the default template if `--listings` is
specified.  This way we can consistently escape the
special characters.

Closes #1629.
2017-04-29 11:05:44 +02:00
John MacFarlane
e76b672414 LaTeX writer: don't use lstinline it \item[..].
If you do, the contents of item disappear or are misplaced.
Use `\texttt` instead.

Closes #645.
2017-04-28 12:03:59 +02:00
Albert Krewinkel
24ef672132 Lua module: provide simple read format parser
A single `read` function parsing pandoc-supported formats is added to
the module. This is simpler and more convenient than the previous method
of exposing all reader functions individually.
2017-04-26 23:28:40 +02:00
Albert Krewinkel
9cd20c9b8b Lua filter: allow filtering of meta data only 2017-04-26 23:28:40 +02:00
schrieveslaach
a29fa15a7b LaTeX reader: Add basic support for hyphenat package (#3603) 2017-04-26 12:05:13 +02:00
schrieveslaach
81548960d5 LaTeX reader: Add support for \vdots (#3607) 2017-04-26 12:03:07 +02:00
John MacFarlane
66b08391b3 HTML line block: Use class instead of style attribute.
We now issue `<div class="line-block">` and include a
default definition for `line-block` in the default
templates, instead of hard-coding a `style` on the
div.

Closes #1623.
2017-04-25 23:07:30 +02:00
John MacFarlane
ee160d7c4c LaTeX writer: fix error with line breaks after empty content.
LaTeX requires something before a line break, so we insert a
`~` if no printable content has yet been emitted.

Closes #2874.
2017-04-25 15:00:27 +02:00
John MacFarlane
d17f0dab84 LaTeX reader: better support for subfigure package.
A figure with two subfigures turns into two pandoc
figures; the subcaptions are used and the main caption
ignored, unless there are no subcaptions.

Closes #3577.
2017-04-24 23:39:14 +02:00
Albert Krewinkel
04cb602d79
Org reader: allow multi-word arguments to src block params
The reader now correctly parses src block parameter list even if
parameter arguments contain multiple words.

Closes: #3477
2017-04-23 13:58:16 +02:00
Albert Krewinkel
2e43e27e5c
Org reader: stop adding rundoc prefix to src params
Source block parameter names are no longer prefixed with *rundoc*. This
was intended to simplify working with the rundoc project, a babel
runner. However, the rundoc project is unmaintained, and adding those
markers is not the reader's job anyway.

The original language that is specified for a source element is now
retained as the `data-org-language` attribute and only added if it
differs from the translated language.
2017-04-23 12:56:11 +02:00
Albert Krewinkel
04658c491b
Org reader: handle line numbering switch for src blocks
The line-numbering switch that can be given to source blocks (`-n` with
an start number as an optional parameter) is parsed and translated to a
class/key-value combination used by highlighting and other readers and
writers.
2017-04-23 11:54:36 +02:00
John MacFarlane
51a46b7e31 HTML reader: Revise treatment of li with id attribute.
Previously we always added an empty div before the list
item, but this created problems with spacing in tight
lists.  Now we do this:

If the list item contents begin with a Plain block,
we modify the Plain block by adding a Span around
its contents.

Otherwise, we add a Div around the contents of the
list item (instead of adding an empty Div to the
beginning, as before).

Closes #3596.
2017-04-23 11:03:48 +02:00
schrieveslaach
020dc63e23 Add siunitx Support (#3588)
For example:


```latex
\SI[round-precision=2]{1}{m} is equal to \SI{1000}{mm}.

\SI[round-precision=2]{1}[\$]{} is equal to \SI{0.938094}{\euro}
```
2017-04-22 21:57:21 +02:00
Albert Krewinkel
464db59394
Org reader: allow emphasized text to be followed by [
Closes: #3577
2017-04-16 21:19:35 +02:00
Albert Krewinkel
56dddcc3f5
Org reader: convert markup at beginning of footnotes
Closes: #3576
2017-04-16 17:22:47 +02:00
Albert Krewinkel
e6a536befc
Lua filter: revert to non-destructuring filters
We want to provide an interface familiar to users of other filtering
libraries.
2017-04-15 21:40:48 +02:00
John MacFarlane
bcc848d773 Avoid parsing "Notes:**" as a bare URI.
This avoids parsing bare URIs that start with a scheme
+ colon + `*`, `_`, or `]`.

Closes #3570.
2017-04-15 13:32:28 +02:00
Albert Krewinkel
3aeed816e1
Lua filter: allow shorthand functions for math and quoted
Allow to use functions named `SingleQuoted`, `DoubleQuoted`,
`DisplayMath`, and `InlineMath` in filters.
2017-04-14 23:43:59 +02:00
Albert Krewinkel
07f41a5515
Lua filter: use destructured functions for block filters
Filtering functions take element components as arguments instead of the
whole block elements. This resembles the way elements are handled in
custom writers.
2017-04-14 11:34:44 +02:00
Albert Krewinkel
425df8fff4
Use lua constructors to push meta values 2017-04-13 22:57:50 +02:00
Albert Krewinkel
2761a38e53
Lua filter: use destructured functions for inline filters
Instead of taking the whole inline element, forcing users to destructure it
themselves, the components of the elements are passed to the filtering
functions.
2017-04-12 20:48:44 +02:00
John MacFarlane
31a36cf186 Man writer: Fix handling of nested font commands.
Previously pandoc emitted incorrect markup for bold + italic, for example,
or bold + code.

Closes #3568.
2017-04-12 12:23:29 +02:00
Albert Krewinkel
41ebdee5df
Lua filter: improve doc filter performance
Pandoc elements are pushed and pulled from the lua stack via custom
instances.
2017-04-07 21:04:22 +02:00
Albert Krewinkel
d412c38c71
Ensure correctness of StackValue instances 2017-04-06 21:00:38 +02:00
John MacFarlane
6b0d3d1582 Ms writer: wider indents for lists.
Previously some indents weren't wide enough, leading
the list item to start on a line after the marker.
2017-04-06 12:45:23 +02:00
John MacFarlane
12ae1df5bf Allow raw latex commands starting with \start in Markdown.
Previously these weren't allowed because they were interpreted
as starting ConTeXt environments, even without a corresponding
\stop...

Closes #3558.
2017-04-06 11:30:03 +02:00
John MacFarlane
12a3481632 Ms writer: respect text wrapping options. 2017-04-05 15:17:35 +02:00
John MacFarlane
48729f9715 Ms writer improvements:
- added some variables to the default template.
- cleaner output for images (stringify alt text).
2017-04-04 17:21:02 +02:00
John MacFarlane
1ebb766aff Ms writer: ensure that @ is escaped in URIs.
Otherwise we may get unescaped @s that give eqn fits,
with @ as the delimiter character.
2017-04-04 16:13:24 +02:00
Timm Albers
3e817124fe Add class to footnote back references
The HTML writer now also adds the class footnoteBack to back references
of footnotes. This allows for easier CSS styling.
2017-04-03 17:02:16 +02:00
Albert Krewinkel
e7eb21ecca
Lua module: add readers submodule
Plain text readers are exposed to lua scripts via the `pandoc.reader`
submodule, which is further subdivided by format.  Converting e.g. a
markdown string into a pandoc document is possible from within lua:

    doc = pandoc.reader.markdown.read_doc("Hello, World!")

A `read_block` convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.

Custom reader options are not supported yet, default options are used
for all parsing operations.
2017-04-02 17:28:07 +02:00
John MacFarlane
1c84a03509 Ms writer: added syntax highlighting.
Closes #3547.

Macro definitions are inserted in the template when there is highlighted
code.

Limitations: background colors and underline currently not
supported.
2017-04-01 22:05:38 +02:00
John MacFarlane
34b9bee5a4 OpenDocument writer: wider labels for lists.
This avoids overly narrow labels for ordered lists with
() delimiters.

However, arguably it creates overly wide labels for bullets.

Also, lists now start flush with the margin, rather than
indented.

Fixes #2421.
2017-04-01 12:27:40 +02:00
John MacFarlane
8a3ef99882 JATS template: always include <back> element even if empty. 2017-03-31 15:15:34 +02:00
John MacFarlane
3217bc192e JATS writer: put references in <back>.
Modified template to include a `<back>` and `<body>` section.
This should give authors more flexibility, e.g. to put
acknowledgements metadata in `<back>`.  References are
automatically extracted and put into `<back>`.
2017-03-31 11:07:09 +02:00
John MacFarlane
e5e2a6e0a5 JATS writer: use both tex and mml alternatives for math when possible. 2017-03-30 16:22:54 +02:00
John MacFarlane
0d06c632b1 JATS writer: Fixed bibliography handling. 2017-03-30 15:39:21 +02:00
John MacFarlane
9575dfc970 Merge branch 'jats' 2017-03-30 01:17:36 +02:00
John MacFarlane
831e1c5edd Added JATS writer.
* New module Text.Pandoc.Writer.JATS exporting writeJATS.
* New output format `jats`.
* Added tests.
* Revised manual.
2017-03-30 01:16:34 +02:00
schrieveslaach
5fe734d452 lstinline with braces can be used (verb cannot be used with braces) (#3535)
* Fix lstinline handling: lstinline with braces can be used (verb cannot be used with braces)

* Use codeWith and determine the language from lstinline

* Improve code

* Add another test: convert lstinline without language option
2017-03-29 14:49:46 +02:00
schrieveslaach
49d72444d7 LaTeX reader: add support for LaTeX subfiles package.
Closes #3530.
2017-03-27 21:20:27 +02:00
John MacFarlane
fddd6ffdd0 Add blank lines to #3531 command test. 2017-03-26 20:48:54 +02:00
John MacFarlane
358dfba8f4 MediaWiki writer: don't softbreak lines inside list items.
Closes #3531.
2017-03-26 20:41:09 +02:00
John MacFarlane
0eb62f03fe Ms writer: Hyperlink table of contents and other improvements. 2017-03-26 20:03:37 +02:00
John MacFarlane
bd99d9f6af Ms writer: Add PDF outline bookmarks. 2017-03-26 18:06:15 +02:00
John MacFarlane
0cb0aa7308 Fixed a test not updated on last commit. 2017-03-26 17:15:53 +02:00
John MacFarlane
e30d2c700a Ms writer: Use @ instead of | for inline math delimiter.
The `|` delimiter had a bad interaction with tbl.
See discussion in #1839.
2017-03-26 16:59:38 +02:00
John MacFarlane
267e1a13ea Ms writer: Support external links.
Also add config options for link color.
2017-03-26 11:05:23 +02:00
John MacFarlane
d9e8e84be0 Ms writer: better placement of header anchors. 2017-03-26 10:44:34 +02:00
John MacFarlane
1d659bec01 Ms writer: Implement header identifiers and internal links. 2017-03-25 22:16:44 +01:00
John MacFarlane
ed6249bd0b Ms writer: use light gray for strikeout.
Pending groff definitions for striking out an arbitrary
section of text (not just a few words).
2017-03-25 20:53:32 +01:00
John MacFarlane
c941a00cac Ms writer: improved pdf metadata. 2017-03-25 19:30:24 +01:00
John MacFarlane
7d3d5387ac Updated test suite for ms template change. 2017-03-25 11:45:05 +01:00
John MacFarlane
2e20129903 Ms. writer: links: use footnote only for absolute URIs. 2017-03-25 10:35:05 +01:00
John MacFarlane
14ebd289ea Updated tests. 2017-03-25 09:27:04 +01:00
John MacFarlane
c13cfe8f5d Ms writer: Use indented paragraphs after first in section.
Note that the current indentation setting is 0; see the
settings in the template.
2017-03-24 23:32:28 +01:00
John MacFarlane
af57de0b27 default.ms: Add settings for document variables like width. 2017-03-24 22:15:46 +01:00
John MacFarlane
a7ae4b1ee2 Ms writer: support --toc, date, abstract. 2017-03-24 17:25:09 +01:00
John MacFarlane
438e8686cf Markdown writer: don't emit a simple table if simple_tables disabled.
Closes #3529.
2017-03-24 16:11:56 +01:00
John MacFarlane
2251d9cb73 Ms writer: Use custom .HRULE macro for horizontal rule. 2017-03-24 09:23:19 +01:00
John MacFarlane
ffd699385a Ms writer: improved definition lists.
Use standard .IP macro.
Also properly escape ".
2017-03-23 17:29:26 +01:00
John MacFarlane
a939cfe769 Pipe tables: impose minimum cell size.
This might help with #3526.
At any rate, it fixes another bug (see test/command/3526.md).
2017-03-23 16:54:47 +01:00
John MacFarlane
e92941a9ca Grid tables: remove unnecessary extra space in cells. 2017-03-23 14:59:51 +01:00
John MacFarlane
e180a2efa6 Ms writer: fixed hard line breaks. 2017-03-23 14:48:09 +01:00
John MacFarlane
86142ab7c0 Updated ms tests. 2017-03-23 14:33:29 +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
286b320fb0 Added to issue 3516 command test to debug test failure on appveyor. 2017-03-22 14:36:12 +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
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
John MacFarlane
fff3489bf3 Removed failing part of 3348 test.
This was failing because of a small discrepancy in markdown
table header line lengths on appveyor.

It's a minor issue, I can't see what is causing it, and
it's irrelevant to the issue this is testing, so we'll
just write native for this test.
2017-03-19 20:37:39 +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
435221a9f3 Added test case to 3348 to try to figure out why appveyor build fails. 2017-03-17 17:10:43 +01:00
John MacFarlane
8f90b83fee Adjust command test 3348.md to specify column width.
This is meant to address a test failure on appveyor.
2017-03-17 16:19:51 +01:00
John MacFarlane
090165d714 Added test for #256. 2017-03-16 22:31:36 +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
2235c2a8f7 Use tasty-golden for golden tests in Old. 2017-03-15 00:27:39 +01:00
John MacFarlane
93c49a2865 Command tests: just findPandoc once. 2017-03-14 23:39:28 +01:00
John MacFarlane
14edbd2967 Removed unneeded import. 2017-03-14 21:30:15 +01:00
John MacFarlane
6cb54c3def Got rid of distracting warning in test output. 2017-03-14 21:06:14 +01:00
John MacFarlane
ebbaf2e965 Small test plumbing improvement. 2017-03-14 17:27:30 +01:00
John MacFarlane
6ecc5b96a9 Use tasty for tests rather than test-framework. 2017-03-14 17:07:23 +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
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
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
62becc1536 Changed test case labeled 3384.md to 3348.md.
The last commit referred to #3384, but should have
closed #3348.
2017-03-11 23:29:57 +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
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
c46febaaee Expand \newenvironment macros.
Closes #987.

Depends on still unreleased texmath 0.9.3.
2017-03-10 09:46:32 +01:00