1
0
Fork 0

If text contains "{display|voice}" groups, skip the delimiters and discard

the "voice" part. It's no longer possible to display the three letters {|}
in screen message at the moment, but they aren't overly useful. We may want
to support escaping in the future, if necessary.
This commit is contained in:
mfranz 2007-03-23 15:56:34 +00:00
parent 03ba6e2b80
commit 10093284ba

View file

@ -58,15 +58,23 @@ var trim = func(s, lr = 0) {
##
# convert string for output (replaces tabs only for now)
# convert string for output; replaces tabs by spaces, and skips
# delimitiers and the voice part in "{text|voice}" constructions
#
var sanitize = func(s) {
var r = "";
var skip = 0;
for (var i = 0; i < size(s); i += 1) {
var c = s[i];
if (c == `\t`) {
r ~= ' ';
} else {
} elsif (c == `{`) {
#
} elsif (c == `|`) {
skip = 1;
} elsif (c == `}`) {
skip = 0;
} elsif (!skip) {
r ~= chr(c);
}
}