OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.150 / (download) - annotate - [select for diffs], Tue Aug 9 11:21:50 2022 UTC (21 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.149: +6 -3 lines
Diff to previous 1.149 (colored)

prevent breakable hyphens in segment identifiers
from being turned into underscores;
bug reported by <Eldred dot fr> Habert

Revision 1.149 / (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.148: +2 -2 lines
Diff to previous 1.148 (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.148 / (download) - annotate - [select for diffs], Sun Jul 3 14:28:26 2022 UTC (22 months, 2 weeks ago) by schwarze
Branch: MAIN
Changes since 1.147: +3 -1 lines
Diff to previous 1.147 (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.147 / (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.146: +5 -1 lines
Diff to previous 1.146 (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.146 / (download) - annotate - [select for diffs], Thu Sep 9 14:45:18 2021 UTC (2 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.145: +2 -1 lines
Diff to previous 1.145 (colored)

If the layout or data of an individual cell in a tbl(7) contains
only "_", "-", or "=", requesting a horizontal line to be drawn
across the middle of the cell, print <hr/> in that cell in HTML
output.

That is arguably slightly ugly because HTML 5 regards <hr/> as
semantic markup, meaning "thematic break".  If somebody knowns
a better way to render a horizontal line across the middle of a
table cell with pure HTML and CSS, and without implying a specific
meaning, please tell me.

Missing feature reported by <Oliver dot Corff at email dot de>.

Revision 1.145 / (download) - annotate - [select for diffs], Tue Aug 10 12:36:42 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +17 -5 lines
Diff to previous 1.144 (colored)

Support two-character font names (BI, CW, CR, CB, CI)
in the tbl(7) layout font modifier.

Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use
the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead,
which simplifies and unifies some code.

While here, also support CB and CI in roff(7) \f escape sequences
and in roff(7) .ft requests for all output modes.  Using those is
certainly not recommended because portability is limited even with
groff, but supporting them makes some existing third-party manual
pages look better, in particular in HTML output mode.

Bug-compatible with groff as far as i'm aware, except that i consider
font names starting with the '\n' (ASCII 0x0a line feed) character
so insane that i decided to not support them.

Missing feature reported by nabijaczleweli dot xyz in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002.
I used none of the code from the initial patch submitted by
nabijaczleweli, but some of their ideas.
Final patch tested by them, too.

Revision 1.144 / (download) - annotate - [select for diffs], Sat May 22 05:49:32 2021 UTC (2 years, 11 months ago) by anton
Branch: MAIN
Changes since 1.143: +3 -1 lines
Diff to previous 1.143 (colored)

In revision 1.95 of cgi.c, a meta viewport element was added to the HTML output.
Let `mandoc -Thtml' behave the same, makes the generated HTML a bit more
pleasant to view on a mobile device.

ok schwarze@

Revision 1.143 / (download) - annotate - [select for diffs], Sun May 16 18:08:37 2021 UTC (3 years ago) by schwarze
Branch: MAIN
Changes since 1.142: +2 -1 lines
Diff to previous 1.142 (colored)

implement the tbl(7) layout modifiers "b" (bold) and "i" (italic)
in HTML output mode, similar to tbl_term.c, function tbl_word();
issue reported by Oliver dot Corff at email dot de

Revision 1.142 / (download) - annotate - [select for diffs], Fri Oct 16 17:22:38 2020 UTC (3 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.141: +2 -2 lines
Diff to previous 1.141 (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.141 / (download) - annotate - [select for diffs], Mon Apr 20 12:59:24 2020 UTC (4 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.140: +4 -3 lines
Diff to previous 1.140 (colored)

In fragment identifiers, use ~%d for ordinal suffixes,
and reserve the character '~' for that purpose.

Bug found by validator.w3.org in openssl(1), which contains both a
tag "tls1_2" and a second instance of a tag "tls1", which also resulted
in "tls1_2", causing a clash.  Now, the second instance of "tls1" is
rendered as "tls1~2" instead, employing the newly reserved '~'.

Revision 1.140 / (download) - annotate - [select for diffs], Sun Apr 19 15:15:54 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.139: +40 -34 lines
Diff to previous 1.139 (colored)

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

Revision 1.139 / (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.138: +21 -4 lines
Diff to previous 1.138 (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.138 / (download) - annotate - [select for diffs], Wed Apr 8 11:54:14 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.137: +3 -3 lines
Diff to previous 1.137 (colored)

Use a separate node->tag attribute rather than abusing the node->string
attribute for the purpose.  No functional change intended.
The purpose is to make it possible to later attach tags to text nodes.

Revision 1.137 / (download) - annotate - [select for diffs], Tue Apr 7 22:45:37 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.136: +11 -7 lines
Diff to previous 1.136 (colored)

Separate the place to put the <a href> permalink (now marked
with NODE_HREF) from the target element of the link (still marked
with NODE_ID).  In many cases, use this to move the target to the
beginning of the paragraph, such that readers don't get dropped
into the middle of a sentence.

Revision 1.136 / (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.135: +17 -6 lines
Diff to previous 1.135 (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.135 / (download) - annotate - [select for diffs], Fri Mar 13 00:31:04 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +68 -10 lines
Diff to previous 1.134 (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.134 / (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.133: +3 -3 lines
Diff to previous 1.133 (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.133 / (download) - annotate - [select for diffs], Sun Jan 19 17:59:01 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +2 -1 lines
Diff to previous 1.132 (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.132 / (download) - annotate - [select for diffs], Thu Sep 5 13:34:55 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.131: +5 -8 lines
Diff to previous 1.131 (colored)

Do not clear HTML_NOSPACE in print_indent().
I don't think there ever was a reason for doing so.

Besides, there is a discrepacy with respect to the point in the
document affected.  That flag controls whitespace at the current
formatting point.  But when HTML_BUFFER is in effect, the line break
and indentation is typically inserted one word further to the left.
Anything happening at that point to the left can't reasonably
influence spacing at the different point further to the right.

Among other effects, this change avoids some spurious line breaks
in HTML code at points where they weren't supposed to happen, line
breaks that in some cases caused undesirable, visible whitespace
when the resulting HTML was rendered.

Revision 1.131 / (download) - annotate - [select for diffs], Tue Sep 3 18:07:57 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +25 -2 lines
Diff to previous 1.130 (colored)

Wrap text and phrasing elements in paragraphs unless already
contained in flow containers; never put them directly into sections.
This helps to format paragraphs with the CSS class selector .Pp.

Suggested by bentley@ and also by Colin Watson <cjwatson at debian>
via Michael Stapelberg <stapelberg at debian>,
see https://github.com/Debian/debiman/issues/116

Revision 1.130 / (download) - annotate - [select for diffs], Tue Sep 3 12:30:34 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +5 -4 lines
Diff to previous 1.129 (colored)

oops, fix use after free in previous

Revision 1.129 / (download) - annotate - [select for diffs], Tue Sep 3 12:03:05 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +10 -14 lines
Diff to previous 1.128 (colored)

Make html_close_paragraph() more versatile, more robust, less
dependent on individual HTML elements, and simpler: don't just close
<p>, <pre>, and <a>, but any element that establishes phrasing
context.  This doesn't change output for any OpenBSD manual page,
but it will allow using this function more safely and at more places
in the future.

Revision 1.128 / (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.127: +1 -2 lines
Diff to previous 1.127 (colored)

delete the TAG_IDIV crutch, which is no longer used

Revision 1.127 / (download) - annotate - [select for diffs], Thu Aug 29 17:57:25 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +40 -28 lines
Diff to previous 1.126 (colored)

In the HTML formatter, assert(3) that no HTML nesting violation occurs.
Tested on the complete manual page trees of Version 7 AT&T UNIX,
4.4BSD-Lite2, POSIX-2013, OpenBSD 2.2 to 6.5 and -current,
FreeBSD 10.0 to 12.0, NetBSD 6.1.5 to 8.1, DragonFly 3.8.2 to 5.6.1,
and Linux 4.05 to 5.02.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Aug 2 17:04:55 2019 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +7 -12 lines
Diff to previous 1.125 (colored)

minor sync of the inline stylesheet with mandoc.css:
delete unimportant .Pp rule and shorten overly specific selectors

Revision 1.125 / (download) - annotate - [select for diffs], Tue Apr 30 15:52:42 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.124: +26 -48 lines
Diff to previous 1.124 (colored)

In HTML output, allow switching the desired font for subsequent
text without printing an opening tag right away, and use that in
the .ft request handler.  While here, garbage collect redundant
enum htmlfont and reduce code duplication in print_text().
Fixing an assertion failure reported by Michael <Stapelberg at Debian>
in pmRegisterDerived(3) from libpcp3-dev.

Revision 1.124 / (download) - annotate - [select for diffs], Sun Mar 3 13:01:47 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.123: +18 -7 lines
Diff to previous 1.123 (colored)

Reset HTML formatter state, in particular the id_unique hash,
after processing each manual page, such that the next page
starts from a clean state and doesn't continue suffix numbering.

Issue found while looking at https://github.com/Debian/debiman/issues/48
which was brought up by Orestis Ioannou <oorestisime at github>.

Revision 1.123 / (download) - annotate - [select for diffs], Fri Mar 1 10:48:58 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +2 -1 lines
Diff to previous 1.122 (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.122 / (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.121: +50 -42 lines
Diff to previous 1.121 (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.121 / (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.120: +1 -7 lines
Diff to previous 1.120 (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.120 / (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.119: +11 -13 lines
Diff to previous 1.119 (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.119 / (download) - annotate - [select for diffs], Sun Jan 6 04:41:15 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +17 -2 lines
Diff to previous 1.118 (colored)

Finally, represent the man(7) .PP and .HP macros by the natural
choice, which is <p> HTML element.  On top of the previous fill-mode
improvements, the key to making this possible is to automatically
close the <p> when required: before headers, subsequent paragraphs,
lists, indented blocks, synopsis blocks, tbl(7) blocks, and before
blocks using no-fill mode.

In man(7) documents, represent the .sp request by a blank line in
no-fill mode and in the same way as .PP in fill mode.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Jan 5 09:14:11 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +34 -1 lines
Diff to previous 1.117 (colored)

Now that the NODE_NOFILL flag in the syntax tree is accurate,
use it in the man(7) HTML formatter rather than keeping fill mode
state locally, resulting in massive simplification (minus 40 LOC).

Move the html_fillmode() state handler function to the html.c module
such that both the man(7) and the roff(7) formatter (and in the future,
also the mdoc(7) formatter) can use it.  Give it a query mode, to be
invoked with TOKEN_NONE.

Revision 1.117 / (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.116: +3 -4 lines
Diff to previous 1.116 (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.116 / (download) - annotate - [select for diffs], Sat Dec 15 19:30:19 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +6 -4 lines
Diff to previous 1.115 (colored)

Several improvements to escape sequence handling.

* Add the missing special character \_ (underscore).
* Partial implementations of \a (leader character)
and \E (uninterpreted escape character).
* Parse and ignore \r (reverse line feed).
* Add a WARNING message about undefined escape sequences.
* Add an UNSUPP message about unsupported escape sequences.
* Mark \! and \? (transparent throughput)
and \O (suppress output) as unsupported.
* Treat the various variants of zero-width spaces as one-byte escape
sequences rather than as special characters, to avoid defining bogus
forms with square brackets.
* For special characters with one-byte names, do not define bogus
forms with square brackets, except for \[-], which is valid.
* In the form with square brackets, undefined special characters do not
fall back to printing the name verbatim, not even for one-byte names.
* Starting a special character name with a blank is an error.
* Undefined escape sequences never abort formatting of the input
string, not even in HTML output mode.
* Document the newly handled escapes, and a few that were missing.
* Regression tests for most of the above.

Revision 1.115 / (download) - annotate - [select for diffs], Tue Dec 4 18:29:18 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +2 -5 lines
Diff to previous 1.114 (colored)

HTML syntax audit: render \p as <br/>, not as <div>.
It can occur anywhere, in particular in phrasing context.

Revision 1.114 / (download) - annotate - [select for diffs], Mon Nov 26 01:38:17 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +25 -16 lines
Diff to previous 1.113 (colored)

Support more than one style attribute one the same HTML element.
In fact, this is already required when a table uses non-default
horizontal and vertical alignment in the same cell.

Revision 1.113 / (download) - annotate - [select for diffs], Fri Nov 23 19:15:32 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +5 -2 lines
Diff to previous 1.112 (colored)

When a font escape appears in the middle of a string,
make sure it doesn't cause output of bogus whitespace.
Fixing a bug reported by Pali dot Rohar at gmail dot com.

Revision 1.112 / (download) - annotate - [select for diffs], Thu Oct 25 01:21:30 2018 UTC (5 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +11 -1 lines
Diff to previous 1.111 (colored)

Implement the \f(CW and \f(CR (constant width font) escape sequences
for HTML output.  Somewhat relevant because pod2man(1) relies on this.
Missing feature reported by Pali dot Rohar at gmail dot com.

Note that constant width font was already correctly selected before
this when required by semantic markup.  Only attempting physical
markup with the low-level escape sequence was ineffective.

Revision 1.111 / (download) - annotate - [select for diffs], Tue Oct 2 14:56:36 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.110: +3 -1 lines
Diff to previous 1.110 (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.110 / (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.109: +19 -3 lines
Diff to previous 1.109 (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.109 / (download) - annotate - [select for diffs], Thu Aug 16 13:49:40 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +4 -1 lines
Diff to previous 1.108 (colored)

Implement the \*(.T predefined string (interpolate device name)
by allowing the preprocessor to pass it through to the formatters.
Used for example by the groff_char(7) manual page.

Revision 1.108 / (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.107: +18 -139 lines
Diff to previous 1.107 (colored)

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

Revision 1.107 / (download) - annotate - [select for diffs], Mon Jun 25 14:13:50 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +3 -11 lines
Diff to previous 1.106 (colored)

Delete support for style=margin-left attributes, which are no longer used.

Revision 1.106 / (download) - annotate - [select for diffs], Mon Jun 25 13:59:33 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +1 -41 lines
Diff to previous 1.105 (colored)

Delete support for style=width attributes, which are no longer used.

Revision 1.105 / (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.104: +1 -3 lines
Diff to previous 1.104 (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.104 / (download) - annotate - [select for diffs], Mon Jun 25 13:26:53 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +1 -4 lines
Diff to previous 1.103 (colored)

Delete support for the style=text-indent attribute, which is no longer used.

Revision 1.103 / (download) - annotate - [select for diffs], Mon Jun 18 01:49:12 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +4 -1 lines
Diff to previous 1.102 (colored)

Revert previous: style=height is still used by roff_html.c, and it
doesn't actually harm responsive design, so keep it for now.
Bug reported in de.comp.os.unix.bsd via naddy@, thanks.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Jun 10 16:46:52 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +1 -4 lines
Diff to previous 1.101 (colored)

delete support for the HTML style=height property, which is no longer used

Revision 1.101 / (download) - annotate - [select for diffs], Tue May 29 02:10:05 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +1 -12 lines
Diff to previous 1.100 (colored)

Delete support for the print_otag(sw) * and - modifiers,
which are no longer used because we write fewer style= attributes.

Revision 1.100 / (download) - annotate - [select for diffs], Mon May 28 14:12:35 2018 UTC (5 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +9 -3 lines
Diff to previous 1.99 (colored)

URL-fragment strings can only contain certain characters.
Fixing HTML syntax violations e.g. in pf.conf(5) and ifconfig(1)
reported by Anton Lazarov <lists at wrant dot com>.

Revision 1.99 / (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.98: +45 -5 lines
Diff to previous 1.98 (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.98 / (download) - annotate - [select for diffs], Mon May 21 01:10:06 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.97: +3 -1 lines
Diff to previous 1.97 (colored)

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

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

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

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

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

Revision 1.95 / (download) - annotate - [select for diffs], Wed May 9 00:45:33 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.94: +4 -1 lines
Diff to previous 1.94 (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.94 / (download) - annotate - [select for diffs], Tue May 8 21:42:11 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.93: +5 -1 lines
Diff to previous 1.93 (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.93 / (download) - annotate - [select for diffs], Tue May 8 17:52:24 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.92: +7 -1 lines
Diff to previous 1.92 (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.92 / (download) - annotate - [select for diffs], Tue May 1 23:36:39 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.91: +7 -6 lines
Diff to previous 1.91 (colored)

skip printing the embedded style sheet if an external style is referenced

Revision 1.91 / (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.90: +28 -2 lines
Diff to previous 1.90 (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.90 / (download) - annotate - [select for diffs], Wed Sep 6 16:24:11 2017 UTC (6 years, 8 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.89: +3 -1 lines
Diff to previous 1.89 (colored)

fix a NULL pointer access on deroff() failure;
could be triggered with '.SS ""';
reported by Michael <Stapelberg at debian>

Revision 1.89 / (download) - annotate - [select for diffs], Sat Jul 15 17:57:46 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +18 -14 lines
Diff to previous 1.88 (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.88 / (download) - annotate - [select for diffs], Fri Jul 14 16:28:35 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +7 -2 lines
Diff to previous 1.87 (colored)

Fix an assertion failure triggered by print_otag("sw+-l", NULL).
Even though we skip the style when the argument is NULL,
we must still consume the options.
Not found with afl(1), but during manual testing of the previous patch...

Revision 1.87 / (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.86: +1 -12 lines
Diff to previous 1.86 (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.86 / (download) - annotate - [select for diffs], Fri Jul 14 15:26:14 2017 UTC (6 years, 10 months ago) by bentley
Branch: MAIN
Changes since 1.85: +4 -4 lines
Diff to previous 1.85 (colored)

Print HTML character references as 4+ digits hexadecimal, like Unicode.

tweaks + ok schwarze@

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jun 23 02:31:39 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +2 -1 lines
Diff to previous 1.84 (colored)

Write text boxes as <mi>, <mn>, or <mo> as appropriate,
and write fontstyle or fontweight attributes where required.
Missing features reported by bentley@.

Revision 1.84 / (download) - annotate - [select for diffs], Wed Jun 14 01:31:19 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +27 -8 lines
Diff to previous 1.83 (colored)

implement the roff(7) \p (break output line) escape sequence

Revision 1.83 / (download) - annotate - [select for diffs], Thu Jun 8 12:54:40 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +5 -2 lines
Diff to previous 1.82 (colored)

make the internal a2roffsu() interface more powerful by returning
a pointer to the end of the parsed data, making it easier to
parse subsequent bytes

Revision 1.82 / (download) - annotate - [select for diffs], Sun May 14 12:26:59 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.81: +2 -2 lines
Diff to previous 1.81 (colored)

Tweak previous: tb@ noticed that some browser/font combinations
have so amazingly wide bold fonts (for the same nominal font size)
that adding 15% to the column width still isn't sufficient to make
text reliably fit, so go for 20%.

Revision 1.81 / (download) - annotate - [select for diffs], Fri May 12 17:56:39 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.80: +11 -5 lines
Diff to previous 1.80 (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.80 / (download) - annotate - [select for diffs], Wed Mar 15 11:29:50 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.79: +25 -2 lines
Diff to previous 1.79 (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.79 / (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.78: +3 -1 lines
Diff to previous 1.78 (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.78 / (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.77: +13 -6 lines
Diff to previous 1.77 (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.77 / (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.76: +2 -1 lines
Diff to previous 1.76 (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.76 / (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.75: +2 -1 lines
Diff to previous 1.75 (colored)

for .Rs, use <cite>

Revision 1.75 / (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.74: +2 -2 lines
Diff to previous 1.74 (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.74 / (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.73: +10 -10 lines
Diff to previous 1.73 (colored)

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

Revision 1.73 / (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.72: +51 -33 lines
Diff to previous 1.72 (colored)

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

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jan 26 18:28:04 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +2 -3 lines
Diff to previous 1.71 (colored)

Fix -man -Thtml formatting after .nf (which has nothing to do
with "literal", by the way, it means "no fill"):

* Use <pre> such that whitespace is preserved.
* Preserve lines breaks.
* For font alternating macros, avoid node recursion which required
scary juggling with the fill state.  Instead, simply print the text
children directly.

Missing feature first noticed by kristaps@ in 2011,
the again reported by afresh1@ in 2016,
and finally reported here: https://github.com/Debian/debiman/issues/21 ,
which i only found because of Shane Kerr's comment here:
https://plus.google.com/110314300533310775053/posts/H1eaw9Yskoc

Revision 1.71 / (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.70: +4 -1 lines
Diff to previous 1.70 (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.70 / (download) - annotate - [select for diffs], Sat Jan 21 02:28:42 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +1 -5 lines
Diff to previous 1.69 (colored)

slightly simplify header and footer styles

Revision 1.69 / (download) - annotate - [select for diffs], Thu Jan 19 16:56:53 2017 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +1 -2 lines
Diff to previous 1.68 (colored)

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

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

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

Revision 1.67 / (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.66: +171 -65 lines
Diff to previous 1.66 (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.66 / (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.65: +144 -77 lines
Diff to previous 1.65 (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.65 / (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.64: +73 -155 lines
Diff to previous 1.64 (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.64 / (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.63: +135 -50 lines
Diff to previous 1.63 (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.63 / (download) - annotate - [select for diffs], Sun Jan 8 16:38:04 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

style: missing blank between case statement and label;
from Tiago Silva <tiagofilipesilva at icloud dot com> long ago

Revision 1.62 / (download) - annotate - [select for diffs], Fri Dec 25 20:43:04 2015 UTC (8 years, 4 months ago) by bentley
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.61: +4 -4 lines
Diff to previous 1.61 (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.61 / (download) - annotate - [select for diffs], Tue Oct 13 22:57:49 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +3 -5 lines
Diff to previous 1.60 (colored)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.60 / (download) - annotate - [select for diffs], Mon Oct 12 00:14:41 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +2 -2 lines
Diff to previous 1.59 (colored)

Fix an obvious bug found during the /* FALLTHROUGH */ cleanup:
ASCII_NBRSP has to be rendered as "&nbsp;", not "-".

Revision 1.59 / (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.58: +2 -11 lines
Diff to previous 1.58 (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.58 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:43 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +8 -8 lines
Diff to previous 1.57 (colored)

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

Revision 1.57 / (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.56: +1 -2 lines
Diff to previous 1.56 (colored)

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

Revision 1.56 / (download) - annotate - [select for diffs], Fri Mar 27 21:17:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.55: +10 -29 lines
Diff to previous 1.55 (colored)

Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.

Revision 1.55 / (download) - annotate - [select for diffs], Wed Jan 21 20:20:49 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.54: +9 -2 lines
Diff to previous 1.54 (colored)

Rudimentary implementation of the roff(7) \o escape sequence (overstrike).
This is of some relevance because the pod2man(1) preamble abuses it
for the icelandic letter Thorn, instead of simply using \(TP and \(Tp.
Missing feature found by sthen@ in DateTime::Locale::is_IS(3p).

Revision 1.54 / (download) - annotate - [select for diffs], Sat Dec 20 00:19:54 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +19 -27 lines
Diff to previous 1.53 (colored)

resolve some code duplication; no functional change

Revision 1.53 / (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.52: +3 -2 lines
Diff to previous 1.52 (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.52 / (download) - annotate - [select for diffs], Mon Dec 1 04:32:34 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +1 -2 lines
Diff to previous 1.51 (colored)

The header libmandoc.h is part of the internal parser interface,
but html.c is not part of the parser at all, so it cannot include
that header, and actually, it doesn't need it.
Found while auditing includes after Theo's recent *.h commit.

Revision 1.51 / (download) - annotate - [select for diffs], Wed Oct 29 00:17:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +7 -4 lines
Diff to previous 1.50 (colored)

In terminal output, unify handling of Unicode and numbered character
escape sequences just like it was earlier implemented for -Thtml.
Do not let control characters other than ASCII 9 (horizontal tab)
propagate to the output, even though groff allows them; but that
really doesn't look like a great idea.

Let mchars_num2char() return int such that we can distinguish invalid \N
syntax from \N'0'.  This also reduces the danger of signed char issues
popping up.

Revision 1.50 / (download) - annotate - [select for diffs], Tue Oct 28 17:35:42 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +4 -22 lines
Diff to previous 1.49 (colored)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.49 / (download) - annotate - [select for diffs], Mon Oct 27 16:28:30 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +11 -23 lines
Diff to previous 1.48 (colored)

Handle output encoding for unicode, numbered and named escape sequences
in one common, safe way instead of three different ways.  In particular,
* skip NUL, it is used to mean "no output desired"
* deny 0x01-0x1F and 0x7F-0x9F, print REPLACEMENT CHARACTER instead
* print 0x20-0x7E literally or name-encoded, as required
* print characters above 0x9F numerically

Revision 1.48 / (download) - annotate - [select for diffs], Mon Oct 27 13:29:30 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +6 -5 lines
Diff to previous 1.47 (colored)

Fix a regression in term.c rev. 1.89 reported by bentley@:
In UTF-8 output, do not print anything if mchars_spec2cp() returns 0.
In particular, this repairs handling of zero-width spaces (\&).

While here, let mchars_spec2cp() return 0xFFFD instead of -1
if the character is not found, simplifying the using code.
In HTML output, do not print obfuscated ASCII characters and
do not test for one-char escapes, mchars_spec2cp() already does that.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Oct 26 17:11:18 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +13 -3 lines
Diff to previous 1.46 (colored)

Improve -Tascii output for Unicode escape sequences: For the first 512
code points, provide ASCII approximations.  This is already much better
than what groff does, which prints nothing for most code points.

A few minor fixes while here:
* Handle Unicode escape sequences in the ASCII range.
* In case of errors, use the REPLACEMENT CHARACTER U+FFFD for -Tutf8
and the string "<?>" for -Tascii output.
* Handle all one-character escape sequences in mchars_spec2{cp,str}()
and remove the workarounds on the higher level.

Revision 1.46 / (download) - annotate - [select for diffs], Mon Oct 13 21:05:59 2014 UTC (9 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.45: +1 -1 lines
Diff to previous 1.45 (colored)

Add missing */ after $OpenBSD$ tag

ok schwarze@

Revision 1.45 / (download) - annotate - [select for diffs], Fri Oct 10 15:25:06 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +2 -1 lines
Diff to previous 1.44 (colored)

Partial eqn(7) rewrite by kristaps@ in order to get operator precedence right.

Revision 1.44 / (download) - annotate - [select for diffs], Thu Oct 9 15:59:08 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +4 -1 lines
Diff to previous 1.43 (colored)

parse and render "from" and "to" clauses in eqn, and render matrices;
written by kristaps@ during EuroBSDCon

Revision 1.43 / (download) - annotate - [select for diffs], Thu Oct 9 15:49:09 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +16 -1 lines
Diff to previous 1.42 (colored)

initial bits of MathML rendering for eqn(7) -Thtml;
written by kristaps@ during EuroBSDCon

Revision 1.42 / (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.41: +39 -59 lines
Diff to previous 1.41 (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.41 / (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.40: +1 -2 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Wed Aug 13 22:09:28 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +3 -1 lines
Diff to previous 1.39 (colored)

Begin cleanup of scaling units.
Note that we use 240u := 1i for all devices, even -Tps and -Tpdf.
Big fix of -Tascii rendering of f, m, and u.
Small fix of -Tascii rendering of c.
Big fix of -Thtml rendering of u.
Big fix of -Tps rendering of m, p, and u.
Clarify -Tps rendering of c.
Correct documentation of scaling units, in particular with respect to u.
This for example improves rendering of the OpenGL manuals.
Joint work with kristaps@.

Revision 1.39 / (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.38: +2 -1 lines
Diff to previous 1.38 (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.38 / (download) - annotate - [select for diffs], Wed Jul 23 15:00:00 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.37: +38 -27 lines
Diff to previous 1.37 (colored)

Security fix:
After decoding numeric (\N) and one-character (\<, \> etc.)
character escape sequences, do not forget to HTML-encode the
resulting ASCII character.  Malicious manuals were able to smuggle
XSS content by roff-escaping the HTML-special characters they need.
That's a classic bug type in many web applications, actually...  :-(

Found myself while auditing the HTML formatter for safe output handling.

Revision 1.37 / (download) - annotate - [select for diffs], Tue Jul 22 22:41:29 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +5 -2 lines
Diff to previous 1.36 (colored)

Security fix:
The function print_encode() is used both for plain text
and for quoted attribute values.
Escape the '"' character such that malicious manuals cannot pull off
XSS attacks using malformed .Lk, .Mt, .%U, and .UR macros (and maybe
others) to trigger the latter case.
In the former case, escaping does no harm.
Issue found by Sebastien Marie <semarie-openbsd at latrappe dot fr>.

Revision 1.36 / (download) - annotate - [select for diffs], Wed Apr 23 16:07:06 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.35: +7 -1 lines
Diff to previous 1.35 (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.35 / (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.34: +59 -67 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jan 22 20:58:35 2014 UTC (10 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.32: +9 -3 lines
Diff to previous 1.32 (colored)

Implement the \: (optional line break) escape sequence,
documented in the Ossanna-Kernighan-Ritter troff manual
and also supported by groff.

Missing feature reported by Steffen Nurpmeso <sdaoden at gmail dot com>.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Jan 5 21:21:08 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Fix one case where a non-literal is used as format string.
Fix another case where a variable is formatted using the wrong type.
Patch from Joerg Sonnenberger <joerg@NetBSD>.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Aug 8 20:07:24 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +35 -10 lines
Diff to previous 1.30 (colored)

Implement the roff(7) font-escape sequence \f(BI "bold+italic".
This improves the formatting of about 40 base manuals
and reduces groff-mandoc formatting differences in base by about 5%.

Revision 1.30 / (download) - annotate - [select for diffs], Mon May 28 13:00:51 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.29: +58 -25 lines
Diff to previous 1.29 (colored)

Implement the roff \z escape sequence, intended to output the next
character without advancing the cursor position; implement it to
simply skip the next character, as it will usually be overwritten.

With this change, the pod2man(1) preamble user-defined string \*:,
intended to render as a diaeresis or umlaut diacritic above the
preceding character, is rendered in a slightly less ugly way,
though still not correctly.  It was rendered as "z.." and is now
rendered as ".".

Given that the definition of \*: uses elaborate manual \h positioning,
there is little chance for mandoc(1) to ever render it correctly,
but at least we can refrain from printing out a spurious "z", and
we can make the \z do something semi-reasonable for easier cases.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Oct 9 17:59:56 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.28: +7 -3 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Fri Jul 8 17:47:54 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.27: +4 -2 lines
Diff to previous 1.27 (colored)

clean up .HP, .IP, .TP, .nf, and \c handling in -T[x]html;
from kristaps@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jul 5 04:12:41 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +1 -2 lines
Diff to previous 1.26 (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.26 / (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.25: +130 -213 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.24: +1 -10 lines
Diff to previous 1.24 (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.24 / (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.23: +9 -50 lines
Diff to previous 1.23 (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.23 / (download) - annotate - [select for diffs], Sun Jan 30 16:05:29 2011 UTC (13 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.22: +17 -1 lines
Diff to previous 1.22 (colored)

Implement the \N'number' (numbered character) roff escape sequence.
Don't use it in new manuals, it is inherently non-portable, but we
need it for backward-compatibility with existing manuals, for example
in Xenocara driver pages.
ok kristaps@ matthieu@ jmc@

Revision 1.22 / (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.21: +15 -2 lines
Diff to previous 1.21 (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.21 / (download) - annotate - [select for diffs], Mon Dec 27 21:44:30 2010 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +14 -10 lines
Diff to previous 1.20 (colored)

In case an ID attribute is written in pieces, only protect the first
piece with a prepended 'x', not each piece, such that quoted and
unquoted .Sh, .Ss, and .Sx arguments are compatible with each other.
Fixing a bug reported by Nicolas Joly <njoly at NetBSD dot org>,
avoiding a regression in my first patch as pointed out by njoly as well.
"feel free to do so" kristaps@

Revision 1.20 / (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.19: +27 -29 lines
Diff to previous 1.19 (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.19 / (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.18: +17 -15 lines
Diff to previous 1.18 (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.18 / (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.17: +12 -8 lines
Diff to previous 1.17 (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.17 / (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.16: +3 -1 lines
Diff to previous 1.16 (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.16 / (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.15: +3 -3 lines
Diff to previous 1.15 (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.15 / (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.14: +3 -3 lines
Diff to previous 1.14 (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.14 / (download) - annotate - [select for diffs], Sat Jul 31 21:43:07 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.13: +3 -1 lines
Diff to previous 1.13 (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.13 / (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.12: +31 -13 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Tue Jul 13 01:09:12 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +27 -13 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Sun Jun 27 20:28:56 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.10: +6 -6 lines
Diff to previous 1.10 (colored)

Remove "pt" from struct roffsu, as CSS (the only reason it was there) is
unclear about which units accept floats/integers, which leads me to
assume that it handles either and rounds as appropriate.
from kristaps@

Revision 1.10 / (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.9: +1 -3 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Wed May 26 02:39:58 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +15 -16 lines
Diff to previous 1.8 (colored)

When a word does not fully fit onto the output line, but it contains
at least one hyphen, we already had support for breaking the line a the
last fitting hyphen.  This patch improves this functionality by only
breaking at hyphens in free-form text, and by not breaking at hyphens
* at the beginning or end of a word   or
* immediately preceded or followed by another hyphen   or
* escaped by a preceding backslash.

Before this patch, differences in break-at-hyphen support were one
of the major sources of noise in automatic comparisons to mdoc(7)
groff output.  Now, the remaining differences are hard to find among
the noise coming from other sources.

Where there are still differences, what we do seems to be better than
what groff does, see e.g. the chio(1) exchange and position commands
for one of the now rare examples.

idea and coding by kristaps@

Besides, this was the last substantial code difference left
between bsd.lv and openbsd.org.  We are now in full sync.

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 14 01:54:37 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.7: +6 -2 lines
Diff to previous 1.7 (colored)

merge 1.9.24, keeping local patches; some changes:
* preserve multiple consecutive space characters in input
* do not restrict .Cd and .Rv to certain sections (requested by Joerg)
* do not run lookup() on quoted words
* enum return types for mdoc_args and mdoc_argv
* fix auto-closing of LINK tag in -Txhtml (from Daniel Friesel)
* various lint and manual fixes

Revision 1.7 / (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.6: +1 -6 lines
Diff to previous 1.6 (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.6 / (download) - annotate - [select for diffs], Thu Feb 18 02:11:25 2010 UTC (14 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.5: +112 -20 lines
Diff to previous 1.5 (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.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: +108 -118 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: +22 -25 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: +44 -14 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: +13 -17 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.