aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
...
* In HTML output, man(7) .RS blocks get formatted as <div class="Bd-indent">,Ingo Schwarze2019-01-051-2/+5
| | | | | | | | | and i can see no reasonable alternative: they do indeed represent indented displays. They certainly require flow context and make no sense in phrasing context. Consequently, they have to suspend no-fill mode during their head, in just the same way as other paragraph-type macros do it. This fixes HTML syntax errors that resulted from .nf followed by .RS.
* minor cleanup, no functional change:Ingo Schwarze2019-01-051-24/+16
| | | | | | | | * delete one irrelevant FIXME; no more fixed lengths in HTML, please * simplify some conditions * avoid testing pointers as truth values, use "!= NULL" * sort some declarations * delete some pointless blank lines
* Now that the NODE_NOFILL flag in the syntax tree is accurate,Ingo Schwarze2019-01-054-123/+74
| | | | | | | | | | use it in the man(7) HTML formatter rather than keeping fill mode state locally, resulting in massive simplification (minus 40 LOC). Move the html_fillmode() state handler function to the html.c module such that both the man(7) and the roff(7) formatter (and in the future, also the mdoc(7) formatter) can use it. Give it a query mode, to be invoked with TOKEN_NONE.
* no-fill mode has to be suspended during tbl(7) rendering, tooIngo Schwarze2019-01-051-1/+3
|
* minor cleanup, no functional change:Ingo Schwarze2019-01-051-82/+65
| | | | | | | | | | | * in node type switches, explicitly handle all types, sort them, and abort() on those that cannot occur * avoid testing pointers as truth values, use "!= NULL" * avoid testing "constant == variable", use "variable == constant" * prefer sizeof(var) over sizeof(type) * delete one duplicate function * sort some declarations * delete some useless blank lines
* Some high-level block macros have an effect similar to temporarilyIngo Schwarze2019-01-055-16/+22
| | | | | | | | | | | | suspending no-fill mode during their head. Model this with an additional roff parser state flag ROFF_NONOFILL. That is much simpler than it would be to save and restore the ROFF_NOFILL flag itself, in particular since the latter can be switched (with lasting effect) by the .nf and .fi requests even while its effect is temporarily suspended. This commit does not change formatting yet, but prepares for future formatting simplifications and improvements.
* Test interaction of low-level roff(7) filling requests with .Bd in generalIngo Schwarze2019-01-047-13/+98
| | | | and filling in .Bd -centered in particular; related to mdoc_term.c rev. 1.372.
* Two functional improvements to filling in terminal output.Ingo Schwarze2019-01-042-72/+45
| | | | | | | | | | | 1. Fully support no-fill mode in mdoc(7), even when invoked with low-level roff(7) .nf requests. As a side effect, this substantially simplifies the implementation of .Bd -unfilled and .Bd -literal. 2. Let .Bd -centered fill its text, using the new TERMP_CENTER flag. That finally fixes the long-standing bug that it used to operate in no-fill mode, which was known to be wrong for at least five years. This also simplifies the implementation of .Bd -centered considerably.
* Simplify the roff(7) .ce and .rj terminal formatter by using theIngo Schwarze2019-01-041-15/+4
| | | | new TERMP_CENTER and TERMP_RIGHT flags. No functional change.
* Implement centering and adjustment to the right margin directly inIngo Schwarze2019-01-042-4/+20
| | | | | | | the terminal filling routine, controlled by new flags TERMP_CENTER and TERMP_RIGHT. This became possible by the recent term_flushln() rewrite. No functional change yet, but to be used by upcoming commits.
* Oops, i forgot to adjust this file to the changes in roff.h rev. 1.67.Ingo Schwarze2019-01-041-10/+33
| | | | | | Provide a handler for the new .nf and .fi roff(7) request nodes, avoiding a potential crash, and correctly restore the former fill more at .Ed even when there was .nf or .fi inside the block.
* test the roff(7) .ce and .rj requests;Ingo Schwarze2019-01-044-2/+43
| | | | they were already supported in the past
* Rewrite the line filling function for terminal output yet again.Ingo Schwarze2019-01-031-179/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | This function has always been among the most complicated parts of mandoc, and it repeatedly needed substantial functional enhancements. The present rewrite is required to prepare for the implementation of simultaneous filling and centering of output lines. The previous implementation looked at each word in turn and printed it to the output stream as soon as it was found to still fit on the current output line. Obviously, that approach neither allows centering nor adjustment to the right margin. The new implementation first decides which part of the paragraph to put onto the current output line, also measuring the display width of that part, even if that part consists of multiple words including intervening whitespace. This will allow moving the whole output line to the right as desired before printing it, for example to center it or to adjust it to the right margin. The function is split into three parts, each much shorter, solving a better defined task, much easier to understand and better commented: 1. the steering function term_flushln() looping over output lines; 2. the calculation function term_fill() looping over input characters; 3. and the output function term_field() looping over printed characters. No functional change yet.
* Support taking the -O tag value from apropos(1) key=value search terms;Ingo Schwarze2019-01-012-12/+29
| | | | | | feature improvement suggested by kn@. While here, also make "-O value" work from standard input. OK kn@
* Correctly set the ROFF_NOFILL parser flag for .Bd .Ed .Sh, suchIngo Schwarze2019-01-012-44/+49
| | | | | | that children and later siblings get correct NODE_NOFILL assignments. This doesn't change rendering yet but prepares for future rendering improvements.
* display the NODE_NOFILL flag indicating no-fill modeIngo Schwarze2019-01-011-12/+16
|
* Now that .nf and .fi are implemented in the roff(7) parser and formattersIngo Schwarze2019-01-012-35/+47
| | | | | | | rather than in the man(7) parser and formatters, document them in the roff(7) manual, where they belong, rather than in the man(7) manual. Mention that they imply an output line break, and mention which macros imply these requests.
* drop flag HTML_LITERAL which is no longer usedIngo Schwarze2018-12-311-2/+1
|
* Cleanup, minus 25 LOC, no functional change:Ingo Schwarze2018-12-311-48/+7
| | | | | Delete the complicated mechanism keeping fill mode state locally in the man(7) HTML formatter. Instead, use the state stored in the nodes.
* Cleanup, no functional change:Ingo Schwarze2018-12-311-13/+4
| | | | | | | | | | Stop trying to keep fill mode state locally in the mdoc HTML formatter, rely on the state stored in the nodes instead. Note that the .Bd -literal code is buggy. Nested literal displays result in nested <pre> elements, which violates HTML syntax. But i'm not yet fixing bugs in this commit, i'm merely deleting code which has no effect.
* Cleanup, no functional change:Ingo Schwarze2018-12-314-27/+6
| | | | | | Since the man(7) and roff(7) validators no longer use the parser state flag ROFF_NOFILL, we can finally get rid of the function man_state(), resulting in a better separation of parsing and validation.
* oops, one change ROFF_NOFILL -> NODE_NOFILL was forgotten in rev. 1.17Ingo Schwarze2018-12-311-2/+2
|
* catch up with the changed order of warnings;Ingo Schwarze2018-12-312-2/+2
| | | | related to man_validate.c rev. 1.145
* Use the new flag NODE_NOFILL in the validators, which is sometimesIngo Schwarze2018-12-314-17/+26
| | | | | | simpler and always more robust. In particular, move the nesting warnings for .EX and .EE from man_state(), where they were misplaced, to the man(7) validator.
* Store the fill mode with a new flag NODE_NOFILL in every node,Ingo Schwarze2018-12-312-9/+14
| | | | | | like it is already done with NODE_SYNPRETTY, such that the fill mode becomes more directly available to the formatters. Not used yet, but will be used by upcoming commits.
* For .EX and .EE, set the fill mode parser state directly in theIngo Schwarze2018-12-311-1/+6
| | | | | | macro parsing function, in the same way as the roff parser already does it for the .nf and .fi requests. This is a preparation for getting rid of the ugly function man_state() later on.
* Cleanup, no functional change:Ingo Schwarze2018-12-314-12/+11
| | | | | | Use the new parser flag ROFF_NOFILL in the mdoc(7) parser, too, instead of the old MDOC_LITERAL, which was an alias for the former MAN_LITERAL.
* Move parsing of the .nf and .fi (fill mode) requests from the man(7)Ingo Schwarze2018-12-3111-91/+105
| | | | | | parser to the roff(7) parser. As a side effect, .nf and .fi are now also parsed in mdoc(7) input, though the mdoc(7) formatters still ignore most of their effect.
* Cleanup, minus 15 LOC, no functional change:Ingo Schwarze2018-12-3112-53/+30
| | | | | | | | | Simplify the way the man(7) and mdoc(7) validators are called. Reset the parser state with a common function before calling them. There is no need to again reset the parser state afterwards, the parsers are no longer used after validation. This allows getting rid of man_node_validate() and mdoc_node_validate() as separate functions.
* Cleanup, no functional change:Ingo Schwarze2018-12-3031-337/+301
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* add some notes about using col(1) and ul(1) to process the ascii markupIngo Schwarze2018-12-281-2/+9
| | | | | | since these may not be commonly known utilities; idea from and joint work with tedu@ CV: ----------------------------------------------------------------------
* bugfix: make the static class buffer long enoughIngo Schwarze2018-12-251-2/+2
| | | | for .Bl -bullet -compact -offset indent
* mandoc.css lives in /usr/share/misc now; use full paths to indicate this.Ingo Schwarze2018-12-241-9/+9
| | | | from tedu@
* Finally, stop abusing .Ss and .Sx to mark up macros, use .Ic insteadIngo Schwarze2018-12-231-796/+683
| | | | | | since these are clearly commands in a domain-specific language. As a nice side effect, the resulting list allows including the synopsis for each macro in the item head, reducing some repetitive verbiage.
* Simplify and clarify instructions for .Ql, and deprecate .Li.Ingo Schwarze2018-12-231-35/+21
| | | | | | The macros .Ql, .Dl, and .Bd -literal leave no room for any valid use case for .Li whatsoever. General direction discussed with jmc@.
* Deprecate .Lp, use .Pp instead.Ingo Schwarze2018-12-231-4/+4
| | | | | Simplicity matters, and fewer macros is simpler. OK jmc@
* In the TOC, close <a> before opening <ul>.Ingo Schwarze2018-12-221-2/+3
| | | | Simplified version of a bugfix patch from rapha@.
* merge a test update from OpenBSD that was forgotten in AprilIngo Schwarze2018-12-212-1/+11
|
* Rename mandoc_getarg() to roff_getarg() and pass it the roff parserIngo Schwarze2018-12-2135-98/+521
| | | | | | | | | | | | | | | | | | struct as an argument such that after copy-in, it can call roff_expand() once again, which used to be called roff_res() before this. This fixes a subtle low-level roff(7) parsing bug reported by Fabio Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7) manual page, because that page used an escaped escape sequence in a macro argument. To expand escaped escape sequences in quoted mdoc(7) arguments, too, stop bypassing the call to roff_getarg() in mdoc_argv.c, function args() for this case. This does not solve the case of escaped escape sequences in quoted .Bl -column phrases yet. Because roff_expand() can make the string longer, roff_getarg() can no longer operate in-place but needs to malloc(3) the returned string. In the high-level parsers, free(3) that string after processing it.
* Move the full responsibility for reporting open(2) errors fromIngo Schwarze2018-12-202-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | mparse_open() to the caller. That is better because only the caller knows its preferred reporting method and format and only the caller has access to all the data that should be included - like the column number in .so processing or the current manpath in makewhatis(8). Moving the mandoc_msg() call out is possible because the caller can call strerror(3) just as easily as mparse_open() can. Move mandoc_msg_setinfilename() closer to the parsing of the file contents, to avoid problems *with* the file (like non-existence, lack of permissions, etc.) getting misreported as problems *in* the file. Fix the column number reported for .so failure: let it point to the beginning of the filename. Taken together, this prevents makewhatis(8) from spewing confusing messages about .so failures to stderr, a bug reported by Raf Czlonka <rczlonka at gmail dot com> on ports@. It also prevents mandoc(1) from issuing *two* messages for every single .so failure.
* Explain what the fields in mandoc messages mean,Ingo Schwarze2018-12-201-5/+21
| | | | | | rather than merely specifying the message syntax. Gap in documentation found while looking at a bug report from Raf Czlonka <rczlonka at gmail dot com>.
* Bugfix:Ingo Schwarze2018-12-204-5/+10
| | | | | | | When after a \\, \t, or \a, another \t or \a had to be resolved in copy mode within the same argument, the argument got corrupted. Found while working on a loosely related bug report from Fabio Scotoni <fabio at esse dot ch>.
* As a first step towards making roff_res() callable from mandoc_getarg(),Ingo Schwarze2018-12-182-98/+99
| | | | | | | | | move the function mandoc_getarg() from mandoc.c to roff.c. It was misplaced in mandoc.c in the first place; that file is intended for utilities needed both by parsers and by formatters, while reading macro arguments in copy mode is purely a task of the roff(7) parser. Needed as a preliminary for an upcoming bugfix. No code change.
* The .HP macro was deprecated by groff, and that makes senseIngo Schwarze2018-12-161-12/+20
| | | | | | because it serves no real purpose and works poorly with HTML. While here, describe the section argument of .TH, clarify the syntax display of .TP, and polish some wordings.
* minor polishing, in parts related to functional improvements in the past,Ingo Schwarze2018-12-161-21/+29
| | | | and also adding some cross references for important escape sequences
* s/OpenBSD/Id/ in CVS IdsIngo Schwarze2018-12-163-3/+3
|
* Yet another round of improvements to manual font selection.Ingo Schwarze2018-12-1623-177/+266
| | | | | | | | | Unify handling of \f and .ft. Support \f4 (bold+italic). Support ".ft BI" and ".ft CW" for terminal output. Support the .ft request in HTML output. Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP. In regress.pl, only strip leading whitespace in math mode.
* Several improvements to escape sequence handling.Ingo Schwarze2018-12-1540-143/+522
| | | | | | | | | | | | | | | | | | | | | | | * Add the missing special character \_ (underscore). * Partial implementations of \a (leader character) and \E (uninterpreted escape character). * Parse and ignore \r (reverse line feed). * Add a WARNING message about undefined escape sequences. * Add an UNSUPP message about unsupported escape sequences. * Mark \! and \? (transparent throughput) and \O (suppress output) as unsupported. * Treat the various variants of zero-width spaces as one-byte escape sequences rather than as special characters, to avoid defining bogus forms with square brackets. * For special characters with one-byte names, do not define bogus forms with square brackets, except for \[-], which is valid. * In the form with square brackets, undefined special characters do not fall back to printing the name verbatim, not even for one-byte names. * Starting a special character name with a blank is an error. * Undefined escape sequences never abort formatting of the input string, not even in HTML output mode. * Document the newly handled escapes, and a few that were missing. * Regression tests for most of the above.
* zap trailing whitespace; from jmc@Ingo Schwarze2018-12-141-3/+3
|
* Cleanup, no functional change:Ingo Schwarze2018-12-1414-77/+33
| | | | | | | | | | Now that message handling is properly encapsulated, remove struct mparse pointers from four structs (roff, roff_man, tbl_node, eqn_node) and from the argument lists of five functions (roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc). Except for being passed to the main program as an opaque object, it now only occurs in read.c, as it should, and not across 15 files like in the past.