summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-28 08:00:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-28 08:00:17 +0000
commit3211a3293d4f68feb48e68fc3014d6831c1b44e3 (patch)
treef6bb6ebeda945d354143c9f47fe7839393a6c792
parentcdff20f6d7e19ed09c4c123178ff9c16bdef9aa9 (diff)
downloadmandoc-3211a3293d4f68feb48e68fc3014d6831c1b44e3.tar.gz
mandoc-3211a3293d4f68feb48e68fc3014d6831c1b44e3.tar.zst
mandoc-3211a3293d4f68feb48e68fc3014d6831c1b44e3.zip
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--Makefile5
-rw-r--r--html.c46
-rw-r--r--html.h3
-rw-r--r--index.sgml4
-rw-r--r--man_html.c5
-rw-r--r--mdoc_html.c21
6 files changed, 36 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index 981f8fe5..f2a75b79 100644
--- a/Makefile
+++ b/Makefile
@@ -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:
diff --git a/html.c b/html.c
index 5fbf7006..c14d97d5 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.69 2009/10/28 06:54:12 kristaps Exp $ */
+/* $Id: html.c,v 1.70 2009/10/28 08:00:18 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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;
+ }
}
diff --git a/html.h b/html.h
index 3775edb9..fd3939d0 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.16 2009/10/28 05:08:17 kristaps Exp $ */
+/* $Id: html.h,v 1.17 2009/10/28 08:00:18 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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
diff --git a/index.sgml b/index.sgml
index 9e636a64..4189c406 100644
--- a/index.sgml
+++ b/index.sgml
@@ -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>
@@ -201,7 +201,7 @@
<tr>
<td>
<div class="foot">
- Copyright &#169; 2008, 2009 Kristaps D&#382;onsons, $Date: 2009/10/22 03:35:35 $
+ Copyright &#169; 2008, 2009 Kristaps D&#382;onsons, $Date: 2009/10/28 08:00:18 $
</div>
</td>
</tr>
diff --git a/man_html.c b/man_html.c
index 4dda39df..8402ec37 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.15 2009/10/27 04:50:15 kristaps Exp $ */
+/* $Id: man_html.c,v 1.16 2009/10/28 08:00:18 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 65f78ea6..5a314fa1 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.41 2009/10/28 05:08:17 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.42 2009/10/28 08:00:18 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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);
}