From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=LOTS_OF_MONEY, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: from mandoc.bsd.lv (bsd.lv [66.111.2.12]) by inbox.vuxu.org (Postfix) with ESMTP id D37AD200D1 for ; Sat, 25 Jan 2025 00:36:25 +0100 (CET) Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id d6199879 for ; Fri, 24 Jan 2025 23:36:24 +0000 (UTC) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 91d61bdb for ; Fri, 24 Jan 2025 23:36:24 +0000 (UTC) Date: Fri, 24 Jan 2025 23:36:24 +0000 (UTC) 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: Formatting of the .%T (title) macro needs some logic to adhere X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: <12bbce5847bb14f9@mandoc.bsd.lv> Log Message: ----------- Formatting of the .%T (title) macro needs some logic to adhere to traditional typographic conventions that are already implemented for terminal output: set titles of independent works (like books or RFCs) in italic and of parts of larger works (like journal articles) in quotation marks and roman font. Do that in HTML output, too. OK job@ (without the regress parts), and tb@ appears to agree with the general direction Modified Files: -------------- mandoc: mandoc.css mdoc_html.c mandoc/regress/mdoc/Rs: Makefile rfc.out_html Added Files: ----------- mandoc/regress/mdoc/Rs: journal.in journal.out_ascii journal.out_html journal.out_markdown outside.in outside.out_ascii outside.out_html outside.out_markdown Revision Data ------------- Index: mdoc_html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.351 -r1.352 --- mdoc_html.c +++ mdoc_html.c @@ -1555,7 +1555,13 @@ mdoc__x_pre(MDOC_ARGS) cattr = "RsR"; break; case MDOC__T: - cattr = "RsT"; + if (n->parent != NULL && n->parent->tok == MDOC_Rs && + n->parent->norm->Rs.quote_T) { + print_text(h, "\\(lq"); + h->flags |= HTML_NOSPACE; + cattr = "RsT"; + } else + cattr = "RsB"; break; case MDOC__U: print_otag(h, TAG_A, "ch", "RsU", arg); @@ -1576,14 +1582,23 @@ mdoc__x_post(MDOC_ARGS) { struct roff_node *nn; - if (n->tok == MDOC__A && - (nn = roff_node_next(n)) != NULL && nn->tok == MDOC__A && - ((nn = roff_node_next(nn)) == NULL || nn->tok != MDOC__A) && - ((nn = roff_node_prev(n)) == NULL || nn->tok != MDOC__A)) - return; - - /* TODO: %U */ - + switch (n->tok) { + case MDOC__A: + if ((nn = roff_node_next(n)) != NULL && nn->tok == MDOC__A && + ((nn = roff_node_next(nn)) == NULL || nn->tok != MDOC__A) && + ((nn = roff_node_prev(n)) == NULL || nn->tok != MDOC__A)) + return; + break; + case MDOC__T: + if (n->parent != NULL && n->parent->tok == MDOC_Rs && + n->parent->norm->Rs.quote_T) { + h->flags |= HTML_NOSPACE; + print_text(h, "\\(rq"); + } + break; + default: + break; + } if (n->parent == NULL || n->parent->tok != MDOC_Rs) return; Index: mandoc.css =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v diff -Lmandoc.css -Lmandoc.css -u -p -r1.52 -r1.53 --- mandoc.css +++ mandoc.css @@ -179,7 +179,7 @@ h3.Ss { margin-top: 1.2em; .RsP { } .RsQ { } .RsR { } -.RsT { text-decoration: underline; } +.RsT { } .RsU { } .RsV { } Index: Makefile =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Rs/Makefile,v diff -Lregress/mdoc/Rs/Makefile -Lregress/mdoc/Rs/Makefile -u -p -r1.7 -r1.8 --- regress/mdoc/Rs/Makefile +++ regress/mdoc/Rs/Makefile @@ -1,9 +1,10 @@ -# $OpenBSD: Makefile,v 1.13 2025/01/19 23:01:27 schwarze Exp $ +# $OpenBSD: Makefile,v 1.14 2025/01/24 23:22:13 schwarze Exp $ -REGRESS_TARGETS = allch args break empty paragraph three_authors rfc transp +REGRESS_TARGETS = allch args break empty journal outside paragraph +REGRESS_TARGETS += rfc three_authors transp UTF8_TARGETS = allch break empty three_authors LINT_TARGETS = allch args empty -HTML_TARGETS = paragraph rfc +HTML_TARGETS = journal outside paragraph rfc # groff-1.22.3 defect: # - arguments after .Rs cause the macro to be ignored --- /dev/null +++ regress/mdoc/Rs/journal.out_markdown @@ -0,0 +1,21 @@ +RS-JOURNAL(1) - General Commands Manual + +# NAME + +**Rs-journal** - reference to a journal article + +# DESCRIPTION + +BEGINTEST + +Brian W. Kernighan, +Lorinda L. Cherry, +"System for Typesetting Mathematics", +*Communications of the ACM*, +18, +pp. 151–157, +March 1975. + +ENDTEST + +OpenBSD - January 24, 2025 Index: rfc.out_html =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/mdoc/Rs/rfc.out_html,v diff -Lregress/mdoc/Rs/rfc.out_html -Lregress/mdoc/Rs/rfc.out_html -u -p -r1.1 -r1.2 --- regress/mdoc/Rs/rfc.out_html +++ regress/mdoc/Rs/rfc.out_html @@ -1,5 +1,5 @@

David Waitzman, - A Standard for the Transmission of IP Datagrams on Avian + A Standard for the Transmission of IP Datagrams on Avian Carriers, RFC 1149, April 1990.

--- /dev/null +++ regress/mdoc/Rs/outside.out_html @@ -0,0 +1,4 @@ +

Some percent-macros can be used outside reference blocks. For + example, let's study The Book of PF and relax reading + A Standard for the Transmission of IP Datagrams on Avian + Carriers afterwards.

--- /dev/null +++ regress/mdoc/Rs/journal.out_ascii @@ -0,0 +1,14 @@ +RS-JOURNAL(1) General Commands Manual RS-JOURNAL(1) + +NNAAMMEE + RRss--jjoouurrnnaall - reference to a journal article + +DDEESSCCRRIIPPTTIIOONN + BEGINTEST + + Brian W. Kernighan and Lorinda L. Cherry, "System for Typesetting + Mathematics", _C_o_m_m_u_n_i_c_a_t_i_o_n_s _o_f _t_h_e _A_C_M, 18, pp. 151-157, March 1975. + + ENDTEST + +OpenBSD January 24, 2025 OpenBSD --- /dev/null +++ regress/mdoc/Rs/outside.in @@ -0,0 +1,18 @@ +.\" $OpenBSD: outside.in,v 1.1 2025/01/24 23:22:13 schwarze Exp $ +.Dd $Mdocdate: January 24 2025 $ +.Dt RS-OUTSIDE 1 +.Os +.Sh NAME +.Nm Rs-outside +.Nd reference macros outside reference blocks +.Sh DESCRIPTION +BEGINTEST +.Pp +Some percent-macros can be used outside reference blocks. +For example, let's study +.%B The Book of PF +and relax reading +.%T A Standard for the Transmission of IP Datagrams on Avian Carriers +afterwards. +.Pp +ENDTEST --- /dev/null +++ regress/mdoc/Rs/journal.out_html @@ -0,0 +1,5 @@ +

Brian W. Kernighan and + Lorinda L. Cherry, “System + for Typesetting Mathematics”, Communications of + the ACM, 18, pp. + 151–157, March 1975.

--- /dev/null +++ regress/mdoc/Rs/outside.out_ascii @@ -0,0 +1,15 @@ +RS-OUTSIDE(1) General Commands Manual RS-OUTSIDE(1) + +NNAAMMEE + RRss--oouuttssiiddee - reference macros outside reference blocks + +DDEESSCCRRIIPPTTIIOONN + BEGINTEST + + Some percent-macros can be used outside reference blocks. For example, + let's study _T_h_e _B_o_o_k _o_f _P_F and relax reading _A _S_t_a_n_d_a_r_d _f_o_r _t_h_e + _T_r_a_n_s_m_i_s_s_i_o_n _o_f _I_P _D_a_t_a_g_r_a_m_s _o_n _A_v_i_a_n _C_a_r_r_i_e_r_s afterwards. + + ENDTEST + +OpenBSD January 24, 2025 OpenBSD --- /dev/null +++ regress/mdoc/Rs/journal.in @@ -0,0 +1,21 @@ +.\" $OpenBSD: journal.in,v 1.1 2025/01/24 23:22:13 schwarze Exp $ +.Dd $Mdocdate: January 24 2025 $ +.Dt RS-JOURNAL 1 +.Os +.Sh NAME +.Nm Rs-journal +.Nd reference to a journal article +.Sh DESCRIPTION +BEGINTEST +.Pp +.Rs +.%A Brian W. Kernighan +.%A Lorinda L. Cherry +.%T System for Typesetting Mathematics +.%J Communications of the ACM +.%V 18 +.%P pp. 151\(en157 +.%D March 1975 +.Re +.Pp +ENDTEST --- /dev/null +++ regress/mdoc/Rs/outside.out_markdown @@ -0,0 +1,20 @@ +RS-OUTSIDE(1) - General Commands Manual + +# NAME + +**Rs-outside** - reference macros outside reference blocks + +# DESCRIPTION + +BEGINTEST + +Some percent-macros can be used outside reference blocks. +For example, let's study +*The Book of PF* +and relax reading +*A Standard for the Transmission of IP Datagrams on Avian Carriers* +afterwards. + +ENDTEST + +OpenBSD - January 24, 2025 -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv