From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id oBHAbRbN011509 for ; Fri, 17 Dec 2010 05:37:27 -0500 (EST) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id oBHAbRlw006280; Fri, 17 Dec 2010 05:37:27 -0500 (EST) Date: Fri, 17 Dec 2010 05:37:27 -0500 (EST) Message-Id: <201012171037.oBHAbRlw006280@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Make literal `Bd' use a PRE in -Thtml. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Make literal `Bd' use a PRE in -Thtml. Make `Bd' output in general use only a single DIV or PRE. Tag all displays with display class. Modified Files: -------------- mdocml: example.style.css html.c html.h mdoc_html.c Revision Data ------------- Index: html.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.h,v retrieving revision 1.30 retrieving revision 1.31 diff -Lhtml.h -Lhtml.h -u -p -r1.30 -r1.31 --- html.h +++ html.h @@ -45,6 +45,7 @@ enum htmltag { TAG_DD, TAG_BLOCKQUOTE, TAG_P, + TAG_PRE, TAG_MAX }; Index: html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v retrieving revision 1.117 retrieving revision 1.118 diff -Lhtml.c -Lhtml.c -u -p -r1.117 -r1.118 --- html.c +++ html.c @@ -69,6 +69,7 @@ static const struct htmldata htmltags[TA {"dd", HTML_CLRLINE}, /* TAG_DD */ {"blockquote", HTML_CLRLINE}, /* TAG_BLOCKQUOTE */ {"p", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */ + {"pre", HTML_CLRLINE }, /* TAG_PRE */ }; static const char *const htmlfonts[HTMLFONT_MAX] = { Index: mdoc_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v retrieving revision 1.125 retrieving revision 1.126 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.125 -r1.126 --- mdoc_html.c +++ mdoc_html.c @@ -1059,10 +1059,11 @@ mdoc_d1_pre(MDOC_ARGS) /* BLOCKQUOTE needs a block body. */ if (MDOC_Dl == n->tok) { - PAIR_CLASS_INIT(&tag[1], "lit"); + PAIR_CLASS_INIT(&tag[0], "lit display"); print_otag(h, TAG_DIV, 1, tag); } else - print_otag(h, TAG_DIV, 0, tag); + PAIR_CLASS_INIT(&tag[0], "display"); + print_otag(h, TAG_DIV, 1, tag); return(1); } @@ -1103,19 +1104,8 @@ mdoc_bd_pre(MDOC_ARGS) if (MDOC_HEAD == n->type) return(0); - SCALE_VS_INIT(&su, 0); - - assert(n->data.Bd); - if (n->data.Bd->offs) - a2offs(n->data.Bd->offs, &su); - - comp = n->data.Bd->comp; - - /* FIXME: -centered, etc. formatting. */ - /* FIXME: does not respect -offset ??? */ - if (MDOC_BLOCK == n->type) { - bufcat_su(h, "margin-left", &su); + comp = n->data.Bd->comp; for (nn = n; nn && ! comp; nn = nn->parent) { if (MDOC_BLOCK != nn->type) continue; @@ -1124,26 +1114,27 @@ mdoc_bd_pre(MDOC_ARGS) if (nn->prev) break; } - if (comp) { - PAIR_STYLE_INIT(&tag[0], h); - print_otag(h, TAG_DIV, 1, tag); - return(1); - } - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-top", &su); - PAIR_STYLE_INIT(&tag[0], h); - print_otag(h, TAG_DIV, 1, tag); + if ( ! comp) + print_otag(h, TAG_P, 0, NULL); return(1); } + SCALE_HS_INIT(&su, 0); + if (n->data.Bd->offs) + a2offs(n->data.Bd->offs, &su); + + bufcat_su(h, "margin-left", &su); + PAIR_STYLE_INIT(&tag[0], h); + if (DISP_unfilled != n->data.Bd->type && - DISP_literal != n->data.Bd->type) + DISP_literal != n->data.Bd->type) { + PAIR_CLASS_INIT(&tag[1], "display"); + print_otag(h, TAG_DIV, 2, tag); return(1); + } - PAIR_CLASS_INIT(&tag[0], "lit"); - bufcat_style(h, "white-space", "pre"); - PAIR_STYLE_INIT(&tag[1], h); - print_otag(h, TAG_DIV, 2, tag); + PAIR_CLASS_INIT(&tag[1], "lit display"); + print_otag(h, TAG_PRE, 2, tag); for (nn = n->child; nn; nn = nn->next) { print_mdoc_node(m, nn, h); @@ -1175,8 +1166,9 @@ mdoc_bd_pre(MDOC_ARGS) } if (nn->next && nn->next->line == nn->line) continue; + else if (nn->next) + print_text(h, "\n"); - print_text(h, "\n"); h->flags |= HTML_NOSPACE; } Index: example.style.css =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/example.style.css,v retrieving revision 1.31 retrieving revision 1.32 diff -Lexample.style.css -Lexample.style.css -u -p -r1.31 -r1.32 --- example.style.css +++ example.style.css @@ -38,6 +38,10 @@ table { margin-top: 0px; margin-bottom: .roman { font-style: normal; font-weight: normal; } /* Roman: (implicit). */ .small { font-style: normal; font-weight: normal; font-size: smaller; } /* Small: SB, SM. */ +/* Block modes. */ + +.display { } + /* Context-specific modes. */ span.addr { font-style: italic; font-weight: normal; } /* Address (Ad). */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv