|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.martiansoftware.snip.RunSnip
An Ant task designed to help with the
single-sourcing of program documentation. This task reptracts 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 "@@runSnip:myProperty@@"
and "@@endSnip@@" will be stored in a property called snip.myProperty.
Example Usage:
<taskdef
name="runsnip"
classname="com.martiansoftware.snip.RunSnip"
classpath="snip-0.1.jar"/>
<snip>
<fileset dir="src" includes="**/*.txt" />
</snip>
Multiple snippets may be defined within a single file. Snippets may not be nested.
Field Summary | |
static java.lang.String |
FORMAT_DOCBOOK
Format constant indicating that output should be written in docbook format. |
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 | |
RunSnip()
|
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. |
java.lang.String |
formatDocbook(java.lang.String command,
java.lang.String output)
Formats the program output in docbook format. |
java.lang.String |
formatResult(java.lang.String command,
java.lang.String output)
Formats the program output |
java.lang.String |
processMacro(java.lang.String macro)
Processes the specified macro, returning the formatted result. |
void |
setFormat(java.lang.String format)
Sets the output format |
void |
setPrompt(java.lang.String prompt)
Sets the prompt to include in output |
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 |
Field Detail |
public static final java.lang.String FORMAT_DOCBOOK
Constructor Detail |
public RunSnip()
Method Detail |
public void addFileSet(org.apache.tools.ant.types.FileSet fs)
fs
- the FileSet to addpublic void setPrompt(java.lang.String prompt)
prompt
- the prompt to include in outputpublic java.lang.String formatDocbook(java.lang.String command, java.lang.String output)
command
- the command executedoutput
- the command's output
public java.lang.String formatResult(java.lang.String command, java.lang.String output)
command
- the command executedoutput
- the command's output
public void setFormat(java.lang.String format)
format
- the output format (currently only "docbook" is
supported)public java.lang.String processMacro(java.lang.String macro)
processMacro
in interface MacroProcessor
macro
- the macro to run
public void execute() throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException
- if any I/O errors occur while reading files.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |