I use BibTeX not only to create bbl files for my LaTeX documents, but also to produce HTML of my whole collection of articles. It works pretty well for the last 12 years but since I decided to add a DOI field I've got a minor problem.
BibTeX, outputs
(<small>doi:<a href=http://dx.doi.org/10.1051/jp2:1995145>10.1051/jp2:1995145</a></small>)
as I programmed it like
FUNCTION {startdoienc}
{ duplicate$ empty$
{ pop$ "" }
{ " (<small>doi:<a href=http://dx.doi.org/" swap$ * ">" * }
if$
}
FUNCTION {enddoienc}
{ duplicate$ empty$
{ pop$ "" }
{ "</a></small>)" * }
if$
}
FUNCTION {article}
{ output.bibitem
.... <cut out>
new.block
doi startdoienc output
doi enddoienc pureoutput
new.block
.... <cut out>
}
So the HTML result looks like
A. Ajdari, F. Brochard-Wyart, C. Gay, P. G. de Gennes, and J. L. Viovy Drag on a tethered chain moving in a polymer melt J. Phys. II France 1995 5 491–495 (doi:10.1051/jp2:1995145)
where the DOI link is clickable.
However, some journals (e.g. J. Polym. Sci. B: Polym. Phys.) have characters in their DOI's, which need to be escaped to become a valid URL: <, >, and #. Example:
10.1002/(SICI)1099-0488(19990701)37:13<1449::AID-POLB11>3.0.CO;2-T
Question: is it possible to program BibTeX to substitute, e.g., "<" by "%3c" before outputting it?