Class | Asciidoctor::Converter::ManPageConverter |
In: |
lib/asciidoctor/converter/manpage.rb
|
Parent: | Converter::BuiltIn |
A built-in {Converter} implementation that generates the man page (troff) format.
The output follows the groff man page definition while also trying to be consistent with the output produced by the a2x tool from AsciiDoc Python.
See www.gnu.org/software/groff/manual/html_node/Man-usage.html#Man-usage
LF | = | %(\n) |
TAB | = | %(\t) |
WHITESPACE | = | %(#{LF}#{TAB} ) |
ET | = | ' ' * 8 |
ESC | = | %(\u001b) |
ESC_BS | = | %(#{ESC}\\) |
ESC_FS | = | %(#{ESC}.) |
LiteralBackslashRx | = | /(?:\A|[^#{ESC}])\\/ |
LeadingPeriodRx | = | /^\./ |
EscapedMacroRx | = | /^(?:#{ESC}\\c\n)?#{ESC}\.((?:URL|MTO) ".*?" ".*?" )( |[^\s]*)(.*?)(?: *#{ESC}\\c)?$/ |
MockBoundaryRx | = | /<\/?BOUNDARY>/ |
EmDashCharRefRx | = | /—(?:;​)?/ |
EllipsisCharRefRx | = | /…(?:​)?/ |
skip | -> | page_break |
TODO use Page Control www.gnu.org/software/groff/manual/html_node/Page-Control.html#Page-Control | ||
content | -> | preamble |
skip | -> | toc |
Converts HTML entity references back to their original form, escapes special man characters and strips trailing whitespace.
It‘s crucial that text only ever pass through manify once.
str - the String to convert opts - an Hash of options to control processing (default: {})
* :preserve_space a Boolean that indicates whether to preserve spaces (only expanding tabs) if true or to collapse all adjacent whitespace to a single space if false (default: true) * :append_newline a Boolean that indicates whether to append an endline to the result (default: false)
FIXME: The reason this method is so complicated is because we are not receiving empty(marked) cells when there are colspans or rowspans. This method has to create a map of all cells and in the case of rowspans create empty cells as placeholders of the span. To fix this, asciidoctor needs to provide an API to tell the user if a given cell is being used as a colspan or rowspan.