Commit graph

11545 commits

Author SHA1 Message Date
John MacFarlane
15fa5455e2 Man reader: support .SY, .OP macros.
Closes #4994.
2018-10-21 21:06:46 -07:00
Alexander Krotov
fe99001d9f hlint Muse writer 2018-10-22 03:14:45 +03: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
95b9d94092 Man reader: improved escaping code.
We're now set up to handle user string substitutions `\*(xy` better.

The present approach has some inefficient list concatenation,
but we can fix that later.
2018-10-21 16:18:30 -07:00
John MacFarlane
1561bf2ecb Man reader: slightly improved handling of \* escapes. 2018-10-21 15:10:37 -07:00
John MacFarlane
3fa9a838c0 Man reader: Support .so for include files.
Closes #4986.
2018-10-21 13:10:42 -07:00
John MacFarlane
0ac43ab2a8 Man reader: moved all lexer functions to the front. 2018-10-21 12:57:57 -07:00
John MacFarlane
6b553c2e22 Man reader: Moved handling of P, PP, LP to parser phase. 2018-10-21 12:53:26 -07:00
John MacFarlane
f3a71d723b Man reader: added type synonym for Arg. 2018-10-21 12:48:14 -07: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
e388dddefa Man reader: Clean up inline parsing. 2018-10-21 12:18:53 -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
3ec0b78343 Man reader: allow unescaped " in plain arguments. 2018-10-20 22:59:30 -07: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
78bec0837d Muse reader: make sure that the whole text is parsed 2018-10-21 06:42:17 +03: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
f3954553a4 Man reader: some support for custom macros. 2018-10-20 11:37:15 -07:00
John MacFarlane
3e23b472f2 Man reader: skip macro definitions for now. 2018-10-20 11:06:30 -07:00
John MacFarlane
446790e95b Man reader: raise parse error if we don't get through whole input. 2018-10-20 10:55:16 -07:00
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
Albert Krewinkel
916db81ade
Lua filters: iterate over AST element fields when using pairs
This makes it possible to iterate over all field names of an AST element
by using a generic `for` loop with `pairs`:

    for field_name, field_content in pairs(element) do
      …
    end

Raw table fields of AST elements should be considered an implementation
detail and might change in the future. Accessing element properties
should always happen through the fields listed in the Lua filter docs.

Note that the iterator currently excludes the `t`/`tag` field.
2018-10-20 19:14:17 +02: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
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
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
cfa824b977 Regenerated man page. 2018-10-19 23:02:42 -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
c01897281a Update man page to use \[at] instead of \@. 2018-10-19 22:56:40 -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
4333556bcf stack.yaml - use latest cmark-gfm, pandoc-citeproc. 2018-10-19 20:28:35 -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
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