From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 73bd9b28 for ; Sun, 25 Nov 2018 20:38:53 -0500 (EST) Date: Sun, 25 Nov 2018 20:38:53 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Support more than one style attribute one the same HTML element. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-Id: <381d7c56194af1de@fantadrom.bsd.lv> Log Message: ----------- Support more than one style attribute one the same HTML element. In fact, this is already required when a table uses non-default horizontal and vertical alignment in the same cell. Modified Files: -------------- mandoc: html.c mandoc_html.3 Revision Data ------------- Index: mandoc_html.3 =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc_html.3,v retrieving revision 1.17 retrieving revision 1.18 diff -Lmandoc_html.3 -Lmandoc_html.3 -u -p -r1.17 -r1.18 --- mandoc_html.3 +++ 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 Index: html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.c,v retrieving revision 1.243 retrieving revision 1.244 diff -Lhtml.c -Lhtml.c -u -p -r1.243 -r1.244 --- html.c +++ html.c @@ -523,7 +523,7 @@ print_otag(struct html *h, enum htmltag 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 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 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 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. */ -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv