break;
if (i == lenof(versions))
- error(err_htmlver, &p->fpos, vername);
+ err_htmlver(&p->fpos, vername);
else
ret.htmlver = versions[i].ver;
} else if (!ustricmp(k, L"html-single-filename")) {
frag = adv(frag);
}
} else
- error(err_cfginsufarg, &p->fpos, p->origkeyword, 1);
+ err_cfginsufarg(&p->fpos, p->origkeyword, 1);
} else if (!ustricmp(k, L"html-chapter-numeric")) {
ret.achapter.just_numbers = utob(uadv(k));
} else if (!ustricmp(k, L"html-chapter-shownumber")) {
* turn both off.
*/
if (!ret.chm_filename ^ !ret.hhp_filename) {
- error(err_chmnames);
+ err_chmnames();
sfree(ret.chm_filename); ret.chm_filename = NULL;
sfree(ret.hhp_filename); ret.hhp_filename = NULL;
}
else
ho.fp = fopen(f->filename, "w");
if (!ho.fp)
- error(err_cantopenw, f->filename);
+ err_cantopenw(f->filename);
ho.charset = conf.output_charset;
ho.restrict_charset = conf.restrict_charset;
ho.fp = fopen(conf.hhp_filename, "w");
if (!ho.fp)
- error(err_cantopenw, conf.hhp_filename);
+ err_cantopenw(conf.hhp_filename);
fprintf(ho.fp,
"[OPTIONS]\n"
ho.fp = fopen(conf.hhc_filename, "w");
if (!ho.fp)
- error(err_cantopenw, conf.hhc_filename);
+ err_cantopenw(conf.hhc_filename);
ho.charset = CS_CP1252; /* as far as I know, HHC files are */
ho.restrict_charset = CS_CP1252; /* hardwired to this charset */
ho.fp = fopen(hhk_filename, "w");
if (!ho.fp)
- error(err_cantopenw, hhk_filename);
+ err_cantopenw(hhk_filename);
ho.charset = CS_CP1252; /* as far as I know, HHK files are */
ho.restrict_charset = CS_CP1252; /* hardwired to this charset */
htmlfile *file, keywordlist *keywords, htmlconfig *cfg)
{
word *w;
- char *c;
+ char *c, *c2, *p, *q;
int style, type;
for (w = words; w; w = w->next) switch (w->type) {
if (flags & LINKS) {
element_open(ho, "a");
c = utoa_dup(w->text, CS_ASCII);
- element_attr(ho, "href", c);
+ c2 = snewn(1 + 10*strlen(c), char);
+ for (p = c, q = c2; *p; p++) {
+ if (*p == '&')
+ q += sprintf(q, "&");
+ else if (*p == '<')
+ q += sprintf(q, "<");
+ else if (*p == '>')
+ q += sprintf(q, ">");
+ else
+ *q++ = *p;
+ }
+ *q = '\0';
+ element_attr(ho, "href", c2);
+ sfree(c2);
sfree(c);
}
break;