From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id e6598237 for ; Fri, 1 Mar 2019 05:57:54 -0500 (EST) Date: Fri, 1 Mar 2019 05:57:54 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML
X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML
elements as recommended for accessibility by the HTML 5 standard. Triggered by a similar, but slightly different suggestion from Laura Morales . Modified Files: -------------- mandoc: TODO html.c html.h man_html.c mandoc.css mdoc_html.c mandoc/regress/man/IP: literal.out_html mandoc/regress/man/SH: paragraph.out_html mandoc/regress/man/SS: paragraph.out_html mandoc/regress/mdoc/Rs: paragraph.out_html mandoc/regress/mdoc/Sh: paragraph.out_html mandoc/regress/roff/ft: badargs.out_html Revision Data ------------- Index: paragraph.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Rs/paragraph.out_html,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/mdoc/Rs/paragraph.out_html -Lregress/mdoc/Rs/paragraph.out_html -u -p -r1.2 -r1.3 --- regress/mdoc/Rs/paragraph.out_html +++ regress/mdoc/Rs/paragraph.out_html @@ -4,6 +4,8 @@ initial reference: book title.

in a paragraph: another author, another book.

+
+

initial reference: Index: mdoc_html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v retrieving revision 1.327 retrieving revision 1.328 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.327 -r1.328 --- mdoc_html.c +++ mdoc_html.c @@ -531,8 +531,10 @@ mdoc_sh_pre(MDOC_ARGS) html_close_paragraph(h); if ((h->oflags & HTML_TOC) == 0 || h->flags & HTML_TOCDONE || - n->sec <= SEC_SYNOPSIS) + n->sec <= SEC_SYNOPSIS) { + print_otag(h, TAG_SECTION, "c", "Sh"); break; + } h->flags |= HTML_TOCDONE; sc = 0; for (sn = n->next; sn != NULL; sn = sn->next) @@ -573,6 +575,7 @@ mdoc_sh_pre(MDOC_ARGS) print_tagq(h, tsec); } print_tagq(h, t); + print_otag(h, TAG_SECTION, "c", "Sh"); break; case ROFFT_HEAD: id = html_make_id(n, 1); @@ -598,6 +601,7 @@ mdoc_ss_pre(MDOC_ARGS) switch (n->type) { case ROFFT_BLOCK: html_close_paragraph(h); + print_otag(h, TAG_SECTION, "c", "Ss"); return 1; case ROFFT_HEAD: break; Index: html.h =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.h,v retrieving revision 1.101 retrieving revision 1.102 diff -Lhtml.h -Lhtml.h -u -p -r1.101 -r1.102 --- html.h +++ html.h @@ -24,6 +24,7 @@ enum htmltag { TAG_TITLE, TAG_DIV, TAG_IDIV, + TAG_SECTION, TAG_H1, TAG_H2, TAG_SPAN, Index: TODO =================================================================== RCS file: /home/cvs/mandoc/mandoc/TODO,v retrieving revision 1.284 retrieving revision 1.285 diff -LTODO -LTODO -u -p -r1.284 -r1.285 --- TODO +++ TODO @@ -342,13 +342,6 @@ are mere guesses, and some may be wrong. --- HTML issues -------------------------------------------------------- -- wrap Sh and Ss content into
- Laura Morales 21 Apr 2018 18:10:48 +0200 - (Evaluate whether this is really useful and has no adverse - side effects before implementing; if it is possible, - it does seem cleaner.) - loc ** exist ** algo * size * imp *** - - format ".IP *" etc. as
    rather than
    https://github.com/Debian/debiman/issues/67 reminded by Pali Rohar 25 Nov 2018 14:34:26 +0100 Index: mandoc.css =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v retrieving revision 1.44 retrieving revision 1.45 diff -Lmandoc.css -Lmandoc.css -u -p -r1.44 -r1.45 --- mandoc.css +++ mandoc.css @@ -66,11 +66,13 @@ td.foot-os { text-align: right; } .manual-text { margin-left: 3.8em; } .Nd { } -.Sh { margin-top: 1.2em; +section.Sh { } +h1.Sh { margin-top: 1.2em; margin-bottom: 0.6em; margin-left: -3.2em; font-size: 110%; } -.Ss { margin-top: 1.2em; +section.Ss { } +h2.Ss { margin-top: 1.2em; margin-bottom: 0.6em; margin-left: -1.2em; font-size: 105%; } @@ -256,7 +258,7 @@ a.In { } /* Tooltip support. */ -.Sh, .Ss { position: relative; } +h1.Sh, h2.Ss { position: relative; } .An, .Ar, .Cd, .Cm, .Dv, .Em, .Er, .Ev, .Fa, .Fd, .Fl, .Fn, .Ft, .Ic, code.In, .Lb, .Lk, .Ms, .Mt, .Nd, code.Nm, .Pa, .Rs, .St, .Sx, .Sy, .Va, .Vt, .Xr { @@ -286,8 +288,8 @@ code.In::before { content: "In"; } code.Nm::before { content: "Nm"; } .Pa::before { content: "Pa"; } .Rs::before { content: "Rs"; } -.Sh::before { content: "Sh"; } -.Ss::before { content: "Ss"; } +h1.Sh::before { content: "Sh"; } +h2.Ss::before { content: "Ss"; } .St::before { content: "St"; } .Sx::before { content: "Sx"; } .Sy::before { content: "Sy"; } @@ -301,7 +303,7 @@ code.Nm::before { content: "Nm"; } .Ic::before, code.In::before, .Lb::before, .Lk::before, .Ms::before, .Mt::before, .Nd::before, code.Nm::before, .Pa::before, .Rs::before, -.Sh::before, .Ss::before, .St::before, .Sx::before, .Sy::before, +h1.Sh::before, h2.Ss::before, .St::before, .Sx::before, .Sy::before, .Va::before, .Vt::before, .Xr::before { opacity: 0; transition: .15s ease opacity; @@ -322,7 +324,7 @@ code.Nm::before { content: "Nm"; } .Ft:hover::before, .Ic:hover::before, code.In:hover::before, .Lb:hover::before, .Lk:hover::before, .Ms:hover::before, .Mt:hover::before, .Nd:hover::before, code.Nm:hover::before, .Pa:hover::before, -.Rs:hover::before, .Sh:hover::before, .Ss:hover::before, .St:hover::before, +.Rs:hover::before, h1.Sh:hover::before, h2.Ss:hover::before, .St:hover::before, .Sx:hover::before, .Sy:hover::before, .Va:hover::before, .Vt:hover::before, .Xr:hover::before { opacity: 1; @@ -333,7 +335,7 @@ code.Nm::before { content: "Nm"; } @media (max-width: 37.5em) { .manual-text { margin-left: 0.5em; } -.Sh, .Ss { margin-left: 0em; } +h1.Sh, h2.Ss { margin-left: 0em; } .Bd-indent { margin-left: 2em; } .Bl-hang > dd { margin-left: 2em; } Index: man_html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/man_html.c,v retrieving revision 1.171 retrieving revision 1.172 diff -Lman_html.c -Lman_html.c -u -p -r1.171 -r1.172 --- man_html.c +++ man_html.c @@ -310,18 +310,25 @@ man_root_post(const struct roff_meta *ma static int man_SH_pre(MAN_ARGS) { - char *id; + const char *class; + char *id; + enum htmltag tag; + if (n->tok == MAN_SH) { + tag = TAG_H1; + class = "Sh"; + } else { + tag = TAG_H2; + class = "Ss"; + } switch (n->type) { case ROFFT_BLOCK: html_close_paragraph(h); + print_otag(h, TAG_SECTION, "c", class); break; case ROFFT_HEAD: id = html_make_id(n, 1); - if (n->tok == MAN_SH) - print_otag(h, TAG_H1, "ci", "Sh", id); - else - print_otag(h, TAG_H2, "ci", "Ss", id); + print_otag(h, tag, "ci", class, id); if (id != NULL) print_otag(h, TAG_A, "chR", "permalink", id); break; Index: html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.c,v retrieving revision 1.252 retrieving revision 1.253 diff -Lhtml.c -Lhtml.c -u -p -r1.252 -r1.253 --- html.c +++ html.c @@ -63,6 +63,7 @@ static const struct htmldata htmltags[TA {"title", HTML_NLAROUND}, {"div", HTML_NLAROUND}, {"div", 0}, + {"section", HTML_NLALL}, {"h1", HTML_NLAROUND}, {"h2", HTML_NLAROUND}, {"span", 0}, Index: literal.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/IP/literal.out_html,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/IP/literal.out_html -Lregress/man/IP/literal.out_html -u -p -r1.2 -r1.3 --- regress/man/IP/literal.out_html +++ regress/man/IP/literal.out_html @@ -24,6 +24,7 @@ literal paragraph regular text +

    regular text @@ -42,6 +43,8 @@ text indented regular text

    new regular paragraph

    +
+

regular text Index: paragraph.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/SH/paragraph.out_html,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/SH/paragraph.out_html -Lregress/man/SH/paragraph.out_html -u -p -r1.2 -r1.3 --- regress/man/SH/paragraph.out_html +++ regress/man/SH/paragraph.out_html @@ -1,6 +1,10 @@ BEGINTEST +
+

This text immediately follows a section header.

This is a paragraph.

+
+

ENDTEST Index: paragraph.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/man/SS/paragraph.out_html,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/man/SS/paragraph.out_html -Lregress/man/SS/paragraph.out_html -u -p -r1.2 -r1.3 --- regress/man/SS/paragraph.out_html +++ regress/man/SS/paragraph.out_html @@ -1,8 +1,11 @@ BEGINTEST +

This text immediately follows a subsection header.

This is a paragraph.

+
+

ENDTEST Index: paragraph.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Sh/paragraph.out_html,v retrieving revision 1.2 retrieving revision 1.3 diff -Lregress/mdoc/Sh/paragraph.out_html -Lregress/mdoc/Sh/paragraph.out_html -u -p -r1.2 -r1.3 --- regress/mdoc/Sh/paragraph.out_html +++ regress/mdoc/Sh/paragraph.out_html @@ -1,7 +1,11 @@ BEGINTEST

descriptive text

+

initial subsection text

subsection paragraph

+
+
+

ENDTEST Index: badargs.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/roff/ft/badargs.out_html,v retrieving revision 1.1 retrieving revision 1.2 diff -Lregress/roff/ft/badargs.out_html -Lregress/roff/ft/badargs.out_html -u -p -r1.1 -r1.2 --- regress/roff/ft/badargs.out_html +++ regress/roff/ft/badargs.out_html @@ -6,4 +6,4 @@ default font italic italic bold still bold italic back to bold back to italic
-ENDTEST +ENDTEST -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv