summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Sync stringlist implementation with NetBSD.Ingo Schwarze2020-06-152-45/+73
| | | | Various improvements of security, functionality, and style.
* sync with OpenBSD, no functional change intendedIngo Schwarze2020-06-152-43/+42
|
* update millert@'s email addressIngo Schwarze2020-06-151-3/+4
|
* document -T html -O tag as implemented in main.c rev. 1.350Ingo Schwarze2020-06-151-0/+17
|
* Support -T html -O tag by passing a file:// URI to the pager.Ingo Schwarze2020-06-151-16/+23
| | | | | Feature suggested by and implementation based on a patch from Abel Romero Perez <romeroperezabel at gmail dot com>.
* add missing compat_stringlist.o to ALL_COBJS, useful for make cleanIngo Schwarze2020-06-151-0/+1
|
* Only compile compat_*.c implementations that are actually needed.Ingo Schwarze2020-06-1520-244/+105
| | | | | That's cleaner and it is supposed to fix compiler warnings with gcc 10 reported by Wynn Wolf Arbor <wolf at oriole dot systems> on discuss@.
* Make the ./configure script simpler, more robust, and 23 lines shorter:Ingo Schwarze2020-06-143-95/+69
| | | | | | | | | | * three rather than four arguments for singletest() * let runtest() support testing two variants of compiler flags * always report a failed test, even when another test follows * run all tests before detecting fatal conditions * rename HAVE_CMSG_XPG42 to NEED_XPG4_2 for consistency * consistently use braces for shell variable interpolation * drop archaic "X${" syntax and unusual "==" in string comparisons
* merge rev. 1.58 from OpenBSD (deraadt@):Ingo Schwarze2020-06-141-5/+6
| | | | | | | recallocarray() the string buffer, to avoid leaving such contents around in the address space. Don't bother doing so for the buffer which contains aslr'd pointers... OK millert@
* Give the fts_compar struct member a real prototype.Ingo Schwarze2020-06-142-2/+6
| | | | This adds clarity and avoids compiler warnings.
* Fix a regression in rev. 1.319 (2019/03/03):Ingo Schwarze2020-06-141-1/+1
| | | | | | | Pass the right object to html_reset() or it will crash when rendering more than one manual page to HTML in a row. Bug reported by Abel Romero Perez <romeroperezabel at gmail dot com>. Patch from otto@.
* While we do not recommend the idiom ".Fl Fl long" for long optionsIngo Schwarze2020-04-268-9/+93
| | | | | | | | | | | 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.
* Resurrect the documentation of the print_otag() 's' attribute specifier,Ingo Schwarze2020-04-241-0/+17
| | | | | reverting a minor part of rev. 1.21. Contrary to what i thought, that attribute *is* still supported for a small number of unusual cases.
* provide a STYLE message when mandoc knows the file name and the extensionIngo Schwarze2020-04-247-11/+47
| | | | | disagrees with the section number given in the .Dt or .TH macro; feature suggested and patch tested by jmc@
* In fragment identifiers, use ~%d for ordinal suffixes,Ingo Schwarze2020-04-206-10/+11
| | | | | | | | | 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 permalinkIngo Schwarze2020-04-1923-69/+150
| | | | to the first few letters, similar to what was earlier done for .Pp.
* Correctly handle non-unique tags even when NODE_ID and NODE_HREF fallIngo Schwarze2020-04-193-50/+62
| | | | apart, NODE_ID occurring earlier than NODE_HREF.
* Major update:Ingo Schwarze2020-04-181-30/+135
| | | | | Complete includes, add several functions, no more <?xml?>, no more style attributes, NODE_HREF flag, mention roff_html.c.
* When a .Tg is attached to a paragraph, attach the permalinkIngo Schwarze2020-04-1819-34/+105
| | | | to the first word, or the first few words if they are short.
* Use a separate node->tag attribute rather than abusing the node->stringIngo Schwarze2020-04-087-64/+61
| | | | | attribute for the purpose. No functional change intended. The purpose is to make it possible to later attach tags to text nodes.
* Separate the place to put the <a href> permalink (now markedIngo Schwarze2020-04-0722-45/+148
| | | | | | | 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.Ingo Schwarze2020-04-0648-75/+323
| | | | | | 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 outputIngo Schwarze2020-04-049-4/+42
| | | | in the same way as it was done for .Sh and .Ss in mdoc(7)
* Remove some stray argument names from function prototypes,Ingo Schwarze2020-04-037-23/+37
| | | | | | for consistency with the dominant style used in mandoc. No functional change. Patch from Martin Vahlensieck <academicsolutions dot ch>.
* #include <stdint.h> because that is needed before #include <ohash.h>;Ingo Schwarze2020-04-031-0/+1
| | | | | fixing a build failure of mandoc-portable on Arch Linux reported by Stephen Gregoratto <dev at sgregoratto dot me>.
* When the last file formatted yielded no tags, the tags file gotIngo Schwarze2020-04-026-80/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | deleted before starting the pager, even when earlier input files had written to it; thanks to weerd@ for reporting that bug. Since we now generate tags for section headers, we almost always generate at least some. Consequently, while fixing the above bug, simplify the code by never deleting the tags file before the pager exits, not even in the rare case that the file happens to be empty. Hence, this patch is -75 +63 LOC even though it fixes two bugs. While deleting the output files belongs after exit from the pager, closing them should be done before it is started. Collect the related code, which was scattered in various places, to where it belongs, in a dedicated function in the term_tag.c module. As a side benefit, never fclose(2) stdout, only dup2(2) to it. Similarly, when the -O tag argument wasn't found in the last file formatted, there was a complaint about "no such tag" even when the argument did occur in earlier files. Fix that by looking for a matching tag after every formatted file rather than just once at the very end. Given that command line arguments aren't properties of the file(s) being formatted, that check is a job for the main program, not for the formatters, so while fixing the check, move it from term_tag.c to main.c.
* Copy tagged strings before marking hyphens as breakable.Ingo Schwarze2020-04-0217-25/+44
| | | | For example, this makes ":tCo-processes" work in ksh(1).
* Just like we are already doing it in HTML output, automatically tagIngo Schwarze2020-04-0122-30/+121
| | | | | | | 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.
* Even though the HTML, man, markdown, PDF, PostScript, and tree formattersIngo Schwarze2020-03-281-12/+9
| | | | | | never write a ctags(1) file, using a pager still requires writing the main output file and passing the file name to the pager. Recent regression mentioned on IRC and reported by kn@.
* test skipping of initial hyphens and minus signs in automatic tags;Ingo Schwarze2020-03-215-5/+41
| | | | related to tags.c rev. 1.30
* When setting automatic tags, skip initial hyphens and minus signs,Ingo Schwarze2020-03-211-2/+18
| | | | | | | | bringing the behaviour for mdoc(7) closer to what is already done for man(7). Triggered by the observation of kn@ that automatic tagging didn't work very well for find(1) primaries. OK kn@
* The tag file always needs to be closed before starting the pager,Ingo Schwarze2020-03-191-1/+2
| | | | | | even when no output formatter was allocated because all pages shown were preformatted. Regression in previous reported by <Andreas dot Kahari at abc dot se> on bugs@.
* Make the "make depend" maintainer target more convenientIngo Schwarze2020-03-132-6/+20
| | | | by having it run ./configure with native fts and ohash disabled.
* Properly reset the validation part of the tagging module between files.Ingo Schwarze2020-03-132-0/+5
| | | | This fixes a crash in makewhatis(8) encountered by naddy@.
* Split tagging into a validation part including prioritizationIngo Schwarze2020-03-13121-909/+2339
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* The HTML standard does not allow self-closing syntax for non-void elements.Ingo Schwarze2020-02-272-3/+3
| | | | Consequently, write an explicit end tag for <mark> elements.
* Fully support explicit tagging of .Sh and .Ss.Ingo Schwarze2020-02-2710-18/+141
| | | | | | | | | | | | | | | | | | | | | | | | | 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:Ingo Schwarze2020-02-2764-311/+1156
| | | | | | | | | | | | | | 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.Ingo 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.
* Marc Espie reported that "man p*ipc" displayed the perlipc(1) manual.Ingo Schwarze2020-02-241-3/+25
| | | | | | | | | | | | | | The reason was that as a last resort when failing to find a page name in mandoc.db(5) or at a few well well-defined fully qualified file names, man(1) uses glob(3) to look for candidate files in relevant directories, because some operating systems have weird file name extensions, for example pcap.3pcap and BF_set_key.3ssl on Linux. But during that globbing, the metacharacters "*?[" need to be escaped in the name, section, and path supplied by the user, or you would get weird false positives and misleading warning messages and would be unable to use the fallback for path or file names that actually contain an opening bracket. Feedback and OK espie@.
* bugfix: indented paragraph macros need a space characterIngo Schwarze2020-02-201-3/+3
| | | | before the width argument
* bugfix: .Tg must be ignored completely in these output modesIngo Schwarze2020-02-202-2/+2
|
* Mention that .AT, .P, .SB, and .UC are extensions; it really mattersIngo Schwarze2020-02-181-3/+14
| | | | | | | | | | | | | because we only retain the language for backward compatibility in the first place. Part of the research done by <G dot Branden dot Robinson at gmail dot com>, see the list <groff at gnu dot org> for details. No change to the following conventions: Consider portable whatever made it into GNU troff no later than 4.4BSD. For portable extensions, mention their origin at the end of the description. For non-portable extensions, for example from man-ext, usually warn earlier, near the beginning of the description.
* mention that -T man does not support eqn(7) and tbl(7);Ingo Schwarze2020-02-151-1/+6
| | | | triggered by a question from Stephen Gregoratto <dev at sgregoratto dot me>
* two new entries: "Fl Fl" to "Fl \-" in validation and eqn/tbl in -T manIngo Schwarze2020-02-151-0/+8
|
* Mention that the .Dd "date" argument is the date of the last change.Ingo Schwarze2020-02-131-15/+2
| | | | | | Triggered by a question from Jason A. Donenfeld. While here, delete three COMPATIBILITY entries that i fixed some time ago.
* Digit-width and narrow spaces are non-breaking.Ingo Schwarze2020-02-132-8/+9
| | | | Noticed because Branden Robinson worked on related documentation in groff.
* In roff, a space character at the beginning of an input line requiresIngo Schwarze2020-02-121-2/+2
| | | | | | | | starting a new output line, and merely starting a new line of HTML code isn't sufficient to achieve that. Solve this in the same way as mdoc_html.c already does it, by printing a <br/> element. Fixing a bug reported by Jason A. Donenfeld <Jason at zx2c4 dot com> in the wg-quick(8) manual page on manpages.debian.org.
* Finally delete support for the "_whatdb" configuration directive,Ingo Schwarze2020-02-102-14/+1
| | | | | which has a misleading syntax. It was declared obsolete and superseded by the "manpath" directive five years ago.
* Reduce the diff to OpenBSD by making FILES a list,Ingo Schwarze2020-02-101-1/+3
| | | | | even though it has only one entry in the portable version. Do not add /etc/examples/man.conf for the portable version, though.