* mdocml: Use a single P tag for paragraph breaks (which can be configured
@ 2010-12-15 17:19 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-12-15 17:19 UTC (permalink / raw)
To: source
Log Message:
-----------
Use a single P tag for paragraph breaks (which can be configured for
paragraph breaking in CSS).
Use -man's handling of `sp' and `br', which accomodates for scaling
widths (-mdoc wasn't).
Modified Files:
--------------
mdocml:
html.c
html.h
man_html.c
mdoc_html.c
Revision Data
-------------
Index: html.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -Lhtml.h -Lhtml.h -u -p -r1.29 -r1.30
--- html.h
+++ html.h
@@ -44,6 +44,7 @@ enum htmltag {
TAG_DT,
TAG_DD,
TAG_BLOCKQUOTE,
+ TAG_P,
TAG_MAX
};
Index: man_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lman_html.c -Lman_html.c -u -p -r1.52 -r1.53
--- man_html.c
+++ man_html.c
@@ -141,20 +141,13 @@ static void
print_man(MAN_ARGS)
{
struct tag *t;
- struct htmlpair tag;
t = print_otag(h, TAG_HEAD, 0, NULL);
-
print_man_head(m, n, mh, h);
print_tagq(h, t);
- t = print_otag(h, TAG_BODY, 0, NULL);
-
- tag.key = ATTR_CLASS;
- tag.val = "body";
- print_otag(h, TAG_DIV, 1, &tag);
+ t = print_otag(h, TAG_BODY, 0, NULL);
print_man_nodelist(m, n, mh, h);
-
print_tagq(h, t);
}
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -Lhtml.c -Lhtml.c -u -p -r1.115 -r1.116
--- html.c
+++ html.c
@@ -68,6 +68,7 @@ static const struct htmldata htmltags[TA
{"dt", HTML_CLRLINE}, /* TAG_DT */
{"dd", HTML_CLRLINE}, /* TAG_DD */
{"blockquote", HTML_CLRLINE}, /* TAG_BLOCKQUOTE */
+ {"p", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */
};
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.119
retrieving revision 1.120
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.119 -r1.120
--- mdoc_html.c
+++ mdoc_html.c
@@ -103,6 +103,7 @@ static int mdoc_nm_pre(MDOC_ARGS);
static int mdoc_ns_pre(MDOC_ARGS);
static int mdoc_pa_pre(MDOC_ARGS);
static void mdoc_pf_post(MDOC_ARGS);
+static int mdoc_pp_pre(MDOC_ARGS);
static void mdoc_quote_post(MDOC_ARGS);
static int mdoc_quote_pre(MDOC_ARGS);
static int mdoc_rs_pre(MDOC_ARGS);
@@ -126,7 +127,7 @@ static const struct htmlmdoc mdocs[MDOC_
{NULL, NULL}, /* Os */
{mdoc_sh_pre, NULL }, /* Sh */
{mdoc_ss_pre, NULL }, /* Ss */
- {mdoc_sp_pre, NULL}, /* Pp */
+ {mdoc_pp_pre, NULL}, /* Pp */
{mdoc_d1_pre, NULL}, /* D1 */
{mdoc_d1_pre, NULL}, /* Dl */
{mdoc_bd_pre, NULL}, /* Bd */
@@ -227,7 +228,7 @@ static const struct htmlmdoc mdocs[MDOC_
{NULL, NULL}, /* Fr */
{mdoc_ud_pre, NULL}, /* Ud */
{mdoc_lb_pre, NULL}, /* Lb */
- {mdoc_sp_pre, NULL}, /* Lp */
+ {mdoc_pp_pre, NULL}, /* Lp */
{mdoc_lk_pre, NULL}, /* Lk */
{mdoc_mt_pre, NULL}, /* Mt */
{mdoc_quote_pre, mdoc_quote_post}, /* Brq */
@@ -1132,12 +1133,15 @@ mdoc_d1_pre(MDOC_ARGS)
bufcat_su(h, "margin-top", &su);
bufcat_su(h, "margin-bottom", &su);
PAIR_STYLE_INIT(&tag[0], h);
+ print_otag(h, TAG_BLOCKQUOTE, 1, tag);
+
+ /* BLOCKQUOTE needs a block body. */
if (MDOC_Dl == n->tok) {
PAIR_CLASS_INIT(&tag[1], "lit");
- print_otag(h, TAG_BLOCKQUOTE, 2, tag);
+ print_otag(h, TAG_DIV, 1, tag);
} else
- print_otag(h, TAG_BLOCKQUOTE, 1, tag);
+ print_otag(h, TAG_DIV, 0, tag);
return(1);
}
@@ -1533,37 +1537,40 @@ mdoc_sm_pre(MDOC_ARGS)
return(0);
}
+/* ARGSUSED */
+static int
+mdoc_pp_pre(MDOC_ARGS)
+{
+
+ if ((NULL == n->next || NULL == n->prev) &&
+ (MDOC_Ss == n->parent->tok ||
+ MDOC_Sh == n->parent->tok))
+ return(0);
+
+ print_otag(h, TAG_P, 0, NULL);
+ return(0);
+
+}
/* ARGSUSED */
static int
mdoc_sp_pre(MDOC_ARGS)
{
- int len;
- struct htmlpair tag;
struct roffsu su;
+ struct htmlpair tag;
- switch (n->tok) {
- case (MDOC_sp):
- /* FIXME: can this have a scaling indicator? */
- len = n->child ? atoi(n->child->string) : 1;
- break;
- case (MDOC_br):
- len = 0;
- break;
- default:
- assert(n->parent);
- if ((NULL == n->next || NULL == n->prev) &&
- (MDOC_Ss == n->parent->tok ||
- MDOC_Sh == n->parent->tok))
- return(0);
- len = 1;
- break;
- }
+ SCALE_VS_INIT(&su, 1);
+
+ if (MDOC_sp == n->tok) {
+ if (n->child)
+ a2roffsu(n->child->string, &su, SCALE_VS);
+ } else
+ su.scale = 0;
- SCALE_VS_INIT(&su, len);
bufcat_su(h, "height", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);
+
/* So the div isn't empty: */
print_text(h, "\\~");
@@ -1571,7 +1578,6 @@ mdoc_sp_pre(MDOC_ARGS)
}
-
/* ARGSUSED */
static int
mdoc_lk_pre(MDOC_ARGS)
@@ -1858,10 +1864,8 @@ mdoc_rs_pre(MDOC_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
- if (n->prev && SEC_SEE_ALSO == n->sec) {
- print_otag(h, TAG_BR, 0, NULL);
- print_otag(h, TAG_BR, 0, NULL);
- }
+ if (n->prev && SEC_SEE_ALSO == n->sec)
+ print_otag(h, TAG_P, 0, NULL);
PAIR_CLASS_INIT(&tag, "ref");
print_otag(h, TAG_SPAN, 1, &tag);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-15 17:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 17:19 mdocml: Use a single P tag for paragraph breaks (which can be configured kristaps
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).