version 1.234, 2018/06/25 13:26:57 |
version 1.236, 2018/06/25 14:00:28 |
Line 69 static const struct htmldata htmltags[TAG_MAX] = { |
|
Line 69 static const struct htmldata htmltags[TAG_MAX] = { |
|
{"br", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL}, |
{"br", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL}, |
{"a", 0}, |
{"a", 0}, |
{"table", HTML_NLALL | HTML_INDENT}, |
{"table", HTML_NLALL | HTML_INDENT}, |
{"colgroup", HTML_NLALL | HTML_INDENT}, |
|
{"col", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL}, |
|
{"tr", HTML_NLALL | HTML_INDENT}, |
{"tr", HTML_NLALL | HTML_INDENT}, |
{"td", HTML_NLAROUND}, |
{"td", HTML_NLAROUND}, |
{"li", HTML_NLAROUND | HTML_INDENT}, |
{"li", HTML_NLAROUND | HTML_INDENT}, |
Line 122 static const char *const roffscales[SCALE_MAX] = { |
|
Line 120 static const char *const roffscales[SCALE_MAX] = { |
|
/* Avoid duplicate HTML id= attributes. */ |
/* Avoid duplicate HTML id= attributes. */ |
static struct ohash id_unique; |
static struct ohash id_unique; |
|
|
static void a2width(const char *, struct roffsu *); |
|
static void print_byte(struct html *, char); |
static void print_byte(struct html *, char); |
static void print_endword(struct html *); |
static void print_endword(struct html *); |
static void print_indent(struct html *); |
static void print_indent(struct html *); |
Line 689 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 686 print_otag(struct html *h, enum htmltag tag, const cha |
|
case 'u': |
case 'u': |
su = va_arg(ap, struct roffsu *); |
su = va_arg(ap, struct roffsu *); |
break; |
break; |
case 'w': |
|
if ((arg2 = va_arg(ap, char *)) != NULL) { |
|
su = &mysu; |
|
a2width(arg2, su); |
|
} |
|
if (*fmt == '+') { |
|
if (su != NULL) { |
|
/* Make even bold text fit. */ |
|
su->scale *= 1.2; |
|
/* Add padding. */ |
|
su->scale += 3.0; |
|
} |
|
fmt++; |
|
} |
|
break; |
|
default: |
default: |
abort(); |
abort(); |
} |
} |
Line 717 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 699 print_otag(struct html *h, enum htmltag tag, const cha |
|
case 'l': |
case 'l': |
attr = "margin-left"; |
attr = "margin-left"; |
break; |
break; |
case 'w': |
|
attr = "width"; |
|
break; |
|
case 'W': |
|
attr = "min-width"; |
|
break; |
|
case '?': |
case '?': |
attr = arg1; |
attr = arg1; |
arg1 = va_arg(ap, char *); |
arg1 = va_arg(ap, char *); |
Line 1036 print_word(struct html *h, const char *cp) |
|
Line 1012 print_word(struct html *h, const char *cp) |
|
{ |
{ |
while (*cp != '\0') |
while (*cp != '\0') |
print_byte(h, *cp++); |
print_byte(h, *cp++); |
} |
|
|
|
/* |
|
* Calculate the scaling unit passed in a `-width' argument. This uses |
|
* either a native scaling unit (e.g., 1i, 2m) or the string length of |
|
* the value. |
|
*/ |
|
static void |
|
a2width(const char *p, struct roffsu *su) |
|
{ |
|
const char *end; |
|
|
|
end = a2roffsu(p, su, SCALE_MAX); |
|
if (end == NULL || *end != '\0') { |
|
su->unit = SCALE_EN; |
|
su->scale = html_strlen(p); |
|
} else if (su->scale < 0.0) |
|
su->scale = 0.0; |
|
} |
} |