Source for file paragraph.php
Documentation is available at paragraph.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
// $Id: paragraph.php,v 1.5 2004/03/30 16:47:00 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
* Generates a token entry for the matched text. Token options are:
* 'start' => The starting point of the paragraph.
* 'end' => The endinging 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->addToken(array ('type' => 'start'));
$end = $this->addToken(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)
$token_type = $this->_wiki->_tokens [$key][0 ];
if (in_array($token_type, $this->_conf['skip'])) {
$start = $this->addToken(array ('type' => 'start'));
$end = $this->addToken(array ('type' => 'end'));
return $start . trim($matches[0 ]) . $end;
* Renders a token into text matching the requested format.
* @param array $options The "options" portion of the token (second
* @return string The text rendered from the token options.
Documentation generated on Mon, 11 Mar 2019 10:14:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|