You are here

function Markdown_Parser::hashPart in Markdown 6

Same name and namespace in other branches
  1. 5 markdown.php \Markdown_Parser::hashPart()
18 calls to Markdown_Parser::hashPart()
MarkdownExtra_Parser::hashClean in ./markdown.php
MarkdownExtra_Parser::_doAbbreviations_callback in ./markdown.php
MarkdownExtra_Parser::_doAnchors_inline_callback in ./markdown.php
MarkdownExtra_Parser::_doAnchors_reference_callback in ./markdown.php
MarkdownExtra_Parser::_doImages_inline_callback in ./markdown.php

... See full list

File

./markdown.php, line 548

Class

Markdown_Parser

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.
}