Page MenuHomePhabricator
Diviner Phabricator Tech Docs PhutilRemarkupBlockStorage

final class PhutilRemarkupBlockStorage
Phabricator Technical Documentation (Remarkup)

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.

Methods

public function store($text)

This method is not documented.
Parameters
$text
Return
wild

public function restore($corpus, $text_mode)

This method is not documented.
Parameters
$corpus
$text_mode
Return
wild

public function overwrite($key, $new_text)

This method is not documented.
Parameters
$key
$new_text
Return
wild

public function getMap()

This method is not documented.
Return
wild

public function setMap($map)

This method is not documented.
Parameters
array$map
Return
wild