summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2021-07-18Support auto-tagging for ".It Va".Ingo Schwarze
This combination is somewhat rare because few libraries expose so many global variables that they need a list to enumerate them, but when the idiom does occur, tagging the variable names is generally useful. For example, this helps awk(1), dc(1), make(1), rc.subr(8), ... Missing feature reported and patch reviewed, tested, and OK'ed by kn@.
2021-07-04The mandoc(1) manual already mentions that -T man output modeIngo Schwarze
neither supports tbl(7) nor eqn(7) input. If an input file contains such code anyway, tell the user rather than failing an assert(3)ion. Fixing a crash reported by Bjarni Ingi Gislason <bjarniig at rhi dot hi dot is> in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901636 which the Debian maintainer of mandoc, Michael at Stapelberg dot ch, forwarded to me.
2021-06-28In terminal output of man(7) documents, stop printing two extra blankIngo Schwarze
lines before the NAME section and before the page footer. While these blank lines had a long tradition, they didn't really serve any purpose and merely wasted screen real estate. Besides, this makes output from man(7) more similar to output from mdoc(7). This commit keeps mandoc compatible with groff-current, where G. Branden Robinson committed the same change on June 16 (groff commit 2278d6ed).
2021-06-27add a style message about overlong text lines,Ingo Schwarze
trying very hard to avoid false positives, not at all trying to catch as many cases as possible; feature originally suggested by tb@, OK tb@ kn@ jmc@
2021-06-02In -W style mode, check .Xr links along the full manpath becauseIngo Schwarze
that is more useful for validating manuals of non-base software. Nothing changes in -W all mode: by default for -T lint, we still assume we want to check base system conventions, including usually not wanting to link to non-base manual pages. The use case, a partial idea how to handle it, and a preliminary patch was originally presented by kn@, then refined by me. Final patch tested and OK'ed by kn@.
2021-05-22In revision 1.95 of cgi.c, a meta viewport element was added to the HTML output.anton
Let `mandoc -Thtml' behave the same, makes the generated HTML a bit more pleasant to view on a mobile device. ok schwarze@
2021-05-18When looking for column separators on tbl(7) data lines, properly skipIngo Schwarze
escape sequences; do not misinterpret bytes from the middle of escape sequence names or arguments as column separators. Bug reported and patch tested by Oliver dot Corff at email dot de.
2021-05-16Implement the layout specification "a" (left justify with 1em indentation)Ingo Schwarze
in HTML output mode; before this patch, the indentation was missing. Terminal output already supported the "a" specifier since 2010. Issue reported and patch tested by Oliver dot Corff at email dot de.
2021-05-16implement the tbl(7) layout modifiers "b" (bold) and "i" (italic)Ingo Schwarze
in HTML output mode, similar to tbl_term.c, function tbl_word(); issue reported by Oliver dot Corff at email dot de
2021-05-15When looking for the last layout row used, we need to look at the layoutIngo Schwarze
row used for the previous data line containing data, not at the previous data line outright, which might be a horizontal ruler. If it is, do not restart from the first layout row but still proceed to the next data row, which may have been just read from T&. Bug originally reported by Oliver dot Corff at email dot de on groff at gnu dot org: https://lists.gnu.org/archive/html/groff/2021-03/msg00003.html and forwarded to me by bentley@. Patch OK'ed by bentley@ back in April.
2021-05-01Retire OpenBSD/sgi.Visa Hankala
OK deraadt@
2021-04-28recognise riscv64 as a valid arch in mandocJonathan Gray
ok jmc@ deraadt@
2021-04-04fix spacing issue in macro;Jason McIntyre
2021-03-30In HTML output, correctly render .Bd -unfilled in proportionally-spacedIngo Schwarze
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.
2021-02-19Append .html suffix to temporary files enabling browsers to recognise itkn
Occasionally one might read a manual page in a webbrowser, e.g. "MANPAGER=firefox man -T html jq", however temporary files created for pagers lack file extensions and most web browsers are unable to detect a file's content without it. Special case mandoc(1)'s HTML output format by appending the ".html" suffix to file names such that browsers will actually render HTML as such instead of showing it as plain text. Input schwarze
2020-10-30Finally get rid of the "overflow: auto" property of ".Bl-tag > dd"Ingo Schwarze
which has long been know to cause ugly and pointless scroll bars. Matthew Martin <phy1729 at gmail dot com> helpfully explained the following two points to me: 1. What we need to do here is establish a new block formatting context such that the first line of the <dd> content moves down rather than to the right if the preceding <dt> is wide. 2. A comprehensive list of methods to establish block formatting context is available in: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context In that list, i found that "column-count: 1" does the job. It is part of CSS Multi-column Layout Level 1. While that is still in Working Draft status according to https://www.w3.org/Style/CSS/current-work , it is fully supported by all browsers according to https://developer.mozilla.org/en-US/docs/Web/CSS/column-count , probably because it was already part of the second draft of this standard almost 20 years ago: WD-css3-multicol-20010118.
2020-10-30Promote section headers that can can be used unmodified as fragmentIngo Schwarze
identifiers from TAG_WEAK to TAG_STRONG, such that for example ...#DESCRIPTION always works. Suggested by Aman Verma on the discuss@ list.
2020-10-25The GNU tbl(1) program contained in the groff package internallyIngo Schwarze
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.
2020-10-24Treat \*[.T] in the same way as \*(.T rather than calling abort(3).Ingo Schwarze
Bug found because the groff-current manual pages started using the variant form of this predefined string.
2020-10-16In HTML output, avoid printing a newline right after <pre>Ingo Schwarze
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@.
2020-10-01add a missing .PpIngo Schwarze
2020-10-01add example to apropos.1 to list all manuals in a given sectionians
ok schwarze@
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-09Do not abuse assert(3) to react to absurd input; the purpose of assert(3)Ingo Schwarze
only is to catch internal inconsistencies in the program itself. Issue found in an afl run performed by Jan Schreiber <jes at posteo dot de>. Instead, just cut down unreasonably wide spacing requested by the document to a narrower width.
2020-09-06After .ti, there are many reasons why the offset may change, so settingIngo Schwarze
it back later requires a guard against underflow, or subsequent assertions may fail. Issue found in an afl run performed by Jan Schreiber <jes at posteo dot de>.
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-27Remove a lie reported by Jamie Landeg-Jones <jamie at catflap dot org>:Ingo Schwarze
The times when -T man may have expanded .so requests are long gone, nor would such a feature be useful. Use soelim(1) if you need that.
2020-08-27Fix a regression caused by the insertion of two new tokens,Ingo Schwarze
which unintentionally made the -O tag= argument mandatory, breaking commands like "man -akO tag Ic=ulimit". Noticed while answering questions from Ian Ropers.
2020-08-27Make it more explicit that the statement "-O tag does not work with less(1)"Ingo Schwarze
only applies to -T html output mode, and why. Of course, -O tag works just fine with less(1) in the -T ascii and -T utf8 output modes. Potential for confusion pointed out by Ian Ropers.
2020-08-27Avoid artifacts in the most common case of closing conditional blocksIngo Schwarze
when no arguments follow the closing brace, \}. For example, the line "'br\}" contained in the pod2man(1) preamble would throw a bogus "escaped character not allowed in a name" error. This issue was originally reported by Chris Bennett on ports@, and afresh1@ noticed it came from the pod2man(1) preamble.
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-21undocumented options -O outfilename and -O tagfilenameIngo Schwarze
to support regression testing without a tty; no user visible change intended
2020-07-20as jmc@ points out, i missed a few instances of .Xr more 1Ingo Schwarze
2020-07-20Switch the default pager from "more -s" to "less".Ingo Schwarze
POSIX explicitly allows using a different default pager if that is documented. The pager provided in the OpenBSD base system is less(1). It can merely be called as more(1) for compatibility. Our man(1) implementation uses less(1) features that traditional more(1) did not provide, in particular tagging. Besides, as noted by deraadt@, the user interface of less(1) is slightly more refined and preferable over the user inferface of more(1). This switch was originally suggested by Ian Ropers. As explained by jmc@ and deraadt@, the -s flag was added a very long time ago when an antique version of groff(1) had an annoying bug in terminal output that would randomly display blank lines in the middle of pages. Clearly, -s has no longer been needed for many years, so drop it from the default pager invocation. OK deraadt@ jmc@ martijn@ job@
2020-06-29Support the "powerpc64" architecture name.Ingo Schwarze
The first file using it in .Dt was just committed by kettenis@.
2020-06-17Manually tag the section option.Ingo Schwarze
Automatic tagging does not work because the [-s] flag is optional. Patch from Martin Vahlensieck.
2020-06-15document -T html -O tag as implemented in main.c rev. 1.253Ingo Schwarze
2020-06-15Support -T html -O tag by passing a file:// URI to the pager.Ingo Schwarze
Feature suggested by and implementation based on a patch from Abel Romero Perez <romeroperezabel at gmail dot com>.
2020-06-11Fix a regression in rev. 1.238 (2019/07/26):Otto Moerbeek
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>. Ingo came up with the same diff and I'm borrowing his draft commit message. ok 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-24provide a STYLE message when mandoc knows the file name and the extensionIngo Schwarze
disagrees with the section number given in the .Dt or .TH macro; feature suggested and patch tested by jmc@
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-19Correctly handle non-unique tags even when NODE_ID and NODE_HREF fallIngo Schwarze
apart, NODE_ID occurring earlier than NODE_HREF.
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-08Use a separate node->tag attribute rather than abusing the node->stringIngo Schwarze
attribute for the purpose. No functional change intended. The purpose is to make it possible to later attach tags to text nodes.
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.