org.pz.platypus.plugin.html
Class Start

java.lang.Object
  extended by org.pz.platypus.plugin.html.Start
All Implemented Interfaces:
IPlugin

public class Start
extends java.lang.Object
implements IPlugin

Main line for HTML plugin. Error-handling convention: Output plugins handle all their own errors. Platypus is made aware of a problem only by the value returned from calling process(). However, it does not issue any user message(s) as a result of this.

Author:
alb/ask

Field Summary
private  HtmlCommandTable commandTable
          the command table indexed by command root
private  HtmlData htmlData
          contains state data for the pdf file
private  HtmlOutfile outfile
          the outputfile we write to
private  PdfSymbolsTable symbolsTable
          the symbols table indexed by root
 
Constructor Summary
Start()
          Start() is always called first by Platypus, followed by a call to process() Any plugin initialization code should go in here.
Start(HtmlOutfile newOutfile, HtmlCommandTable newCommandTable)
          Constructor that is only ever used in unit testing
 
Method Summary
private  void errMsgUnrecognizedCommand(Token tok, GDD gdd)
          Output error message to logger for unrecognized command
private  java.lang.String escapeSpecialChars(java.lang.String s)
           
(package private)  boolean isNextTokenCr(int currTokNumber, TokenList tokList)
          Determines if the next token in the token list is the command [cr]
 void process(GDD gdd, CommandLineArgs clArgs)
          This is the main line of the plug-in.
(package private)  void processCommand(Token tok, HtmlData htmlData, int tokNum)
          Principal method for implementing command tokens
(package private)  int processCompoundCommand(GDD gdd, int startTokNumber)
          Handle compount commands.
(package private)  void processMacro()
           
(package private)  void processSymbol(GDD gdd, java.lang.String filename, Token tok, int tokNum, HtmlData pdd)
          Process a symbol or foreign character
(package private)  void processText(GDD gdd, java.lang.String filename, java.lang.String text)
          Process a token consisting of a text item
 void processTokens(GDD gdd, HtmlData htmlData, java.lang.String outfileName)
          Where the token stream is translated into text and actions.
(package private)  void setUpDataItems(GDD gdd)
          set up various data items needed in processing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

htmlData

private HtmlData htmlData
contains state data for the pdf file


outfile

private HtmlOutfile outfile
the outputfile we write to


commandTable

private HtmlCommandTable commandTable
the command table indexed by command root


symbolsTable

private PdfSymbolsTable symbolsTable
the symbols table indexed by root

Constructor Detail

Start

public Start(HtmlOutfile newOutfile,
             HtmlCommandTable newCommandTable)
Constructor that is only ever used in unit testing

Parameters:
newOutfile - the outfile for this HTML
newCommandTable - command table for this HTML

Start

public Start()
Start() is always called first by Platypus, followed by a call to process() Any plugin initialization code should go in here.

Method Detail

process

public void process(GDD gdd,
                    CommandLineArgs clArgs)
This is the main line of the plug-in. Platypus calls only the Start constructor and this method.

Specified by:
process in interface IPlugin
Parameters:
gdd - The Global Document Data
clArgs - command-line arguments in a hash map (key = argument, value = parameters)

setUpDataItems

void setUpDataItems(GDD gdd)
set up various data items needed in processing

Parameters:
gdd - the GDD

processTokens

public void processTokens(GDD gdd,
                          HtmlData htmlData,
                          java.lang.String outfileName)
                   throws java.io.IOException
Where the token stream is translated into text and actions.

Parameters:
gdd - the GDD. Only the literals are used
htmlData - state info about the HTML file
outfileName - the file being written to
Throws:
java.io.IOException - in the event the file can't be written to

isNextTokenCr

boolean isNextTokenCr(int currTokNumber,
                      TokenList tokList)
Determines if the next token in the token list is the command [cr]

Parameters:
currTokNumber - the number of the current token
tokList - the list of tokens
Returns:
true if == [cr]; false if not, or if an error occurred.

processCommand

void processCommand(Token tok,
                    HtmlData htmlData,
                    int tokNum)
Principal method for implementing command tokens

Parameters:
tok - command token to process
htmlData - document state data
tokNum - the number of the token in the token list

errMsgUnrecognizedCommand

private void errMsgUnrecognizedCommand(Token tok,
                                       GDD gdd)
Output error message to logger for unrecognized command

Parameters:
tok - the command token
gdd - the GDD

processCompoundCommand

int processCompoundCommand(GDD gdd,
                           int startTokNumber)
Handle compount commands. Essentially, extract the individual commands and process those.

Parameters:
gdd - the GDD
startTokNumber - the number of the opening token in the compound command
Returns:
the number of tokens to skip over because they're processed here

processMacro

void processMacro()

processSymbol

void processSymbol(GDD gdd,
                   java.lang.String filename,
                   Token tok,
                   int tokNum,
                   HtmlData pdd)
             throws java.io.IOException
Process a symbol or foreign character

Parameters:
gdd - the GDD
filename - name of the output file (in the event the output file is not open yet)
tok - the Token containing the symbol info
tokNum - the number of the token
pdd - the HTML document data
Throws:
java.io.IOException - if any error occurred

processText

void processText(GDD gdd,
                 java.lang.String filename,
                 java.lang.String text)
           throws java.io.IOException
Process a token consisting of a text item

Parameters:
gdd - the GDD
filename - name of the output file (in the event the output file is not open yet
text - the text to output
Throws:
java.io.IOException - if any error occurred

escapeSpecialChars

private java.lang.String escapeSpecialChars(java.lang.String s)


Copyright © 2008-10 Pacific Data Works LLC