|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pz.platypus.plugin.listing.Start
public class Start
Simple, illustrative plugin for creating Platypus listing files in HTML. Note: Methods order: constructor, methods in alphabetical order, getters and setters Error-handling convention: Output plugins handle all their own error messages. Platypus is made aware of a problem only by the value returned from calling process(). However, it does not issue any user messages as a result of this.
Field Summary | |
---|---|
private boolean |
inCode
|
private java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
Start()
Start() is always called first by Platypus, followed by a call to process() Any plugin initialization code should go in here. |
Method Summary | |
---|---|
void |
closeOuputFile(java.io.FileWriter outputFile,
GDD gdd)
Close the file |
void |
emitClosingHtml(java.io.FileWriter outputFile,
GDD gdd)
Emits the HTML closing code |
void |
emitHtmlHeader(java.lang.String inputFile,
java.io.FileWriter outputFile,
GDD gdd)
Emit the HTML needed at the beginning of the listing file |
void |
emitListing(java.io.FileWriter outfile,
GDD gdd)
Where the content of the listing file is written out |
java.lang.String |
getHeaderHtml(GDD gdd,
java.lang.String inputFile)
Build the string of HTML needed as the prelude to output of the code |
private boolean |
isItANewHtmlLine(Token tok,
int lineNumber)
Should we start a new Html line? Every token carries with it the original source line number. |
private java.lang.String |
makeInitialSpacesHard(java.lang.String s)
|
java.io.FileWriter |
openOutputFile(java.lang.String filename,
GDD gdd)
Get an instance of FileWriter, to which we will emit HTML output |
private void |
printToken(java.io.FileWriter outfile,
GDD gdd,
Token tok)
Print the token contents with all the Html bells and whistles (colors, bold fonts, line breaks etc.) Get the Html string and output it to the output file. |
void |
process(GDD gdd,
CommandLineArgs clArgs)
This is the main line of the plug-in. |
void |
setLogger(java.util.logging.Logger newLogger)
|
private int |
skipNextTokens(int currTokIndex,
Token tok,
TokenList tokensList)
We skip next one or many tokens at times. |
private boolean |
skipThisToken(Token tok,
TokenList tokensList,
int i)
Will the next record indicate the present command is a replacement? If so, don't print this command, just skip it. |
private int |
startANewHtmlLine(java.io.FileWriter outfile,
GDD gdd,
Token tok)
Start a new Html line. |
int |
tokensToSkip(TokenList tokList,
int tokenNumber)
We skip all compound commands tokens. |
private void |
writeIt(java.io.FileWriter outfile,
GDD gdd,
HtmlListingStrategy strategy,
java.lang.String s)
|
java.lang.String |
writeStringToFile(java.io.FileWriter outfile,
GDD gdd,
java.lang.String s)
Write a String to the output - deals with the business of actual writing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.logging.Logger logger
private boolean inCode
Constructor Detail |
---|
public Start()
Method Detail |
---|
public void closeOuputFile(java.io.FileWriter outputFile, GDD gdd) throws java.io.IOException
outputFile
- file to closegdd
- the GDD. Only the literals are used
java.io.IOException
- in case of errorpublic void emitClosingHtml(java.io.FileWriter outputFile, GDD gdd) throws java.io.IOException
outputFile
- the HTML is written to this filegdd
- GDD, only the literals are used in this method
java.io.IOException
- in the rare event the file cannot be written topublic void emitHtmlHeader(java.lang.String inputFile, java.io.FileWriter outputFile, GDD gdd) throws java.io.IOException
inputFile
- filename of the file being converted into a listingoutputFile
- the file to write the HTML togdd
- the GDD. Only the literals are used in this method
java.io.IOException
- in the rare event the file cannot be written topublic void emitListing(java.io.FileWriter outfile, GDD gdd) throws java.io.IOException
outfile
- the file being written togdd
- the GDD. Only the literals are used
java.io.IOException
- in the event the file can't be written toprivate void printToken(java.io.FileWriter outfile, GDD gdd, Token tok) throws java.io.IOException
outfile
- gdd
- tok
-
java.io.IOException
private void writeIt(java.io.FileWriter outfile, GDD gdd, HtmlListingStrategy strategy, java.lang.String s) throws java.io.IOException
java.io.IOException
private java.lang.String makeInitialSpacesHard(java.lang.String s)
private int startANewHtmlLine(java.io.FileWriter outfile, GDD gdd, Token tok) throws java.io.IOException
outfile
- gdd
- tok
-
java.io.IOException
private boolean isItANewHtmlLine(Token tok, int lineNumber)
tok
- the token we're processinglineNumber
- the line number
private boolean skipThisToken(Token tok, TokenList tokensList, int i)
tok
- the command token, the next token is/isn't a replacement commandtokensList
- list of input tokensi
- which token in the token list
private int skipNextTokens(int currTokIndex, Token tok, TokenList tokensList) throws java.io.IOException
currTokIndex
- where we are in the token listtok
- current tokentokensList
- list of input tokens
java.io.IOException
public java.lang.String getHeaderHtml(GDD gdd, java.lang.String inputFile)
gdd
- the GDD. Only the literals are usedinputFile
- filename of the file being converted into a listing
public java.io.FileWriter openOutputFile(java.lang.String filename, GDD gdd) throws java.io.IOException
filename
- of file to open (obtained from the command line)gdd
- GDD. Only the literals are used in this method.
java.io.IOException
- in the event the file can't be openedpublic java.lang.String writeStringToFile(java.io.FileWriter outfile, GDD gdd, java.lang.String s) throws java.io.IOException
outfile
- output filegdd
- global document datas
- string to write to ouput
java.io.IOException
public int tokensToSkip(TokenList tokList, int tokenNumber) throws java.io.IOException
tokList
- list of tokenstokenNumber
- which token in the input stream tok is
java.io.IOException
- in event of exception in writing to filepublic void process(GDD gdd, CommandLineArgs clArgs)
process
in interface IPlugin
gdd
- The Global Document DataclArgs
- command-line arguments in a hash map (key = argument, value = parameters)public void setLogger(java.util.logging.Logger newLogger)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |