Many dot-operators are intended to work on a literal string, the value of a String-type attribute or an expression resolving to a string. There are a small number of exceptions to this where the operator applies rich text (RTF) styles to its output.
Closing styles
If this code is used:
$Text = "This is " + "some".strike + " text.";
The result is "This is some text." This occurs because as with normal typing in $Text if a style is turned on the user must also turn it off. The the end of $Text is bolded, any new text added is also bolded. The way to avoid run in it to apply '.plain' to the next added segment.
$Text = "This is " + "some".strike + " text.".plain;
The result is "This is some text." There is currently no way to add a plain 'closure' without applying it to at least one character. But adding tot to punctuation, e.g. ".".plain
, or invisible characters , e.g. "\n".plain
is possible.
Passing styled text
At present, $Text is the only attribute capable of holding such styled text. String attributes and action code variables, i.e. var(), cannot store styled text. If passed styled text the latter will store the un-styled version of the text being passed.
Thus, if we create a styled string and pass it direct to a RTF-capable String type, it works:
$Text = "This is " + "some".strike + " text".plain;
The result is a $Text value of a "This is some text". Also if $MyString is "some":
$Text = "This is " + $MyString.strike + " text".plain;
But if we try this:
$MyString = "This is " + "some".strike + " text".plain; $Text = $MyString;
…the result is a $Text value of an un-styled "This is some text". So, a String-type attribute cannot hold styled text. The same is true if a variable is use for hold the result:
var vStr = "This is " + "some".strike + " text".plain; $Text = vStr;
…again, the result is a $Text value of an un-styled “This is some text”.