4 static void html_doc_beg(struct doc
*doc
)
6 doc_write(doc
, "<body>\n");
9 static void html_doc_end(struct doc
*doc
)
11 doc_write(doc
, "</body>\n");
14 static int digits(int n
)
22 static char *putint(char *s
, int n
)
26 for (i
= 0; i
< d
; i
++) {
27 s
[d
- i
- 1] = n
% 10 + '0';
34 static char *putstr(char *dst
, char *src
)
37 return strchr(dst
, '\0');
40 static void html_head_beg(struct doc
*doc
, int level
)
45 s
= putint(s
, level
+ 1);
50 static void html_head_end(struct doc
*doc
, int level
)
55 s
= putint(s
, level
+ 1);
60 static void html_par_beg(struct doc
*doc
)
62 doc_write(doc
, "<p>\n");
65 static void html_par_end(struct doc
*doc
)
69 static void html_put(struct doc
*doc
, char *s
)
74 static void html_list_beg(struct doc
*doc
)
76 doc_write(doc
, "<ul>\n");
79 static void html_list_end(struct doc
*doc
)
81 doc_write(doc
, "</ul>\n");
84 static void html_item_beg(struct doc
*doc
)
86 doc_write(doc
, "<li>");
89 static void html_item_end(struct doc
*doc
)
91 doc_write(doc
, "</li>\n");
94 static void html_pre_beg(struct doc
*doc
)
96 doc_write(doc
, "<pre>");
99 static void html_pre_end(struct doc
*doc
)
101 doc_write(doc
, "</pre>");
104 static void html_formula_beg(struct doc
*doc
)
106 doc_write(doc
, "<p><i>");
109 static void html_formula_end(struct doc
*doc
)
111 doc_write(doc
, "</i>\n");
114 static void html_put_txt(struct doc
*doc
, char *s
, int marker
)
118 doc_write(doc
, "<b>");
120 doc_write(doc
, "</b>");
126 doc_write(doc
, "<a href=\"");
128 doc_write(doc
, "\">");
130 doc_write(doc
, "</a>");
143 static void html_table_beg(struct doc
*doc
, int columns
)
145 doc_write(doc
, "<table>\n");
148 static void html_table_end(struct doc
*doc
)
150 doc_write(doc
, "</table>\n");
153 static void html_row_beg(struct doc
*doc
)
155 doc_write(doc
, "<tr>");
158 static void html_row_end(struct doc
*doc
)
160 doc_write(doc
, "</tr>\n");
163 static void html_entry_beg(struct doc
*doc
)
165 doc_write(doc
, "<td>");
168 static void html_entry_end(struct doc
*doc
)
170 doc_write(doc
, "</td>");
173 struct fmt_ops html_ops
= {
174 .doc_beg
= html_doc_beg
,
175 .doc_end
= html_doc_end
,
176 .head_beg
= html_head_beg
,
177 .head_end
= html_head_end
,
178 .par_beg
= html_par_beg
,
179 .par_end
= html_par_end
,
180 .list_beg
= html_list_beg
,
181 .list_end
= html_list_end
,
182 .item_beg
= html_item_beg
,
183 .item_end
= html_item_end
,
184 .pre_beg
= html_pre_beg
,
185 .pre_end
= html_pre_end
,
186 .formula_beg
= html_formula_beg
,
187 .formula_end
= html_formula_end
,
188 .table_beg
= html_table_beg
,
189 .table_end
= html_table_end
,
190 .row_beg
= html_row_beg
,
191 .row_end
= html_row_end
,
192 .entry_beg
= html_entry_beg
,
193 .entry_end
= html_entry_end
,
195 .put_txt
= html_put_txt