2 * Emit html. Keep track of tags so that user doesn't have to.
7 typedef struct Tag Tag;
26 t = runemalloc(sizeof(Rune));
33 while(*p && *p != Ugt)
38 while(*p && !isspacerune(*p) && *p != Uspace && *p != Ugt)
40 t = runerealloc(t, 1+(p-p0)+2+runestrlen(t)+1);
41 runemove(t+(p-p0)+3, t, runestrlen(t)+1);
44 runemove(t+2, p0, p-p0);
48 if(*p == Ugt && p>s && *(p-1) == '/'){
50 for(p0=t+1; *p0 && *p0 != Ult; p0++)
52 runemove(t, p0, runestrlen(p0)+1);
59 html(Rune *id, Rune *s)
65 hideihtml(); /* br already did, but be paranoid */
66 for(t=tagstack; t; t=t->next){
67 if(runestrcmp(t->id, id) == 0){
68 for(tt=tagstack;; tt=next){
85 if(s == nil || s[0] == 0)
94 if(runestrcmp(id, L("-")) == 0){
100 t = emalloc(sizeof *t);
101 t->id = erunestrdup(id);
114 for(t=tagstack; t; t=next){
125 rshow(Tag *t, Tag *end)
127 if(t == nil || t == end)
134 ihtml(Rune *id, Rune *s)
138 for(t=tagset; t; t=t->next){
139 if(runestrcmp(t->id, id) == 0){
140 if(s && t->open && runestrcmp(t->open, s) == 0)
142 for(l=&tagset; (tt=*l); l=&tt->next){
160 if(s == nil || s[0] == 0)
162 t = emalloc(sizeof *t);
163 t->id = erunestrdup(id);
164 t->open = erunestrdup(s);
165 t->close = closingtag(s);
180 for(t=tagset; t; t=t->next)
235 line = readline(HtmlMode);
236 for(p=line; *p; p++){
263 ".ihtml f <span style=\"font-size: \\n(.spt\">\n"
264 ".if \\n(.f==2 .ihtml f1 <i>\n"
265 ".if \\n(.f==3 .ihtml f1 <b>\n"
266 ".if \\n(.f==4 .ihtml f1 <b><i>\n"
267 ".if \\n(.f==5 .ihtml f1 <tt>\n"
268 ".if \\n(.f==6 .ihtml f1 <tt><i>\n"
275 addraw(L("html"), r_html);
276 addraw(L("ihtml"), r_html);
278 addesc('<', e_lt, CopyMode);
279 addesc('>', e_gt, CopyMode);
280 addesc('\'', e_tick, CopyMode);
281 addesc('`', e_btick, CopyMode);
282 addesc('-', e_minus, CopyMode);
283 addesc('@', e_at, CopyMode);
285 ds(L("font"), L(defaultfont));