function Markdown_Parser::hashPart in Markdown 5
Same name and namespace in other branches
- 6 markdown.php \Markdown_Parser::hashPart()
14 calls to Markdown_Parser::hashPart()
File
- ./
markdown.php, line 513
Class
Code
function hashPart($text, $boundary = 'X') {
#
# Called whenever a tag must be hashed when a function insert an atomic
# element in the text stream. Passing $text to through this function gives
# a unique text-token which will be reverted back when calling unhash.
#
# The $boundary argument specify what character should be used to surround
# the token. By convension, "B" is used for block elements that needs not
# to be wrapped into paragraph tags at the end, ":" is used for elements
# that are word separators and "X" is used in the general case.
#
# Swap back any tag hash found in $text so we do not have to `unhash`
# multiple times at the end.
$text = $this
->unhash($text);
# Then hash the block.
static $i = 0;
$key = "{$boundary}\32" . ++$i . $boundary;
$this->html_hashes[$key] = $text;
return $key;
# String that will replace the tag.
}