=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/html.c,v retrieving revision 1.113 retrieving revision 1.114 diff -c -r1.113 -r1.114 *** src/usr.bin/mandoc/html.c 2018/11/23 19:15:32 1.113 --- src/usr.bin/mandoc/html.c 2018/11/26 01:38:17 1.114 *************** *** 1,4 **** ! /* $OpenBSD: html.c,v 1.113 2018/11/23 19:15:32 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: html.c,v 1.114 2018/11/26 01:38:17 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze *************** *** 521,527 **** struct tag *t; const char *attr; char *arg1, *arg2; ! int tflags; tflags = htmltags[tag].flags; --- 521,527 ---- struct tag *t; const char *attr; char *arg1, *arg2; ! int style_written, tflags; tflags = htmltags[tag].flags; *************** *** 561,567 **** va_start(ap, fmt); ! while (*fmt != '\0') { /* Parse attributes and arguments. */ --- 561,567 ---- va_start(ap, fmt); ! while (*fmt != '\0' && *fmt != 's') { /* Parse attributes and arguments. */ *************** *** 577,586 **** case 'i': attr = "id"; break; - case 's': - attr = "style"; - arg2 = va_arg(ap, char *); - break; case '?': attr = arg1; arg1 = va_arg(ap, char *); --- 577,582 ---- *************** *** 620,638 **** 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, ';'); ! } break; } print_byte(h, '"'); } va_end(ap); /* Accommodate for "well-formed" singleton escaping. */ --- 616,647 ---- fmt++; break; default: ! 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. */