Converters
[ class tree: Converters ] [ index: Converters ] [ all elements ]

Class: XMLDocBookConverter

Source Location: /PhpDocumentor-1.2.0beta2/phpDocumentor/Converters/XML/DocBook/XMLDocBookConverter.inc

Class Overview

Converter
   |
   --XMLDocBookConverter

XML DocBook converter.


Author(s):

Version:

  • $Id: XMLDocBookConverter.inc,v 1.30 2003/01/17 17:48:14 CelloG Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: Converter

Converter::Converter()
Initialize Converter data structures
Converter::AttrToString()
Convert the attribute of a Tutorial docbook tag's attribute list
Converter::Bolden()
Used to convert the contents of <b> in a docblock
Converter::Br()
Used to convert <br> in a docblock
Converter::checkState()
Compare parserStringWithInlineTags::Convert() cache state to $state
Converter::Convert()
Convert all elements to output format
Converter::ConvertErrorLog()
Converter::ConvertTitle()
Convert the title of a Tutorial docbook tag section
Converter::Convert_RIC()
Convert README/INSTALL/CHANGELOG file contents to output format
Converter::copyFile()
Copies a file from the template directory to the target directory
Converter::createParentDir()
Recursively creates all subdirectories that don't exist in the $dir path
Converter::EncloseList()
Used to convert the contents of <ol> or <ul> in a docblock
Converter::EncloseParagraph()
Used to enclose a paragraph in a docblock
Converter::endClass()
Called by walk() while converting, when the last class element has been parsed.
Converter::endPage()
Called by walk() while converting, when the last procedural page element has been parsed.
Converter::formatIndex()
Called by walk() while converting.
Converter::formatLeftIndex()
Called by walk() while converting.
Converter::formatPkgIndex()
Called by walk() while converting.
Converter::formatTutorialTOC()
Creates a table of contents for a {@toc} inline tag in a tutorial
Converter::getClassLink()
return false or a classLink to $expr
Converter::getConverterDir()
Get the absolute path to the converter's base directory
Converter::getDefineLink()
return false or a defineLink to $expr
Converter::getFunctionLink()
return false or a functionLink to $expr
Converter::getGlobalLink()
return false or a globalLink to $expr
Converter::getGlobalValue()
Parse a global variable's default value for class initialization.
Converter::getIncludeValue()
Parse an include's file to see if it is a file documented in this project
Converter::getLink()
The meat of the @see tag and inline {@link} tag
Converter::getMethodLink()
return false or a methodLink to $expr in $class
Converter::getPageLink()
return false or a pageLink to $expr
Converter::getPPageId()
Used by {@id}
Converter::getSortedClassTreeFromClass()
Return a tree of all classes that extend this class
Converter::getSourceLink()
Converter::getState()
Return parserStringWithInlineTags::Convert() cache state
Converter::getTutorialLink()
The meat of the @tutorial tag and inline { @tutorial} tag
Converter::getTutorialTree()
Converter::getVarLink()
return false or a varLink to $expr in $class
Converter::hasTutorial()
Converter::highlightSource()
Called by parserSourceInlineTag::arrayConvert() to allow converters to format the source code the way they'd like.
Converter::Italicize()
Used to convert the contents of <i> in a docblock
Converter::ListItem()
Used to convert the contents of <li> in a docblock
Converter::Output()
do all necessary output
Converter::postProcess()
This version does nothing
Converter::PreserveWhiteSpace()
Used to convert the contents of <pre> in a docblock
Converter::ProgramExample()
Used to convert the <code> tag in a docblock
Converter::returnLink()
take URL $link and text $text and return a link in the format needed for the Converter
Converter::returnSee()
take abstractLink descendant and text $eltext and return a link in the format needed for the Converter
Converter::setTargetDir()
Sets the output directory for generated documentation
Converter::setTemplateDir()
sets the template directory based on the $outputformat and $name
Converter::sortPageContentsByElementType()
sorts $page_contents by element type as well as alphabetically
Converter::sourceLine()
Converter::TranslateTag()
Used to translate an xml DocBook tag from a tutorial by reading the options.ini file for the template.
Converter::type_adjust()
Called by parserReturnTag::Convert() to allow converters to change type names to desired formatting
Converter::unmangle()
Called by parserSourceInlineTag::stringConvert() to allow converters to format the source code the way they'd like.
Converter::vardump_tree()
Debugging function for dumping $tutorial_tree
Converter::walk()
called by phpDocumentor_IntermediateParser::Convert() to traverse the array of pages and their elements, converting them to the output format
Converter::walk_everything()
walk over elements by package rather than page
Converter::writeExample()
Write out the formatted source code for an example php file
Converter::writeFile()
Writes a file to target dir
Converter::writeSource()
Write out the formatted source code for a php file
Converter::writeSourceFunction()
Write out the formatted source code for a function

Class Details

[line 28]
XML DocBook converter.

This Converter takes output from the Parser and converts it to DocBook output



[ Top ]


Class Variables

$base_dir =

[line 86]

target directory passed on the command-line.

$targetDir is malleable, always adding package/ and package/subpackage/ subdirectories onto it.


Type:   string


[ Top ]

$class =

[line 67]

name of current class being converted

Type:   string
Overrides:   Array


[ Top ]

$class_data =

[line 98]

template for the class currently being processed

Type:   Template


[ Top ]

$class_dir =

[line 92]

output directory for the current class being processed

Type:   string


[ Top ]

$current =

[line 123]

contains all of the template procedural page element loop data needed for the current template

Type:   array


[ Top ]

$currentclass =

[line 129]

contains all of the template class element loop data needed for the current template

Type:   array


[ Top ]

$function_data = array()

[line 140]


Type:   mixed


[ Top ]

$juststarted =  false

[line 117]

controls formatting of parser informative output

Converter prints: "Converting /path/to/file.php... Procedural Page Elements... Classes..." Since HTMLdefaultConverter outputs files while converting, it needs to send a \n to start a new line. However, if there is more than one class, output is messy, with multiple \n's just between class file output. This variable prevents that and is purely cosmetic


Type:   boolean


[ Top ]

$leftindex = array('classes' => true, 'pages' => true, 'functions' => false, 'defines' => false, 'globals' => false)

[line 44]

indexes of elements by package that need to be generated

Type:   array
Overrides:   Array


[ Top ]

$local =  true

[line 49]

whether a @see is going to be in the $base_dir, or in a package/subpackage subdirectory of $base_dir

Type:   boolean


[ Top ]

$method_data = array()

[line 141]


Type:   mixed


[ Top ]

$name =  'DocBook'

[line 39]


Type:   string


[ Top ]

$outputformat =  'XML'

[line 37]


Type:   string
Overrides:   Array


[ Top ]

$package_pages = array()

[line 105]

array of converted package page names.

Used to link to the package page in the left index

  • Var: Format: array(package => 1)

Type:   array


[ Top ]

$page =

[line 55]

name of current page being converted

Type:   string


[ Top ]

$page_data =

[line 73]

template for the procedural page currently being processed

Type:   Template


[ Top ]

$page_dir =

[line 79]

output directory for the current procedural page being processed

Type:   string


[ Top ]

$path =

[line 61]

path of current page being converted

Type:   string


[ Top ]

$sort_page_contents_by_type =  true

[line 35]

XMLDocBookConverter wants elements sorted by type as well as alphabetically

Type:   boolean
Overrides:   Array


[ Top ]

$sourceloc =  ''

[line 142]


Type:   mixed


[ Top ]

$template_options = array('usepear' => false)

[line 138]

template options. Currently only 1 recognized option usepear

usepear tells the getLink() function to return a package link to PEAR and PEAR_ERROR if possible, and to link directly to the fully-delimited link package#class.method or package#file.method in PEAR style, if possible, even if the package is not parsed. This will allow parsing of separate PEAR packages without parsing the entire thing at once!


Type:   array
Overrides:   Array


[ Top ]



Method Detail

XMLDocBookConverter (Constructor)   [line 148]

XMLDocBookConverter XMLDocBookConverter( mixed &$allp, mixed &$packp, mixed &$classes, mixed &$procpages, mixed $po, mixed $pp, mixed $qm, mixed $targetDir, mixed $templateDir, mixed $title)

sets $base_dir to $targetDir

[ Top ]

checkState   [line 2142]

void checkState( boolean $state)

checks $state to see if it is the same as $local

Overrides Converter::checkState() (Compare parserStringWithInlineTags::Convert() cache state to $state)

Parameters:

boolean   $state     value to compare to $local

[ Top ]

Convert   [line 622]

void Convert( mixed &$element)

Convert abstract $element for template

calls helper function based on element type


Overrides Converter::Convert() (Convert all elements to output format)

Parameters:

mixed   &$element     any descendant of parserElement, or parserPage or parserPackagePage

[ Top ]

convertClass   [line 914]


convertDefine   [line 1178]

void convertDefine( parserDefine &$element)

Converts defines for template output

Parameters:

parserDefine   &$element     

[ Top ]

ConvertErrorLog   [line 667]

void ConvertErrorLog( )

Create errors.html template file output

This method takes all parsing errors and warnings and spits them out ordered by file and line number. It does not display any phpDocumentor internal errors, that is handled by exceptions, which always terminate execution.

  • Global: ErrorTracker $phpDocumentor_errors: We'll be using it's output facility
  • See: PHPDOCUMENTOR_EXCEPTIONS

Overrides Converter::ConvertErrorLog() (parent method not documented)
[ Top ]

convertFunction   [line 1088]

void convertFunction( parserFunction &$element)

Converts function for template output

Parameters:

parserFunction   &$element     

[ Top ]

convertGlobal   [line 1204]

void convertGlobal( parserGlobal &$element)

Converts global variables for template output

Parameters:

parserGlobal   &$element     

[ Top ]

convertInclude   [line 1151]

void convertInclude( parserInclude &$element)

Converts include elements for template output

Parameters:

parserInclude   &$element     

[ Top ]

convertMethod   [line 1006]

void convertMethod( parserMethod &$element)

Converts method for template output

Parameters:

parserMethod   &$element     

[ Top ]

convertPackagePage   [line 818]

void convertPackagePage( parserPackagePage &$element)

Converts package page and sets its package as used in $package_pages

Parameters:

parserPackagePage   &$element     

[ Top ]

convertPage   [line 1234]

void convertPage( parserData &$element)

converts procedural pages for template output

Parameters:

parserData   &$element     

[ Top ]

convertTutorial   [line 842]

void convertTutorial( mixed &$element)


[ Top ]

convertVar   [line 877]

void convertVar( parserVar &$element)

Converts class variables for template output.

Parameters:

parserVar   &$element     

[ Top ]

endClass   [line 205]

void endClass( )

Writes out the template file of $class_data and unsets the template to save memory

Overrides Converter::endClass() (Called by walk() while converting, when the last class element has been parsed.)
[ Top ]

endPage   [line 237]

void endPage( )

Writes out the template file of $page_data and unsets the template to save memory

Overrides Converter::endPage() (Called by walk() while converting, when the last procedural page element has been parsed.)
[ Top ]

formatIndex   [line 349]

void formatIndex( )

HTMLdefaultConverter uses this function to format template index.html and packages.html

This function generates the package list from $all_packages, eliminating any packages that don't have any entries in their package index (no files at all, due to @ignore or other factors). Then it uses the default package name as the first package index to display. It sets the right pane to be either a blank file with instructions on making package-level docs, or the package-level docs for the default package.

  • Global: string $phpDocumentor_DefaultPackageName: Used to set the starting package to display

Overrides Converter::formatIndex() (Called by walk() while converting.)
[ Top ]

formatLeftIndex   [line 427]

void formatLeftIndex( )

Generate indexes for li_package.html and classtree output files

This function generates the li_package.html files from the template file left.html. It does this by iterating through each of the $page_elements, $class_elements and $function_elements arrays to retrieve the pre-sorted abstractLink descendants needed for index generation. Conversion of these links to text is done by returnSee(). The $local parameter is set to false to ensure that paths are correct.

Then it uses generateFormattedClassTrees() to create class trees from the template file classtrees.html. Output filename is classtrees_packagename.html. This function also unsets $elements and $pkg_elements to free up the considerable memory these two class vars use


Overrides Converter::formatLeftIndex() (Called by walk() while converting.)
[ Top ]

formatPkgIndex   [line 316]

void formatPkgIndex( )

HTMLdefaultConverter chooses to format both package indexes and the complete index here

This function formats output for the elementindex.html and pkgelementindex.html template files. It then writes them to the target directory


Overrides Converter::formatPkgIndex() (Called by walk() while converting.)
[ Top ]

generateChildClassList   [line 1391]

void generateChildClassList( parserClass $class)

returns a list of child classes

Parameters:

parserClass   $class     class variable

[ Top ]

generateElementIndex   [line 1651]

void generateElementIndex( )

Generate alphabetical index of all elements

[ Top ]

generateFormattedClassTree   [line 1415]

array generateFormattedClassTree( parserClass $class)

returns an array containing the class inheritance tree from the root object to the class

Parameters:

parserClass   $class     class variable

[ Top ]

generateFormattedClassTrees   [line 1562]

void generateFormattedClassTrees( string $package)

returns a template-enabled array of class trees
  • See: $roots, HTMLConverter::getRootTree()

Parameters:

string   $package     package to generate a class tree for

[ Top ]

generatePkgElementIndex   [line 1841]

void generatePkgElementIndex( string $package)

Generate alphabetical index of all elements by package and subpackage

Parameters:

string   $package     name of a package

[ Top ]

generatePkgElementIndexes   [line 1983]

void generatePkgElementIndexes( )


[ Top ]

getCData   [line 809]

void getCData( mixed $value)


[ Top ]

getClassesOnPage   [line 1311]

array getClassesOnPage( parserData &$element)

gets a list of all classes declared on a procedural page represented by $element, a parserData class
  • Return: links to each classes documentation

Parameters:

parserData   &$element     

[ Top ]

getClassLink   [line 2023]

mixed getClassLink( string $expr, string $package, [string $file = false], [boolean $text = false], [boolean $local = true], [mixed $with_a = true])


Overrides Converter::getClassLink() (return false or a classLink to $expr)

Parameters:

string   $expr     name of class
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getDefineLink   [line 2055]

mixed getDefineLink( string $expr, string $package, [string $file = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getDefineLink() (return false or a defineLink to $expr)

Parameters:

string   $expr     name of define
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getFormattedConflicts   [line 1336]

array getFormattedConflicts( mixed &$element, string $type)

  • Return: links to conflicting elements, or empty array
  • Uses: parserClass::getConflicts(), - parserFunction::getConflicts(), parserDefine::getConflicts(), parserGlobal::getConflicts()

Parameters:

mixed   &$element     parserClass, parserFunction, parserDefine or parserGlobal
string   $type     type to display. either 'class','function','define' or 'global variable'

[ Top ]

getFormattedDescMethods   [line 1355]

array getFormattedDescMethods( parserMethod &$element)


Parameters:

parserMethod   &$element     

[ Top ]

getFormattedInheritedMethods   [line 1512]

array getFormattedInheritedMethods( parserMethod $child)

Return template-enabled list of inherited methods

uses parserMethod helper function getInheritedMethods and generates a template-enabled list using getClassLink()


Parameters:

parserMethod   $child     class method

[ Top ]

getFormattedInheritedVars   [line 1468]

array getFormattedInheritedVars( parserVar $child)

Return template-enabled list of inherited variables

uses parserVar helper function getInheritedVars and generates a template-enabled list using getClassLink()


Parameters:

parserVar   $child     class method

[ Top ]

getFormattedOverrides   [line 1376]

array|false getFormattedOverrides( parserMethod &$element)

Get the method this method overrides, if any

Parameters:

parserMethod   &$element     

[ Top ]

getFunctionLink   [line 2039]

mixed getFunctionLink( string $expr, string $package, [string $file = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getFunctionLink() (return false or a functionLink to $expr)

Parameters:

string   $expr     name of function
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getGlobalLink   [line 2071]

mixed getGlobalLink( string $expr, string $package, [string $file = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getGlobalLink() (return false or a globalLink to $expr)

Parameters:

string   $expr     name of global variable
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getId   [line 569]

string getId( mixed &$el)

Get the id value needed to allow linking

Parameters:

mixed   &$el     descendant of parserElement or parserData/parserPage

[ Top ]

getLink   [line 157]

void &getLink( mixed $expr, [mixed $package = false], [mixed $packages = false])

do that stuff in $template_options

Overrides Converter::getLink() (The meat of the @see tag and inline {@link} tag)
[ Top ]

getMethodLink   [line 2104]

mixed getMethodLink( string $expr, string $class, string $package, [string $file = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getMethodLink() (return false or a methodLink to $expr in $class)

Parameters:

string   $expr     name of method
string   $class     class containing method
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getPageLink   [line 2087]

mixed getPageLink( string $expr, string $package, [string $path = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getPageLink() (return false or a pageLink to $expr)

Parameters:

string   $expr     name of procedural page
string   $package     package name
string   $path     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

getPageName   [line 1301]

void getPageName( mixed &$element)


[ Top ]

getPPageId   [line 802]

void getPPageId( mixed $package, mixed $subpackage, mixed $tutorial, mixed $id)


Overrides Converter::getPPageId() (Used by {@id})
[ Top ]

getRootTree   [line 1583]

string getRootTree( array $tree, mixed $package)

return formatted class tree for the Class Trees page

Parameters:

array   $tree     output from getSortedClassTreeFromClass()

[ Top ]

getState   [line 2132]

void getState( )

returns $local

Overrides Converter::getState() (Return parserStringWithInlineTags::Convert() cache state)
[ Top ]

getVarLink   [line 2121]

mixed getVarLink( string $expr, string $class, string $package, [string $file = false], [boolean $text = false], [boolean $local = true])


Overrides Converter::getVarLink() (return false or a varLink to $expr in $class)

Parameters:

string   $expr     name of var
string   $class     class containing var
string   $package     package name
string   $file     full path to look in (used in index generation)
boolean   $text     deprecated
boolean   $local     return just the URL, or enclose it in an html a tag

[ Top ]

makeLeft   [line 270]

void makeLeft( )


[ Top ]

newSmarty   [line 186]

void &newSmarty( )


[ Top ]

Output   [line 2197]

void Output( )

This function is not used by HTMLdefaultConverter, but is required by Converter

Overrides Converter::Output() (do all necessary output)
[ Top ]

postProcess   [line 728]

void postProcess( mixed $text)


Overrides Converter::postProcess() (This version does nothing)
[ Top ]

prepareDocBlock   [line 741]

array prepareDocBlock( mixed &$element, [boolean $nopackage = true])

convert the element's DocBlock for output

This function converts all tags and descriptions for output

  • Return: Format: array(short description, long description, array(array('keyword' => tagname,'data' => converted tag),...))

Parameters:

mixed   &$element     any descendant of parserElement, or parserData
boolean   $nopackage     set to false for pages and classes, the only elements allowed to specify @package

[ Top ]

rcNatCmp   [line 2154]

int rcNatCmp( mixed $a, mixed $b)

does a nat case sort on the specified second level value of the array

Parameters:

mixed   $a     
mixed   $b     

[ Top ]

rcNatCmp1   [line 2170]

int rcNatCmp1( mixed $a, mixed $b)

does a nat case sort on the specified second level value of the array.

this one puts constructors first


Parameters:

mixed   $a     
mixed   $b     

[ Top ]

returnLink   [line 265]

string returnLink( string $link, string $text)

  • Return: &lt;ulink url="'.$link.'">'.$text.'</ulink&gt;

Overrides Converter::returnLink() (take URL $link and text $text and return a link in the format needed for the Converter)

Parameters:

string   $link     
string   $text     

[ Top ]

returnSee   [line 466]

void returnSee( abstractLink &$element, [string $eltext = false], [boolean $local = true], [boolean $with_a = true])

This function takes an abstractLink descendant and returns an html link

Overrides Converter::returnSee() (take abstractLink descendant and text $eltext and return a link in the format needed for the Converter)

Parameters:

abstractLink   &$element     a descendant of abstractlink should be passed, and never text
string   $eltext     text to display in the link
boolean   $local     this parameter is not used, and it set to $this->local. See $local
boolean   $with_a     determines whether the returned text is enclosed in an &lt;a> tag

[ Top ]

setTargetDir   [line 1781]

void setTargetDir( mixed $dir)

calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied

Overrides Converter::setTargetDir() (Sets the output directory for generated documentation)
[ Top ]

setTemplateDir   [line 1771]

void setTemplateDir( mixed $dir)


Overrides Converter::setTemplateDir() (sets the template directory based on the $outputformat and $name)
[ Top ]

type_adjust   [line 167]

void type_adjust( mixed $typename)


Overrides Converter::type_adjust() (Called by parserReturnTag::Convert() to allow converters to change type names to desired formatting)
[ Top ]

unmangle   [line 162]

void unmangle( mixed $s, mixed $sourcecode)


Overrides Converter::unmangle() (Called by parserSourceInlineTag::stringConvert() to allow converters to format the source code the way they'd like.)
[ Top ]

writeNewPPage   [line 395]

void writeNewPPage( mixed $key)


[ Top ]


Documentation generated on Fri, 30 Apr 2004 22:10:46 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.