Source for file Blockquote.php
Documentation is available at Blockquote.php
* Parse for block-quoted text.
* Find source text marked as a blockquote, identified by any number of
* greater-than signs '>' at the start of the line, followed by a space,
* and then the quote text; each '>' indicates an additional level of
* $Id: Blockquote.php,v 1.3 2004/09/25 19:05:13 pmjones Exp $
* @author Paul M. Jones <pmjones@ciaweb.net>
* Regex for parsing the source text.
var $regex = '/\n((\>).*\n)(?!(\>))/Us';
* Generates a replacement for the matched text.
* 'start' : the start of a blockquote
* 'end' : the end of a blockquote
* 'level' => the indent level (0 for the first level, 1 for the
* @param array &$matches The array of matches from parse().
* @return A series of text and delimited tokens marking the different
* list text and list elements.
// the replacement text we will return to parse()
// the list of post-processing matches
// $matches[1] is the text matched as a list set by parse();
// create an array called $list that contains a new set of
// matches for the various list-item elements.
// a stack of starts and ends; we keep this so that we know what
// indent level we're at.
// loop through each list-item element.
foreach ($list as $key => $val) {
// $val[0] is the full matched list-item line
// $val[1] is the number of initial '>' chars (indent level)
// $val[2] is the quote text
// we number levels starting at 1, not zero
// get the text of the line
// add a level to the list?
while ($level > count($stack)) {
// the current indent level is greater than the number
// of stack elements, so we must be starting a new
// level. push the new level onto the stack with a
// dummy value (boolean true)...
// ...and add a start token to the return.
$return .= $this->wiki->addToken (
while (count($stack) > $level) {
// as long as the stack count is greater than the
// current indent level, we need to end list types.
// continue adding end-list tokens until the stack count
// and the indent level are the same.
$return .= $this->wiki->addToken (
// the last line may have been indented. go through the stack
// and create end-tokens until the stack is empty.
while (count($stack) > 0 ) {
$return .= $this->wiki->addToken (
// we're done! send back the replacement text.
Documentation generated on Mon, 11 Mar 2019 14:22:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|