From 10093284ba994fa5213166810a213a46d9cb95df Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 23 Mar 2007 15:56:34 +0000 Subject: [PATCH] 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. --- Nasal/screen.nas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Nasal/screen.nas b/Nasal/screen.nas index ccc03629d..16e0152cc 100644 --- a/Nasal/screen.nas +++ b/Nasal/screen.nas @@ -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); } }