com.martiansoftware.snip
Class Snip
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.martiansoftware.snip.Snip
- public class Snip
- extends org.apache.tools.ant.Task
An Ant task designed to help with the
single-sourcing of program documentation. This task extracts snippets
of text from files, placing them into properties in the Ant project.
These properties can then be used by any other Ant task, and are
particularly useful when referenced by <filter>
s
within the <copy>
task.
The <snip>
task takes one or more nested
<fileset>
s that indicate the
files to process. Any text between lines containing "@@snip:myProperty@@"
and "@@endSnip@@" will be stored in a property called snip.myProperty.
Example Usage:
<taskdef
name="snip"
classname="com.martiansoftware.snip.Snip"
classpath="snip-0.11.jar"/>
<snip>
<fileset dir="src" includes="**/*.txt" />
</snip>
Multiple snippets may be defined within a single file. Snippets may
not be nested.
- Author:
- Marty Lamb
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary |
Snip()
|
Method Summary |
void |
addFileSet(org.apache.tools.ant.types.FileSet fs)
Adds a FileSet to this Task |
void |
execute()
Reads all snippets from the previously specified FileSets, storing
their contents in project properties. |
void |
setXmlsafe(boolean xmlSafe)
Sets whether properties set by this task should be
"xml-safe" - that is, should have any greater-than or less-than signs
xml-encoded |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorFlush, handleErrorOutput, handleFlush, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Snip
public Snip()
addFileSet
public void addFileSet(org.apache.tools.ant.types.FileSet fs)
- Adds a FileSet to this Task
- Parameters:
fs
- the FileSet to add
setXmlsafe
public void setXmlsafe(boolean xmlSafe)
- Sets whether properties set by this task should be
"xml-safe" - that is, should have any greater-than or less-than signs
xml-encoded
- Parameters:
xmlSafe
-
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Reads all snippets from the previously specified FileSets, storing
their contents in project properties.
- Throws:
org.apache.tools.ant.BuildException
- if any I/O errors occur while reading files.