public function store($text)
| $text |
| wild |
public function restore($corpus, $text_mode)
| $corpus | ||
| $text_mode |
| wild |
public function overwrite($key, $new_text)
| $key | ||
| $new_text |
| wild |
public function getMap()
| wild |
public function setMap($map)
| array | $map |
| wild |
Remarkup prevents several classes of text-processing problems by replacing tokens in the text as they are marked up. For example, if you write something like this:
//D12//
It is processed in several stages. First the "D12" matches and is replaced with a token, in the form of "<0x01><ID number><literal "Z">". The first byte, "<0x01>" is a single byte with value 1 that marks a token. If this is token ID "444", the text may now look like this:
//<0x01>444Z//
Now the italics match and are replaced, using the next token ID:
<0x01>445Z
When processing completes, all the tokens are replaced with their final equivalents. For example, token 444 is evaluated to:
<a href="http://...">...</a>
Then token 445 is evaluated:
<em><0x01>444Z</em>
...and all tokens it contains are replaced:
<em><a href="http://...">...</a></em>
If we didn't do this, the italics rule could match the "//" in "http://", or any other number of processing mistakes could occur, some of which create security risks.
This class generates keys, and stores the map of keys to replacement text.
| $text |
| wild |
| $corpus | ||
| $text_mode |
| wild |
| $key | ||
| $new_text |
| wild |
| wild |
| array | $map |
| wild |