Commit graph

5821 commits

Author SHA1 Message Date
John MacFarlane
bccfb1177f Man reader: support \*[lq], \*[rq]. 2018-10-20 10:49:42 -07:00
John MacFarlane
08179695fa Man reader: support '..' (end macro).
Also give feedback for unknown character codes,
and return a replacement character U+FFFD.
2018-10-20 10:46:08 -07:00
John MacFarlane
02b33a7d63 Man reader: handle lines with just one period. 2018-10-20 10:46:08 -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
John MacFarlane
faa35bb014 Man reader: minor refactoring. 2018-10-20 09:30:37 -07:00
Jesse Rosenthal
5547cd6000 Powerpoint: Support raw openxml in pptx writer.
This allows raw openxml blocks and inlines to be used in the pptx
writer.

A few caveats:

1. It's up to the user to write well-formed openxml. The chances for
corruption, especially with such a brittle format as pptx, is pretty
high.

2. Because of the tricky way that blocks map onto shapes, if you are
using a raw block, it should be the only block on a slide (otherwise
other text might end up overlapping it).

3. The pptx ooxml namespace abbreviations are different from the docx ooxml
namespaces. Again, it's up to the user to get it right. Unzipped
document and ooxml specification should be consulted.

Closes: #4976
2018-10-20 08:43:50 -04:00
John MacFarlane
0c419a01f7 Man reader: skip optional .IP before code block. 2018-10-19 23:59:12 -07: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
eaef849536 Man reader: remove commented-out code. 2018-10-19 23:29:49 -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
3b710b6fa7 Man reader: minor refactoring. 2018-10-19 20:56:00 -07:00
John MacFarlane
7a3380381c Man reader: Nicer looking "skipped content" report.
Just give the macro name, which users will recognize,
rather than the internal token.
2018-10-19 16:24:30 -07:00
John MacFarlane
574f9250a7 Man reader: got rid of MUnknownMacro and simplified code. 2018-10-19 16:09:56 -07:00
John MacFarlane
31821451f0 Man reader: remove algebraic type for MacroKind.
Instead, just use a String for the literal macro.
This makes the code easier to follow and yields better
info messages for ignored content.

Closes #4980.
2018-10-19 16:03:12 -07:00
John MacFarlane
2451d38147 Use man reader for files with extension dot + digit. 2018-10-19 16:02:05 -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
f61d35fd5a Man reader: generate Space elements correctly.
Closes #4979.
2018-10-19 14:19:44 -07:00
John MacFarlane
a49cd34983 Man reader: improve list parsing.
We now handle all kinds of ordered list markers.
We also avoid having an extra bullet character
in bullet list contents.
2018-10-18 23:54:13 -07:00
John MacFarlane
b59ba39e1a Man reader: remove final newline in code blocks.
This is consistent with other readers.
2018-10-18 23:54:13 -07:00
John MacFarlane
e9c422649d Man reader: use report instead of logMessage. 2018-10-18 23:54:13 -07:00
John MacFarlane
e15b5b360f Man reader: improved parsing of groff escapes.
We now handle all the named escapes, plus combining accents
and unicode escapes.
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
5935718628 Remove unneeded import. 2018-10-18 10:57: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
bbd94eae2b Add Text.Pandoc.GroffChar.
This will hold common escaping data for groff characters.
2018-10-18 09:39:55 -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
Alexander Krotov
7f814c5339 Muse reader: simplify "atStart" 2018-10-16 19:26:54 +03:00
Alexander Krotov
d2262122d3 Muse reader: code cleanup 2018-10-16 18:40:52 +03:00
Alexander Krotov
50aa7bfddc Muse reader: simplify "commonPrefix" implementation 2018-10-16 16:23:59 +03:00
Alexander Krotov
d3ba2fc3d8 Muse reader: simplify emphasis parsing 2018-10-16 15:56:07 +03:00
John MacFarlane
85394d4034 LaTeX reader: small verbatim mode cleanups. 2018-10-15 17:28:37 -07:00
John MacFarlane
252398a4f3 LaTeX reader: withVerbatimMode now does nothing if already in
verbatim mode.  Previously nested uses wouldn't work properly.
2018-10-15 17:28:10 -07:00
John MacFarlane
5bd852c5db LaTeX reader: simplified type on doMacros'. 2018-10-15 17:16:01 -07:00
Yan Pas
ce27bf9a02 builders 2018-10-16 03:12:06 +03:00
John MacFarlane
ae51de3b3d LaTeX reader: small efficiency improvement. 2018-10-15 15:54:49 -07:00
John MacFarlane
1db585689a LaTeX reader: tokenize before pulling tokens,
rather than after.  This has some performance penalty
but is more reliable.

Closes #4408.
2018-10-15 15:54:49 -07:00
Yan Pas
1684e918b2 font as a set of styles, mono font support 2018-10-16 01:53:04 +03:00
Yan Pas
2ca50e95b7 style issues 2018-10-15 23:35:27 +03:00
John MacFarlane
788b1bb3d8 LaTeX reader: more care with verbatim mode in macro definitions.
This solves some of the issues in #4408, but it is fragile and may
introduce new problems. We really need to change the approach
fundamentally and expand macros before pulling tokens from the stream,
rather than after.
2018-10-15 12:32:38 -07:00