Ejemplo n.º 1
0
function _RunBlockGamut($text)
{
    #
    # These are all the transformations that form block-level
    # tags like paragraphs, headers, and list items.
    #
    global $md_empty_element_suffix;
    $text = _DoHeaders($text);
    # Do Horizontal Rules:
    $text = preg_replace(array('{^[ ]{0,2}([ ]?\\*[ ]?){3,}[ \\t]*$}mx', '{^[ ]{0,2}([ ]? -[ ]?){3,}[ \\t]*$}mx', '{^[ ]{0,2}([ ]? _[ ]?){3,}[ \\t]*$}mx'), "\n<hr{$md_empty_element_suffix}\n", $text);
    $text = _DoLists($text);
    $text = _DoCodeBlocks($text);
    $text = _DoBlockQuotes($text);
    # We already ran _HashHTMLBlocks() before, in Markdown(), but that
    # was to escape raw HTML in the original Markdown source. This time,
    # we're escaping the markup we've just created, so that we don't wrap
    # <p> tags around block-level tags.
    $text = _HashHTMLBlocks($text);
    $text = _FormParagraphs($text);
    return $text;
}
function _RunBlockGamut($text)
{
    global $g_empty_element_suffix;
    $text = _DoHeaders($text);
    $text = preg_replace(array('/^( ?\\* ?){3,}$/m', '/^( ?- ?){3,}$/m'), array("\n<hr{$g_empty_element_suffix}\n", "\n<hr{$g_empty_element_suffix}\n"), $text);
    $text = _DoLists($text);
    $text = _DoCodeBlocks($text);
    $text = _DoBlockQuotes($text);
    $text = _DoAutoLinks($text);
    $text = _HashHTMLBlocks($text);
    $text = _FormParagraphs($text);
    return $text;
}
Ejemplo n.º 3
0
function _RunBlockGamut($text, $hash_html_blocks = TRUE)
{
    #
    # These are all the transformations that form block-level
    # tags like paragraphs, headers, and list items.
    #
    if ($hash_html_blocks) {
        # We need to escape raw HTML in Markdown source before doing anything
        # else. This need to be done for each block, and not only at the
        # begining in the Markdown function since hashed blocks can be part of
        # a list item and could have been indented. Indented blocks would have
        # been seen as a code block in previous pass of _HashHTMLBlocks.
        $text = _HashHTMLBlocks($text);
    }
    $text = _DoHeaders($text);
    $text = _DoTables($text);
    # Do Horizontal Rules:
    global $md_empty_element_suffix;
    $text = preg_replace(array('{^[ ]{0,2}([ ]?\\*[ ]?){3,}[ \\t]*$}emx', '{^[ ]{0,2}([ ]? -[ ]?){3,}[ \\t]*$}emx', '{^[ ]{0,2}([ ]? _[ ]?){3,}[ \\t]*$}emx'), "_HashBlock('\n<hr{$md_empty_element_suffix}\n')", $text);
    $text = _DoLists($text);
    $text = _DoDefLists($text);
    $text = _DoCodeBlocks($text);
    $text = _DoBlockQuotes($text);
    $text = _FormParagraphs($text);
    return $text;
}