]>
git.cameronkatri.com Git - mandoc.git/blob - html.c
1 /* $Id: html.c,v 1.278 2022/07/06 14:34:59 schwarze Exp $ */
3 * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
5 * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 * Common functions for mandoc(1) HTML formatters.
20 * For use by individual formatters and by the main program.
24 #include <sys/types.h>
37 #include "mandoc_aux.h"
38 #include "mandoc_ohash.h"
49 #define HTML_INPHRASE (1 << 0) /* Can appear in phrasing context. */
50 #define HTML_TOPHRASE (1 << 1) /* Establishes phrasing context. */
51 #define HTML_NOSTACK (1 << 2) /* Does not have an end tag. */
52 #define HTML_NLBEFORE (1 << 3) /* Output line break before opening. */
53 #define HTML_NLBEGIN (1 << 4) /* Output line break after opening. */
54 #define HTML_NLEND (1 << 5) /* Output line break before closing. */
55 #define HTML_NLAFTER (1 << 6) /* Output line break after closing. */
56 #define HTML_NLAROUND (HTML_NLBEFORE | HTML_NLAFTER)
57 #define HTML_NLINSIDE (HTML_NLBEGIN | HTML_NLEND)
58 #define HTML_NLALL (HTML_NLAROUND | HTML_NLINSIDE)
59 #define HTML_INDENT (1 << 7) /* Indent content by two spaces. */
60 #define HTML_NOINDENT (1 << 8) /* Exception: never indent content. */
63 static const struct htmldata htmltags
[TAG_MAX
] = {
65 {"head", HTML_NLALL
| HTML_INDENT
},
66 {"meta", HTML_NOSTACK
| HTML_NLALL
},
67 {"link", HTML_NOSTACK
| HTML_NLALL
},
68 {"style", HTML_NLALL
| HTML_INDENT
},
69 {"title", HTML_NLAROUND
},
72 {"div", HTML_NLAROUND
},
73 {"section", HTML_NLALL
},
75 {"table", HTML_NLALL
| HTML_INDENT
},
76 {"tr", HTML_NLALL
| HTML_INDENT
},
77 {"td", HTML_NLAROUND
},
78 {"li", HTML_NLAROUND
| HTML_INDENT
},
79 {"ul", HTML_NLALL
| HTML_INDENT
},
80 {"ol", HTML_NLALL
| HTML_INDENT
},
81 {"dl", HTML_NLALL
| HTML_INDENT
},
82 {"dt", HTML_NLAROUND
},
83 {"dd", HTML_NLAROUND
| HTML_INDENT
},
84 {"h2", HTML_TOPHRASE
| HTML_NLAROUND
},
85 {"h3", HTML_TOPHRASE
| HTML_NLAROUND
},
86 {"p", HTML_TOPHRASE
| HTML_NLAROUND
| HTML_INDENT
},
87 {"pre", HTML_TOPHRASE
| HTML_NLAROUND
| HTML_NOINDENT
},
88 {"a", HTML_INPHRASE
| HTML_TOPHRASE
},
89 {"b", HTML_INPHRASE
| HTML_TOPHRASE
},
90 {"cite", HTML_INPHRASE
| HTML_TOPHRASE
},
91 {"code", HTML_INPHRASE
| HTML_TOPHRASE
},
92 {"i", HTML_INPHRASE
| HTML_TOPHRASE
},
93 {"small", HTML_INPHRASE
| HTML_TOPHRASE
},
94 {"span", HTML_INPHRASE
| HTML_TOPHRASE
},
95 {"var", HTML_INPHRASE
| HTML_TOPHRASE
},
96 {"br", HTML_INPHRASE
| HTML_NOSTACK
| HTML_NLALL
},
97 {"hr", HTML_INPHRASE
| HTML_NOSTACK
},
98 {"mark", HTML_INPHRASE
},
99 {"math", HTML_INPHRASE
| HTML_NLALL
| HTML_INDENT
},
118 /* Avoid duplicate HTML id= attributes. */
121 int ord
; /* Ordinal number of the latest occurrence. */
122 char id
[]; /* The id= attribute without any ordinal suffix. */
124 static struct ohash id_unique
;
126 static void html_reset_internal(struct html
*);
127 static void print_byte(struct html
*, char);
128 static void print_endword(struct html
*);
129 static void print_indent(struct html
*);
130 static void print_word(struct html
*, const char *);
132 static void print_ctag(struct html
*, struct tag
*);
133 static int print_escape(struct html
*, char);
134 static int print_encode(struct html
*, const char *, const char *, int);
135 static void print_href(struct html
*, const char *, const char *, int);
136 static void print_metaf(struct html
*);
140 html_alloc(const struct manoutput
*outopts
)
144 h
= mandoc_calloc(1, sizeof(struct html
));
147 h
->metac
= h
->metal
= ESCAPE_FONTROMAN
;
148 h
->style
= outopts
->style
;
149 if ((h
->base_man1
= outopts
->man
) == NULL
)
151 else if ((h
->base_man2
= strchr(h
->base_man1
, ';')) != NULL
)
152 *h
->base_man2
++ = '\0';
153 h
->base_includes
= outopts
->includes
;
154 if (outopts
->fragment
)
155 h
->oflags
|= HTML_FRAGMENT
;
157 h
->oflags
|= HTML_TOC
;
159 mandoc_ohash_init(&id_unique
, 4, offsetof(struct id_entry
, id
));
165 html_reset_internal(struct html
*h
)
168 struct id_entry
*entry
;
171 while ((tag
= h
->tag
) != NULL
) {
175 entry
= ohash_first(&id_unique
, &slot
);
176 while (entry
!= NULL
) {
178 entry
= ohash_next(&id_unique
, &slot
);
180 ohash_delete(&id_unique
);
186 html_reset_internal(p
);
187 mandoc_ohash_init(&id_unique
, 4, offsetof(struct id_entry
, id
));
193 html_reset_internal(p
);
198 print_gen_head(struct html
*h
)
202 print_otag(h
, TAG_META
, "?", "charset", "utf-8");
203 print_otag(h
, TAG_META
, "??", "name", "viewport",
204 "content", "width=device-width, initial-scale=1.0");
205 if (h
->style
!= NULL
) {
206 print_otag(h
, TAG_LINK
, "?h??", "rel", "stylesheet",
207 h
->style
, "type", "text/css", "media", "all");
212 * Print a minimal embedded style sheet.
215 t
= print_otag(h
, TAG_STYLE
, "");
216 print_text(h
, "table.head, table.foot { width: 100%; }");
218 print_text(h
, "td.head-rtitle, td.foot-os { text-align: right; }");
220 print_text(h
, "td.head-vol { text-align: center; }");
222 print_text(h
, ".Nd, .Bf, .Op { display: inline; }");
224 print_text(h
, ".Pa, .Ad { font-style: italic; }");
226 print_text(h
, ".Ms { font-weight: bold; }");
228 print_text(h
, ".Bl-diag ");
230 print_text(h
, " dt { font-weight: bold; }");
232 print_text(h
, "code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd "
233 "{ font-weight: bold; font-family: inherit; }");
238 html_setfont(struct html
*h
, enum mandoc_esc font
)
241 case ESCAPE_FONTPREV
:
244 case ESCAPE_FONTITALIC
:
245 case ESCAPE_FONTBOLD
:
247 case ESCAPE_FONTROMAN
:
253 font
= ESCAPE_FONTROMAN
;
264 print_metaf(struct html
*h
)
267 print_tagq(h
, h
->metaf
);
271 case ESCAPE_FONTITALIC
:
272 h
->metaf
= print_otag(h
, TAG_I
, "");
274 case ESCAPE_FONTBOLD
:
275 h
->metaf
= print_otag(h
, TAG_B
, "");
278 h
->metaf
= print_otag(h
, TAG_B
, "");
279 print_otag(h
, TAG_I
, "");
282 h
->metaf
= print_otag(h
, TAG_SPAN
, "c", "Li");
285 h
->metaf
= print_otag(h
, TAG_SPAN
, "c", "Li");
286 print_otag(h
, TAG_B
, "");
289 h
->metaf
= print_otag(h
, TAG_SPAN
, "c", "Li");
290 print_otag(h
, TAG_I
, "");
298 html_close_paragraph(struct html
*h
)
300 struct tag
*this, *next
;
306 flags
= htmltags
[this->tag
].flags
;
307 if (flags
& (HTML_INPHRASE
| HTML_TOPHRASE
))
309 if ((flags
& HTML_INPHRASE
) == 0)
316 * ROFF_nf switches to no-fill mode, ROFF_fi to fill mode.
317 * TOKEN_NONE does not switch. The old mode is returned.
320 html_fillmode(struct html
*h
, enum roff_tok want
)
325 for (t
= h
->tag
; t
!= NULL
; t
= t
->next
)
326 if (t
->tag
== TAG_PRE
)
329 had
= t
== NULL
? ROFF_fi
: ROFF_nf
;
337 html_close_paragraph(h
);
338 print_otag(h
, TAG_PRE
, "");
350 * Allocate a string to be used for the "id=" attribute of an HTML
351 * element and/or as a segment identifier for a URI in an <a> element.
352 * The function may fail and return NULL if the node lacks text data
353 * to create the attribute from.
354 * The caller is responsible for free(3)ing the returned string.
356 * If the "unique" argument is non-zero, the "id_unique" ohash table
357 * is used for de-duplication. If the "unique" argument is 1,
358 * it is the first time the function is called for this tag and
359 * location, so if an ordinal suffix is needed, it is incremented.
360 * If the "unique" argument is 2, it is the second time the function
361 * is called for this tag and location, so the ordinal suffix
365 html_make_id(const struct roff_node
*n
, int unique
)
367 const struct roff_node
*nch
;
368 struct id_entry
*entry
;
374 buf
= mandoc_strdup(n
->tag
);
382 for (nch
= n
->child
; nch
!= NULL
; nch
= nch
->next
)
383 if (nch
->type
!= ROFFT_TEXT
)
391 if (n
->child
== NULL
|| n
->child
->type
!= ROFFT_TEXT
)
393 buf
= mandoc_strdup(n
->child
->string
);
399 * In ID attributes, only use ASCII characters that are
400 * permitted in URL-fragment strings according to the
402 * https://url.spec.whatwg.org/#url-fragment-string
403 * In addition, reserve '~' for ordinal suffixes.
406 for (cp
= buf
; *cp
!= '\0'; cp
++)
407 if (isalnum((unsigned char)*cp
) == 0 &&
408 strchr("!$&'()*+,-./:;=?@_", *cp
) == NULL
)
414 /* Avoid duplicate HTML id= attributes. */
416 slot
= ohash_qlookup(&id_unique
, buf
);
417 if ((entry
= ohash_find(&id_unique
, slot
)) == NULL
) {
418 len
= strlen(buf
) + 1;
419 entry
= mandoc_malloc(sizeof(*entry
) + len
);
421 memcpy(entry
->id
, buf
, len
);
422 ohash_insert(&id_unique
, slot
, entry
);
423 } else if (unique
== 1)
426 if (entry
->ord
> 1) {
428 mandoc_asprintf(&buf
, "%s~%d", cp
, entry
->ord
);
435 print_escape(struct html
*h
, char c
)
440 print_word(h
, "<");
443 print_word(h
, ">");
446 print_word(h
, "&");
449 print_word(h
, """);
452 print_word(h
, " ");
466 print_encode(struct html
*h
, const char *p
, const char *pend
, int norecurse
)
471 int c
, len
, breakline
, nospace
;
473 static const char rejs
[10] = { ' ', '\\', '<', '>', '&', '"',
474 ASCII_NBRSP
, ASCII_HYPH
, ASCII_BREAK
, '\0' };
477 pend
= strchr(p
, '\0');
483 if (HTML_SKIPCHAR
& h
->flags
&& '\\' != *p
) {
484 h
->flags
&= ~HTML_SKIPCHAR
;
489 for (sz
= strcspn(p
, rejs
); sz
-- && p
< pend
; p
++)
493 (p
>= pend
|| *p
== ' ' || *p
== ASCII_NBRSP
)) {
494 print_otag(h
, TAG_BR
, "");
496 while (p
< pend
&& (*p
== ' ' || *p
== ASCII_NBRSP
))
510 if (print_escape(h
, *p
++))
513 esc
= mandoc_escape(&p
, &seq
, &len
);
516 case ESCAPE_FONTPREV
:
517 case ESCAPE_FONTBOLD
:
518 case ESCAPE_FONTITALIC
:
520 case ESCAPE_FONTROMAN
:
524 if (0 == norecurse
) {
525 h
->flags
|= HTML_NOSPACE
;
526 if (html_setfont(h
, esc
))
528 h
->flags
&= ~HTML_NOSPACE
;
531 case ESCAPE_SKIPCHAR
:
532 h
->flags
|= HTML_SKIPCHAR
;
540 if (h
->flags
& HTML_SKIPCHAR
) {
541 h
->flags
&= ~HTML_SKIPCHAR
;
547 /* Skip past "u" header. */
548 c
= mchars_num2uc(seq
+ 1, len
- 1);
550 case ESCAPE_NUMBERED
:
551 c
= mchars_num2char(seq
, len
);
556 c
= mchars_spec2cp(seq
, len
);
564 print_word(h
, "html");
573 case ESCAPE_OVERSTRIKE
:
581 if ((c
< 0x20 && c
!= 0x09) ||
582 (c
> 0x7E && c
< 0xA0))
585 (void)snprintf(numbuf
, sizeof(numbuf
), "&#x%.4X;", c
);
586 print_word(h
, numbuf
);
587 } else if (print_escape(h
, c
) == 0)
595 print_href(struct html
*h
, const char *name
, const char *sec
, int man
)
603 if (h
->base_man2
!= NULL
) {
604 mandoc_asprintf(&filename
, "%s.%s", name
, sec
);
605 if (stat(filename
, &sb
) == -1)
610 pp
= h
->base_includes
;
612 while ((p
= strchr(pp
, '%')) != NULL
) {
613 print_encode(h
, pp
, p
, 1);
614 if (man
&& p
[1] == 'S') {
618 print_encode(h
, sec
, NULL
, 1);
619 } else if ((man
&& p
[1] == 'N') ||
620 (man
== 0 && p
[1] == 'I'))
621 print_encode(h
, name
, NULL
, 1);
623 print_encode(h
, p
, p
+ 2, 1);
627 print_encode(h
, pp
, NULL
, 1);
631 print_otag(struct html
*h
, enum htmltag tag
, const char *fmt
, ...)
637 int style_written
, tflags
;
639 tflags
= htmltags
[tag
].flags
;
641 /* Flow content is not allowed in phrasing context. */
643 if ((tflags
& HTML_INPHRASE
) == 0) {
644 for (t
= h
->tag
; t
!= NULL
; t
= t
->next
) {
647 assert((htmltags
[t
->tag
].flags
& HTML_TOPHRASE
) == 0);
652 * Always wrap phrasing elements in a paragraph
653 * unless already contained in some flow container;
654 * never put them directly into a section.
657 } else if (tflags
& HTML_TOPHRASE
&& h
->tag
->tag
== TAG_SECTION
)
658 print_otag(h
, TAG_P
, "c", "Pp");
660 /* Push this tag onto the stack of open scopes. */
662 if ((tflags
& HTML_NOSTACK
) == 0) {
663 t
= mandoc_malloc(sizeof(struct tag
));
672 if (tflags
& HTML_NLBEFORE
)
676 else if ((h
->flags
& HTML_NOSPACE
) == 0) {
677 if (h
->flags
& HTML_KEEP
)
678 print_word(h
, " ");
680 if (h
->flags
& HTML_PREKEEP
)
681 h
->flags
|= HTML_KEEP
;
686 if ( ! (h
->flags
& HTML_NONOSPACE
))
687 h
->flags
&= ~HTML_NOSPACE
;
689 h
->flags
|= HTML_NOSPACE
;
691 /* Print out the tag name and attributes. */
694 print_word(h
, htmltags
[tag
].name
);
698 while (*fmt
!= '\0' && *fmt
!= 's') {
700 /* Parse attributes and arguments. */
702 arg1
= va_arg(ap
, char *);
719 arg1
= va_arg(ap
, char *);
725 arg2
= va_arg(ap
, char *);
729 /* Print the attributes. */
737 print_href(h
, arg1
, NULL
, 0);
741 print_href(h
, arg1
, arg2
, 1);
746 print_encode(h
, arg1
, NULL
, 1);
750 print_encode(h
, arg1
, NULL
, 1);
757 while (*fmt
++ == 's') {
758 arg1
= va_arg(ap
, char *);
759 arg2
= va_arg(ap
, char *);
763 if (style_written
== 0) {
764 print_word(h
, "style=\"");
778 /* Accommodate for "well-formed" singleton escaping. */
780 if (htmltags
[tag
].flags
& HTML_NOSTACK
)
785 if (tflags
& HTML_NLBEGIN
)
788 h
->flags
|= HTML_NOSPACE
;
790 if (tflags
& HTML_INDENT
)
792 if (tflags
& HTML_NOINDENT
)
799 * Print an element with an optional "id=" attribute.
800 * If the element has phrasing content and an "id=" attribute,
801 * also add a permalink: outside if it can be in phrasing context,
805 print_otag_id(struct html
*h
, enum htmltag elemtype
, const char *cattr
,
808 struct roff_node
*nch
;
814 if (n
->flags
& NODE_ID
)
815 id
= html_make_id(n
, 1);
816 if (n
->flags
& NODE_HREF
)
817 href
= id
== NULL
? html_make_id(n
, 2) : id
;
818 if (href
!= NULL
&& htmltags
[elemtype
].flags
& HTML_INPHRASE
)
819 ret
= print_otag(h
, TAG_A
, "chR", "permalink", href
);
820 t
= print_otag(h
, elemtype
, "ci", cattr
, id
);
823 if (href
!= NULL
&& (nch
= n
->child
) != NULL
) {
824 /* man(7) is safe, it tags phrasing content only. */
825 if (n
->tok
> MDOC_MAX
||
826 htmltags
[elemtype
].flags
& HTML_TOPHRASE
)
828 else /* For mdoc(7), beware of nested blocks. */
829 while (nch
!= NULL
&& nch
->type
== ROFFT_TEXT
)
832 print_otag(h
, TAG_A
, "chR", "permalink", href
);
842 print_ctag(struct html
*h
, struct tag
*tag
)
846 if (tag
->closed
== 0) {
853 tflags
= htmltags
[tag
->tag
].flags
;
854 if (tflags
& HTML_INDENT
)
856 if (tflags
& HTML_NOINDENT
)
858 if (tflags
& HTML_NLEND
)
863 print_word(h
, htmltags
[tag
->tag
].name
);
865 if (tflags
& HTML_NLAFTER
)
868 if (tag
->refcnt
== 0) {
875 print_gen_decls(struct html
*h
)
877 print_word(h
, "<!DOCTYPE html>");
882 print_gen_comment(struct html
*h
, struct roff_node
*n
)
886 print_word(h
, "<!-- This is an automatically generated file."
890 while (n
!= NULL
&& n
->type
== ROFFT_COMMENT
) {
891 if (strstr(n
->string
, "-->") == NULL
&&
892 (wantblank
|| *n
->string
!= '\0')) {
895 print_word(h
, n
->string
);
896 wantblank
= *n
->string
!= '\0';
902 print_word(h
, " -->");
908 print_text(struct html
*h
, const char *word
)
910 print_tagged_text(h
, word
, NULL
);
914 print_tagged_text(struct html
*h
, const char *word
, struct roff_node
*n
)
920 * Always wrap text in a paragraph unless already contained in
921 * some flow container; never put it directly into a section.
924 if (h
->tag
->tag
== TAG_SECTION
)
925 print_otag(h
, TAG_P
, "c", "Pp");
927 /* Output whitespace before this text? */
929 if (h
->col
&& (h
->flags
& HTML_NOSPACE
) == 0) {
930 if ( ! (HTML_KEEP
& h
->flags
)) {
931 if (HTML_PREKEEP
& h
->flags
)
932 h
->flags
|= HTML_KEEP
;
935 print_word(h
, " ");
939 * Optionally switch fonts, optionally write a permalink, then
940 * print the text, optionally surrounded by HTML whitespace.
943 assert(h
->metaf
== NULL
);
947 if (n
!= NULL
&& (href
= html_make_id(n
, 2)) != NULL
) {
948 t
= print_otag(h
, TAG_A
, "chR", "permalink", href
);
953 if ( ! print_encode(h
, word
, NULL
, 0)) {
954 if ( ! (h
->flags
& HTML_NONOSPACE
))
955 h
->flags
&= ~HTML_NOSPACE
;
956 h
->flags
&= ~HTML_NONEWLINE
;
958 h
->flags
|= HTML_NOSPACE
| HTML_NONEWLINE
;
960 if (h
->metaf
!= NULL
) {
961 print_tagq(h
, h
->metaf
);
963 } else if (t
!= NULL
)
966 h
->flags
&= ~HTML_IGNDELIM
;
970 print_tagq(struct html
*h
, const struct tag
*until
)
972 struct tag
*this, *next
;
974 for (this = h
->tag
; this != NULL
; this = next
) {
975 next
= this == until
? NULL
: this->next
;
981 * Close out all open elements up to but excluding suntil.
982 * Note that a paragraph just inside stays open together with it
983 * because paragraphs include subsequent phrasing content.
986 print_stagq(struct html
*h
, const struct tag
*suntil
)
988 struct tag
*this, *next
;
990 for (this = h
->tag
; this != NULL
; this = next
) {
992 if (this == suntil
|| (next
== suntil
&&
993 (this->tag
== TAG_P
|| this->tag
== TAG_PRE
)))
1000 /***********************************************************************
1001 * Low level output functions.
1002 * They implement line breaking using a short static buffer.
1003 ***********************************************************************/
1006 * Buffer one HTML output byte.
1007 * If the buffer is full, flush and deactivate it and start a new line.
1008 * If the buffer is inactive, print directly.
1011 print_byte(struct html
*h
, char c
)
1013 if ((h
->flags
& HTML_BUFFER
) == 0) {
1019 if (h
->col
+ h
->bufcol
< sizeof(h
->buf
)) {
1020 h
->buf
[h
->bufcol
++] = c
;
1029 fwrite(h
->buf
, h
->bufcol
, 1, stdout
);
1031 h
->col
= (h
->indent
+ 1) * 2 + h
->bufcol
+ 1;
1033 h
->flags
&= ~HTML_BUFFER
;
1037 * If something was printed on the current output line, end it.
1038 * Not to be called right after print_indent().
1041 print_endline(struct html
*h
)
1048 fwrite(h
->buf
, h
->bufcol
, 1, stdout
);
1053 h
->flags
|= HTML_NOSPACE
;
1054 h
->flags
&= ~HTML_BUFFER
;
1058 * Flush the HTML output buffer.
1059 * If it is inactive, activate it.
1062 print_endword(struct html
*h
)
1069 if ((h
->flags
& HTML_BUFFER
) == 0) {
1071 h
->flags
|= HTML_BUFFER
;
1072 } else if (h
->bufcol
) {
1074 fwrite(h
->buf
, h
->bufcol
, 1, stdout
);
1075 h
->col
+= h
->bufcol
+ 1;
1081 * If at the beginning of a new output line,
1082 * perform indentation and mark the line as containing output.
1083 * Make sure to really produce some output right afterwards,
1084 * but do not use print_otag() for producing it.
1087 print_indent(struct html
*h
)
1091 if (h
->col
|| h
->noindent
)
1094 h
->col
= h
->indent
* 2;
1095 for (i
= 0; i
< h
->col
; i
++)
1100 * Print or buffer some characters
1101 * depending on the current HTML output buffer state.
1104 print_word(struct html
*h
, const char *cp
)
1107 print_byte(h
, *cp
++);