public class SplitStep extends ProcessStep
ConvertStep
) or input
semantic XHTML document (typically created using a EditStep
running "w2x:xed/main.xed") into several parts and
to save to disk the corresponding frameset.
The outline level used to split the input XHTML+CSS document is specified by parameter step_name.split-before-level. This outline level is an integer between 0 and 8 inclusive.
For an input semantic XHTML document, this outline level is an integer
between 0 (h1
) and 5 (h6
) inclusive.
Default outline level is 0.
The save file of the frameset is specified by parameter step_name.out-file.
Modifier and Type | Class and Description |
---|---|
protected static class |
SplitStep.Part |
Modifier and Type | Field and Description |
---|---|
protected static Name |
COLS_ATTR |
protected static Name |
FRAME_ELEM |
protected static Name |
FRAMESET_ELEM |
protected static Name |
SCROLLING_ATTR |
protected static String |
TOC_CSS |
stepName
Constructor and Description |
---|
SplitStep(String stepName)
Constructs a SplitStep having specified name.
|
Modifier and Type | Method and Description |
---|---|
protected SplitStep.Part |
addPart(int level,
int splitBeforeLevel,
Set<String> idUsedAsFilename,
boolean allowLonelyHeading,
Element p,
Element dstBody,
File outFile,
Document partTemplate,
List<SplitStep.Part> parts) |
protected static void |
collectCounters(Element tree,
Map<String,Integer> counterMap,
Map<String,Integer> resetCounterMap) |
protected static void |
collectIds(Element tree,
String docHref,
Map<String,String[]> idMap) |
protected void |
collectNotes(Element tree,
Map<String,Element> idToNote) |
protected void |
copyNotes(String role,
Element tree,
Element srcNotes,
Element dstNotes) |
protected void |
copyNotes2(Element tree,
Map<String,Element> idToNote,
int[] noteCount,
Element dstBody) |
protected static Element |
createCharsetMeta(String charset) |
protected Document |
createFrameset(Document xhtmlDoc,
String charset,
String tocHref,
String contentHref) |
protected Document |
createPartTemplate(Document xhtmlDoc) |
protected Element |
createTOCStyle(List<SplitStep.Part> parts) |
protected static void |
creatingFile(File file,
ProgressMonitor monitor) |
protected void |
deleteNotes(Element tree) |
protected static Element |
findById(Element tree,
String id) |
protected static String |
findCharset(Document doc) |
protected static Element |
findCharsetMeta(Element head,
String[] foundCharset) |
protected static Element |
findNotes(String role,
Element body) |
protected static SplitStep.Part |
findParentPart(List<SplitStep.Part> parts) |
protected static Element |
findTitle(Document doc) |
protected static void |
fixLinks(Element tree,
String docHref,
Map<String,String[]> idMap) |
protected static String |
getAllText(Element tree,
boolean collapseWhiteSpace) |
protected static Element |
getBoxFirstChildElement(Element element) |
protected static int |
getOutlineLevel(Element element) |
protected static boolean |
isNote(Element element) |
protected static boolean |
isNoteRef(Element element) |
protected static boolean |
isNoteSeparator(Element element) |
protected File |
newOutFile(File file,
int partNum) |
protected static File |
newOutFile(File file,
String suffix) |
protected static Object[] |
parseCounterPI(Element p,
ProcessingInstruction[] counterPI) |
protected static void |
parseCounterReset(String prop,
Map<String,Integer> counterMap) |
void |
process(Object[] state,
Map<String,String> parameters,
int[] stepCounter,
ProgressMonitor monitor)
Execute this processing step.
|
protected void |
processCounters(List<SplitStep.Part> parts) |
protected void |
processLinks(List<SplitStep.Part> parts) |
protected void |
processNotes(List<SplitStep.Part> parts,
Document htmlDoc) |
protected void |
processNotes2(Element srcBody,
List<SplitStep.Part> parts,
Document htmlDoc) |
protected void |
processParts(List<SplitStep.Part> parts,
Document htmlDoc) |
protected static String |
resetCounters(Map<String,Integer> counterMap,
Map<String,Integer> resetCounterMap) |
protected void |
saveDocument(Document doc,
boolean indent,
String encoding,
File file,
ProgressMonitor monitor) |
protected void |
saveParts(List<SplitStep.Part> parts,
boolean indent,
String encoding,
File outFile,
ProgressMonitor monitor) |
protected static void |
setNotes(String role,
Element newNotes,
Element body) |
protected void |
splitDocument(Document xhtmlDoc,
int splitBeforeLevel,
Set<String> idUsedAsFilename,
boolean allowLonelyHeading,
File outFile,
List<SplitStep.Part> parts,
ProgressMonitor monitor) |
protected Document |
toTOC(List<SplitStep.Part> parts,
String charset) |
protected boolean |
useSameChunk(boolean allowLonelyHeading,
Element dstBody) |
debugParameters, equals, getAllParameters, getBooleanParameter, getFileParameter, getIntParameter, getParameter, getURLParameter, hashCode, illegalState, joinAllParameters, missingParameter, parameterName, progress, toString, urlOrFile
protected static final Name FRAMESET_ELEM
protected static final Name FRAME_ELEM
protected static final Name COLS_ATTR
protected static final Name SCROLLING_ATTR
protected static final String TOC_CSS
public SplitStep(String stepName)
public void process(Object[] state, Map<String,String> parameters, int[] stepCounter, ProgressMonitor monitor) throws Exception
state[0]
contains:
ConvertStep
).
process
in class ProcessStep
state
- contains the current state of processing:
a Document
or a File
.
This object is used as the input of this step and thus, is processed by this step.
After its execution, this method generally updates
the state array with a new Document
or File
to pass the result/output of this step to the next step.
parameters
- all the parameters passed to the Processor
owning and thus executing this process step.
Parameters which are relevant to this processing step are prefixed
with "ProcessStep.stepName
.".
stepCounter
- contains the rank of previously executed
processing step. Must be incremented by this method.monitor
- used to monitor the progress of the processing steps
Invoking convenience method ProcessStep.progress(java.lang.String, int[], com.xmlmind.util.ProgressMonitor)
suffices to
make good use of both monitor and stepCounter.
Exception
- if for any reason, this method failsprotected void splitDocument(Document xhtmlDoc, int splitBeforeLevel, Set<String> idUsedAsFilename, boolean allowLonelyHeading, File outFile, List<SplitStep.Part> parts, ProgressMonitor monitor) throws Exception
Exception
protected static final int getOutlineLevel(Element element)
protected Document createPartTemplate(Document xhtmlDoc) throws Exception
Exception
protected SplitStep.Part addPart(int level, int splitBeforeLevel, Set<String> idUsedAsFilename, boolean allowLonelyHeading, Element p, Element dstBody, File outFile, Document partTemplate, List<SplitStep.Part> parts)
protected static final Object[] parseCounterPI(Element p, ProcessingInstruction[] counterPI)
protected static final SplitStep.Part findParentPart(List<SplitStep.Part> parts)
protected boolean useSameChunk(boolean allowLonelyHeading, Element dstBody)
protected void processParts(List<SplitStep.Part> parts, Document htmlDoc)
protected void processCounters(List<SplitStep.Part> parts)
protected static final void parseCounterReset(String prop, Map<String,Integer> counterMap)
protected static final void collectCounters(Element tree, Map<String,Integer> counterMap, Map<String,Integer> resetCounterMap)
protected static final String resetCounters(Map<String,Integer> counterMap, Map<String,Integer> resetCounterMap)
protected void processNotes(List<SplitStep.Part> parts, Document htmlDoc)
protected void processNotes2(Element srcBody, List<SplitStep.Part> parts, Document htmlDoc)
protected void deleteNotes(Element tree)
protected static final boolean isNote(Element element)
protected static final boolean isNoteSeparator(Element element)
protected void copyNotes2(Element tree, Map<String,Element> idToNote, int[] noteCount, Element dstBody)
protected static final boolean isNoteRef(Element element)
protected void processLinks(List<SplitStep.Part> parts)
protected static final void collectIds(Element tree, String docHref, Map<String,String[]> idMap)
protected static final void fixLinks(Element tree, String docHref, Map<String,String[]> idMap)
protected void saveParts(List<SplitStep.Part> parts, boolean indent, String encoding, File outFile, ProgressMonitor monitor) throws Exception
Exception
protected void saveDocument(Document doc, boolean indent, String encoding, File file, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected static final void creatingFile(File file, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected Document toTOC(List<SplitStep.Part> parts, String charset)
protected Element createTOCStyle(List<SplitStep.Part> parts)
protected Document createFrameset(Document xhtmlDoc, String charset, String tocHref, String contentHref)