Source for file PackagePageElements.inc
Documentation is available at PackagePageElements.inc
* Data structures used in parsing XML DocBook-based tutorials
* Conversion of DocBook-based tutorials is performed using special
* {@link Converter} class methods. By default, these methods simply retrieve
* simple rules for replacement of tags and slight re-ordering from the
* options.ini file present for every template.
* In future versions, there may be utilization of xslt or other more powerful
* protocols. However, for most situations, the power of these classes will
* be more than sufficient to handle very complex documentation.
* Note that an entire tutorial is contained in a single parserXMLDocBookTag,
* matching the document model for DocBook. The top-level tag, <refentry>,
* contains every other tag and all text.
* phpDocumentor :: automatic documentation generator
* Copyright (c) 2002-2006 Gregory Beaver
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* @copyright 2002-2006 Gregory Beaver
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version CVS: $Id: PackagePageElements.inc,v 1.4 2006/05/22 01:07:28 cellog Exp $
* @tutorial tutorials.pkg
* @link http://www.phpdoc.org
* @link http://pear.php.net/PhpDocumentor
* Represents <![CDATA[ ]]> sections.
* These sections are interpreted as plain text
* @uses Converter::getCData() convert contents to text
function Convert(&$c, $postprocess = true)
foreach($this->value as $key => $value)
* a standard XML DocBook Tag
* This class is designed to represent all DocBook tags. It is intelligent
* enough to understand the <title> tag, and also the <refname> tag for
* as title for <refentry>
* Attributes from the XML tag
* Format: array(attrname => attrvalue, attrname => attrvalue,...)
/**#@+ @access private */
/** @var parserIdLineTag */
* Set to <refpurpose> in <refsynopsisdiv>
* @uses Converter::TranslateTag() Calls this to enclose the contents of the
* DocBook tag based on the values in template options.ini file
function Convert(&$c, $postprocess = true)
$value = parent::Convert($c, $postprocess);
$simvalue = parent::Convert($c, false);
if (isset ($this->_title))
return $c->TranslateTag($this->name,$this->attributes,$value,$simvalue);
* Begin a new CData section
* Adds {@link $_cdata} to {@link $value}
$this->value[] = $this->_cdata;
* Retrieve either the table of contents index, or the location that
* @param false|integereither an index of the {@}toc} tag in $this->value
* or false, if the next index value of $this->value
function getTOC($state = false)
if ($state !== false) return $this->value[$state];
* @param integer index of the TOC in $this->value
* @param parserTocInlineTag
$this->value[$state] = $val;
$this->_cdata->add($word);
* Add an xml tag attribute name="value" pair
* if the attribute is id, value must be a {@link parserIdInlineTag}
* @param string attribute name
* @param string|parserIdInlineTagvalue of attribute
* Set the title of a DocBook tag section.
* For most DocBook tags, the title is represented with a <title></title>
* tag pair. The <refentry> top-level tag is a little different. Instead
* of using <title></title>, phpDocumentor uses the contents of the
* <refname> tag in the <refnamediv> tag
* @param parserXMLDocBookTag the title element
* If the id attribute is present, this method will set its id
* @param parserIdInlineTag
* Return converter-specific formatting of ID.
* Passes $c to {@link parserIdInlineTag::Convert()}
if ($this->_id) return trim($this->_id->Convert($c));
* Determine whether the docbook element has a title
return isset ($this->_title);
* Retrieve Converter-specific formatting of the title of this element
if ($this->name == 'refentry')
foreach($this->value as $tag)
if (is_object($tag) && $tag->name == 'refnamediv')
return $tag->getTitle($c);
if ($this->name == 'refnamediv')
foreach($this->value as $tag)
if (is_object($tag) && is_a($tag, 'parserXMLDocBookTag') && $tag->name == 'refname')
foreach($tag->value as $val) $t->add($val);
if (is_object($tag) && is_a($tag, 'parserXMLDocBookTag') && $tag->name == 'refpurpose')
foreach($tag->value as $val) $t->add($val);
$this->_description = $t;
if (isset ($this->_title))
return $this->value[0]->getTitle($c);
if (isset ($this->value[1])) {
return $this->value[1]->getTitle($c);
* Retrieve the contents of a subsection
* This method uses the $_id members of nested docbook tags to retrieve
* the section defined by $subsection
* @param string converter-specific subsection
$search->id = $subsection;
foreach($this->value as $el)
if ($el->getId($c) == $search->Convert($c))
} elseif ($a = $el->getSubsection($c,$subsection))
* Add contents to this tag.
* There are four kinds of data in a DocBook tutorial:
* 1. <b>tags</b> - normal tags like <refentry>
* 2. <b>entities</b> - normal entities like ”
* 3. <b><![CDATA[</b> - character data that should not be interpreted,
* like <programlisting> contents
* 4. <b>text</b> - normal non-markup text
* All four kinds of data are added here
* @param parserEntity|parserCData|parserXMLDocBookTag|stringnested tag,
if ($el->name == 'title')
} else return parent::add($el);
} else return parent::add($el);
* a standard entity like ”
* This class is designed to represent all DocBook entities.
* @param string entity name
* @uses Converter::TranslateEntity() convert contents to text
function Convert(&$c, $postprocess = true)
return $c->TranslateEntity($this->value);
$ret = strtr ('&'. $this->value. ';', $trans_tbl);
|