OpenBSD CVS

CVS log for src/usr.bin/mandoc/mdoc_html.c


[BACK] Up to [local] / src / usr.bin / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.225 / (download) - annotate - [select for diffs], Wed Jul 6 16:02:52 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.224: +3 -3 lines
Diff to previous 1.224 (colored)

https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/ says:
"Start names with a capital letter;
it helps some screen readers speak them with appropriate inflection."
Anna Vyalkova already did that correctly when sending patches,
but i ruined it when committing, so fix it now.

Revision 1.224 / (download) - annotate - [select for diffs], Wed Jul 6 15:25:22 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.223: +2 -2 lines
Diff to previous 1.223 (colored)

assign the ARIA role "doc-subtitle" to the .Nd element;
discussed with Anna Vyalkova <cyber at sysrq dot in>

Revision 1.223 / (download) - annotate - [select for diffs], Wed Jul 6 14:27:55 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
Changes since 1.222: +4 -4 lines
Diff to previous 1.222 (colored)

While the HTML standard allows multiple <h1> elements in the same
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>.

Revision 1.222 / (download) - annotate - [select for diffs], Tue Jul 5 21:25:24 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.221: +18 -15 lines
Diff to previous 1.221 (colored)

Finally get rid of the archaic <table> markup for header and footer lines
and use flexbox CSS instead.  Improve accessibility by adding role
and aria-label attributes to these header and footer lines.
Using ideas from both Anna Vyalkova <cyber at sysrq dot in> and myself.

As a welcome side effect, this also resolves the long-standing issue
that the rendering was always 65em wide, requiring horizontal scrolling
when the window was narrower.  Now, rendering nicely adapts to browser
windows of arbitrary narrowness.

Revision 1.221 / (download) - annotate - [select for diffs], Mon Jul 4 14:37:14 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.220: +3 -3 lines
Diff to previous 1.220 (colored)

Put the HTML comment containing the Copyright header (if any)
between the <head> and the <body> rather than before the <head>
because the <meta charset="utf-8"/> element ought to be within
the first 1024 bytes of the HTML code.
Issue found with validator.w3.org.

Revision 1.220 / (download) - annotate - [select for diffs], Sun Jul 3 14:28:27 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.219: +2 -2 lines
Diff to previous 1.219 (colored)

Instead of the custom <div class="manual-text">, use the standard
HTML <main> element.  The benefit is that it has the ARIA landmark
role "main" by default.  To ease the transition for people using
their own CSS file instead of mandoc.css, retain the custom class
for now.

I had this idea in a discussion with Anna Vyalkova <cyber at sysrq dot in>.
Patch from Anna, slightly tweaked by me.

Revision 1.219 / (download) - annotate - [select for diffs], Sat Jun 25 12:44:12 2022 UTC (22 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.218: +20 -11 lines
Diff to previous 1.218 (colored)

If an .Xr macro contains a section argument, write an aria-label attribute
such that users of screen readers aren't forced to listen to lengthy and
distracting readings like "mdoc, left parenthesis, 7, right parenthesis".

Based on a patch from Anna Vyalkova <cyber at sysrq dot in>,
significantly tweaked by me.

Revision 1.218 / (download) - annotate - [select for diffs], Fri Jun 24 11:15:19 2022 UTC (22 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.217: +4 -3 lines
Diff to previous 1.217 (colored)

Improve accessibility of -T html -O toc output by using the <nav> element
in the DPUB-ARIA doc-toc role.
Patch from Anna Vyalkova <cyber at sysrq dot in> slightly tweaked by me.

This is hopefully the start of a collaboration to improve accessibility
of Unix manual pages using the WAI-ARIA, HTML-ARIA, and DPUB-ARIA standards.
Progress appears to be possible without changing *anything* with respect to
the way manual pages are written.  Instead, it seems sufficient to properly
translate semantic cues already implied by existing mdoc(7) markup into the
appropriate HTML elements and ARIA attributes.  Overall, the total length
of HTML output is likely to increase slightly, but not much.

Revision 1.217 / (download) - annotate - [select for diffs], Tue Mar 30 19:23:50 2021 UTC (3 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.216: +6 -3 lines
Diff to previous 1.216 (colored)

In HTML output, correctly render .Bd -unfilled in proportionally-spaced
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.

Revision 1.216 / (download) - annotate - [select for diffs], Fri Oct 16 17:22:39 2020 UTC (3 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.215: +5 -6 lines
Diff to previous 1.215 (colored)

In HTML output, avoid printing a newline right after <pre>
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@.

Revision 1.215 / (download) - annotate - [select for diffs], Sun Apr 19 15:15:54 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.214: +9 -4 lines
Diff to previous 1.214 (colored)

Correctly handle non-unique tags even when NODE_ID and NODE_HREF fall
apart, NODE_ID occurring earlier than NODE_HREF.

Revision 1.214 / (download) - annotate - [select for diffs], Sat Apr 18 20:28:46 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.213: +7 -4 lines
Diff to previous 1.213 (colored)

When a .Tg is attached to a paragraph, attach the permalink
to the first word, or the first few words if they are short.

Revision 1.213 / (download) - annotate - [select for diffs], Mon Apr 6 09:55:49 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.212: +20 -15 lines
Diff to previous 1.212 (colored)

Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.
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.

Revision 1.212 / (download) - annotate - [select for diffs], Wed Apr 1 20:10:17 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.211: +1 -3 lines
Diff to previous 1.211 (colored)

Just like we are already doing it in HTML output, automatically tag
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.

Revision 1.211 / (download) - annotate - [select for diffs], Fri Mar 13 00:31:05 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.210: +41 -159 lines
Diff to previous 1.210 (colored)

Split tagging into a validation part including prioritization
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.

Revision 1.210 / (download) - annotate - [select for diffs], Thu Feb 27 22:26:26 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +2 -2 lines
Diff to previous 1.209 (colored)

The HTML standard does not allow self-closing syntax for non-void elements.
Consequently, write an explicit end tag for <mark> elements.

Revision 1.209 / (download) - annotate - [select for diffs], Thu Feb 27 01:25:57 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +38 -32 lines
Diff to previous 1.208 (colored)

Introduce the concept of nodes that are semantically transparent:
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@.

Revision 1.208 / (download) - annotate - [select for diffs], Sun Jan 19 17:59:01 2020 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +14 -2 lines
Diff to previous 1.207 (colored)

Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a place
as defining a term.  Please only use it when automatic tagging does
not work.  Manual page authors will not be required to add the new
macro; using it remains optional.  HTML output is still rudimentary
in this version and will be polished later.

Thanks to kn@ for reminding me that i have been considering since
BSDCan 2014 whether something like this might be useful.  Given
that possibilities of making automatic tagging better are running
out and there are still several situations where automatic tagging
cannot do the job, i think the time is now ripe.

Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.

Revision 1.207 / (download) - annotate - [select for diffs], Tue Dec 10 10:49:04 2019 UTC (4 years, 5 months ago) by bentley
Branch: MAIN
Changes since 1.206: +8 -4 lines
Diff to previous 1.206 (colored)

In HTML, display straight quotes, not curly quotes, for Qq/Qo/Qc macros.

This is the intended behavior and already the case in terminal output.

Incorrect output noticed by Eldred Habert.

ok schwarze@

Revision 1.206 / (download) - annotate - [select for diffs], Sun Sep 15 00:08:46 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.205: +27 -21 lines
Diff to previous 1.205 (colored)

Fix line breaking in no-fill mode (.Bd -unfilled/<pre>),
which apparently didn't work since the .Pp/<p> reorg.
The new logic is more similar to what the terminal formatter does:

1. Before a node that starts a new mdoc(7) input line,
start a new HTML output line.
2. An empty input line or a .Pp causes an empty output line.
3. Nothing needs to be done at the end of a node.

Severe misformatting was reported in table(5) by
Edgar Pettijohn <edgar at pettijohn dash web dot com> on misc@.

Revision 1.205 / (download) - annotate - [select for diffs], Tue Sep 3 15:09:39 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +2 -4 lines
Diff to previous 1.204 (colored)

Format .Nd with more logically with <span> rather than <div>; after all,
it is supposed to be a one-line description.  For the case where .Nd
generates flow content (which is very bad style but syntactically
valid), rely on the new feature of html_close_paragraph() to close
out the <span> prematurely, effectively moving the flow content out
of the .Nd for HTML presentation.  For the final closing, also rely
on the new html_close_paragraph() functionality, this time triggered
by the subsequent block, which will typically be .Sh SYNOPSIS.

Revision 1.204 / (download) - annotate - [select for diffs], Sun Sep 1 15:12:03 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +2 -2 lines
Diff to previous 1.203 (colored)

delete the TAG_IDIV crutch, which is no longer used

Revision 1.203 / (download) - annotate - [select for diffs], Fri Mar 1 10:48:58 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.202: +6 -2 lines
Diff to previous 1.202 (colored)

Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML <section> elements
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>.

Revision 1.202 / (download) - annotate - [select for diffs], Fri Jan 18 14:36:16 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +11 -8 lines
Diff to previous 1.201 (colored)

The .UR and .MT blocks in man(7) are represented by <a> elements
which establish phrasing context, but they can contain paragraph
breaks (which is relevant for terminal formatting, so we can't just
change the structure of the syntax tree), which are respresented
by <p> elements and cannot occur inside <a>.

Fix this by prematurely closing the <a> element in the HTML formatter.
This menas that the clickable text in HTML output is shorter than
what is represented as the link text in terminal output, but in
HTML, it is frankly impossible to have the clickable area of a
hyperlink extend across a paragraph break.  The difference in
presentation is not a major problem, and besides, paragraph breaks
inside .UR are rather poor style in the first place.

The implementation is quite tricky.  Naively closing out the <a>
prematurely would result in accessing a stale pointer when later
reaching the physical end of the .UR block.  So this commit separates
visual and structural closing of "struct tag" stack items.  Visual
closing means that the HTML element is closed but the "struct tag"
remains on the stack, to avoid later access to a stale pointer and
to avoid closing the same HTML element a second time later.

This also needs reference counting of pointers to "struct tag" stack
items because often more than one child holds a pointer to the same
parent item, and only the outermost child can safely do the physical
closing.

In the whole corpus of nearly half a million manual pages on
man.openbsd.org, this problem occurs in exactly one page: the
groff(1) version 1.20.1 manual contained in DragonFly-3.8.2, which
contains a formatting error triggering the bug.

Revision 1.201 / (download) - annotate - [select for diffs], Fri Jan 11 16:35:39 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +3 -3 lines
Diff to previous 1.200 (colored)

do not access a NULL pointer when formatting a completely empty document

Revision 1.200 / (download) - annotate - [select for diffs], Fri Jan 11 12:44:10 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +43 -43 lines
Diff to previous 1.199 (colored)

Remove the HTML title= attributes which harmed accessibility and
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.

Revision 1.199 / (download) - annotate - [select for diffs], Thu Jan 10 07:39:39 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +1 -13 lines
Diff to previous 1.198 (colored)

After years of gnashing of teeth, i finally found a way to avoid
having to write empty list elements for non-compact .Bl -tag lists:

1. Add margin-bottom to the <dd>.
Note that margin-top on the <dt> doesn't work because it would put
a short <dt> lower than the <dd>; margin-bottom on the <dt> doesn't
work because it would put vertical space before the <dd> for a long
<dt>; and margin-top on the <dd> doesn't work because it would put
a short <dt> higher than the <dd>.  Only margin-bottom on the <dd>
has none of these adverse effects.

2. Of course, margin-bottom on the <dd> fails to take care of the
vertical spacing before the first list element, so implement that
separately by margin-top on the <dl>.

3. For .Bl -tag -compact, reset both to zero.

Revision 1.198 / (download) - annotate - [select for diffs], Mon Jan 7 06:51:37 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +132 -94 lines
Diff to previous 1.197 (colored)

Represent mdoc(7) .Pp (and .sp, and some SYNOPSIS and .Rs features)
by the <p> HTML element and use the html_fillmode() mechanism
for .Bd -unfilled, just like it was done for man(7) earlier, finally
getting rid both of the horrible <div class="Pp"></div> hack and
of the worst HTML syntax violations caused by nested displays.

Care is needed because in some situations, paragraphs have to remain
open across several subsequent macros, whereas in other situations,
they must get closed together with a block containing them.

Some implementation details include:
* Always close paragraphs before emitting HTML flow content.
* Let html_close_paragraph() also close <pre> for extra safety.
* Drop the old, now unused function print_paragraph().
* Minor adjustments in the top-level man(7) node formatter for symmetry.
* Bugfix: .Ss heads suspend no-fill mode, even though .Ss doesn't end it.
* Bugfix: give up on .Op semantic markup for now, see the comment.

Revision 1.197 / (download) - annotate - [select for diffs], Mon Dec 31 10:35:51 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +4 -13 lines
Diff to previous 1.196 (colored)

Cleanup, no functional change:
Stop trying to keep fill mode state locally in the mdoc HTML formatter,
rely on the state stored in the nodes instead.

Note that the .Bd -literal code is buggy.  Nested literal displays
result in nested <pre> elements, which violates HTML syntax.
But i'm not yet fixing bugs in this commit, i'm merely deleting
code which has no effect.

Revision 1.196 / (download) - annotate - [select for diffs], Sun Dec 30 00:48:47 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.195: +6 -6 lines
Diff to previous 1.195 (colored)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.195 / (download) - annotate - [select for diffs], Tue Dec 25 00:05:38 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.194: +2 -2 lines
Diff to previous 1.194 (colored)

bugfix: make the static class buffer long enough
for .Bl -bullet -compact -offset indent

Revision 1.194 / (download) - annotate - [select for diffs], Sat Dec 22 19:48:46 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.193: +3 -2 lines
Diff to previous 1.193 (colored)

In the TOC, close <a> before opening <ul>.
Simplified version of a bugfix patch from rapha@.

Revision 1.193 / (download) - annotate - [select for diffs], Sat Dec 15 23:33:20 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +2 -1 lines
Diff to previous 1.192 (colored)

Yet another round of improvements to manual font selection.

Unify handling of \f and .ft.
Support \f4 (bold+italic).
Support ".ft BI" and ".ft CW" for terminal output.
Support the .ft request in HTML output.
Reject the bogus fonts \f(C1, \f(C2, \f(C3, and \f(CP.

Revision 1.192 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:14 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.191: +1 -2 lines
Diff to previous 1.191 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.191 / (download) - annotate - [select for diffs], Mon Dec 3 21:00:06 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +10 -4 lines
Diff to previous 1.190 (colored)

In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)
to the standard forms (Pp, Ft, PP) up front, such that later code
does not need to look for the obsolete versions.
This reduces the risk of incomplete handling.

Revision 1.190 / (download) - annotate - [select for diffs], Thu Oct 4 13:22:35 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.189: +4 -2 lines
Diff to previous 1.189 (colored)

When a subsection header contains no letters but only special
characters, skip the TOC entry.  Issue reported by kristaps@.

Revision 1.189 / (download) - annotate - [select for diffs], Tue Oct 2 19:43:27 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.188: +23 -7 lines
Diff to previous 1.188 (colored)

add DESCRIPTION and .Ss to the toc; suggested by espie@

Revision 1.188 / (download) - annotate - [select for diffs], Tue Oct 2 14:56:36 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +32 -2 lines
Diff to previous 1.187 (colored)

Add an option -T html -O toc to add a brief table of contents near
the top of HTML pages containing at least two non-standard sections.
Suggested by Adam Kalisz and discussed with kristaps@ during EuroBSDCon 2018.

Revision 1.187 / (download) - annotate - [select for diffs], Tue Oct 2 12:32:55 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +2 -2 lines
Diff to previous 1.186 (colored)

Support a second argument to -O man,
selecting the format according to local existence of the file.
Suggested by kristaps@ during EuroBSDCon 2018.
Written on the train Frankfurt-Karlsruhe returning from EuroBSDCon.

Revision 1.186 / (download) - annotate - [select for diffs], Fri Aug 17 20:31:52 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +8 -8 lines
Diff to previous 1.185 (colored)

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard.  Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.

Revision 1.185 / (download) - annotate - [select for diffs], Fri Jul 27 17:47:05 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +1 -3 lines
Diff to previous 1.184 (colored)

garbage collect the unused "#define INDENT"

Revision 1.184 / (download) - annotate - [select for diffs], Mon Jun 25 16:54:55 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +3 -4 lines
Diff to previous 1.183 (colored)

Delete substantial amounts of code
now that we no longer use variable style= attributes.

Revision 1.183 / (download) - annotate - [select for diffs], Mon Jun 25 14:06:03 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +2 -2 lines
Diff to previous 1.182 (colored)

Drop explicit, constant style=margin-left attribute on .Bf blocks.
Since <div> uses HTML_NLAROUND, it is no longer needed.

Revision 1.182 / (download) - annotate - [select for diffs], Mon Jun 25 13:46:01 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +2 -22 lines
Diff to previous 1.181 (colored)

Do not write <colgroup> elements.  Their only purpose is to enforce
author-specified column widths, which can harm responsive design and
provide no real benefit: HTML rendering engines usually do just
fine automatically selecting appropriate column widths.

Revision 1.181 / (download) - annotate - [select for diffs], Sun Jun 10 16:15:40 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +10 -17 lines
Diff to previous 1.180 (colored)

In HTML output, for lists that have an -indent argument, just use
a uniform indentation in CSS adapted to the viewport width and
ignore the value of the argument taken from mdoc(7).  While
author-specified widths somewhat work as a micro-optimization in
terminal and typeset output, they are nothing but harmful in HTML
style= attributes because they break responsive design, whereas
using a reasonable default indent almost never results in ugly
output.  Admittedly, the author-specified width might occasionally
look even better, but only slightly so, and only for some viewport
sizes.
Based on guidance provided by John Gardner.

Revision 1.180 / (download) - annotate - [select for diffs], Tue May 29 01:55:45 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +6 -7 lines
Diff to previous 1.179 (colored)

Ignore author-specified -width arguments for -tag and -hang lists
in HTML output.  For terminal and typeset output, such arguments
kind of work to achieve presentational micro-optimization.
But for HTML, they only do harm.

Large increases usually look ugly.  Large reductions are impossible
since the default is not large in the first place.  Small tweaks in
either direction are not important; at least not important enough
to justify making responsive design impossible.

Triggered by John Gardner's suggestion to further reduce style=
attributes in the HTML code, in particular those containing hard-coded
lengths.

Revision 1.179 / (download) - annotate - [select for diffs], Fri May 25 20:23:39 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +6 -17 lines
Diff to previous 1.178 (colored)

Do not write duplicate id= attributes, they violate HTML syntax.
Append suffixes for disambiguation.  Issue first reported by Jakub
Klinkovsky <j dot l dot k at gmx dot com> (Arch Linux).

Revision 1.178 / (download) - annotate - [select for diffs], Mon May 21 01:10:06 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.177: +2 -2 lines
Diff to previous 1.177 (colored)

Use <span> for .Ms rather than <b>; discussed with John Gardner.

Revision 1.177 / (download) - annotate - [select for diffs], Mon May 21 00:29:41 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.176: +2 -2 lines
Diff to previous 1.176 (colored)

Use <span> for .Ad rather than <i>; also suggested by John Gardner.

Revision 1.176 / (download) - annotate - [select for diffs], Sun May 20 23:54:15 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored)

Use <span> rather than abusing <i> for .Pa;
suggested by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.175 / (download) - annotate - [select for diffs], Wed May 9 00:45:33 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.174: +11 -15 lines
Diff to previous 1.174 (colored)

Fix a long-standing issue:
Some macros (Nd, Oo) can contain blocks but rendered as elements that
can only contain phrasing content, resulting in invalid HTML nesting.
Switch them to <div>.
Also move the related "display: inline" style from the HTML to the CSS.

Reminded during a conversation with John Gardner.

Revision 1.174 / (download) - annotate - [select for diffs], Tue May 8 21:42:11 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.173: +13 -54 lines
Diff to previous 1.173 (colored)

Eliminate the class=It-* attributes.
Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code.
Suggested by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.173 / (download) - annotate - [select for diffs], Tue May 8 17:52:24 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.172: +11 -11 lines
Diff to previous 1.172 (colored)

Switch the emitted HTML element from <b> to <code> for the fixed
syntax element macros .Nm, .Fl, .Cm, .Ic, .In, .Fd, .Fn, and .Cd.
Adjust both the internal and external style sheets such that
rendering remains unchanged in typical browsers.

Based on feedback from John Gardner <gardnerjohng at gmail dot com>.

Revision 1.172 / (download) - annotate - [select for diffs], Tue Apr 24 00:36:04 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.171: +12 -12 lines
Diff to previous 1.171 (colored)

replace my vague and idiosyncratic term "selflink"
with the clearer and more usual "permalink";
suggested by John Gardner <gardnerjohng at gmail dot com>

Revision 1.171 / (download) - annotate - [select for diffs], Fri Apr 13 16:27:14 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.170: +20 -13 lines
Diff to previous 1.170 (colored)

preserve comments before .Dd and .TH (typically Copyright and license)
in full HTML output, but not with -Ofragment, e.g. in man.cgi(8);
suggested by Thomas Klausner <wiz at NetBSD>

Revision 1.170 / (download) - annotate - [select for diffs], Wed Apr 11 17:10:35 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored)

preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jul 15 17:57:46 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.168: +5 -5 lines
Diff to previous 1.168 (colored)

In .Bl -tag and -hang, do not print a margin-left style attribute
for each individual item if the -width argument matches the default
of 6n.  Suggested by Steffen Nurpmeso <steffen at sdaoden dot eu>
on <groff at GNU dot org> in April 2017.

Revision 1.168 / (download) - annotate - [select for diffs], Sat Jul 15 17:29:26 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

use the same width increase logic for .Bl -hang as for .Bl -tag

Revision 1.167 / (download) - annotate - [select for diffs], Fri Jul 14 16:05:52 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +19 -26 lines
Diff to previous 1.166 (colored)

Handle .Bl -compact via CSS rather than writing individual style
attributes into .It blocks; suggested by Steffen Nurpmeso <steffen
at sdaoden dot eu> on <groff at GNU dot org> in April 2017.

Delete margin-bottom and margin-top style names and the 'v' argument
letter from print_otag() because they are no longer used.

Revision 1.166 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:27 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.165: +2 -1 lines
Diff to previous 1.165 (colored)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system.  Mark operating system specific messages
with "(OpenBSD)" at the end.

Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.

Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.

Revision 1.165 / (download) - annotate - [select for diffs], Mon Jun 19 12:53:50 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.164: +7 -3 lines
Diff to previous 1.164 (colored)

Fix a regression in the previous revision:
When there is no link description, reuse the URI.
Reported by tj@ and bentley@.

Revision 1.164 / (download) - annotate - [select for diffs], Tue May 30 16:31:25 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +18 -10 lines
Diff to previous 1.163 (colored)

fix formatting of intermediate punctuation in .Lk

Revision 1.163 / (download) - annotate - [select for diffs], Wed May 17 17:53:48 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.162: +1 -18 lines
Diff to previous 1.162 (colored)

Delete pointless width calculation for SYNOPSIS .Nm block heads.
Just let HTML <table> do its work of selecting the needed width.
<Anton dot Lindqvist at gmail dot com> reported that the manually
calculated width was insufficient in some manual pages.

Revision 1.162 / (download) - annotate - [select for diffs], Fri May 12 17:56:39 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.161: +5 -5 lines
Diff to previous 1.161 (colored)

Make the tag column in .Bl -tag lists wider:
1. I forgot about the 2n padding between tag and body.
2. The factor 1.1 was too small for bold fold, make it *1.15 + 1n.
Ugliness spotted by tb@.

Revision 1.161 / (download) - annotate - [select for diffs], Tue May 9 14:09:37 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.160: +4 -4 lines
Diff to previous 1.160 (colored)

Trailing \c suppresses the output line break even if
the next line is a text line starting with whitespace.
Quirk found in the sysutils/rancid port.

Revision 1.160 / (download) - annotate - [select for diffs], Fri May 5 15:16:25 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.159: +3 -27 lines
Diff to previous 1.159 (colored)

Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Revision 1.159 / (download) - annotate - [select for diffs], Fri May 5 13:17:04 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.158: +1 -2 lines
Diff to previous 1.158 (colored)

move .ll to the roff modules

Revision 1.158 / (download) - annotate - [select for diffs], Fri May 5 02:06:17 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.157: +2 -1 lines
Diff to previous 1.157 (colored)

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules.  As a side effect,
mdoc(7) now handles .ft, too.  Of course, do not use that.

Revision 1.157 / (download) - annotate - [select for diffs], Thu May 4 22:07:44 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.156: +8 -18 lines
Diff to previous 1.156 (colored)

Start roff formatter modules for HTML and termininal output,
used by both the mdoc and man formatters, with the ultimate
goal of reducing code duplication between the two macro formatters.
Made possible by the parser unification.
Add the first formatting function (for the .br request).

Revision 1.156 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.155: +15 -4 lines
Diff to previous 1.155 (colored)

Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

Revision 1.155 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.154: +8 -5 lines
Diff to previous 1.154 (colored)

Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].

Revision 1.154 / (download) - annotate - [select for diffs], Mon Apr 17 12:52:00 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.153: +15 -9 lines
Diff to previous 1.153 (colored)

Fix handling of trailing punctuation in .Lk.
This macro is unusual in so far as trailing punction needs to remain
inside the scope because it must be inside, not after the display
of long URIs in terminal output mode.
Improves formatting of fw_update(1), help(1), less(1), sendbug(1),
acx(4), inet6(4), ipsec(4), oce(4), isakmpd.conf(5), afterboot(8),
release(8), traceroute(8).

Revision 1.153 / (download) - annotate - [select for diffs], Fri Mar 17 12:06:02 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.152: +5 -3 lines
Diff to previous 1.152 (colored)

Fix regression in mdoc_html.c 1.150, man_html 1.87:
For .Sh, .Ss, .SH, .SS, only write selflink if an id could be constructed.
Crash reported by Raf Czlonka <rczlonka at gmail dot com>,
analysis of root cause by natano@

Revision 1.152 / (download) - annotate - [select for diffs], Wed Mar 15 11:29:50 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.151: +6 -29 lines
Diff to previous 1.151 (colored)

Minimal support for deep linking into man(7) pages.
As the man(7) language does not provide semantic markup,
only .SH, .SS, and .UR become anchors for now.

Revision 1.151 / (download) - annotate - [select for diffs], Tue Mar 14 01:34:57 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.150: +3 -2 lines
Diff to previous 1.150 (colored)

Slightly increase widths calculated from string lengths (mainly
for .Bl -tag lists and SYNOPSIS .Nm blocks), such that the text
still fits even if it is printed in bold font.
This is an ugly band aid - but implementing font-dependent width
measurements would be a major project and even more difficult
for HTML than for PostScript.

Issue reported by Jan Stary <hans at stare dot cz>.

Revision 1.150 / (download) - annotate - [select for diffs], Mon Mar 13 20:22:11 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.149: +81 -11 lines
Diff to previous 1.149 (colored)

Port ctags-style, less(1) :t internal searching from terminal output
to HTML output.  For certain macros appearing at the beginning of .It
heads, write HTML id="..." attributes such that deep linking works.
Write HTML <a> attributes such that you can easily copy out link
targets with the mouse.  Try: http://man.openbsd.org/vmctl.8#create

Feature suggested by <guettliml at Thomas dash Guettler dot de>,
some details of the design and implementation by me.

Revision 1.149 / (download) - annotate - [select for diffs], Mon Mar 13 19:01:14 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.148: +43 -43 lines
Diff to previous 1.148 (colored)

Print title="..." in addition to id="..." attributes for macro keys
that can be searched for by apropos(1), such that you see the
semantic function in a tooltip when hovering with the mouse.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Mar 3 13:55:06 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (colored)

remove a few redundant conditions that jsg@ found with cppcheck

Revision 1.147 / (download) - annotate - [select for diffs], Wed Feb 22 08:52:24 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +2 -1 lines
Diff to previous 1.146 (colored)

Handle an odd edge case where .It is preceded by .Sm.
NULL dereference in man.cgi reported by Gabriel Guzman <gabe at
guzman dash nunez dot com> on misc@.

Revision 1.146 / (download) - annotate - [select for diffs], Thu Feb 16 02:59:42 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +1 -3 lines
Diff to previous 1.145 (colored)

Remove the ENDBODY_NOSPACE flag, simplifying the code.

Comparing to groff output, it appears that all cases where it was used
and made a difference actually require the opposite, ENDBODY_SPACE.

I have no idea why i added it back in 2010; maybe to compensate for
some other bug that has long been fixed.

Revision 1.145 / (download) - annotate - [select for diffs], Mon Feb 6 03:41:44 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +1 -3 lines
Diff to previous 1.144 (colored)

The .Nm macro does not only use the default name when it has no
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.

Revision 1.144 / (download) - annotate - [select for diffs], Sun Feb 5 21:00:18 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +11 -3 lines
Diff to previous 1.143 (colored)

Wrap .St content in a <span class="St">.
Also add forgotten <span class="Ux"> to .At rendering.

Revision 1.143 / (download) - annotate - [select for diffs], Sun Feb 5 20:34:47 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.142: +2 -2 lines
Diff to previous 1.142 (colored)

fix font selection for .Bf without argument

Revision 1.142 / (download) - annotate - [select for diffs], Sun Feb 5 20:21:17 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +10 -10 lines
Diff to previous 1.141 (colored)

mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;
suggested by bentley@ long ago, but needed lots of cleanup first

Revision 1.141 / (download) - annotate - [select for diffs], Sun Feb 5 19:29:03 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +2 -2 lines
Diff to previous 1.140 (colored)

for .Rs, use <cite>

Revision 1.140 / (download) - annotate - [select for diffs], Sun Feb 5 18:13:28 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +13 -9 lines
Diff to previous 1.139 (colored)

Improve <table> syntax:
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.

Revision 1.139 / (download) - annotate - [select for diffs], Sun Jan 29 14:02:19 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +3 -3 lines
Diff to previous 1.138 (colored)

eliminate one useless struct and one level of indirection;
no functional change

Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 28 22:36:17 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +21 -48 lines
Diff to previous 1.137 (colored)

Simplify usage of print_otag() even more:
accept NULL to skip the attribute or format.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Jan 28 18:42:10 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +17 -17 lines
Diff to previous 1.136 (colored)

.Bl -column with zero columns is legal, so don't segfalt on it.
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.

Revision 1.136 / (download) - annotate - [select for diffs], Wed Jan 25 02:14:41 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +46 -4 lines
Diff to previous 1.135 (colored)

Improve HTML formatting of .Bl -tag.

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.

Revision 1.135 / (download) - annotate - [select for diffs], Sat Jan 21 02:09:49 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +15 -10 lines
Diff to previous 1.134 (colored)

Avoid writing constant style attributes over and over again.
Move them to the style sheet.

Revision 1.134 / (download) - annotate - [select for diffs], Sat Jan 21 01:20:29 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +8 -8 lines
Diff to previous 1.133 (colored)

clean up the remaining class attributes

Revision 1.133 / (download) - annotate - [select for diffs], Fri Jan 20 23:50:59 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +44 -43 lines
Diff to previous 1.132 (colored)

Standardize class attributes for semantic macros.
Correct markup for .Va and iprove markup for .Dv, .Er, .Ev while here.

Revision 1.132 / (download) - annotate - [select for diffs], Fri Jan 20 21:37:52 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +18 -24 lines
Diff to previous 1.131 (colored)

standardize .Rs class attributes

Revision 1.131 / (download) - annotate - [select for diffs], Fri Jan 20 19:58:00 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +104 -72 lines
Diff to previous 1.130 (colored)

standardize .Bl and .It class attributes

Revision 1.130 / (download) - annotate - [select for diffs], Thu Jan 19 16:56:53 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +10 -14 lines
Diff to previous 1.129 (colored)

clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;
in particular, stop abuse of <blockquote>

Revision 1.129 / (download) - annotate - [select for diffs], Thu Jan 19 15:48:34 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +7 -7 lines
Diff to previous 1.128 (colored)

clean up .Sx and .Xr HTML markup

Revision 1.128 / (download) - annotate - [select for diffs], Thu Jan 19 15:27:26 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +8 -10 lines
Diff to previous 1.127 (colored)

Clean up CSS rules for sections and paragraphs.
Start using real macro names for CSS classes.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Jan 19 13:34:59 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +8 -10 lines
Diff to previous 1.126 (colored)

Start cleanup: trim useless HTML comments and <div> elements
on the <html> and <body> levels.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Jan 19 01:00:11 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +1 -3 lines
Diff to previous 1.125 (colored)

Implement line breaking of the generated HTML code at space characters
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.

Revision 1.125 / (download) - annotate - [select for diffs], Wed Jan 18 19:22:18 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +1 -2 lines
Diff to previous 1.124 (colored)

Make HTML output more human readable by overhauling line break logic
around tags and by introducing some simple indentation.
No change of HTML semantics intended.

Revision 1.124 / (download) - annotate - [select for diffs], Tue Jan 17 15:32:39 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +78 -74 lines
Diff to previous 1.123 (colored)

Completely delete the buf field of struct html and all the buf*()
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().

Revision 1.123 / (download) - annotate - [select for diffs], Tue Jan 17 01:47:46 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +159 -403 lines
Diff to previous 1.122 (colored)

Simplify the usage of print_otag() by making it accept a variable
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.

Revision 1.122 / (download) - annotate - [select for diffs], Wed Jan 11 17:39:45 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +5 -113 lines
Diff to previous 1.121 (colored)

Do text production for .Bt, .Ex, .Rv, .Ud at the validation stage
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@.

Revision 1.121 / (download) - annotate - [select for diffs], Tue Jan 10 23:36:24 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +2 -30 lines
Diff to previous 1.120 (colored)

Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
More rigorous AST and 40 lines less code.

Revision 1.120 / (download) - annotate - [select for diffs], Tue Jan 10 21:54:34 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +2 -35 lines
Diff to previous 1.119 (colored)

For the .Ux/.Ox family of macros, do text production at the validation
stage rather than in each and every individual formatter, using the
new NODE_NOSRC flag.  More rigorous and also ten lines less code.

Revision 1.119 / (download) - annotate - [select for diffs], Tue Jan 10 13:46:53 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +19 -19 lines
Diff to previous 1.118 (colored)

unify names of AST node flags; no change of cpp output

Revision 1.118 / (download) - annotate - [select for diffs], Tue Jan 10 12:54:27 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +4 -1 lines
Diff to previous 1.117 (colored)

Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.
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.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Jan 9 12:48:52 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

The .No macro is not supposed to produce fixed-width font, it is not
the same as .Li, so don't use <code>.
Bug reported by <Anton dot Lindqvist at gmail dot com> on tech@.

Revision 1.116 / (download) - annotate - [select for diffs], Sun Jan 8 22:51:53 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +9 -9 lines
Diff to previous 1.115 (colored)

Indentation must be measured in units of the surrounding text,
not in units of the contained text.  Consequently, "display"
and "lit" class tags must not be on the same element:  First,
"display" must set up the indentation, still using the outer
units, and only after that, "lit" may change the font.

This fixes .Bd -literal which got the wrong indentation.
Bug reported by tb@.

Revision 1.115 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:04 2016 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.114: +26 -25 lines
Diff to previous 1.114 (colored)

Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

Revision 1.114 / (download) - annotate - [select for diffs], Fri Dec 25 20:43:04 2015 UTC (8 years, 4 months ago) by bentley
Branch: MAIN
Changes since 1.113: +2 -4 lines
Diff to previous 1.113 (colored)

Generate simpler in-page links: just replace spaces with underscores.

So
http://example.com/OpenBSD-current/man1/ls.1#x546865204c6f6e6720466f726d6174
becomes
http://example.com/OpenBSD-current/man1/ls.1#The_Long_Format

ok schwarze@

Revision 1.113 / (download) - annotate - [select for diffs], Mon Oct 12 00:07:27 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +1 -55 lines
Diff to previous 1.112 (colored)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.112 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:44 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +96 -96 lines
Diff to previous 1.111 (colored)

modernize style: "return" is not a function; ok cmp(1)

Revision 1.111 / (download) - annotate - [select for diffs], Sat Sep 26 00:53:15 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +1 -6 lines
Diff to previous 1.110 (colored)

/* NOTREACHED */ after abort() is silly, delete it

Revision 1.110 / (download) - annotate - [select for diffs], Sat Sep 26 00:32:17 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +5 -9 lines
Diff to previous 1.109 (colored)

resolve code duplication and do style cleanup in mdoc_nm_pre(),
no functional change

Revision 1.109 / (download) - annotate - [select for diffs], Sat Sep 26 00:18:04 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +4 -3 lines
Diff to previous 1.108 (colored)

Fix multiple aspects of SYNOPSIS .Nm formatting:
* Don't break lines before non-block .Nm elements.
* Use proper <b> markup for the heads of .Nm blocks.
* Make the width measurements work by doing them on the head children.

Revision 1.108 / (download) - annotate - [select for diffs], Sun Aug 30 18:59:44 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +3 -4 lines
Diff to previous 1.107 (colored)

If an .Fo macro lacks its mandatory argument, don't die on an assertion.
Bug found by jsg@ with afl.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Apr 18 17:50:02 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.106: +11 -18 lines
Diff to previous 1.106 (colored)

Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.

Revision 1.106 / (download) - annotate - [select for diffs], Sat Apr 18 16:04:40 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.105 / (download) - annotate - [select for diffs], Thu Apr 16 20:21:08 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.104: +3 -7 lines
Diff to previous 1.104 (colored)

Restore the page headers and page footers that accidentally got lost
in rev. 1.225.  Regression reported by florian@.

Revision 1.104 / (download) - annotate - [select for diffs], Thu Apr 2 23:47:43 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Apr 2 22:06:17 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.102: +7 -7 lines
Diff to previous 1.102 (colored)

Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

Revision 1.102 / (download) - annotate - [select for diffs], Thu Apr 2 21:03:18 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.101: +55 -54 lines
Diff to previous 1.101 (colored)

First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Mar 3 21:09:25 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.100: +3 -1 lines
Diff to previous 1.100 (colored)

If an eqn(7) starts on a new input line, be sure to output whitespace
in front of it.  Issue found by tedu@ in glOrtho(3).

There are also cases of excessive whitespace before and after
equations.  This patch neither fixes them nor makes them worse.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Feb 12 12:20:47 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +6 -5 lines
Diff to previous 1.99 (colored)

Delete the mdoc_node.pending pointer and the function calculating
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser.  After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.

Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks.  Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED.  When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN.  For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.

This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.

Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.

Revision 1.99 / (download) - annotate - [select for diffs], Wed Feb 11 14:14:53 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +3 -4 lines
Diff to previous 1.98 (colored)

do not access a NULL pointer if an .Eo block lacks a tail;
found by jsg@ with afl, test case #16

Revision 1.98 / (download) - annotate - [select for diffs], Thu Feb 5 01:46:38 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +1 -4 lines
Diff to previous 1.97 (colored)

fix handling of empty .An macros

Revision 1.97 / (download) - annotate - [select for diffs], Thu Feb 5 00:13:34 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +4 -7 lines
Diff to previous 1.96 (colored)

Simplify by deleting the "lastline" member of struct mdoc_node.
Minus one struct member, minus 17 lines of code, no functional change.

Revision 1.96 / (download) - annotate - [select for diffs], Sun Feb 1 23:10:15 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +52 -14 lines
Diff to previous 1.95 (colored)

fix .Eo/.Ec spacing

Revision 1.95 / (download) - annotate - [select for diffs], Fri Jan 30 22:04:15 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +5 -4 lines
Diff to previous 1.94 (colored)

Have pity on the poor stack.
Replace tail recursion by iteration when walking the syntax trees.
No functional change.

Revision 1.94 / (download) - annotate - [select for diffs], Fri Jan 23 14:19:52 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +6 -6 lines
Diff to previous 1.93 (colored)

Let .Aq/.Ao/.Ac print "<>" instead of the normal "\(la\(ra"
when the only child is .Mt, not when the preceding node is .An,
to improve robustness.  Triggered by a question from Svyatoslav
Mishyn <juef at openmailbox dot org> (Crux Linux).

Revision 1.93 / (download) - annotate - [select for diffs], Tue Dec 23 13:48:15 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +7 -3 lines
Diff to previous 1.92 (colored)

support negative horizontal widths in man(7);
minus twenty lines of code in spite of enhanced functionality

Revision 1.92 / (download) - annotate - [select for diffs], Tue Dec 23 09:31:17 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +3 -3 lines
Diff to previous 1.91 (colored)

some scaling unit fixes:
- .sp with an invalid argument is .sp 1v, not .sp 0v
- in man(1), trailing garbage doesn't make scaling units invalid

Revision 1.91 / (download) - annotate - [select for diffs], Tue Dec 2 10:07:17 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +3 -2 lines
Diff to previous 1.90 (colored)

Fix the implementation and documentation of \c (continue text input line).
In particular, make it work in no-fill mode, too.
Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).

Revision 1.90 / (download) - annotate - [select for diffs], Mon Dec 1 08:05:02 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +2 -3 lines
Diff to previous 1.89 (colored)

header cleanup:
* add missing forward declarations
* remove needless header inclusions
* some style unification

Revision 1.89 / (download) - annotate - [select for diffs], Sun Nov 30 05:28:00 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored)

Multiple fixes with respect to .Pf:
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Nov 27 22:27:40 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +14 -9 lines
Diff to previous 1.87 (colored)

Multiple fixes with respect to .Eo:
1. Correctly parse stray .Ec without preceding .Eo,
avoiding an assertion violation found by jsg@ with afl.
2. Correctly parse .Ec arguments when breaking another block.
3. Correct spacing around closing delimiter when breaking another block.
4. Sync some related formatting control from -Tascii to -Thtml.

Revision 1.87 / (download) - annotate - [select for diffs], Thu Nov 27 16:20:27 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

Fix the obsolete .Db (toggle debug mode) macro to ignore its arguments
and not trigger an assertion when there is more than one argument;
the latter found by jsg@ with afl.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Nov 19 21:59:19 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +5 -3 lines
Diff to previous 1.85 (colored)

Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
just like groff; minibug noticed by bentley@.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Nov 17 06:44:35 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +13 -2 lines
Diff to previous 1.84 (colored)

Multiple fixes with respect to in-line macros:
* .No selects the default font; relevant e.g. in .Bf blocks
* no need to force empty .Li elements
* closing delimiters as leading macro arguments do not suppress space
* opening delimiters at the end of a macro line do not suppress space
* correctly handle delimiter spacing in -Tman
As a side effect, these fixes let mandoc warn about empty .No macros
as requested by bentley@.

Revision 1.84 / (download) - annotate - [select for diffs], Thu Oct 30 20:05:33 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +14 -28 lines
Diff to previous 1.83 (colored)

Major bugsquashing with respect to -offset and -width:
1. Support specifying the .Bd and .Bl -offset as a macro default width;
while here, simplify the code handling the same for .Bl -width.
2. Correct handling of .Bl -offset arguments:  unlike .Bd -offset, the
arguments "left", "indent", and "indent-two" have no special meaning.
3. Fix the scaling of string length -offset and -width arguments in -Thtml.
Triggered by an incomplete documentation patch from bentley@.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Oct 7 18:17:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +23 -37 lines
Diff to previous 1.82 (colored)

Switch HTML output to polyglot HTML5; have only one single -Thml mode.
Replace hard-coded widths and alignments with a minimal embedded stylesheet.
Do not use <p> because it cannot appear inside block macros.
Remove the "summary" attribute because it is not HTML5.

Written by kristaps@ some months ago, finished during EuroBSDCon.

Revision 1.82 / (download) - annotate - [select for diffs], Wed Sep 17 19:53:35 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +28 -4 lines
Diff to previous 1.81 (colored)

implement .An -[no]split for -Thtml

Revision 1.81 / (download) - annotate - [select for diffs], Thu Aug 21 12:56:24 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +5 -4 lines
Diff to previous 1.80 (colored)

Right after .Fl, a middle delimiter triggers an empty scope,
just like a closing delimiter.  This didn't work in groff-1.15,
but it now works in groff-1.22.

After being closed by delimiters, .Nm scopes do not reopen.

Do not suppress white space after .Fl if the next node is a text node
on the same input line; that can happen for middle delimiters.

Fixing an issue reported by jmc@.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Aug 14 00:29:12 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.79: +7 -5 lines
Diff to previous 1.79 (colored)

Revert previous, as requested by kristaps@.
The .Bf block can contain subblocks, so it has to render as an
element that can contain flow content.  But <em> cannot contain
flow content, only phrasing content.  Rendering .Em and .Bf differently
would by unfortunate, and closing out .Bf before subblocks and
re-opening it afterwards would merely complicate both the C code
of the program and the generated HTML code.  Besides, converting
.Em to semantic HTML markup would require some content to be put
into <em> and some into <i>, but we cannot automatically distinguish
which is which, so strictly speaking, we can't use semantic HTML
here but have to fall back to physical markup.  Wonders of HTML...

Revision 1.79 / (download) - annotate - [select for diffs], Wed Aug 13 15:19:24 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +5 -7 lines
Diff to previous 1.78 (colored)

Use <em> for .Em and .Bf -emphasis.

The vast majority of .Em in real-world manuals is stress emphasis,
for which <em> is the correct markup.  Admittedly, there are some
instances of .Em usage for alternate quality, for which <i> would
be a better match.  Most of these are technical terms that neither
allow semantic markup nor are keywords - for the latter, .Sy would
be preferable.  A typical example is that the shell breaks input into
.Em words .
Alternate voice or mood, which would also require <i>, is almost
absent from manuals.
We cannot satisfy both stress emphasis and alternate quality, so
pick the one that fits more often and looks less wrong when off.

Patch from Guy Harris <guy at alum dot mit dot edu>.
ok bentley@ joerg@NetBSD

Revision 1.78 / (download) - annotate - [select for diffs], Fri Aug 8 16:17:09 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +9 -4 lines
Diff to previous 1.77 (colored)

Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body
and further improving messages.
* The last .Dd wins and the last .Os wins, even in the body.
* The last .Dt before the first body macro wins.
* Missing title in .Dt defaults to UNTITLED.  Warn about it.
* Missing section in .Dt does not default to 1.  But warn about it.
* Do not warn multiple times about the same mdoc(7) prologue macro.
* Warn about missing .Os.
* Incomplete .TH defaults to empty strings.  Warn about it.

Revision 1.77 / (download) - annotate - [select for diffs], Fri Aug 8 16:00:23 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

Clarity with respect to floating point handling:
Write double constants as double rather than integer literals.
Remove useless explicit (double) cast done at one place and nowhere else.
No functional change.

Revision 1.76 / (download) - annotate - [select for diffs], Fri Aug 8 15:10:14 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +31 -25 lines
Diff to previous 1.75 (colored)

Various improvements related to .Ex and .Rv:
* let .Nm fall back to the empty string, not to UNKNOWN
* never let .Rv copy an argument from .Nm
* avoid spurious \fR after empty .Nm in -Tman
* correct handling of .Ex and .Rv in -Tman
* correct the wording of the output for .Rv without arguments
* use non-breaking spaces in .Ex and .Rv output where required
* split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm

Revision 1.75 / (download) - annotate - [select for diffs], Wed Jul 2 19:54:39 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.74: +8 -15 lines
Diff to previous 1.74 (colored)

When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility.  Using this feature is of
course not recommended except in manual page obfuscation contests.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Jul 2 03:47:07 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +24 -9 lines
Diff to previous 1.73 (colored)

Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Revision 1.73 / (download) - annotate - [select for diffs], Wed Apr 23 16:07:06 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.72: +22 -17 lines
Diff to previous 1.72 (colored)

Audit strlcpy(3)/strlcat(3) usage.

* Repair three instances of silent truncation, use asprintf(3).
* Change two instances of strlen(3)+malloc(3)+strlcpy(3)+strlcat(3)+...
to use asprintf(3) instead to make them less error prone.
* Cast the return value of four instances where the destination
buffer is known to be large enough to (void).
* Completely remove three useless instances of strlcpy(3)/strlcat(3).
* Mark two places in -Thtml with XXX that can cause information loss
and crashes but are not easy to fix, requiring design changes of
some internal interfaces.
* The file mandocdb.c remains to be audited.

Revision 1.72 / (download) - annotate - [select for diffs], Sun Apr 20 20:17:36 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.71: +7 -3 lines
Diff to previous 1.71 (colored)

fix unchecked snprintf(3) in page header printing:
the length of the title is unknown, and speed doesn't matter here,
so use asprintf/free rather than a static buffer

Revision 1.71 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.70: +185 -305 lines
Diff to previous 1.70 (colored)

KNF: case (FOO):  ->  case FOO, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.70 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:32 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.69: +12 -2 lines
Diff to previous 1.69 (colored)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Dec 24 20:45:21 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

It turns out SYNOPSIS mode does not imply .Bk in general,
but only within .Nm blocks.  Simplify the code accordingly.
This reduces groff-mandoc differences in base by about 2%.

Triggered by research done by Franco Fichtner.

Revision 1.68 / (download) - annotate - [select for diffs], Tue Dec 24 19:10:34 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +4 -8 lines
Diff to previous 1.67 (colored)

When deciding whether two consecutive macros are on the same input line,
we have to compare the line where the first one *ends* (not where it begins)
to the line where the second one starts.
This fixes the bug that .Bk allowed output line breaks right after block
macros spanning more than one input line, even when the next macro follows
on the same line.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Nov 17 00:25:20 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.66: +30 -29 lines
Diff to previous 1.66 (colored)

Cleanup naming of local variables to make the code easier on the eye:
Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta"
and avoid the confusing "*m" which was sometimes this, sometimes that.
No functional change.

ok kristaps@ some time ago

Revision 1.66 / (download) - annotate - [select for diffs], Sun Aug 12 06:04:09 2012 UTC (11 years, 9 months ago) by matthew
Branch: MAIN
Changes since 1.65: +4 -4 lines
Diff to previous 1.65 (colored)

.Sq should use curly right quotes in HTML output to match its curly
left quotes.

Also, properly reinitialize the styles attribute string buffer for
each column in a table so that the attributes don't accumulate.

tweak and ok schwarze

Revision 1.65 / (download) - annotate - [select for diffs], Thu Nov 3 20:32:33 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.64: +6 -2 lines
Diff to previous 1.64 (colored)

Correct .Eo spacing:
no space between the delimiters and the enclosed text.
The mdoc_html.c part was added by kristaps; ok kristaps@.

Revision 1.64 / (download) - annotate - [select for diffs], Sun Oct 16 12:18:32 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

Remove a bunch of useless assignments,
and assert that print_bvspace cannot be called on NULL pointers.
No change in behaviour, none of these were bugs,
but the code becomes easier to understand.
Based on a clang report posted by joerg@; ok kristaps@.

Revision 1.63 / (download) - annotate - [select for diffs], Sun Oct 9 22:10:51 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +18 -38 lines
Diff to previous 1.62 (colored)

Always print <table> column widths in -T[x]html;
if desired, they can be overridden in the CSS file.
Suggested by kristaps@, and i always like to simplify code.

Revision 1.62 / (download) - annotate - [select for diffs], Sun Oct 9 17:59:56 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +17 -16 lines
Diff to previous 1.61 (colored)

Sync to version 1.12.0; all code by kristaps@:
Implement .Rv in -Tman.
Let -man -Tman work a bit like cat(1).
Add the -Ofragment option to -T[x]html.
Minor fixes in -T[x]html.
Lots of apropos(1) and -Tman code cleanup.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Sep 18 15:54:48 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +30 -19 lines
Diff to previous 1.60 (colored)

sync to version 1.11.7 from kristaps@
main new feature: support the roff(7) .tr request
plus various bugfixes and some refactoring

regressions are so minor that it's better to get this in
and fix them in the tree

Revision 1.60 / (download) - annotate - [select for diffs], Sun Sep 18 10:25:28 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +2 -5 lines
Diff to previous 1.59 (colored)

sync to version 1.11.5:
adding an implementation of the eqn(7) language
by kristaps@

So far, only .EQ/.EN blocks are handled, in-line equations are not, and
rendering is not yet very pretty, but the parser is fairly complete.

Revision 1.59 / (download) - annotate - [select for diffs], Tue Jul 5 04:12:41 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.58: +6 -3 lines
Diff to previous 1.58 (colored)

Sync to bsd.lv (all coded by kristaps@):
 - mdoc(7): fix an assertion if the first line after .Bd -column
   starts with a blank, and some simplifications in mdoc_argv.c
 - man(7): literal mode ends at .SH and .SS (bug reported by naddy@)
 - allow .RS/.RE blocks to nest (bug reported by dcoppa@ and gsoares@)
 - improve vertical spacing of man(7) blocks
 - roff(7): clear user-defined strings when starting a new file
 - correct ID tags in -T[x]html

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jun 18 12:40:57 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +5 -4 lines
Diff to previous 1.57 (colored)

Have -T[x]html print out the link target for `Lk'
if no link title is provided.
Based on a patch by Tim van der Molen, tweaked by kristaps@.

Revision 1.57 / (download) - annotate - [select for diffs], Sun May 29 21:22:18 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +33 -35 lines
Diff to previous 1.56 (colored)

Merge release 1.11.3, almost all code by kristaps@:
* Unicode output support (no Unicode input yet, though).
* Refactoring: completely handle predefined strings in roff.c.
- New function mandoc_escape() replaces a2roffdeco() and mandoc_special().
- Start using mandoc_getarg() in mdoc_argv.c.
- Clean up parsing of delimiters in mdoc(7).
* And many minor fixes and lots of cleanup.

Revision 1.56 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.55: +175 -79 lines
Diff to previous 1.55 (colored)

Merge version 1.11.1:
Again lots of cleanup and maintenance work by kristaps@.
- simplify error reporting: less function pointers, more mandoc_[v]msg
- main: split document parsing out of main.c into read.c
- roff, mdoc, man: improved recognition of control characters
- roff: better handling of if/else stack overflows
- roff: add some predefined strings for backward compatibility
- mdoc, man: empty sections are not errors
- mdoc: move delimiter handling to libmdoc
- some header restructuring and some minor features and fixes
This merge causes two minor regressions
that i will fix in separate commits right afterwards.

Revision 1.55 / (download) - annotate - [select for diffs], Thu Apr 21 22:59:54 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.54: +7 -2 lines
Diff to previous 1.54 (colored)

Merge version 1.10.10:
lots of cleanup and maintenance work by kristaps@.
- move some main.c globals into struct curparse
- move mandoc_*alloc to mandoc.h such that all code can use them
- make mandoc_isdelim available to formatting frontends
- dissolve mdoc_strings.c, move the code where it is used
- make all error reporting functions void, their return values were useless
- and various minor cleanups and fixes

Revision 1.54 / (download) - annotate - [select for diffs], Sun Mar 20 23:36:42 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +4 -1 lines
Diff to previous 1.53 (colored)

Import the foundation for eqn(7) support.
Written by kristaps@.

For now, i'm adding one line to each of the four frontends
to just pass the input text through to the output,
not yet interpreting any of then eqn keywords.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:33 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +2 -5 lines
Diff to previous 1.52 (colored)

Clean up date handling,
as a first step to get rid of the frequent petty warnings in this area:
 - always store dates as strings, not as seconds since the Epoch
 - for input, try the three most common formats everywhere
 - for unrecognized format, just pass the date though verbatim
 - when there is no date at all, still use the current date
Originally triggered by a one-line patch from Tim van der Molen,
<tbvdm at xs4all dot nl>, which is included here.
Feedback and OK on manual parts from jmc@.
"please check this in" kristaps@

Revision 1.52 / (download) - annotate - [select for diffs], Sun Feb 6 22:56:45 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.51: +10 -2 lines
Diff to previous 1.51 (colored)

Do not break the line between the arguments of .Bsx .Dx .Fx .Nx .Ox .Ux.
Original patch from kristaps@, but i fixed a regression regarding .Bk.

Revision 1.51 / (download) - annotate - [select for diffs], Sun Feb 6 17:33:20 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +3 -2 lines
Diff to previous 1.50 (colored)

If .Ns is specified on its own line, ignore it, like groff does;
from kristaps@.

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jan 31 03:04:26 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +17 -3 lines
Diff to previous 1.49 (colored)

When in a <PRE>, don't print out the <BR> before lines that have
leading whitespace; from kristaps@.

Revision 1.49 / (download) - annotate - [select for diffs], Sun Jan 30 18:28:01 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +15 -7 lines
Diff to previous 1.48 (colored)

Make .Bx accept not more than two arguments.
Convert the first character of the second argument to uppercase.
Append the second argument with a hyphen.
Improves chpass(1), column(1), fstat(1), ...
from kristaps@

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jan 16 19:41:16 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +21 -5 lines
Diff to previous 1.47 (colored)

Merge from bsd.lv, original commit message by kristaps@:
Change how -Thtml behaves with tables: use multiple rows, with widths
set by COL, until an external macro is encountered.  At this point in
time, close out the table and process the macro.  When the first table
row is again re-encountered, re-start the table.  This requires a bit of
tracking added to "struct html", but the change is very small and
follows the logic of meta-fonts.  This all follows a bug-report by
joerg@.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Jan 16 02:56:47 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +3 -1 lines
Diff to previous 1.46 (colored)

If the first character of a free-form text input line is whitespace,
then it will start a new output line;
from kristaps@.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jan 9 16:31:46 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +5 -4 lines
Diff to previous 1.45 (colored)

Remove an unused variable, and use int for array indices (not size_t);
found by lint(1), fixed by kristaps@, no functional change.

Revision 1.45 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +6 -3 lines
Diff to previous 1.44 (colored)

Merge kristaps@' cleaner tbl integration, removing mine;
there are still a few bugs, but fixing these will be easier in tree.

Revision 1.44 / (download) - annotate - [select for diffs], Wed Dec 29 00:47:31 2010 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +25 -27 lines
Diff to previous 1.43 (colored)

Reorg by Kristaps:  In libmdoc, replace the union of pointers to structs
of macro-specific data by a pointer to a union of structs, which makes the
code simpler and more robust at the expense of a small memory overhead.
Merging was somewhat difficult because we mustn't break tbl(1) support
which the bsd.lv version does not yet have.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Dec 25 13:23:03 2010 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +12 -11 lines
Diff to previous 1.42 (colored)

Yet another batch of -Thtml polishing from kristaps@:
In particular, use <SMALL> for .SM and <CODE> for .Dl.
Use <B> for bold and <I> for italic in general.
Also call this mandoc 1.10.8 now, as it is functionally equivalent,
even though one one set of refactoring patches has not been merged
yet because it conflicts with our tbl(1) handling.

Revision 1.42 / (download) - annotate - [select for diffs], Wed Dec 22 00:33:25 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +81 -41 lines
Diff to previous 1.41 (colored)

More small -Thtml improvements by kristaps@,
in particular, use <B>, <I> and <U> where appropriate.
Provide relative widths for header and footer lines.
Manuals: More concise short descriptions of output modes.
Correct a few places still talking about CSS2 to say CSS1.
Code examples should use .Dl, not .D1.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Dec 19 12:18:15 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +3 -2 lines
Diff to previous 1.40 (colored)

Handle .Bk in -Thmtl the same way as in -Tascii.
From kristaps@.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Dec 19 09:22:35 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +318 -491 lines
Diff to previous 1.39 (colored)

Significant improvements to -Thtml by kristaps@:
Use less <DIV>, use more <H1>, <H2>, <P>, <BR>, <PRE>, <UL>, <OL>, <DL> etc.
Triggered by input from Will Backman.
Remove CSS2 note in mandoc.1, which is no longer true.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Dec 6 22:10:13 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +5 -1 lines
Diff to previous 1.38 (colored)

Do not follow .D1 and .Dl inside .Bd with a blank line.
Kristaps@ came up with this improvement when he merged
my patch introducing support for nested displays.

Revision 1.38 / (download) - annotate - [select for diffs], Wed Dec 1 22:02:29 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Merge mdoc_action.c into mdoc_validate.c, because having two places to do
basically the same things just causes code duplication and confusion.
Work by kristaps@, including a few bugfixes he found during the merge,
and reapplying OpenBSD changes on top.

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 23 23:30:41 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

let .Bsx print just "BSD/OS" like in modern groff
from Ulrich Spoerlein <uqs at spoerlein dot net>

Revision 1.36 / (download) - annotate - [select for diffs], Sat Oct 23 16:08:36 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +14 -2 lines
Diff to previous 1.35 (colored)

.Sm no longer produces a linebreak when used in .Bd
also avoid an extra space after the opening bracket in .Op in -Thtml
from kristaps@

Revision 1.35 / (download) - annotate - [select for diffs], Sat Oct 16 13:38:29 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +3 -1 lines
Diff to previous 1.34 (colored)

Support tbl(1) code embedded into mdoc(7) input files.
Very similar to what i have done in man(7) yesterday.
Allows to build cpu(4) on HPPA, wi(4), and phantasia(6).
Now we are able to build all tbl code in base.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Oct 1 21:38:26 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +5 -6 lines
Diff to previous 1.33 (colored)

* need a space before .No even if it starts with a closing delimiter
* slightly simplify .Pf *_IGNDELIM code, and share part of it with .No
* do not let opening delimiters fall out of the front of .Ns (from kristaps@)
This fixes a few spacing issues in csh(1) and ksh(1).
OK kristaps@

Revision 1.33 / (download) - annotate - [select for diffs], Mon Sep 27 21:25:28 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +21 -1 lines
Diff to previous 1.32 (colored)

Merge the last bits of 1.10.6 (released today), most were already in:
* ignore double-.Pp
* ignore .Pp before .Bd and .Bl (unless -compact in specified)
* avoid double blank line upon .Pp, .br and friends in literal context
* cast enums to int when passing them to exit(3) to please lint(1)
While merging, fix a regression introduced by kristaps@:
Outside literal mode, double blank lines must both be printed.
To achieve this again after kristaps@ improvements in 1.10.6,
treat such blank lines as .sp (instead of .Pp as in 1.10.5)
and drop .Pp before .sp just like dropping .Pp before .Pp.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Sep 26 18:55:22 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +144 -215 lines
Diff to previous 1.31 (colored)

consolidate all enclosure opening and closing functions
to help code comprehension and reduce code size
also remove redundant TERMP_NOSPACE here and there
from kristaps@

Revision 1.31 / (download) - annotate - [select for diffs], Sun Sep 26 18:23:54 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +7 -8 lines
Diff to previous 1.30 (colored)

no punctuation after .%* outside .Rs
in .Rs, mark full stops after .%* as end of a sentence
from kristaps@

Revision 1.30 / (download) - annotate - [select for diffs], Mon Sep 20 20:02:27 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +10 -1 lines
Diff to previous 1.29 (colored)

Format multiple authors (.%A) in the same way as groff:
Two authors with "and", but without a comma.
Three or more with commata, and an "and" before the last one.
From kristaps@.

Revision 1.29 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK  kristaps@;  Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Aug 7 17:26:11 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.27: +5 -5 lines
Diff to previous 1.27 (colored)

In -Thtml output, preserve blank lines at the end of .Bd -literal.
Patch from kristaps@, analoguous to mdoc_term.c rev. 1.100.
With permission from deraadt@ to still fix bugs in mandoc.

Revision 1.27 / (download) - annotate - [select for diffs], Sat Jul 31 21:43:07 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +5 -8 lines
Diff to previous 1.26 (colored)

Merge bsd.lv version 1.10.5: last larger batch of bug fixes before release.
NOT including Kristaps' .Bd -literal changes which cause regressions.
Features:
* -Tpdf now fully working
Bugfixes:
* proper handling of quoted strings by .ds in roff(7)
* allow empty .Dd
* make .Sm start no-spacing after the first output word
* underline .Ad
* minor fixes in -Thtml
and some optimisations in terminal output.

Revision 1.26 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +26 -3 lines
Diff to previous 1.25 (colored)

Sync to bsd.lv; in particular, pull in lots of bug fixes.
new features:
* support the .in macro in man(7)
* support minimal PDF output
* support .Sm in mdoc(7) HTML output
* support .Vb and .nf in man(7) HTML output
* complete the mdoc(7) manual
bug fixes:
* do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@
* avoid double blank lines related to man(7) .sp and .br
* let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@
* let "\ " produce a non-breaking space; reported by deraadt@
* discard \m colour escape sequences; reported by J.C. Roberts
* map undefined 1-character-escapes to the literal character itself
maintenance:
* express mdoc(7) arguments in terms of an enum for additional type-safety
* simplify mandoc_special() and a2roffdeco()
* use strcspn in term_word() in place of a manual loop
* minor optimisations in the -Tps and -Thtml formatting frontends

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jul 13 01:09:13 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +147 -69 lines
Diff to previous 1.24 (colored)

Merge release 1.10.4 (all code by kristaps@), providing four new features:
1) Proper .Bk support: allow output line breaks at input line breaks,
but keep input lines together in the output, finally fixing
synopses like aucat(1), mail(1) and tmux(1).
2) Mostly finished -Tps (PostScript) output.
3) Implement -Thtml output for .Nm blocks and .Bk -words.
4) Allow iterative interpolation of user-defined roff(7) strings.
Also contains some minor bugfixes and some performance improvements.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jun 29 17:10:29 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

Support for badly nested blocks, written around the time of
the Rostock mandoc hackathon and tested and polished since,
supporting constructs like:

.Ao Bo    Ac    Bc        (exp breaking exp)
.Aq Bo    eol   Bc        (imp breaking exp)
.Ao Bq    Ac    eol       (exp breaking imp)
.Ao Bo So Bc    Ac  Sc    (double break, inner before outer)
.Ao Bo So Ac    Bc  Sc    (double break, outer before inner)
.Ao Bo    Ac So Bc  Sc    (broken breaker)
.Ao Bo So Bc Do Ac  Sc Dc (broken double breaker)

There are still two known issues which are tricky:

1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol)
fails outright, triggering a bogus syntax error.
2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc
or Ao Ao Bq Ac Ac eol) still has a minor rendering error left:
"<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">".

We can fix these later in the tree, let's not grow this diff too large.

"get it in" kristaps@

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jun 27 21:54:42 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +7 -6 lines
Diff to previous 1.22 (colored)

Full .nr nS support, unbreaking the kernel manuals.

Kristaps coded this from scratch after reading my .nr patch;
it is simpler and more powerful.

Registers live in struct regset in regs.h, struct man and struct mdoc
contain pointers to it.  The nS register is cleared when parsing .Sh.
Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jun 26 17:56:43 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +21 -49 lines
Diff to previous 1.21 (colored)

merge release 1.10.2
* bug fixes:
- interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein)
- handling of roff conditionals (found by Ulrich Spoerlein)
- .Bd -offset will no more default to 6n
* maintenance:
- more caching of .Bd and .Bl arguments for efficiency
- deconstify man(7) validation routines
- add FreeBSD library names (provided by Ulrich Spoerlein)
* start PostScript font-switching

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jun 8 00:11:47 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +67 -61 lines
Diff to previous 1.20 (colored)

Merge more bits that will be going into 1.10.1:

Clean up vertical spacing in the SYNOPSIS, making the code much more
systematic; this doesn't solve all SYNOPSIS problems yet, in particular
not those related to keeps, indentation and the low-level .nr roff
instruction, but it's a nice step forward and i couldn't find relevant
regressions.  (from kristaps)

Besides,
* make the output width configurable (default: -Owidth=80) (kristaps)
* use mmap with MAP_SHARED (from Joerg Sonnenberger)

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jun 6 20:30:08 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.19: +68 -69 lines
Diff to previous 1.19 (colored)

Merge bsd.lv version 1.10.1 (to be released soon).

The main step forward is that this now has *much* better .Bl -column
support, now supporting many manuals that previously errored out
without producing any output.

Other fixes include:
* do not die from multiple list types, use the first and warn
* in .Bl without a type, default to -item
* various tweaks to .Dt
* fix .In, .Fd, .Ft, .Fn and .Fo formatting
* some documentation fixes and additions
* and fix a couple of bugs reported by Ulrich Spoerlein:
* better support for roff block-end "\}" without a preceding dot
* .In must not break the line outside SYNOPSIS
* spelling in some error messages

While merging, fix one regression in .In spacing
that needs to go to bsd.lv, too.

Revision 1.19 / (download) - annotate - [select for diffs], Mon May 24 12:33:06 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Fix segfault in mixing old enum types for -Thtml -mdoc; from kristaps@.

Revision 1.18 / (download) - annotate - [select for diffs], Mon May 24 00:00:10 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +35 -80 lines
Diff to previous 1.17 (colored)

Increase performance by saving the list type in struct mdoc_node.
This will eventually be used so that mdoc_macro can know whether to
dump list line arguments into the body (`Bl -column' overflowing).
Remove a2list() and arg_listtype() because of this.

From kristaps@.

While merging, fix a regression in mdoc_term.c, print_bvspace():
The bsd.lv version of this broke vertical spacing in .Bl -column.

Revision 1.17 / (download) - annotate - [select for diffs], Sun May 23 22:45:00 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +7 -3 lines
Diff to previous 1.16 (colored)

Unified error and warning message system for all of mandoc,
featuring three message levels, as agreed during the mandoc hackathon:
* FATAL parser failure, cannot produce any output from this input file:
  eventually, we hope to convert most of these to ERRORs.
* ERROR, meaning mandoc cannot cope fully with the input syntax and will
  probably lose information or produce structurally garbled output;
  it will try to produce output anyway but exit non-zero at the end,
  which is eventually intended to make the ports infrastructure happy.
* WARNING, meaning you should clean up the input file, but output
  is probably mostly OK, so this will not cause error-exit at the end.
This commit is mostly just converting the old system to the new one; before
the classification will become really reliable, we must check all messages.

In particular,
* set up a new central message string table in main.c
* drop the old message string tables from man.c and mdoc.c
* get rid of the piece-meal merr enums in libman and libmdoc
* reduce number of error/warning functions from 16 to 6 (still a lot...)

While here, handle a few problems more gracefully:
* allow .Rv and .Ex to work without a prior .Nm
* allow .An to ignore extra arguments
* allow undeclared columns in .Bl -column

Written by kristaps@.

Revision 1.16 / (download) - annotate - [select for diffs], Sun May 23 20:05:43 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +4 -3 lines
Diff to previous 1.15 (colored)

Small fix for `D1' and `Bd' in -Thtml; from kristaps@.

Revision 1.15 / (download) - annotate - [select for diffs], Sat May 15 18:25:51 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored)

allow non-numeric manual sections in -mdoc;
while here, allow LIBRARY in section 9;
by kristaps@

Revision 1.14 / (download) - annotate - [select for diffs], Fri May 14 19:52:43 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.13: +1 -2 lines
Diff to previous 1.13 (colored)

Integrate kristaps@' end-of-sentence (EOS) framework
which is simpler and more powerful than mine, and remove mine.

* man(7) now has EOS handling, too
* put EOS detection into its own function in libmandoc
* use node and termp flags to communicate the EOS condition
* no more EOS pseudo-macro
* no more non-printable EOS marker character on the formatter level

This slightly breaks EOS detection after trailing punctuation
in mdoc(7) macros, but that will be restored soon.

Revision 1.13 / (download) - annotate - [select for diffs], Fri May 14 14:47:44 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.12: +8 -7 lines
Diff to previous 1.12 (colored)

Merge 1.9.25, keeping local patches;
this does not merge kristaps' end-of-sentences handling yet,
i will check that separately.  This one includes:
* handle \*(Ba as a delimiter
* introduce ARGS_PEND for .Bl -column .It end-of-line special casing
* section ordering: expect EXIT STATUS at the right place
* line break fixes in SYNOPSIS
* allow literal contexts to have arbitrary line lengths
* the input file column number can not be used to identify the beginning
  of a line because white space is allowed after the initial '.'
* proper leading spaces in -man -Tascii mode
* do not let Lb break lines in -mdoc -Thtml LIBRARY

Revision 1.12 / (download) - annotate - [select for diffs], Sat May 8 02:10:09 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.11: +3 -11 lines
Diff to previous 1.11 (colored)

sync to bsd.lv mdoc_term.c 1.117, mdoc_html.c 1.61:
fixed %T: it now correctly underlines, instead of quoting;
noted by jmc@, fixed by kristaps@

Revision 1.11 / (download) - annotate - [select for diffs], Wed Apr 7 23:15:05 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.10: +47 -39 lines
Diff to previous 1.10 (colored)

Merge the good parts of 1.9.23,
avoid the bad parts of 1.9.23, and keep local patches.

Input in general:
 * Basic handling of roff-style font escapes \f, \F.
 * Quoted punctuation does not count as punctuation.

mdoc(7) parser:
 * Make .Pf callable; noted by Claus Assmann.
 * Let .Bd and .Bl ignore unknown arguments; noted by deraadt@.
 * Do not warn when .Er is used outside certain sections.
 * Replace mdoc_node_free[list] by mdoc_node_delete.
 * Replace #define by enum for rew*() return values.

man(7) parser:
 * When .TH is missing, use default section and date.

Output in general:
 * Curly braces do not count as punctuation.
 * No space after .Fl w/o args when a macro follows on the same line.

HTML output:
 * Unify PAIR_*_INIT macros, introduce new PAIR_ID_INIT().
 * Print whitespace after, not before .Vt .Fn .Ft .Fo.

Checked that all manuals in base still build.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Apr 4 00:00:12 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

Better write 'href="mailto:' instead of 'style="mailto:'.
Diff from Tim van der Molen <tbvdm at xs4all dot nl>, thanks!

ok kristaps@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Apr 3 17:06:19 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.8: +4 -1 lines
Diff to previous 1.8 (colored)

no need to die from .Xr without arguments, we can just ignore it

ok deraadt@

Revision 1.8 / (download) - annotate - [select for diffs], Tue Mar 2 00:38:59 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

Proper inter-sentence spacing for mdoc(7).
When a text line or a non-block macro line in the source code ends
in any of ".!?", consider that an end of sentence (EOS).
This makes Jason's rule "new sentence, new line" even more important.
Let the parser detect the EOS and insert a token into the AST.
Let the -Tascii frontend render the EOS token as a double space before
the next word.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Feb 18 02:11:26 2010 UTC (14 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +7 -4 lines
Diff to previous 1.6 (colored)

sync to release 1.9.15:
 * corrected .Vt handling (spotted by Joerg Sonnenberger)
 * corrected .Xr argument handling (based on my patch)
 * removed \\ escape sequence (because it is for low-level roff only)
 * warn about trailing whitespace (suggested by jmc@)
 * -Txhtml support
 * and some general cleanup and doc improvements

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jan 2 02:42:06 2010 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +19 -7 lines
Diff to previous 1.5 (colored)

complete the sync to 1.9.15-pre2: mostly minor fixes
 * bugfix: do not restore TERMP flags when leaving lists, just reset them
 * and a few HTML fixes
 * clarity: return width from a2width, not width+2, and adapt to it
 * manual: document .Bl and .Fl
 * portability: no need to escape '%' in macro names

Revision 1.5 / (download) - annotate - [select for diffs], Thu Dec 24 02:08:14 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +7 -10 lines
Diff to previous 1.4 (colored)

sync to 1.9.14: rewrite escape sequence handling:
- new function a2roffdeco
- font modes (\f) only affect the current stack point
- implement scaling (\s)
- implement space suppression (\c)
- implement non-breaking space (\~) in -Tascii
- many manual improvements

Revision 1.4 / (download) - annotate - [select for diffs], Wed Dec 23 22:30:17 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +7 -4 lines
Diff to previous 1.3 (colored)

sync to 1.9.13: minor fixes:

correctness/functionality:
 - bugfix: properly ignore lines with only a dot in -man
 - bugfix: .Bl -ohang doesn't allow -width, warn about this
 - improve date string handling by new function mandoc_a2time
 - some HTML improvements
 - significant documentation additions in man.7 and mdoc.7

portability:
 - replace __dead by __attribute__((noreturn))
 - bugfix: correct .Dx rendering
 - some more library names for NetBSD

simplicity:
 - replace hand-rolled putchar(3)-loops by fwrite(3)
 - replace single-character printf(3) by putchar(3)

Revision 1.3 / (download) - annotate - [select for diffs], Tue Dec 22 23:58:00 2009 UTC (14 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +33 -24 lines
Diff to previous 1.2 (colored)

sync to 1.9.12, mostly portability and refactoring:

correctness/functionality:
- bugfix: do not die when overstep hits the right margin
- new option: -fign-escape
- and various HTML features

portability:
- replace bzero(3) by memset(3), which is ANSI C
- replace err(3)/warn(3) by perror(3)/exit(3), which is ANSI C
- iuse argv[0] instead of __progname
- add time.h to various files for FreeBSD compilation

simplicity:
- do not allocate header/footer data dynamically in *_term.c
- provide and use malloc frontends that error out on failure

for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/

Revision 1.2 / (download) - annotate - [select for diffs], Tue Oct 27 21:40:07 2009 UTC (14 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +38 -29 lines
Diff to previous 1.1 (colored)

sync to 1.9.11: adapt printing of dates to groff conventions,
NetBSD portability fixes and some minor bugfixes and feature enhancements;
also checked that my hyphenation code still works on top of this

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 21 19:13:50 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN

sync to 1.9.9, featuring:
 * -Thtml output mode
 * roff scaling units
 * and some minor fixes
for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.