summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2017-02-06The .Nm macro does not only use the default name when it has noIngo Schwarze
argument, but also when the first argument is a child macro. Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste Daroussin <bapt at FreeBSD> sent me long ago for a different reason. While solving this, switch to the new technique of doing text production in the validator, reducing code duplication in the formatters, which also makes -Ttree output clearer.
2017-02-05Wrap .St content in a <span class="St">.Ingo Schwarze
Also add forgotten <span class="Ux"> to .At rendering.
2017-02-05fix font selection for .Bf without argumentIngo Schwarze
2017-02-05mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;Ingo Schwarze
suggested by bentley@ long ago, but needed lots of cleanup first
2017-02-05for .Rs, use <cite>Ingo Schwarze
2017-02-05Improve <table> syntax:Ingo Schwarze
The <col> element can only appear inside <colgroup>, so use <colgroup>. The <tbody> element is optional and useless, so don't use it. Even if we would ever need <thead> or <tfoot>, <tbody> would still be optional and useless; besides, we will likely never need <thead> or <tfoot>, simply because our languages don't support such functionality.
2017-02-04Do not fix the default indent for all subsequent files; some may useIngo Schwarze
a different macro language and hence require a different indent. You can see the effect with "man -a 1 host hostname".
2017-02-03Minor cleanup, no functional change:Ingo Schwarze
We always have a roff parser, so mparse_free() does not need to check for existence before freeing it. Also arrange code in struct mparse, mparse_reset(), and mparse_free() in the same order for readability.
2017-02-03If an application parses multiple files with mparse_readfd(3) butIngo Schwarze
without using mparse_open(3) to open the files, and if one of the files includes a gzip'ed file with .so, then the gzip flag remains set and the next main file will be expected to be gzip'ed. Fix this by clearing the gzip flag in mparse_reset(3). Bug found and patch provided by Michael <Stapelberg at debian dot org>.
2017-01-31add missing HISTORY informationIngo Schwarze
2017-01-30Rework fill mode handling for -man -Thtml.Ingo Schwarze
Basically, open <pre> whenever printing text in no-fill mode and it is not already open, and close it whenever printing something that cannot be inside <pre>. This fixes a crash reported by Michael <Stapelberg at debian dot org> in the French Linux chroot(2) manual and also improves rendering for OpenBSD pages like DPMSGetTimeouts(3) and GLwDrawingArea(3). These changes also permitted retiring struct mhtml.
2017-01-29eliminate one useless struct and one level of indirection;Ingo Schwarze
no functional change
2017-01-28Add a warning "new sentence, new line".Ingo Schwarze
This does not attempt to pinpoint each and every offender, but instead tries very hard to avoid false positives: Currently, there are only two false positives in the whole OpenBSD base system. Only do this in mdoc(7), not in man(7), because manuals written in man(7) typically have much worse problems than this. OK jmc@ on a previous version of the patch
2017-01-28Simplify usage of print_otag() even more:Ingo Schwarze
accept NULL to skip the attribute or format.
2017-01-28.Bl -column with zero columns is legal, so don't segfalt on it.Ingo Schwarze
Bug introduced in rev. 1.123 triggered for example in gssapi(3), analyzed and reported by Michael <Stapelberg at debian dot org>. Simplify the code a bit more while here.
2017-01-27warn about invalid output optionsIngo Schwarze
and error out if they occur on the command line; missing feature found in the TODO file
2017-01-27warn about missing one-line description;Ingo Schwarze
missing feature found in the TODO file
2017-01-27Parse the section number from the content of preformatted pagesIngo Schwarze
and warn if it doesn't match the directory where the file was found.
2017-01-27If parsing a page reveals that it is neither mdoc(7) nor man(7),Ingo Schwarze
fall back to treating it as preformatted rather than treating it as man(7) anyway.
2017-01-27fix base directory detection for makewhatis -tIngo Schwarze
2017-01-27Always register names taken from file names in the names ohash.Ingo Schwarze
Bug found by makewhatis -p crashing in mlink_check().
2017-01-26Fix -man -Thtml formatting after .nf (which has nothing to doIngo Schwarze
with "literal", by the way, it means "no fill"): * Use <pre> such that whitespace is preserved. * Preserve lines breaks. * For font alternating macros, avoid node recursion which required scary juggling with the fill state. Instead, simply print the text children directly. Missing feature first noticed by kristaps@ in 2011, the again reported by afresh1@ in 2016, and finally reported here: https://github.com/Debian/debiman/issues/21 , which i only found because of Shane Kerr's comment here: https://plus.google.com/110314300533310775053/posts/H1eaw9Yskoc
2017-01-25+arm64Theo de Raadt
2017-01-25Add the style sheet used on man.openbsd.org to the source tree.Ingo Schwarze
It is NOT used during "make build" and NOT installed, but it is helpful for people trying to read and understand html.c and mdoc_html.c, and maybe even for users of mandoc -Thtml. OK deraadt@
2017-01-25Improve HTML formatting of .Bl -tag.Ingo Schwarze
In particular, when using the style sheet, put the body on the same line as the head for short heads, or on the next line for long heads, in a way that preserves both correct indentation and correct vertical spacing with and without -compact, and with one or more heads per body (hi, Zaphod) - eight use cases so far - and with and without -tag, and with and without -offset, 32 use cases grand total. Using many ideas from zhuk@, from <David dot Dahlberg at fkie dot fraunhofer dot de>, and from Benny Lofgren <bl dash lists at lofgren dot biz>, and a few of my own. This is an excellent demonstration that CSS is an extremely hostile language, much more trapful and much harder to use than, say, C. When matthew@ reported this in July 2014 (!), it was already a known issue, and i no longer remember for how long. My first serious attempt at fixing it (in November 2015) failed miserably. I'd love to see simplifications of both the generated HTML code and of the style sheet, but without breaking any of the 32 use cases, please.
2017-01-21bug was fixed, delete the BUGS sectionIngo Schwarze
2017-01-21slightly simplify header and footer stylesIngo Schwarze
2017-01-21Avoid writing constant style attributes over and over again.Ingo Schwarze
Move them to the style sheet.
2017-01-21clean up the remaining class attributesIngo Schwarze
2017-01-20Standardize class attributes for semantic macros.Ingo Schwarze
Correct markup for .Va and iprove markup for .Dv, .Er, .Ev while here.
2017-01-20standardize .Rs class attributesIngo Schwarze
2017-01-20standardize .Bl and .It class attributesIngo Schwarze
2017-01-19clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;Ingo Schwarze
in particular, stop abuse of <blockquote>
2017-01-19clean up .Sx and .Xr HTML markupIngo Schwarze
2017-01-19Clean up CSS rules for sections and paragraphs.Ingo Schwarze
Start using real macro names for CSS classes.
2017-01-19Adjust indentation of the HTML output to the conventions establishedIngo Schwarze
by html.c. No semantic change.
2017-01-19Start cleanup: trim useless HTML comments and <div> elementsIngo Schwarze
on the <html> and <body> levels.
2017-01-19Implement line breaking of the generated HTML code at space charactersIngo Schwarze
in filled text. This does not affect HTML semantics, but makes the HTML code even more humanly readable. While here, - collapse multiple consecutive space characters in filled text - and insert a blank between style entries.
2017-01-18Make HTML output more human readable by overhauling line break logicIngo Schwarze
around tags and by introducing some simple indentation. No change of HTML semantics intended.
2017-01-17Completely delete the buf field of struct html and all the buf*()Ingo Schwarze
interfaces. Such a static buffer was a bad idea in the first place, causing unfixable truncation that was only prevented by triggering an assertion failure. Instead, let the small number of remaining users allocate and free their own, temporary dynamic buffers, or for the case of .Xr and .In, pass the original data to be assembled in print_otag().
2017-01-17Simplify the usage of print_otag() by making it accept a variableIngo Schwarze
number of arguments. Delete struct htmlpair and all the PAIR_*() macros. Delete enum htmlattr, handle that in print_otag() instead. Minus 190 lines of code; no functional change except better ordering of attributes (class before style) in three cases.
2017-01-15When looking up macro values while the macro tables are being builtIngo Schwarze
in makewhatis(8), use ohash rather than linear searches. This was identified as the main makewhatis(8) performance bottleneck by Baptiste Daroussin <bapt at FreeBSD>, who also suggested part of the improved algorithm. This reduces the run time of "makewhatis /usr/share/man" from eleven to five seconds on my notebook. Note that the changed code is not used in apropos(1), so don't expect speedups there. While here, sort macro values asciibetically, to improve reproducibility - which still isn't perfect, but getting better.
2017-01-12Skipping all escape sequences at the beginning of strings in deroff()Ingo Schwarze
was too aggressive. There are strings that legitimately begin with an escape sequence. Only skip leading escape sequences representing whitespace. Bug reported by martijn@.
2017-01-12show meta data for -Ttree outputIngo Schwarze
2017-01-11Do text production for .Bt, .Ex, .Rv, .Ud at the validation stageIngo Schwarze
rather than in the formatters. Use NODE_NOSRC flag for .Lb and NODE_NOSRC and NODE_NOPRT for .St. Results in a more rigorous syntax tree and in 135 lines less code. This work was triggered by a question from Abhinav Upadhyay <er dot abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.
2017-01-10Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.Ingo Schwarze
More rigorous AST and 40 lines less code.
2017-01-10For the .Ux/.Ox family of macros, do text production at the validationIngo Schwarze
stage rather than in each and every individual formatter, using the new NODE_NOSRC flag. More rigorous and also ten lines less code.
2017-01-10simplify; NODE_ENDED does no harm in man(7)Ingo Schwarze
2017-01-10unify names of AST node flags; no change of cpp outputIngo Schwarze
2017-01-10Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze
Use them to mark generated nodes and nodes that shall not produce output. Let -Ttree output mode display these new flags. Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments. Use NODE_NOPRT for .Dd, .Dt, and .Os. These will help to make handling of text production macros more rigorous.