Commit message (Collapse)AuthorAgeFilesLines
* Reduce spurious blank lines in output.HEADmasterKaz Kylheku2021-05-171-3/+12
| | | | | | | | | | | | | | | | | | The escape-at-end-of-line fixes have the side effect of adding some 20,000 blank lines to the HTML output for the TXR man page. The reason is that the logic is applied even within macro expansions which have internal escapes. we introduce a recursion depth variable which is incremented for each call to scan_request. The escnl flag is only set at recursion depth 0, unless we are in no-fill mode. The exception for no-fill mode is because there are a few cases where macro-expansion produces nofill mode output, like the .mets macro in the TXR man page.
* Actually fix bug handling escape at end of a line.Kaz Kylheku2021-05-171-4/+5
| | | | | | | | | | | | | | | | | | | The previous fix to this is incorrect. In the TXR man page, cases of \*(TL at the end of a line are still run together with the following material. To set the escnl flag, we must not be looking at the HTML output before the escape. That is not relevant. What we need to know is whether the HTML output *of* the escape ends in whitespace. If the output does not end in whitespace, and the escape is at the end of a source line, then we set the escnl flag. The output of scan_scape is not going into intbuff; intbuff is a local buffer in do_scan_troff. We must peek into the global outbuffer. Also, escnl needs to be cleared when processed.
* Implement .M2HT request for HTML passthrough.Kaz Kylheku2021-04-132-2/+43
* Implement arrow codes supported in groff.Kaz Kylheku2021-04-131-0/+4
* Implement \[xy] syntax for character codes.Kaz Kylheku2021-04-131-1/+3
* .IP: close previous <dd> element with </dd>Kaz Kylheku2021-03-311-0/+2
| | | | | We need these because CSS is fussy when we use the :empty selector.
* .nf/.fi: don't fiddle with fonts.Kaz Kylheku2021-03-301-4/+0
| | | | | | | | | Changing into or out of fill out mode should not be resetting to font 0; this is completely stupid. There is no such semantics in troff. The TXR man page sets up a monospace font around the verbatim blocks, which generates a <tt>. But because of this behavior, that gets canceled with a </tt> before switching to <pre>.
* definition list cleanup.Kaz Kylheku2021-03-301-11/+37
| | | | | | | - Get rid of compact attribute from <dl>. - RS now generates a <dl class="indent"> - IP generates <dl class="items"> we can target with styling. - IP without argument doesn't start definition list.
* Preserve empty lines in preformatted blocks.Kaz Kylheku2021-03-281-1/+6
| | | | | | | | When emitting a newline, if we are in no fill mode, we look ahead. If there is another newline, we emit that also. We don't preserve more than one extra newline. This "surgically" fixes the problem of missing separating lines in the code examplews in the TXR man page.
* Fix bug handling escape code at end of a line.Kaz Kylheku2021-03-281-1/+6
| | | | | | | | | | | | | | | | When scan_troff expands an escape, it calls FLUSHIBP, which nukes all previous context. If the escape is subsequently followed by a newline, it looks like the newline at the start of a line, which is consumed. There is a subtlety there that we also want to preserve a newline after an escape in preformatted mode. This fix addresses at least two issues in the TXR Man page. One is that occurrences of the \*(TL and \*(TX at the ends of lines are causing run-on output: the expansion gets glued to the word which follows in the next line. The other issue is that in some code exmaple blocks, lines ending in a backslash (encoded as the \e escape) are being joined.
* Map \(dq to &quot; rather than ".Kaz Kylheku2016-06-181-1/+1
* Use lower case for all HTML tags and attributes.Kaz Kylheku2015-12-151-111/+111
* Map \e to HTML code rather than escaped backslash.Kaz Kylheku2014-09-301-1/+1
* Fix broken one-character font names.Kaz Kylheku2014-09-291-8/+7
* Take out <X.h> -> file://usr/include/X.hKaz Kylheku2014-09-261-27/+4
| | | | Useless misfeature.
* Don't replace foo@bar by mailto links.Kaz Kylheku2014-09-251-1/+1
| | | | Do the substitution only if there are angle brackets around it: <foo@bar>
* Deal with spurious blank line generation.Kaz Kylheku2014-09-251-3/+26
* Raise argument limit (wordlist array).Kaz Kylheku2014-09-241-1/+1
* Map greek alphabet to proper HTML codes.Kaz Kylheku2014-09-231-51/+51
* Support four letter font names; fix font '5'.Kaz Kylheku2014-09-211-29/+34
* Implement .f register.Kaz Kylheku2014-09-213-3/+6
* man2html should be in troff mode, not nroff.Kaz Kylheku2014-09-211-1/+1
| | | | | This is because it has proportional spacing and fonts. Code switched on .if t should be enabled.
* Add a fifth font: courier italic.Kaz Kylheku2014-09-201-6/+16
| | | | | This font is used for CO and CI. It is useful for documenting meta-identifiers in code.
* In .M2SS we need to call dl_down.Kaz Kylheku2014-09-191-0/+1
| | | | This so that the open definition lists are closed out.
* Fix double evaluation in .SH, .SS and .M2SS.Kaz Kylheku2014-09-181-12/+14
| | | | | | | The add_index function's interface changes so that it returns the result of scan_troff. The caller can use that instead of doing a redundant scan_troff which causes trouble when the text contains side effects like incrementing counters.
* Implementing M2 register and .M2SS extension.Kaz Kylheku2014-09-183-10/+61
| | | | | | | Updating date of the man page and documenting extensions. Changing .ab request to exit unsuccessfully. Index generation needed to be trivially extended to handle more than two levels.
* Fix malloc memory corruptions.Kaz Kylheku2014-09-181-8/+17
| | | | | | | Premature free in the table code. Realloc logic in out_html was not accounting for null byte that is appended into the globally visible buffer elsewhere. Also, one byte overrun in string data compensated by increasing the allocation when .de is processed.
* Allow more than two character names in .nr.Kaz Kylheku2014-09-181-6/+5
* Fix breakage in if, else and while.Kaz Kylheku2014-09-181-4/+1
| | | | | | | | | | | | The if/ie and else constructs must not destructively manipulate the program source, since they can be involved in iteration; removing the dubious assignment to c[-1] and *c. The ifelseval variable should not be touched by while. The ifelseval variable should be set at the last possible moment by ie, because of nesting: the antecedent clause processed by ie could itself clobber the variable.
* Fix broken argument delimiting in macro calls.Kaz Kylheku2014-09-181-13/+15
| | | | | | | | | | The argument line of a macro must be expanded first, and then broken into words according to the original quotes. For instance .mac \\$* passes multiple arguments, not a single argument containing spaces. And .mac "\\$*" must pass a single argument; moreover, if \\$* expands into stuff that contains double quotes, those should probably not be recognized.
* Fix realloc related crash. Abort on error.Kaz Kylheku2014-09-161-4/+7
* Relax $n argument checking.Kaz Kylheku2014-09-161-3/+2
| | | | | man2html expands \$<digit> in code that is skipped conditionally, so we cannot abort if digit >= args. Just expand to blank.
* Implement groff's .shift command.Kaz Kylheku2014-09-151-0/+8
* Implement \n[.$] variable properly.Kaz Kylheku2014-09-153-3/+9
| | | | Make .$ correspond to the number of arguments in the macro call.
* Make \n[IDENT] work.Kaz Kylheku2014-09-151-19/+29
| | | | This needs str_to_code to be expanded a little bit.
* Fix \n interpolation; implement while.Kaz Kylheku2014-09-152-4/+46
| | | | | | | | | | | | The \n interpolation was not working: not substituting the result. When this logic was added, then this was happening even during expression evaluation. The right fix seems to be that scan_expression function needs to suppress output! Implemented the .while operator. str_to_code needed to be fixed so it only bangs together up to four characters, so that we can recognize "while" as "whil". Hack hack! Introduced the V4 macro for four character codes.
* Fix broken .ft XYKaz Kylheku2014-09-151-9/+11
| | | | | The .ft directive was only accepting numeric arguments, not symbolic font names like CO and P.
* Support groff's \(dq escape for double quote.Kaz Kylheku2014-09-141-0/+1
* Fix broken one-letter commands.Kaz Kylheku2014-09-141-1/+9
| | | | | | | In this idiotic program, one-letter commands like .B arg or .B are blindly encoded as a two byte code and so they have two codes, based on whether the name is followed by a space or newline. We must preserve this behavior in the str_to_code function, or else fix numerous places.
* Implementing \$* argument expansion.Kaz Kylheku2014-09-141-2/+35
* Fixes: font escape, macros, crash.Kaz Kylheku2014-09-131-25/+51
| | | | | | | Macros can have up to four letter names, not just two. The \f[..] parsing is fixed so inline font changes work. The CR font is supported. Crash fixed when the section table is empty.
* Kylheku2014-09-13254-0/+31979