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:
parent
03ba6e2b80
commit
10093284ba
1 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue