summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--html.c39
-rw-r--r--mandoc_html.38
2 files changed, 32 insertions, 15 deletions
diff --git a/html.c b/html.c
index 715d0dd1..0b6aa189 100644
--- a/html.c
+++ b/html.c
@@ -523,7 +523,7 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
struct tag *t;
const char *attr;
char *arg1, *arg2;
- int tflags;
+ int style_written, tflags;
tflags = htmltags[tag].flags;
@@ -563,7 +563,7 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
va_start(ap, fmt);
- while (*fmt != '\0') {
+ while (*fmt != '\0' && *fmt != 's') {
/* Parse attributes and arguments. */
@@ -579,10 +579,6 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
case 'i':
attr = "id";
break;
- case 's':
- attr = "style";
- arg2 = va_arg(ap, char *);
- break;
case '?':
attr = arg1;
arg1 = va_arg(ap, char *);
@@ -622,19 +618,32 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
fmt++;
break;
default:
- if (arg2 == NULL)
- print_encode(h, arg1, NULL, 1);
- else {
- print_word(h, arg1);
- print_byte(h, ':');
- print_byte(h, ' ');
- print_word(h, arg2);
- print_byte(h, ';');
- }
+ print_encode(h, arg1, NULL, 1);
break;
}
print_byte(h, '"');
}
+
+ style_written = 0;
+ while (*fmt++ == 's') {
+ arg1 = va_arg(ap, char *);
+ arg2 = va_arg(ap, char *);
+ if (arg2 == NULL)
+ continue;
+ print_byte(h, ' ');
+ if (style_written == 0) {
+ print_word(h, "style=\"");
+ style_written = 1;
+ }
+ print_word(h, arg1);
+ print_byte(h, ':');
+ print_byte(h, ' ');
+ print_word(h, arg2);
+ print_byte(h, ';');
+ }
+ if (style_written)
+ print_byte(h, '"');
+
va_end(ap);
/* Accommodate for "well-formed" singleton escaping. */
diff --git a/mandoc_html.3 b/mandoc_html.3
index 2f3be54c..83ab2fdf 100644
--- a/mandoc_html.3
+++ b/mandoc_html.3
@@ -216,6 +216,14 @@ It requires two
.Va char *
arguments.
The first is the name of the style property, the second its value.
+The name must not be
+.Dv NULL .
+The
+.Cm s
+.Ar fmt
+letter can be repeated, each repetition requiring an additional pair of
+.Va char *
+arguments.
.El
.Pp
.Fn print_otag