Source for file Paragraph.php
Documentation is available at Paragraph.php
// $Id: Paragraph.php,v 1.2 2004/09/25 19:05:13 pmjones Exp $
* This class implements a Text_Wiki rule to find sections of the source
* text that are paragraphs. A para is any line not starting with a token
* delimiter, followed by two newlines.
* @author Paul M. Jones <pmjones@ciaweb.net>
* The regular expression used to find source text matching this
'blockquote', // are we sure about this one?
* Generates a token entry for the matched text. Token options are:
* 'start' => The starting point of the paragraph.
* 'end' => The ending point of the paragraph.
* @param array &$matches The array of matches from parse().
* @return A delimited token number to be used as a placeholder in
$delim = $this->wiki->delim;
if (trim($matches[0 ]) == '') {
// does the match start with a delimiter?
if (substr($matches[0 ], 0 , 1 ) != $delim) {
$start = $this->wiki->addToken (
$this->rule, array ('type' => 'start')
$end = $this->wiki->addToken (
$this->rule, array ('type' => 'end')
return $start . trim($matches[0 ]) . $end;
// the line starts with a delimiter. read in the delimited
// token number, check the token, and see if we should
// loop starting at the second character (we already know
// the first is a delimiter) until we find another
// delimiter; the text between them is a token key number.
for ($i = 1; $i < $len; $i++ ) {
// look at the token and see if it's skippable (if we skip,
// it will not be marked as a paragraph)
$skip = $this->getConf('skip', array ());
// this type of token should not have paragraphs applied to it.
// return the entire matched text.
$start = $this->wiki->addToken (
$this->rule, array ('type' => 'start')
$end = $this->wiki->addToken (
$this->rule, array ('type' => 'end')
return $start . trim($matches[0 ]) . $end;
Documentation generated on Mon, 11 Mar 2019 14:22:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|