Commit graph

443 commits

Author SHA1 Message Date
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
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
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
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
895866222c Test.Command: put stderr output at front, so it can be tested. 2017-05-25 11:51:50 +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
Alexander Krotov
c14c8a1a68 Replace repeat' and take' with `replicate' 2017-05-12 07:36:03 +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
Albert Krewinkel
da8c153a68
Org reader: support macros
Closes: #3401
2017-05-06 11:00:32 +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
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
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
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
425df8fff4
Use lua constructors to push meta values 2017-04-13 22:57:50 +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
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
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
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
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
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
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
93a9c09b6b Speed up Native writer quickcheck tests. 2017-03-07 15:14:36 +01:00
John MacFarlane
69c4602f46 Small change to unbalanced bracket test to speed up test suite. 2017-03-07 15:03:26 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
John MacFarlane
fe4311d5a1 LaTeX writer: always add hypertarget when there's a non-empty identifier.
Previously the hypertargets were only added when there was actually
a link to that identifier.  Closes #2719.
2017-03-01 21:38:28 +01:00
Alexander Krotov
48f809384a Add Org writer unit tests 2017-02-12 17:09:07 +03:00
John MacFarlane
76c55466d3 Use new warnings throughout the code base. 2017-02-11 00:14:44 +01:00
John MacFarlane
47a16065c4 Removed --parse-raw and readerParseRaw.
These were confusing.

Now we rely on the +raw_tex or +raw_html extension with latex
or html input.

Thus, instead of

    --parse-raw -f latex

we use

    -f latex+raw_tex

and instead of

     --parse-raw -f html

we use

    -f html+raw_html
2017-02-06 23:33:23 +01:00
John MacFarlane
a435422d0f Consolidated some common functions in Tests.Helper. 2017-02-04 21:56:32 +01:00
John MacFarlane
49c7cf40fe Added new test framework Tests.Command.
Any files added under test/command will be treated as
shell tests (see smart.md for an example).

This makes it very easy to add regression tests etc.
2017-02-04 21:07:03 +01:00
John MacFarlane
7ea4ad11bb Added skeleton for Tests.Command. 2017-02-04 17:38:03 +01:00
John MacFarlane
18ab864269 Moved tests/ -> test/. 2017-02-04 12:56:30 +01:00