util.text = {};
util.text.EXPORT_OK = [
- 'wrap_on_space',
+ 'wrap_on_space', 'html_escape',
];
util.text.EXPORT_TAGS = { ':all' : util.text.EXPORT_OK };
}
}
+util.text.html_escape = function( text ) {
+ text = text.replace(/&/,'&');
+ text = text.replace(/ /,' ');
+ text = text.replace(/</,'<');
+ text = text.replace(/>/,'>');
+ return text;
+}
+
dump('exiting util/text.js\n');
var nl2 = gb.getElementsByAttribute('name','spine');
for (var k = 0; k < nl2.length; k++) {
for (var m = 0; m < lm; m++) html += ' ';
- html += expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw);
+ html += util.text.html_escape(expand_macros( nl2[k].value, copy, volume, volume.record() ).substr(0,lw));
if ($('pl').checked) {
var sib = nl2[k].nextSibling;
if (sib) {
for (var m = 0; m < lw - nl2[k].value.length; m++) html += ' ';
for (var m = 0; m < mm; m++) html += ' ';
- html += expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw);
+ html += util.text.html_escape(expand_macros( sib.value, copy, volume, volume.record() ).substr(0,plw));
}
}
html += '\n';