summaryrefslogtreecommitdiff
path: root/regress/usr.bin/mandoc
AgeCommit message (Collapse)Author
2024-09-21Check that .In is callable and parsed.Ingo Schwarze
Triggered by a documentation patch from Evan Silberman <evan at jklol dot net>. I'm not testing yet whether the same applies in the SYNOPSIS section because there are multiple parsing and formatting differences with groff in that section.
2024-05-16Check that lower-case variants of UTF-16 surrogate escape sequencesIngo Schwarze
are rejected with the correct error message.
2024-05-16Improve coverage of edge cases for 3-byte UTF-8 sequences.Ingo Schwarze
Coverage for 2-byte and 4-byte sequences was already reasonable.
2024-05-16Add a complete suite of tests covering ASCII characters in UTF-8 spelling.Ingo Schwarze
Most of this goes to nogroff.in rather than ascii.in for now because groff-1.23.0 is buggy as hell in this respect and i'm too lazy to debug the horrific function make_glyph_node() in the file groff/src/roff/troff/node.cpp right now.
2024-05-15Add a complete set of tests for all C0 and C1 control characters.Ingo Schwarze
This is particularly useful to make sure that man(1) does not let control characters sneak through to the output side, no matter how hard an input file tries to deceive it.
2024-05-14fix a char signedness bug such that this testing code becomes ableIngo Schwarze
to display the contents of databases containing UTF-8 strings on signed char architectures: for example on i386 and amd64, UTF-8 bytes are negative...
2023-11-24Additional tests of automatic tagging involving different kinds of hyphensIngo Schwarze
after tag.c rev. 1.38.
2023-11-241. Do not put ASCII_HYPH (0x1c) into the tag file.Ingo Schwarze
That happened when tagging a string containing '-' on an input text line, most commonly in man(7) .TP next line scope. 2. Do not let "\-" end the tag. In both cases, translate ASCII_HYPH and "\-" to plain '-' for output. For example, this improves handling of unbound.conf(5). These two bugs were found thanks to a posting by weerd@.
2023-11-13reduce the man(7) global indentation from 7n to 5n, see man_term.c rev. 1.197Ingo Schwarze
2023-10-24Implement the man(7) .MR macro, a 2023 GNU extension.Ingo Schwarze
The syntax and semantics is almost identical to mdoc(7) .Xr. This will be needed for reading the groff manual pages once our port will be updated to 1.23, and the Linux Manual Pages Project is also determined to start using it sooner or later. I did not advocate for this new macro, but since we want to remain able to read all manual pages found in the wild, there is little choice but to support it. At least it is easy to do, they basically copied .Xr.
2023-10-23once again, i forgot to update the date in the footerIngo Schwarze
2023-10-23Support some escape sequences, in particular character escape sequences,Ingo Schwarze
inside \w arguments, and skip most other escape sequences when measuring the output length in this way because most escape sequences contribute little or nothing to text width: for example, consider font escapes in terminal output. This implementation is very rudimentary. In particular, it assumes that every character has the same width. No attempt is made to detect double-width or zero-width Unicode characters or to take dependencies on output devices or fonts into account. These limitations are hard to avoid because mandoc has to interpolate \w at the parsing stage when the output device is not yet known. I really do not want the content of the syntax tree to depend on the output device. Feature requested by Paul <Eggert at cs dot ucla dot edu>, who also submitted a patch, but i chose to commit this very different patch with almost the same functionality. His input was still very valuable because complete support for \w is out of the question, and consequently, the main task is identifying subsets of the feature that are needed for real-world manual pages and can be supported without uprooting the whole forest.
2023-10-22new regression test for roff.c rev. 1.270:Ingo Schwarze
infinite recursion in macro argument expansion
2023-10-21regression test for roff.c rev. 1.269:Ingo Schwarze
recursive delayed expansion of escape sequences in macro arguments
2023-04-28adjust after man_validate.c rev. 1.128 improved the error messagesIngo Schwarze
2022-08-28Adjust desired output after tbl_term.c rev. 1.66 (stop skippingIngo Schwarze
vertical space after boxed tables). I'm committing this separately because trying to regenerate the desired output with groff-current reveals an unrelated, recent regression in groff. So i fixed the groff output by hand before committing it, to get rid of the effect of the roff regression.
2022-08-28Vertical spacing changes around tables in man_term.c rev. 1.194Ingo Schwarze
and tbl_term.c rev. 1.66 cause quite a bit of churn, unfortunately. This commit cleans up most of it.
2022-08-19Up to version 1.22.4, groff_mdoc(7) only considered the first wordIngo Schwarze
when comparing section headers. For example, ".Sh SEE ELSEWHERE" and ".Sh SEE Em ALSO" were considered instances of a SEE ALSO section. In groff-current, exact matches with no sub-macros are required. Adjust mandoc behaviour. While here, also fix a very minor mandoc bug, even though no detrimental effect of the bug on formatting is known. While using sub-macros in the .Sh HEAD is bad style, the parsers accept it, so setting the section attribute on the HEAD needs to act recursively.
2022-08-16Adjust desired output after the bugfix man.c rev. 1.137.Ingo Schwarze
The new version of the output file was generated with groff-current.
2022-08-16New tests of tabs in fill mode, in particularIngo Schwarze
when multiple input or output lines are involved.
2022-08-16Adjust the desired output after the improvements in term.c rev. 1.150.Ingo Schwarze
The new version of this file was generated with groff-current. Heirloom nroff produces exactly the same output for the content of the DESCRIPTION.
2022-08-15Some more tests of no-fill mode similar to mdoc/Bd/blank.inIngo Schwarze
after vertical spacing was improved in man_term.c rev. 1.192.
2022-08-15oops, once again, i failed to correctly sync some dates in the footerIngo Schwarze
2022-08-15Distinguish between escape sequences that produce no outputIngo Schwarze
whatsoever (for example \fR) and escape sequences that produce invisible zero-width output (for example \&). No, i'm not joking, groff does make that distinction, and it has consequences in some situations, for example for vertical spacing in no-fill mode. Heirloom and Plan 9 behaviour is subtly different, but in case of doubt, we want to follow groff. While this fixes the behaviour for the majority of escape sequences, in particular for those most likely to occur in practice, it is not perfect yet because some of the more exotic ESCAPE_IGNORE sequences are actually of the "no output whatsoever" type but treated as "invisible zero-width" for now. With the new ASCII_NBRZW mechanism in place, switching them over one by one when the need arises will no longer be very difficult.
2022-08-02If the body of a man(7) .MT or .UR block is empty, do not emit a warning.Ingo Schwarze
Leaving the body empty is legitimate in this case if the author only wants to display a mail address or URI without providing a link text. Output modules already handle this correctly: terminal output shows just the URI without an accompanying text, HTML output uses the URI for *both* the href= attribute and as the content of the <a> element. The documentation was also wrong and claimed that an .MT or .UR block with an empty body would produce no output. As explained above, this isn't true. Bogus warning reported by Alejandro Colomar <alx dot manpages at gmail dot com>.
2022-08-02Reorganize the tests that require custom command line optionsIngo Schwarze
such that they don't abort the whole test suite if one of them fails.
2022-07-06While the HTML standard allows multiple <h1> elements in the sameIngo Schwarze
document, <h1> is intended for top level headers, and most of the sections in a manual page can hardly be considered top-level. It is more usual to use <h1> only for the main title of the document of for the site name. Consequently, move .Sh/.SH from <h1> to <h2> and .Ss/.SS from <h2> to <h3>, freeing <h1> for use by header.html in man.cgi(8). Discussed with Anna Vyalkova <cyber at sysrq dot in>.
2022-06-26In groff commit 78e66624 on May 7 20:15:33 2021 +1000,Ingo Schwarze
G. Branden Robinson changed the -T ascii rendering of \(sd, the "second" symbol, U+2033 DOUBLE PRIME, from '' to ". Follow suit in mandoc.
2022-06-08Surprisingly, every escape sequence can also be used as an argumentIngo Schwarze
delimiter for an outer escape sequence, in which case the delimiting escape sequence retains its syntax but usually ignores its argument and loses its inherent effect. Add rudimentary support for this syntax quirk in order to improve parsing compatibility with groff.
2022-06-07Split the excessively generic diagnostic message "invalid escape sequence"Ingo Schwarze
into the more specific messages "invalid escape argument delimiter" and "invalid escape sequence argument".
2022-06-06adjust two desired error messages after roff_escape.c rev. 1.11Ingo Schwarze
improved diagnostics for the \C escape sequence
2022-06-05With the improved escape sequence parser, it becomes easy to also improveIngo Schwarze
diagnostics. Distinguish "incomplete escape sequence", "invalid special character", and "unknown special character" from the generic "invalid escape sequence", also promoting them from WARNING to ERROR because incomplete escape sequences are severe syntax violations and because encountering an invalid or unknown special character makes it likely that part of the document content intended by the authors gets lost.
2022-06-03oops, update forgotten date in the footerIngo Schwarze
2022-06-03During identifier parsing, handle undefined escape sequencesIngo Schwarze
in the same way as groff: * \\ is always reduced to \ * \. is always reduced to . * other undefined escape sequences are usually reduced to the escape name, for example \G to G, except during the expansion of expanding escape sequences having the standard argument form (in particular \* and \n), in which case the backslash is preserved literally. Yes, this is confusing indeed. For example, the following have the same meaning: * .ds \. and .ds . which is not the same as .ds \\. * \*[\.] and \*[.] which is not the same as \*[\\.] * .ds \G and .ds G which is not the same as .ds \\G * \*[\G] and \*[\\G] which is not the same as \*[G] <- sic! To feel less dirty, have a leaning toothpick, if you are so inclined. This patch also slightly improves the string shown by the "escaped character not allowed in a name" error message.
2022-05-30Dummy implementation of the roff(7) \V (interpolate environment variable)Ingo Schwarze
escape sequence. This is needed to get \V into the correct parsing class, ESCAPE_EXPAND. It is intentional that mandoc(1) output is *not* influenced by environment variables, so interpolate the name of the variable with some decorating punctuation rather than interpolating its value.
2022-05-20Re-classify the roff(7) \r (reverse line feed) escape sequenceIngo Schwarze
from "ignore" to "unsupported" because when an input file uses it, mandoc(1) is likely to significantly misformat the output, usually showing parts of the output in a different order than the author intended.
2022-05-20Test the handling of some additional one-character escape sequencesIngo Schwarze
that take no argument and are ignored: \% \& \^ \a \d \t \u \{ \| \} No change to parsing or formatting needed.
2022-05-19following the fixed parsing direction of roff_expand() in roff.c rev. 1.260,Ingo Schwarze
some diagnostics now appear in a more reasonable order, too
2022-05-19Adjust a column number in an error messageIngo Schwarze
after the roff_expand() reorganization in roff.c rev. 1.260. The new parsing direction has two effects: 1. Correct output when a line contains more than one expanding escape sequence that has a side effect. 2. Column numbers in diagnostic messages now report the changed column numbers after any expansions left of them have taken place; in the past, column numbers refered to the original input line. Arguably, item 2 was a bit better in its old state, but slightly less helpful diagnostics are a small price to pay for correct output. Besides, when the expansion of user-defined strings or macros is involved, in many cases, mandoc(1) is already unable to report meaningful line and column numbers, so item 2 is not a noteworthy regression. The effort and code complication for fixing that would probably be excessive, in particular since well-written manual pages are not supposed to use such features in the first place.
2022-05-19fix a wrong column number that got fixed as a side effectIngo Schwarze
of the roff_expand() reorganization in roff.c rev. 1.260
2022-05-19remove a bogus warning that went away as a side effectIngo Schwarze
of the roff_expand() reorganization in roff.c rev. 1.260
2022-05-01Split a new function roff_parse_comment() out of roff_expand() because thisIngo Schwarze
functionality is not needed when called from roff_getarg(). This makes the long and complicated function roff_expand() significantly shorter, and also simpler in so far as it no longer needs to return ROFF_APPEND. No functional change intended.
2022-04-30Provide a new function roff_req_or_macro() to parse and handle a requestIngo Schwarze
or macro, including context-dependent error handling inside tbl(7) code and inside .ce/.rj blocks. Use it both in the top level roff(7) parser and inside conditional blocks. This fixes an assertion failure triggered by ".if 1 .ce" inside tbl(7) code, found by tb@ using afl(1). As a side benefit for readability, only one place remains in the code that calls the main handler functions for the various roff(7) requests. This patch also improves column numbers in some error messages and various comments.
2022-04-28The syntax of the roff(7) .mc request is quite specialIngo Schwarze
and the roff_onearg() parsing function is too generic, so provide a dedicated parsing function instead. This fixes an assertion failure when an \o escape sequence is passed as the argument; the bug was found by tb@ using afl(1). It also makes mandoc output more similar to groff in various cases.
2022-04-28oops, fix wrong .TH nameIngo Schwarze
2022-04-28Element next-line scopes may nest, so man_breakscope() may have toIngo Schwarze
break multiple element next-line scopes at the same time, similar to what man_descope() already does for unconditional rewinding. This fixes an assertion failure that tb@ found with afl(1), caused by .SH .I .I .BI and similar sequences of macros without arguments.
2022-04-27The .AT, .DT, and .UC macros are allowed inside next-line scopeIngo Schwarze
and never produce output at the place of their invocation. Minibugs found while investigating unrelated afl(1) reports from tb@.
2022-04-27Fix three bugs regarding the interaction of \z and \h:Ingo Schwarze
1. The combination \z\h is a no-op whatever the argument may be. In the past, the \z only affected the first space character generated by the \h, which was wrong. 2. For the conbination \zX\h with a positive argument, the first space resulting from the \h is not printed but consumed by the \z. 3. For the combination \zX\h with a negative argument, application of the \z needs to be completed before the \h can be started. In the past, if this combination occurred at the beginning of an output line, the \h backed up to the beginning of the line and after that, the \z attempted to back up even further, triggering an assertion. Bugs found during an audit of assignments to termp->col that i started after the bugfix tbl_term.c rev. 1.65. The assertion triggered by bug 3 was *not* yet found by afl(1).
2022-04-26typo in example text: unsused -> unused; noticed by tb@Ingo Schwarze
2022-04-26At the end of every tbl(7) cell, clear the \z state.Ingo Schwarze
This is needed because the TERMP_MULTICOL mode is designed such that term_tbl() buffers all the cells of the table row before the normal reset logic near the end of term_flushln() can be reached. This fixes an assertion failure triggered by \z near the end of a table cell, found by tb@ using afl(1).