dev-master
9999999-devRich Text Format (RTF) tokens
MIT
The Development Requires
by Jack Clayton
php text token format rtf rich
v0.1.0
0.1.0.0Rich Text Format (RTF) tokens
MIT
The Development Requires
by Jack Clayton
php text token format rtf rich
Wallogit.com
2017 © Pedro Peláez
Rich Text Format (RTF) tokens
Rich Text Format (RTF) tokens., (*1)
namespace Jstewmc\RtfToken;
$open = new Group\Open();
$control = new Control\Word('foo');
$text = new Text('bar');
$close = new Group\Close();
echo $open . $control . $text . $close;
The example above would output the following:, (*2)
{\foo bar}
This library includes tokens for the Rich Text Format (RTF) language including:, (*3)
{),}),\b),\*),foo), and\0).The properties of each token differ, but all tokens implement the _toString() magic method., (*4)
This library supports two group tokens: Group\Open and Group\Close. They have no properties:, (*5)
namespace Jstewmc\RtfToken\Group;
(string) (new Open()); // returns "{"
(string) (new Close()); // returns "}"
This library supports control word and control symbol tokens., (*6)
By default, control tokens are space-delimited. However, this can be turned off using the setIsSpaceDelimited() method., (*7)
The control word token has a word and (optional) integer parameter property:, (*8)
namespace Jstewmc\RtfToken\Control;
$word = new Word('b', 0);
$word->getWord(); // returns "b"
$word->getParameter(); // returns 0
(string) $word; // returns "\b0 "
$word->setIsSpaceDelimited(false);
(string) $word; // returns "\b0" (note, no space)
The control symbol token has a symbol and mixed parameter property:, (*9)
namespace Jstewmc\RtfToken\Control;
$symbol = new Symbol('\'', 99);
$symbol->getSymbol(); // returns "'"
$symbol->getParameter(); // returns 99
(string) $symbol; // returns "\'99 "
$symbol->setIsSpaceDelimited(false);
(string) $symbol; // returns "\'99" (note, no space)
The text token has a single property, text:, (*10)
namespace Jstewmc\RtfToken;
$text = new Text('foo');
$text->getText(); // returns "foo"
(string) $text; // returns "foo"
The "other" token exists for any character that isn't an open-group, close-group, control word, control symbol, or text token. Usually, this includes special characters like line-feeds ("\n"), carriage-returns ("\r"), etc., (*11)
The "other" token has a single property, character:, (*12)
namespace Jstewmc\RtfToken;
$other = new Other("\n");
$other->getCharacter(); // returns "\n"
(string) $other; // returns "\n"
That's about it!, (*13)
Jack Clayton, (*14)
Rich Text Format (RTF) tokens
MIT
php text token format rtf rich
Rich Text Format (RTF) tokens
MIT
php text token format rtf rich