tasks/ext/rSTTask.php
reStructuredText rendering task for Phing, the PHP build tool.
PHP version 5
- Author
- Christian Weiske
- Category
- Tasks
- License
- LGPL v3 or later http://www.gnu.org/licenses/lgpl.html
- Link
- http://www.phing.info/
- Package
- phing.tasks.ext
- Version
- SVN: $Id: ad2ac21008b4635c4f557e3a65c9306a350ca1f2 $
\rSTTask
reStructuredText rendering task for Phing, the PHP build tool.
PHP version 5
- Parent(s)
- \Task < \ProjectComponent
- Author
- Christian Weiske
- Category
- Tasks
- Copyright
- 2001,2002 THYRELL. All rights reserved
- License
- LGPL v3 or later http://www.gnu.org/licenses/lgpl.html
- Link
- http://www.phing.info/
- Version
- $Id$
Properties


string
$destination= 'null'
Output file or directory. May be omitted.
When it ends with a slash, it is considered to be a directory
null
Details- Type
- string


array
$filterChains= 'array()'
all filterchains objects assigned to this task
array()
Details- Type
- array


string
$format= ''html''
Result format, defaults to "html".
'html'
Details- Type
- string
- See
- \$supportedFormats


\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\Task::$$projectnull
Details- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \Task::$$project


array
$supportedFormats= 'array(
'html', 'latex', 'man', 'odt', 's5', 'xml'
)'
Array of supported output formats
array(
'html', 'latex', 'man', 'odt', 's5', 'xml'
)
Details- Type
- array
- See
- \$format
- See
- \$targetExt


array
$targetExt= 'array(
'html' => 'html',
'latex' => 'tex',
'man' => '3',
'odt' => 'odt',
's5' => 'html',
'xml' => 'xml',
)'
Maps formats to file extensions
array(
'html' => 'html',
'latex' => 'tex',
'man' => '3',
'odt' => 'odt',
's5' => 'html',
'xml' => 'xml',
)
Details- Type
- array


string
$taskName= ''rST''
Taskname for logger
'rST'
Details- Type
- string


string
$toolPath= 'null'
Full path to the tool, i.e. /usr/local/bin/rst2html
null
Details- Type
- string


boolean
$uptodate= 'false'
Only render files whole source files are newer than the target files
false
Details- Type
- boolean
Methods


addFileset(
\FileSet $fileset
)
:
void
Add a set of files to be rendered.
Name | Type | Description |
---|---|---|
$fileset | \FileSet | Set of rst files to render |


createFilterChain(
)
:
\FilterChain
Creates a filterchain, stores and returns it
Type | Description |
---|---|
\FilterChain | The created filterchain object |


createMapper(
)
:
\Mapper
Nested creator, creates one Mapper for this task
Type | Description |
---|---|
\Mapper | The created Mapper type object |
Exception | Description |
---|---|
\BuildException |


getLocation(
)
:
\Location
Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.
Inherited from: \Task::getLocation()Type | Description |
---|---|
\Location | The location object describing the position of this task within the buildfile. |


getProject(
)
:
\Project
Returns a reference to current project
Inherited from: \ProjectComponent::getProject()\Task::getProject()Type | Description |
---|---|
\Project | Reference to current porject object |


getRuntimeConfigurableWrapper(
)
:
\RuntimeConfigurable
Returns the wrapper object for runtime configuration
Inherited from: \Task::getRuntimeConfigurableWrapper()Type | Description |
---|---|
\RuntimeConfigurable | The wrapper object used by this task |


getTargetFile(
string $file, string $destination
=
null
)
:
string
Determines and returns the target file name from the input file and the configured destination name.
Name | Type | Description |
---|---|---|
$file | string | Input file |
$destination | string | Destination file or directory name, may be null |
Type | Description |
---|---|
string | Target file name |
- Uses
- \$format
- Uses
- \$targetExt


getTaskType(
)
:
string
Returns the name of the task under which it was invoked, usually the XML tagname
Inherited from: \Task::getTaskType()Type | Description |
---|---|
string | The type of this task (XML Tag) |


getToolPath(
string $format
)
:
string
Finds the rst2* binary path
Name | Type | Description |
---|---|---|
$format | string | Output format |
Type | Description |
---|---|
string | Full path to rst2$format |
Exception | Description |
---|---|
\BuildException | When the tool cannot be found |


init(
)
:
void
Init method: requires the PEAR System class
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
Exception | Description |
---|---|
\BuildException |


log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
void
Name | Type | Description |
---|---|---|
$msg | string | The message to log |
$level | integer | The priority of the message |
- See
- \BuildEvent
- See
- \BuildListener


main(
)
:
void
The main entry point method.
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.


maybeConfigure(
)
:
void
Configure this task if it hasn't been done already.
Inherited from: \Task::maybeConfigure()

render(
string $tool, string $source, string $targetFile
)
:
void
Renders a single file and applies filters on it
Name | Type | Description |
---|---|---|
$tool | string | conversion tool to use |
$source | string | rST source file |
$targetFile | string | target file name |


renderFile(
string $tool, string $source, string $targetFile
)
:
void
Renders a single file with the rST tool.
Name | Type | Description |
---|---|---|
$tool | string | conversion tool to use |
$source | string | rST source file |
$targetFile | string | target file name |
Exception | Description |
---|---|
\BuildException | When the conversion fails |


setDescription(
string $desc
)
:
void
Name | Type | Description |
---|---|---|
$desc | string | The text describing the task |


setDestination(
string $destination
)
:
void
The setter for the attribute "destination"
Name | Type | Description |
---|---|---|
$destination | string | Output file or directory. When it ends with a slash, it is taken as directory. |


setFile(
string $file
)
:
void
The setter for the attribute "file"
Name | Type | Description |
---|---|---|
$file | string | Path of file to render |


setFormat(
string $format
)
:
void
The setter for the attribute "format"
Name | Type | Description |
---|---|---|
$format | string | Output format |
Exception | Description |
---|---|
\BuildException | When the format is not supported |


setLocation(
\Location $location
)
:
void
Sets the location within the buildfile this task occurs. Called by the parser to set location information.
Inherited from: \Task::setLocation()Name | Type | Description |
---|---|---|
$location | \Location | The location object describing the position of this task within the buildfile. |


setOwningTarget(
\Target $target
)
:
void
Name | Type | Description |
---|---|---|
$target | \Target | Reference to owning target |


setProject(
\Project $project
)
:
void
References the project to the current component.
Inherited from: \ProjectComponent::setProject()\Task::setProject()Name | Type | Description |
---|---|---|
$project | \Project | The reference to the current project |


setRuntimeConfigurableWrapper(
\RuntimeConfigurable $wrapper
)
:
void
Sets the wrapper object this task should use for runtime configurable elements.
Inherited from: \Task::setRuntimeConfigurableWrapper()Name | Type | Description |
---|---|---|
$wrapper | \RuntimeConfigurable | The wrapper object this task should use |


setTaskName(
string $name
)
:
string
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
string | A string representing the name of this task for log |


setTaskType(
string $name
)
:
void
Sets the type of the task. Usually this is the name of the XML tag
Inherited from: \Task::setTaskType()Name | Type | Description |
---|---|---|
$name | string | The type of this task (XML Tag) |


setToolparam(
string $param
)
:
void
The setter for the attribute "toolparam"
Name | Type | Description |
---|---|---|
$param | string | Additional rst2* tool parameters |


setToolpath(
$path
)
:
void
The setter for the attribute "toolpath"
Name | Type | Description |
---|---|---|
$path |
Exception | Description |
---|---|
\BuildException | When the tool does not exist or is not executable |