org.teleal.lemma.processor.xhtml
Class TocProcessor

java.lang.Object
  extended by org.teleal.lemma.processor.AbstractProcessor<org.teleal.common.xhtml.XHTML,org.teleal.common.xhtml.XHTML>
      extended by org.teleal.lemma.processor.xhtml.TocProcessor
All Implemented Interfaces:
Processor<org.teleal.common.xhtml.XHTML,org.teleal.common.xhtml.XHTML>

public class TocProcessor
extends AbstractProcessor<org.teleal.common.xhtml.XHTML,org.teleal.common.xhtml.XHTML>

Replaces toc anchors with a generated table-of-contents.

The table-of-contents is generated by discovering all containers in an XHTML document which are classed as a TocProcessor.SectionType. Depending on their nesting level in the document (and not their name - all are equal), they are added to the table-of-contents.

Author:
Christian Bauer

Nested Class Summary
static class TocProcessor.SectionType
           
protected  class TocProcessor.TocItem
           
 
Field Summary
static String SECTION_ELEMENT
           
static String TYPE_TOC
           
static String TYPE_TOC_ITEM
           
static String TYPE_TOC_ITEM_LEVEL
           
static String TYPE_TOC_ITEM_PREFIX
           
 
Fields inherited from class org.teleal.lemma.processor.AbstractProcessor
READER_SUFFIX_MAP
 
Constructor Summary
TocProcessor()
           
 
Method Summary
protected  void addChildTocItems(TocProcessor.TocItem currentTocItem, org.teleal.common.xhtml.XHTMLElement currentElement)
           
protected  org.teleal.common.xhtml.XHTML addTableOfContents(org.teleal.common.xhtml.XHTML input, Context context)
           
protected  String findNearestIdentifier(org.teleal.common.xhtml.XHTMLElement sectionElement)
           
protected  org.teleal.common.xhtml.XHTMLElement findNearestTitleElement(org.teleal.common.xhtml.XHTMLElement sectionElement)
           
protected  org.teleal.common.xhtml.XHTML generateToc(TocProcessor.TocItem root)
           
 org.teleal.common.xhtml.XHTML process(org.teleal.common.xhtml.XHTML input, Context context)
           
 
Methods inherited from class org.teleal.lemma.processor.AbstractProcessor
getParser, getReader, getXPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_TOC

public static final String TYPE_TOC
See Also:
Constant Field Values

TYPE_TOC_ITEM

public static final String TYPE_TOC_ITEM
See Also:
Constant Field Values

TYPE_TOC_ITEM_PREFIX

public static final String TYPE_TOC_ITEM_PREFIX
See Also:
Constant Field Values

TYPE_TOC_ITEM_LEVEL

public static final String TYPE_TOC_ITEM_LEVEL
See Also:
Constant Field Values

SECTION_ELEMENT

public static final String SECTION_ELEMENT
See Also:
Constant Field Values
Constructor Detail

TocProcessor

public TocProcessor()
Method Detail

process

public org.teleal.common.xhtml.XHTML process(org.teleal.common.xhtml.XHTML input,
                                             Context context)

addTableOfContents

protected org.teleal.common.xhtml.XHTML addTableOfContents(org.teleal.common.xhtml.XHTML input,
                                                           Context context)

addChildTocItems

protected void addChildTocItems(TocProcessor.TocItem currentTocItem,
                                org.teleal.common.xhtml.XHTMLElement currentElement)

findNearestIdentifier

protected String findNearestIdentifier(org.teleal.common.xhtml.XHTMLElement sectionElement)

findNearestTitleElement

protected org.teleal.common.xhtml.XHTMLElement findNearestTitleElement(org.teleal.common.xhtml.XHTMLElement sectionElement)

generateToc

protected org.teleal.common.xhtml.XHTML generateToc(TocProcessor.TocItem root)


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.