Commit graph

977 commits

Author SHA1 Message Date
John MacFarlane
1a102c11a9 Fix test case for #5014. 2018-11-13 14:50:26 -08:00
John MacFarlane
1cfdd3662f HTML reader: allow thead containing a row with td rather than th.
See #5014.

Note that this doesn't address the original issue in #5014,
only an unrelated side-issue.
2018-11-13 14:49:12 -08:00
Alexander Krotov
4079697281 Muse writer: output tables with one column as grid tables 2018-11-13 18:44:56 +03:00
John MacFarlane
52a57a5362 LaTeX writer: don't emit [<+->] unless beamer output,
even if `writerIncremental` is True.

See #5072.
2018-11-12 09:43:12 -08:00
John MacFarlane
5bc38a741b Exactly match GitHub's identifier generating algorithm.
See #5057.
2018-11-11 20:45:38 -08:00
John MacFarlane
a36d202e86 Text.Pandoc.Shared: add parameter to uniqueIdent, inlineListToIdentifier.
The parameter is Extensions. This allows these functions to
be sensitive to the settings of `Ext_gfm_auto_identifiers` and
`Ext_ascii_identifiers`.

This allows us to use `uniqueIdent` in the CommonMark reader,
replacing some custom code.

It also means that `gfm_auto_identifiers` can now be used
in all formats.

Semantically, `gfm_auto_identifiers` is now a modifier of
`auto_identifiers`; for identifiers to be set, `auto_identifiers`
must be turned on, and then the type of identifier produced
depends on `gfm_auto_identifiers` and `ascii_identifiers` are set.

Closes #5057.
2018-11-11 13:46:23 -08:00
John MacFarlane
65ca95eeea Texinfo writer: add blank line before @menu section.
Closes #5055.
2018-11-07 15:27:02 -08:00
John MacFarlane
5f030f3c2c Add command test for #5050. 2018-11-06 22:57:11 -08:00
John MacFarlane
985db7b0a8 ICML writer: consolidate adjacent strings, inc. spaces.
This avoids chunking up the output unnecessarily into
separate elements.
2018-11-06 22:54:25 -08:00
Alexander Krotov
928ec21732 Use OverloadedStrings extension to simplify Muse writer tests 2018-11-06 00:04:33 +03:00
quasicomputational
a747268823 CommonMark writer: respect --ascii (#5043) 2018-11-05 09:33:10 -08:00
John MacFarlane
511d647290 XML: toHtml5Entities: prefer shorter entities...
when there are several choices for a particular character.
2018-11-04 22:15:53 -08:00
Alexander Krotov
0c84630549 Muse writer: add support for --reference-location=
Address #107
2018-11-05 08:42:52 +03:00
John MacFarlane
2f65263851 AsciiDoc writer: use single-line section headers.
The underline style is now deprecated.
Previously `--atx-headers` would enable the single-line
style; now the single-line style is always used.

Closes #5038.
2018-11-03 12:03:05 -07:00
Yan Pashkovsky
43a0734f62 table tests 2018-11-02 22:42:51 -07:00
John MacFarlane
805b9f8a12 Roff reader: Improved handling of custom strings as arguments.
Added test.
2018-11-02 21:35:49 -07:00
John MacFarlane
e01ca77313 grofftest.sh - set resource path more appropriately. 2018-11-02 17:22:56 -07:00
John MacFarlane
c71fbb18e1 Improve test/grofftest.sh.
Use --resource-path.
Use iconv for latin1 man pages.
Recurse into subdirectories.
2018-11-02 10:59:38 -07:00
John MacFarlane
26341c1632 Implement --ascii for Markdown writer. 2018-11-01 16:31:04 -07:00
John MacFarlane
f379edc4ad HTML writer: use character entities references when possible for HTML5. 2018-11-01 16:08:27 -07:00
John MacFarlane
714e0eb834 ZimWiki writer: number ordered list items sequentially...
rather than always with 1.
2018-10-31 22:02:10 -07:00
John MacFarlane
e0290fd18b LaTeX writer: add newline if math ends in a comment.
This prevents the closing delimiter from being swalled
up in the comment.

Closes #4880.
2018-10-31 21:51:20 -07:00
John MacFarlane
3305a018bc Roff reader: properly handle unknown backslash escapes.
They are treated as regular characters, according to groff 7.

Cloess #5034.
2018-10-30 15:54:29 -07:00
John MacFarlane
4fe28e947a ZimWiki writer: remove extra indentation on lists.
Closes #4963.
2018-10-29 22:33:11 -07:00
John MacFarlane
c51be5dfc8 LaTeX reader: allow space at end of math after \.
Closes #5010.

Expose trimMath from T.P.Shared.
2018-10-29 22:20:14 -07:00
John MacFarlane
8d55dc10cd Roff tokenizer: better handling of escapes. 2018-10-28 21:37:57 -07:00
John MacFarlane
22755a35b7 Roff tokenizer: revamped font parsing using escapeArg.
Add support for \C'...' escapes.
2018-10-28 18:06:34 -07:00
Albert Krewinkel
6f29e1c9c1 T.P.Lua: rename runPandocLua to runLua (API change) 2018-10-28 12:08:52 -07:00
Albert Krewinkel
7f54f76e8b T.P.Lua: merge runLuaFilter into T.P.Filter.Lua (API change)
The function `runLuaFilter` was only used in Text.Pandoc.Filter.Lua, use
apply from the that module instead.
2018-10-28 12:08:52 -07:00
John MacFarlane
e96bb43ceb Man reader: allow block-level content in table cells.
Closes #5028.
2018-10-27 23:37:18 -07:00
Alexander Krotov
f8ca36525d Muse: Make tables round-trip 2018-10-28 03:52:35 +03:00
Alexander Krotov
e34a0703f5 Muse reader: try to parse lists before trying to parse table
This ensures that tables inside lists are parsed correctly.
2018-10-28 03:52:25 +03:00
Alexander Krotov
d8135b2e67 Remove misleading comment from Muse reader tests
pandoc follows Text::Amuse rules instead of being bug compatible with Emacs Muse
2018-10-27 23:43:23 +03:00
Alexander Krotov
d28dca57db Muse reader: forbid whitespace after opening and before closing markup elements
See https://github.com/melmothx/text-amuse/issues/44 for discussion on these rules
2018-10-27 23:35:11 +03:00
Alexander Krotov
1ca320e249 Muse reader: parse page breaks 2018-10-26 16:30:15 +03:00
John MacFarlane
5945c3b011 Man reader: support tables.
Closes #4982.
2018-10-25 22:13:41 -07:00
Albert Krewinkel
096cbe6987 Lua: allow access to pandoc state (#5015)
* Lua: allow access to pandoc state

Lua filters and custom writers now have read-only access to most fields
of pandoc's internal state via the global variable `PANDOC_STATE`.

* Lua: allow iterating through fields of PANDOC_STATE

* Lua filters doc: describe CommonState

* Lua filters doc: mention global variable PANDOC_STATE

* Lua: add access to logs

Log messages can currently only be printed, but not decomposed.
2018-10-25 22:12:14 -07:00
Alexander Krotov
07fc850172 Muse writer: add support for grid tables 2018-10-25 18:35:02 +03:00
John MacFarlane
3a9f807052 GroffChar: added @ to list of standard escapes.
Because we use it as a delimiter for tables (in man)
and for math (in ms).
2018-10-24 08:59:10 -07:00
Alexander Krotov
f859162554 Vimwiki reader: test empty preformatted text 2018-10-24 15:07:05 +03:00
John MacFarlane
8efb8975ed Groff writer character escaping changes.
T.P.GroffChar:  replaced `essentialEscapes` with `manEscapes`,
which includes all the escapes mentioned in the groff_man manual.

T.P.Writers.Groff: removed escapeCode; changed parameter on
escapeString from Bool to new type `EscapeMode`.
Rewrote `escapeString`.
2018-10-23 21:44:07 -07:00
John MacFarlane
bda1c0da81 Man reader: Handle optional argument in ME, UE macros.
Closes #4995.
2018-10-22 23:56:02 -07:00
John MacFarlane
261cbad0ef Groff writers escaping changes.
- Improve escaping of accented characters with `--ascii`.
  Combining accents are now handled properly.
- Don't escape spaces and tabs in code blocks. This doesn't
  seem to be necessary.
2018-10-22 23:48:12 -07:00
Brian Leung
7eea5c62ed LaTeX reader: add support for nolinkurl command. (#4992) 2018-10-22 23:36:44 -07:00
Alexander Krotov
4275d58a9f Muse writer: do not insert newline before lists 2018-10-23 03:38:59 +03:00
John MacFarlane
0327226d4c Man reader: don't parse \[ul] as unicode escape. 2018-10-22 12:05:34 -07:00
John MacFarlane
4625150f4c Man reader: fix code block tests.
They incorporated a spurious newline which needs to be
removed.
2018-10-21 23:01:58 -07:00
John MacFarlane
382763a7db Man reader: support .ds, .ds1; also fix macro arguments.
Closes #4997.
2018-10-21 22:00:50 -07:00
Alexander Krotov
875e33ecf6 Muse reader: allow footnotes to start with empty line
A space character was required after footnote marker, now newline is allowed.
2018-10-22 03:05:17 +03:00
John MacFarlane
1238a57456 Man reader: Moved handling of B, I, BI, IB, etc. to parsing phase.
Ultimately groff lexing should not handle man-specific macros.
This approach also gives more correct results for the test case.
2018-10-21 12:43:44 -07:00
John MacFarlane
25248c7a37 Man reader: move macro resolution to lexer phase.
We also introduce a new type ManTokens (a sequence of tokens)
and remove MComment.  This allows lexers to return empty strings
of tokens, or multiple tokens (as when macros are resolved).

One test still fails.  This needs to be fixed by moving handling
of .BI, .I, etc. to the parsing phase.
2018-10-21 12:08:54 -07:00
Alexander Krotov
a98e2b7c42 Muse writer: use lightweight markup after </em> tag 2018-10-21 20:23:10 +03:00
John MacFarlane
9593b375d7 Man reader: support UR/UE, MT/ME for links.
Closes #4989.
2018-10-20 22:55:20 -07:00
John MacFarlane
2b7a541dd0 Man reader: Fixed handling of nested fonts.
Closes #4978.
2018-10-20 22:41:39 -07:00
Alexander Krotov
8df59952bf Muse reader: allow empty headers
Previously empty headers caused parser to terminate without parsing the rest of the document.
2018-10-21 06:42:00 +03:00
John MacFarlane
f202279902 Man reader: Fix .B, .I, .BR, etc. 2018-10-20 16:40:44 -07:00
John MacFarlane
a9fc71118f Man reader: major restructuring, support macros.
- Improved support for custom macro definitions.
- LinePart type has been added. RoffStr is now one
  constructor of LinePart (the other being MacroArg).
- MComment has lost its argument.
- MEndMacro has been removed.
- MStr has been removed (we now simply use LinePart).
- Macros now store a list of tokens.
- Each macro argument is a [LinePart], instead of a LinePart.
- .BR now behaves as documented in man (and doesn't create a link).
2018-10-20 15:57:34 -07:00
John MacFarlane
8d4027da4d Man reader: block quotes (using RS..RE). 2018-10-20 10:07:28 -07:00
John MacFarlane
1b19e79650 Man reader: parse TP as definition lists.
Closes #4981.
2018-10-20 10:00:50 -07:00
John MacFarlane
62566c8182 Man reader: handle shift in list style.
Closes #4987.
2018-10-20 09:30:37 -07:00
Jesse Rosenthal
11e681edac Powerpoint tests: test raw openxml
Output files confirmed not to be corrupt, and with content as
expected, on PowerPoint 2013 on Windows 10 (virtualbox on linux).
2018-10-20 09:00:23 -04:00
John MacFarlane
c60ac7c9ab Man reader: improve treatment of .TH.
This should just add to metadata (title, date, section),
and not produce a level-1 header. (That might be done
in the template, depending on the output format.)
2018-10-19 23:55:01 -07:00
John MacFarlane
7dd06e96d7 Man reader: Improved header parsing.
- .SH should be level 1, .SS level 2.
- The header title can come on the next line.
2018-10-19 23:27:04 -07:00
John MacFarlane
13e443d7cc Man writer: avoid unnecessary .RS/.RE pair in defn lists.
When the definition is just one paragraph, we don't need
the `.RS\n.RE`.
2018-10-19 23:01:02 -07:00
John MacFarlane
f5704fac97 Man reader: properly handle multi-block list items.
Closes #4985.
2018-10-19 22:54:05 -07:00
John MacFarlane
790ada8946 Man reader: Added more tests for escapes.
Closes #4983.
2018-10-19 15:36:43 -07:00
John MacFarlane
56c4a11f97 Man reader: minor improvements.
use `trimInlines` for Para content to avoid leading and
trailing spaces.

Fix handling of \" in middle of line.

Add more tests for escapes.
2018-10-19 15:17:53 -07:00
John MacFarlane
e6772360f6 More man reader test updates. 2018-10-19 14:59:11 -07:00
John MacFarlane
2ee9cdcc60 Update tests for last change to man reader. 2018-10-19 14:27:13 -07:00
John MacFarlane
400e87df1d Update man reader tests. 2018-10-18 23:54:13 -07:00
John MacFarlane
7d5b25d6d6 GroffChar: fixed interpretation of \-.
It is the ascii - sign, not the unicode hyphen.
2018-10-18 23:54:13 -07:00
John MacFarlane
94c73e84d5 Merge branch 'Yanpas-groff_reader' 2018-10-18 20:58:46 -07:00
John MacFarlane
efbb329f1a Groff escaping changes.
- `--ascii` is now turned on automatically for man output, for
  portability.  All man output will be escaped to ASCII.
- In T.P.Writers.Groff, `escapeChar`, `escapeString`, and
  `escapeCode` now take a boolean parameter that selects
  ascii-only output.  This is used by the Ms writer for
  `--ascii`, instead of doing an extra pass after writing
  the document.
- In ms output without `--ascii`, unicode is used whenever
  possible (e.g. for double quotes).
- A few escapes are changed: e.g. `\[rs]` instead of `\\` for
  backslash, and `\ga]` instead of `` \` `` for backtick.
2018-10-18 10:21:34 -07:00
John MacFarlane
24f388e1a7 man/ms writers: use \[at] for escaped @. 2018-10-17 17:39:42 -07:00
John MacFarlane
f48960b75f Move common groff functions to Text.Pandoc.Writers.Groff
(unexported module).  These are used in both the man and ms
writers.

Moved groffEscape out of Text.Pandoc.Writers.Shared [cancels earlier
API change from adding it, which was after last release].

This fixes strong/code combination on man (should be `\f[CB]` not
`\f[BC]`), mentioned in #4973.

Updated tests.

Closes #4975.
2018-10-17 17:26:37 -07:00
Alexander Krotov
b3feaba6af Man writer: use \f[R] instead of \f[] to reset font
Fixes #4973
2018-10-17 18:29:07 +03:00
Alexander Krotov
6fc812485e Muse reader: allow examples to be indented with tabs 2018-10-17 18:17:30 +03:00
Alexander Krotov
1071732719 Muse reader: remove indentation from examples indicated by {{{ and }}} 2018-10-17 13:57:05 +03:00
John MacFarlane
5c42101ee9 Merge branch 'groff_reader' of https://github.com/Yanpas/pandoc into Yanpas-groff_reader 2018-10-16 18:39:20 -07:00
Yan Pas
7741cdbf04 added old-style test 2018-10-17 00:21:52 +03:00
John MacFarlane
885cbfd420 Only override --quickcheck-tests=N if N is not default value (100).
Some of the round-trip tests are set to do a maximum of 25
trials when the default value is given.

Closes #4956.
2018-10-15 22:15:43 -07:00
Yan Pas
ce27bf9a02 builders 2018-10-16 03:12:06 +03:00
John MacFarlane
6f6ad0514d LaTeX reader: make macroDef polymorphic and allow in inline context.
Otherwise we can't parse something like
```
\lowercase{\def\x{Foo}}
```
I have actually seen tex like this in the wild.
2018-10-15 11:46:31 -07:00
John MacFarlane
22f81f78bd Added failing test case for macros. 2018-10-15 00:37:17 -07:00
John MacFarlane
88faa45f1d Markdown writer: ensure blank between raw block and normal content.
Otherwise a raw block can prevent a paragraph from being
recognized as such.

Closes #4629.
2018-10-14 17:12:06 -07:00
John MacFarlane
cf8224045b Markdown reader: Fix awkward soft break movements before abbreviations.
Closes #4635.
2018-10-14 13:02:36 -07:00
Yan Pas
3fed62611e tests, commented debug functions 2018-10-14 00:57:15 +03:00
John MacFarlane
f5c64c3060 HTML reader: fix htmlTag and isInlineTag to accept processing instructions.
Fixes regression #3123 (since 2.0). Added regression test.
2018-10-11 09:58:25 -07:00
Alexander Krotov
6b8fd99dbd Test that Muse reader can parse code with = sign inside
(fixed by previous commit)
2018-10-10 03:27:36 +03:00
Alexander Krotov
d3b2161bd1 Muse reader: fix parsing of empty cells 2018-10-10 01:48:58 +03:00
Yan Pas
07b4d7b297 posix man files parsed successfully 2018-10-09 23:59:12 +03:00
John MacFarlane
30033f417f Docx writer: added framework for custom properties.
So far, we don't actually write any custom properties,
but we have the infrastructure to add this.

See #3034.
2018-10-09 10:38:50 -07:00
John MacFarlane
58eb78c437 Fixed tests for new skylighting. 2018-10-08 23:16:50 -07:00
John MacFarlane
a92e43575f LaTeX writer: with --biblatex, use \autocite when possible.
`\autocites{a1}{a2}{a3}` will not collapse the entries.
So, if we don't have prefixes and suffixes, we use instead
`\autocite{a1;a2;a3}`.

Closes #4960.
2018-10-08 20:47:09 -07:00
John MacFarlane
145710c4c3 RST reader: don't allow single-dash separator in headerless table.
Closes #4382.
2018-10-07 12:37:08 -07:00
John MacFarlane
b806bff5b4 LaTeX reader: fix bugs omitting raw tex.
The default is `-raw_tex`, so no raw tex should result
unless we explicitly say `+raw_tex`.  Previously some
raw commands did make it through.

Closes #4527.
2018-10-07 12:21:43 -07:00
John MacFarlane
08fef6b210 RST reader: pass through fields in unknown directives as div attributes.
This commit also adds support for `class` and `name` attributes to
directives in general.

Closes #4715.
2018-10-07 11:44:11 -07:00
Yan Pas
c7aa7a83dd test suite and more secapes 2018-10-07 19:55:10 +03:00
Yan Pas
27467189ab Merge branch 'master' into groff_reader 2018-10-07 18:10:01 +03:00
John MacFarlane
bd8a66394b RST writer: use simple tables when possible.
Closes #4750.

Text.Pandoc.Writers.Shared now exports hasSimpleCells [API change].
2018-10-06 22:33:24 -07:00