summaryrefslogtreecommitdiffstats
path: root/regress/usr.bin/mandoc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* In HTML output, correctly render .Bd -unfilled in proportionally-spacedschwarze2021-03-301-1/+1
| | | | | | | | | | | font, rather than with the monospace font appropriate for .Bd -literal. This fixes a minibug reported by anton@. Implemented by no longer relying on the typical browser default of "pre { font-family: monospace }" but instead letting <pre> elements inherit the font family from their parent, then adding an explicit CSS .Li class only for those displays where the manual page author requested it by using the -literal option on the .Bd macro.
* Rename syntax test of the \O escape sequence (suppress output groffschwarze2020-12-216-26/+26
| | | | | | extension; mandoc only implements syntax checking but ignores the sequence) to please Bill Gates and didickman@: avoid path names that only differ by case, like o.in vs. O.in.
* The GNU tbl(1) program contained in the groff package internallyschwarze2020-10-256-6/+6
| | | | | | | | | | | | | | | | | | uses roff(7) tabulator settings to implement tables, and it used to leak the changed tabulator settings from tables to the subsequent roff(7) code. In mandoc/tbl_term.c rev. 1.42 (June 17, 2017), code was added to be bug-compatible with groff. In commit d0e03cf6 (Oct 20, 2020), GNU tbl(1) changed behaviour to save the tabulator settings before starting a table and restore them afterwards. Adjust mandoc for compatibility. Since mandoc implements tables without using roff(7) tabulator settings, saving and restoring tabulator settings is not needed in mandoc. Simply deleting the code that changed tabulator settings by reverting tbl_term.c rev. 1.42 is sufficient in mandoc. Also adjust the desired output of the regression tests to match the new behaviour of both groff and mandoc.
* Treat \*[.T] in the same way as \*(.T rather than calling abort(3).schwarze2020-10-247-14/+21
| | | | | Bug found because the groff-current manual pages started using the variant form of this predefined string.
* In HTML output, avoid printing a newline right after <pre>schwarze2020-10-1610-97/+47
| | | | | | | | and right before </pre> because that resulted in vertical whitespace not requested by the manual page author. Formatting bug reported by Aman Verma <amanraoverma plus vim at gmail dot com> on discuss@.
* Element next-line scopes can nest. Consequently, even when closingschwarze2020-09-095-10/+34
| | | | | | | | one element next-line scope, the MAN_ELINE flag must not yet be cleared if the parent macro is another element macro having next-line scope, or an assertion failure is caused if all this is wrapped in another macro that has block next-line scope, for example .TP. Bug found in an afl run performed by Jan Schreiber <jes at posteo dot de>.
* oops, i tripped over $Mdocdate$ again; so sync the date after the commitschwarze2020-09-031-1/+1
|
* Fix two issues with .po (page offset) formatting:schwarze2020-09-033-2/+53
| | | | | | | | | | | | 1. Truncate excessive offsets to a width reasonable in the context of manual pages instead of printing excessively long lines and sometimes causing assertion failures; found in an afl run performed by Jan Schreiber <jes at posteo dot de>. 2. Remember both the requested and the applied page offset; otherwise, subtracting an excessive width, then adding it again, would end up with an incorrectly large offset. While here, simplify the code by reverting the previous offset up front, and also add some comments to make the general ideas easier to understand.
* If .ti had an excessive argument, using it was attempted, in someschwarze2020-09-033-2/+49
| | | | | | | | cases resulting in an assertion failure. Instead, truncate the temporary indent to a width reasonable in a manual page. I found the issue in an afl run that was performed by Jan Schreiber <jes at posteo dot de>.
* Do not indent by SIZE_MAX/2 when .ce occurs inside explicit no-fill mode.schwarze2020-09-022-4/+20
| | | | | | | | While here, drop two unused arguments from the function term_field(); the related work was already done by term_fill() before this commit. I found the bug in an afl run that was performed by Jan Schreiber <jes at posteo dot de>.
* Ignore unreasonably large spacing modifiers in tbl layouts.schwarze2020-09-016-5/+121
| | | | | | Jan Schreiber <jes at posteo dot de> ran afl on mandoc and it turned out mandoc tried to use spacing modifiers so large that they would trigger assertion failures in term_ascii.c, function locale_advance().
* Put the code handling \} into a new function roff_cond_checkend()schwarze2020-08-037-6/+95
| | | | | | | | | | | | | | | | | | | | and call that function not only from both places where copies existed - when processing text lines and when processing request/macro lines in conditional block scope - but also when closing a macro definition request, such that this construction works: .if n \{.de macroname macro content .. \} ignored arguments .macroname This fixes a bug reported by John Gardner <gardnerjohng at gmail dot com>. While here, avoid a confusing decrement of the line scope counter in roffnode_cleanscope() for conditional blocks that do not have line scope in the first place (no functional change for this part). Also improve validation of an internal invariant in roff_cblock() and polish some comments.
* bluhm@ has been pointing out for a long time that the mandoc test suiteschwarze2020-07-304-283/+311
| | | | | | | | | | | | was quite nasty in hiding most of the commands being run with '@', hindering debugging in case anything failed. In particular, it hindered debugging that had to start from the log of a bulk regress run. So, finally, resolve this issue by removing almost all these '@'s. This commit does not change any of the test commands. If you want to be sure that you don't miss failures, run something like: make regress 2>&1 | tee make.log ; grep -B1 FAILED make.log
* trivial adjustment of the desired test resultsschwarze2020-07-2128-155/+155
| | | | after getting rid of the "copyless" crutch
* adjust test framework to not require a ttyschwarze2020-07-212-18/+4
|
* While we do not recommend the idiom ".Fl Fl long" for long optionsschwarze2020-04-266-4/+65
| | | | | | | | | | | because it is an abuse of semantic macros for device-specific presentational effects, this idiom is so widespread that it makes sense to convert it to the recommended ".Fl \-long" during the validation phase. For example, this improves HTML formatting in pages where authors have used the dubious .Fl Fl. Feature suggested by Steffen Nurpmeso <steffen at sdaoden dot eu> on freebsd-hackers.
* In fragment identifiers, use ~%d for ordinal suffixes,schwarze2020-04-205-8/+8
| | | | | | | | | and reserve the character '~' for that purpose. Bug found by validator.w3.org in openssl(1), which contains both a tag "tls1_2" and a second instance of a tag "tls1", which also resulted in "tls1_2", causing a clash. Now, the second instance of "tls1" is rendered as "tls1~2" instead, employing the newly reserved '~'.
* When .Bd, .D1, or .Dl is tagged, attach the permalinkschwarze2020-04-1922-49/+113
| | | | to the first few letters, similar to what was earlier done for .Pp.
* When a .Tg is attached to a paragraph, attach the permalinkschwarze2020-04-189-15/+38
| | | | to the first word, or the first few words if they are short.
* Separate the place to put the <a href> permalink (now markedschwarze2020-04-0716-37/+37
| | | | | | | with NODE_HREF) from the target element of the link (still marked with NODE_ID). In many cases, use this to move the target to the beginning of the paragraph, such that readers don't get dropped into the middle of a sentence.
* Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.schwarze2020-04-0641-41/+220
| | | | | | In HTML output, improve the logic for writing inside permalinks: skip them when there is no child content or when there is a risk that the children might contain flow content.
* automatically tag .SH and .SS in man(7) terminal outputschwarze2020-04-047-2/+18
| | | | in the same way as it was done for .Sh and .Ss in mdoc(7)
* Copy tagged strings before marking hyphens as breakable.schwarze2020-04-0216-25/+40
| | | | For example, this makes ":tCo-processes" work in ksh(1).
* Just like we are already doing it in HTML output, automatically tagschwarze2020-04-0120-6/+85
| | | | | | | section and subsection headers in terminal output, too. Even though admittedly, commands like "/SEE" and "/ Subsec" work, too, there is no downside, and besides, with the recent improvements in the tagging framework, implementation cost is negligible.
* test skipping of initial hyphens and minus signs in automatic tags;schwarze2020-03-215-6/+42
| | | | related to tags.c rev. 1.30
* typos resulted in two tests not being runschwarze2020-03-132-7/+7
|
* Split tagging into a validation part including prioritizationschwarze2020-03-13101-61/+1302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in tag.{h,c} and {mdoc,man}_validate.c and into a formatting part including command line argument checking in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c. Immediate functional benefits include: * Improved prioritization of automatic tags for .Em and .Sy. * Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged. * Explicit tagging of .Er and .Fl now works in HTML output. * Automatic tagging of .IP and .TP now works in HTML output. But mainly, this patch provides clean earth to build further improvements on. Technical changes: * Main program: Write a tag file for ASCII and UTF-8 output only. * All formatters: There is no more need to delay writing the tags. * mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection. * HTML formatter: If available, use the "string" attribute as the tag. * HTML formatter: New function to write permalinks, to reduce code duplication. Style cleanup in the vicinity while here: * mdoc(7) terminal formatter: To set up bold font for children, defer to termp_bold_pre() rather than calling term_fontpush() manually. * mdoc(7) terminal formatter: Garbage collect some duplicate functions. * mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions. * Where possible, use switch statements rather than if cascades. * Get rid of some more Yoda notation. The necessity for such changes was first discussed with kn@, but i didn't bother him with a request to review the resulting -673/+782 line patch.
* Fully support explicit tagging of .Sh and .Ss.schwarze2020-02-275-3/+82
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes the offset of two lines in terminal output and this improves HTML output by putting the id= attribute and <a> element into the respective <h1> or <h2> element rather than writing an additional <mark> element. To that end, introduce node flags NODE_ID (to make the node a link target, for example by writing an HTML id= attribute or by calling tag_put()) and NODE_HREF (to make the node a link source, used only in HTML output, used only to write an <a class="permalink"> element). In particular: * In the validator, generalize the concept of the "next node" such that it also works before .Sh and .Ss. * If the first argument of .Tg is empty, don't forget to complain if there are additional arguments, which will be ignored. * In the terminal formatter, support writing of explicit tags for all kinds of nodes, not just for .Tg. * In deroff(), allow nodes to have an explicit string representation even when they aren't text nodes. Use this for explicitly tagged section headers. Suprisingly, this is sufficient to make HTML output work, without explicit code changes in the HTML formatter. * In syntax tree output, display NODE_ID and NODE_HREF.
* Introduce the concept of nodes that are semantically transparent:schwarze2020-02-2754-37/+835
| | | | | | | | | | | | | | they are skipped when looking for previous or following high-level macros. Examples include roff(7) .ft, .ll, and .ta, mdoc(7) .Sm and .Tg, and man(7) .DT and .PD. Use this concept for a variety of improved decisions in various validators and formatters. While here, * remove a few const qualifiers on struct arguments that caused trouble; * get rid of some more Yoda notation in the vicinity; * and apply some other stylistic improvements in the vicinity. I found this class of issues while considering .Tg patches from kn@.
* Fix this test after the recent Unicode update in OpenBSD base.schwarze2020-02-271-1/+1
| | | | | | | | | | The test uses U+07FF NKO TAMAN SIGN because it is the highest code point having a two-byte UTF-8 representation. This character is a new single-width punctuation character in Unicode 11, such that mandoc now does correct horizontal spacing. We already used the code point for the test before it was assigned, which resulted in weird spacing because wcwidth(3) returns -1 for unassigned code points.
* update Mdocdate for a test that got broken by committing to the out_lint fileschwarze2020-01-193-4/+4
|
* Align to the new, sane behaviour of the groff_mdoc(7) .Dd macro:schwarze2020-01-1917-27/+39
| | | | | | | | without an argument, use the empty string, and always concatenate all arguments, no matter their number. This allows reducing the number of arguments of mandoc_normdate() and some other simplifications, at the same time polishing some error messages by adding the name of the macro in question.
* test tbl_term.c rev. 1.61 and tbl_data.c rev. 1.40:schwarze2020-01-116-11/+39
| | | | | incomplete short layout lines followed by longer lines, and spans at the beginning of layout lines
* Skip whitespace before tokens, too.schwarze2020-01-084-3/+23
| | | | Bug found by bentley@ with input like "delim $$ delim off".
* Improve the test case by changing the eqn(7) delimiters such that itschwarze2020-01-082-8/+8
| | | | | actually tests which parts of text lines are processed with eqn(7) and which are not.
* Enable generation of the desired delim/basic output with groff(1).schwarze2020-01-081-1/+3
|
* Give up on the illusion that the maintainer targets for regenerating theschwarze2020-01-085-31/+12
| | | | | | | | | | | | | desired output files could be run with an arbitrary roff(7) implementation; in reality, it only makes sense to run them with groff(1). Also, there is really no point in allowing the groff command line arguments to be overridden; running these targets only makes sense with exactly the right options. So get rid of the fragile ?= and += construct for groff options and make sure the options are always passed in a reasonable order. Finally, use groff(1) directly rather than the shallow nroff(1) wrapper because GNU nroff(1) does not support running the GNU eqn(1) preprocessor, which will probably be needed soon, and also because it simplifies using the GNU tbl(1) preprocessor.
* When all cells in a tbl(1) column are empty, set the column widthschwarze2019-12-313-2/+97
| | | | | to 1n rather than to 0n, in the same way as groff does. This fixes misformatting reported by bentley@ in xkeyboard-config(7).
* oops, commit correct version of the expected resultsschwarze2019-09-131-5/+4
|
* Improve validation of function names:schwarze2019-09-134-4/+65
| | | | | | 1. Relax checking to accept function types of the form "ret_type (fname)(args)" (suggested by Yuri Pankov <yuripv dot net>). 2. Tighten checking to require the closing parenthesis.
* adapt to print_indent() HTML_NOSPACE fix, html.c rev. 1.132schwarze2019-09-052-18/+6
|
* adapt to new <p> output logic (html.c rev. 1.131)schwarze2019-09-0327-79/+27
|
* new test for an empty text block; from rea@ via bapt@ (FreeBSD)schwarze2019-07-183-2/+44
|
* fix date which got broken by Mdocdate during commitschwarze2019-07-112-2/+2
|
* When parsing a tab character that is not preceded by a space characterschwarze2019-07-112-4/+5
| | | | | | | | | | | | | | | | on an .It -column line, args() sets the MDOC_PHRASEQL flag to Quote the Last word of the Phrase. Even if it turns out this quoting is not needed because the word is already quoted for other reasons, clear the flag at the end of parsing the phrase, such that the flag does not leak to the next phrase. This patch fixes the bug that the trailing Macro on a line of the form .It "word<tab>word" Ta word Macro<eol> was incorrectly considered quoted and hence not parsed. Bug found by Havard Eidnes (he@) with the NetBSD gettytab(5) manual page: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54361 Reported via Thomas Klausner (wiz@).
* Do not access a NULL pointer if a table contains a horizontal lineschwarze2019-06-113-2/+99
| | | | | | next to a table line having fewer columns than the table as a whole. Bug found by Stephen Gregoratto <dev at sgregoratto dot me> with aerc-config(5).
* In HTML output, allow switching the desired font for subsequentschwarze2019-04-301-5/+4
| | | | | | | | text without printing an opening tag right away, and use that in the .ft request handler. While here, garbage collect redundant enum htmlfont and reduce code duplication in print_text(). Fixing an assertion failure reported by Michael <Stapelberg at Debian> in pmRegisterDerived(3) from libpcp3-dev.
* When calling an empty macro, do not clobber existing arguments.schwarze2019-04-213-3/+30
| | | | | Fixing a bug found with the groffer(1) version 1.19 manual page following a report from Jan Stary.
* Implement the roff .break request (break out of a .while loop).schwarze2019-04-213-2/+27
| | | | | | | Jan Stary <hans at stare dot cz> found it in an ancient groffer(1) manual page (version 1.19) on MacOS X Mojave. Having .break not implemented wasn't a particularly bright idea because obviously, it tended to cause infinite loops.
* Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML <section> elementsschwarze2019-03-016-1/+17
| | | | | | as recommended for accessibility by the HTML 5 standard. Triggered by a similar, but slightly different suggestion from Laura Morales <lauretas at mail dot com>.