summaryrefslogtreecommitdiff
path: root/regress/usr.bin/mandoc
AgeCommit message (Collapse)Author
2020-09-09Element next-line scopes can nest. Consequently, even when closingIngo Schwarze
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>.
2020-09-03oops, i tripped over $Mdocdate$ again; so sync the date after the commitIngo Schwarze
2020-09-03Fix two issues with .po (page offset) formatting:Ingo Schwarze
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.
2020-09-03If .ti had an excessive argument, using it was attempted, in someIngo Schwarze
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>.
2020-09-02Do not indent by SIZE_MAX/2 when .ce occurs inside explicit no-fill mode.Ingo Schwarze
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>.
2020-09-01Ignore unreasonably large spacing modifiers in tbl layouts.Ingo Schwarze
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().
2020-08-03Put the code handling \} into a new function roff_cond_checkend()Ingo Schwarze
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.
2020-07-30bluhm@ has been pointing out for a long time that the mandoc test suiteIngo Schwarze
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
2020-07-21trivial adjustment of the desired test resultsIngo Schwarze
after getting rid of the "copyless" crutch
2020-07-21adjust test framework to not require a ttyIngo Schwarze
2020-04-26While we do not recommend the idiom ".Fl Fl long" for long optionsIngo Schwarze
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.
2020-04-20In fragment identifiers, use ~%d for ordinal suffixes,Ingo Schwarze
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 '~'.
2020-04-19When .Bd, .D1, or .Dl is tagged, attach the permalinkIngo Schwarze
to the first few letters, similar to what was earlier done for .Pp.
2020-04-18When a .Tg is attached to a paragraph, attach the permalinkIngo Schwarze
to the first word, or the first few words if they are short.
2020-04-07Separate the place to put the <a href> permalink (now markedIngo Schwarze
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.
2020-04-06Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.Ingo Schwarze
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.
2020-04-04automatically tag .SH and .SS in man(7) terminal outputIngo Schwarze
in the same way as it was done for .Sh and .Ss in mdoc(7)
2020-04-02Copy tagged strings before marking hyphens as breakable.Ingo Schwarze
For example, this makes ":tCo-processes" work in ksh(1).
2020-04-01Just like we are already doing it in HTML output, automatically tagIngo Schwarze
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.
2020-03-21test skipping of initial hyphens and minus signs in automatic tags;Ingo Schwarze
related to tags.c rev. 1.30
2020-03-13typos resulted in two tests not being runIngo Schwarze
2020-03-13Split tagging into a validation part including prioritizationIngo Schwarze
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.
2020-02-27Fully support explicit tagging of .Sh and .Ss.Ingo Schwarze
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.
2020-02-27Introduce the concept of nodes that are semantically transparent:Ingo Schwarze
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@.
2020-02-27Fix this test after the recent Unicode update in OpenBSD base.Ingo Schwarze
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.
2020-01-19update Mdocdate for a test that got broken by committing to the out_lint fileIngo Schwarze
2020-01-19Align to the new, sane behaviour of the groff_mdoc(7) .Dd macro:Ingo Schwarze
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.
2020-01-11test tbl_term.c rev. 1.61 and tbl_data.c rev. 1.40:Ingo Schwarze
incomplete short layout lines followed by longer lines, and spans at the beginning of layout lines
2020-01-08Skip whitespace before tokens, too.Ingo Schwarze
Bug found by bentley@ with input like "delim $$ delim off".
2020-01-08Improve the test case by changing the eqn(7) delimiters such that itIngo Schwarze
actually tests which parts of text lines are processed with eqn(7) and which are not.
2020-01-08Enable generation of the desired delim/basic output with groff(1).Ingo Schwarze
2020-01-08Give up on the illusion that the maintainer targets for regenerating theIngo Schwarze
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.
2019-12-31When all cells in a tbl(1) column are empty, set the column widthIngo Schwarze
to 1n rather than to 0n, in the same way as groff does. This fixes misformatting reported by bentley@ in xkeyboard-config(7).
2019-09-13oops, commit correct version of the expected resultsIngo Schwarze
2019-09-13Improve validation of function names:Ingo Schwarze
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.
2019-09-05adapt to print_indent() HTML_NOSPACE fix, html.c rev. 1.132Ingo Schwarze
2019-09-03adapt to new <p> output logic (html.c rev. 1.131)Ingo Schwarze
2019-07-18new test for an empty text block; from rea@ via bapt@ (FreeBSD)Ingo Schwarze
2019-07-11fix date which got broken by Mdocdate during commitIngo Schwarze
2019-07-11When parsing a tab character that is not preceded by a space characterIngo Schwarze
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@).
2019-06-11Do not access a NULL pointer if a table contains a horizontal lineIngo Schwarze
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).
2019-04-30In HTML output, allow switching the desired font for subsequentIngo Schwarze
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.
2019-04-21When calling an empty macro, do not clobber existing arguments.Ingo Schwarze
Fixing a bug found with the groffer(1) version 1.19 manual page following a report from Jan Stary.
2019-04-21Implement the roff .break request (break out of a .while loop).Ingo Schwarze
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.
2019-03-01Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML <section> elementsIngo Schwarze
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>.
2019-02-06Let roff_getname() end the roff identifier at a tab characterIngo Schwarze
and audit all its callers whether termination is handled correctly. Resulting improvements: * An escape or tab ending the macro name in a macro invocation is discarded, and argument processing is started after it. * An escape or tab ending a name in ".if d" and ".if r" is preserved. * An escape ending a name in ".ds" causes the whole request to be ignored. * A tab ending a name in ".ds" becomes part of the string. * An escape or tab ending a name in ".rm" causes the rest of the line to be ignored. * An escape or tab ending the first name in ".als", ".rn", or ".nr" causes the whole request to be ignored. Kurt Jaeger <pi at FreeBSD> made me aware of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235456#c0 and in that bug report, comment 0 item (3) is a special case of this class of issues. Yes, the "mh" manual pages are no doubt among the worst on the planet.
2019-01-31Since resetting of offsets works quite differently in man(7) and mdoc(7),Ingo Schwarze
test table centering in an mdoc(7) document as well. Related to tbl_term.c rev. 1.55.
2015-01-29reorg tbl(7) test suiteIngo Schwarze
2019-01-17Test handling of escaped backslashes because the code related toIngo Schwarze
copy mode is complicated and prone to regressions.
2019-01-11Remove the HTML title= attributes which harmed accessibility andIngo Schwarze
violated the principle of separation of content and presentation. Instead, implement the tooltips purely in CSS. Thanks to John Gardner <gardnerjohng at gmail dot com> for suggesting most of the styling in the new ::before rules.