diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-10-28 08:00:17 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-10-28 08:00:17 +0000 |
commit | b54610ec3ea88d830ee9843b468ad8f396ef41ab (patch) | |
tree | 28cdc0bcf547a7b145eb264cc0c9a4b02919a747 | |
parent | 727efc61ff79f9a152dc0ec1ff6aae25907a32fb (diff) | |
download | mandoc-b54610ec3ea88d830ee9843b468ad8f396ef41ab.tar.gz |
Fixed `sp', `br', `Pp', etc. so as not to have an empty div (-Thtml, -man, -mdoc).
Made html_idcat be completely correct (messy standard) (-Thtml).
Fixed warnings about -ohang and -item lists (-Thtml, -mdoc).
Fixed typo in index.sgml.
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | html.c | 44 | ||||
-rw-r--r-- | html.h | 1 | ||||
-rw-r--r-- | index.sgml | 2 | ||||
-rw-r--r-- | man_html.c | 3 | ||||
-rw-r--r-- | mdoc_html.c | 19 |
6 files changed, 31 insertions, 43 deletions
@@ -88,6 +88,9 @@ clean: cleanlint: rm -f $(LNS) $(LLNS) +cleanhtml: + rm -f $(HTML) $(GSGMLS) + dist: mdocml-$(VERSION).tar.gz www: all $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS) @@ -232,7 +235,7 @@ mandoc: $(MAINOBJS) libmdoc.a libman.a $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a .sgml.html: - #validate $< + validate $< sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@ .1.1.txt .3.3.txt .7.7.txt: @@ -651,46 +651,28 @@ bufcat_su(struct html *h, const char *p, const struct roffsu *su) void -html_idcpy(char *dst, const char *src, int sz) +html_idcat(char *dst, const char *src, int sz) { + int ssz; assert(sz); - dst[0] = '\0'; - html_idcat(dst, src, sz); -} - - -void -html_idcat(char *dst, const char *src, int sz) -{ - int i; /* Cf. <http://www.w3.org/TR/html4/types.html#h-6.2>. */ - for (i = 0; *dst != '\0' && i < sz - 1; dst++, i++) + for ( ; *dst != '\0' && sz; dst++, sz--) /* Jump to end. */ ; - for ( ; *src != '\0' && i < sz - 1; src++, i++, dst++) { - if (isalnum((u_char)*src)) { - *dst = *src; - continue; - } + assert(sz > 2); - switch (*src) { - case (';'): - *dst = ';'; - break; - case ('-'): - *dst = '-'; - break; - case (':'): - *dst = ':'; - break; - default: - *dst = '_'; - break; - } - } + /* We can't start with a number (bah). */ + *dst++ = 'x'; *dst = '\0'; + sz--; + + for ( ; *src != '\0' && sz > 1; src++) { + ssz = snprintf(dst, sz, "%.2x", *src); + sz -= ssz; + dst += ssz; + } } @@ -137,7 +137,6 @@ void bufncat(struct html *, const char *, size_t); void bufinit(struct html *); void html_idcat(char *, const char *, int); -void html_idcpy(char *, const char *, int); __END_DECLS @@ -101,7 +101,7 @@ <td>NetBSD</td> <td> <a href="http://cvsweb.netbsd.org/bsdweb.cgi/src/external/bsd/mdocml/" - class="external">src/external/bsd/mdocml<a/> + class="external">src/external/bsd/mdocml</a> </td> </tr> <tr> @@ -334,6 +334,9 @@ man_br_pre(MAN_ARGS) 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, "\\~"); + return(0); } diff --git a/mdoc_html.c b/mdoc_html.c index 1fcddd27..fb174758 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -583,11 +583,11 @@ mdoc_sh_pre(MDOC_ARGS) return(1); } - html_idcpy(buf, "id_", BUFSIZ); + buf[0] = '\0'; for (nn = n->child; nn; nn = nn->next) { html_idcat(buf, nn->string, BUFSIZ); if (nn->next) - html_idcat(buf, "_", BUFSIZ); + html_idcat(buf, " ", BUFSIZ); } /* @@ -636,11 +636,11 @@ mdoc_ss_pre(MDOC_ARGS) /* TODO: see note in mdoc_sh_pre() about duplicates. */ - html_idcpy(buf, "id_", BUFSIZ); + buf[0] = '\0'; for (nn = n->child; nn; nn = nn->next) { html_idcat(buf, nn->string, BUFSIZ); if (nn->next) - html_idcat(buf, "_", BUFSIZ); + html_idcat(buf, " ", BUFSIZ); } SCALE_HS_INIT(&su, INDENT - HALFINDENT); @@ -954,8 +954,7 @@ mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *width) case (MDOC_Item): /* FALLTHROUGH */ case (MDOC_Ohang): - print_otag(h, TAG_DIV, 0, NULL); - break; + return(0); case (MDOC_Column): bufcat_su(h, "min-width", width); bufcat_style(h, "clear", "none"); @@ -1298,11 +1297,10 @@ mdoc_sx_pre(MDOC_ARGS) /* FIXME: duplicates? */ strlcpy(buf, "#", BUFSIZ); - html_idcat(buf, "id_", BUFSIZ); for (nn = n->child; nn; nn = nn->next) { html_idcat(buf, nn->string, BUFSIZ); if (nn->next) - html_idcat(buf, "_", BUFSIZ); + html_idcat(buf, " ", BUFSIZ); } PAIR_CLASS_INIT(&tag[0], "link-sec"); @@ -1719,7 +1717,10 @@ mdoc_sp_pre(MDOC_ARGS) bufcat_su(h, "height", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); - return(1); + /* So the div isn't empty: */ + print_text(h, "\\~"); + + return(0); } |