public class DefinitionEnhancementHandler extends AbstractEnhancementHandler implements Component, Serviceable, Contextualizable
Modifier and Type | Field and Description |
---|---|
private static Set<String> |
__IGNORE_NAMESPACES
The namespaces in which to ignore the glossary words.
|
private static Set<String> |
__IGNORE_TAGS
The tags in which to ignore the glossary words.
|
protected Context |
_context
The avalon context.
|
protected Map<String,Definition> |
_definitions
The word definitions.
|
protected String |
_glossaryHref
The glossary page href.
|
protected Map<String,Integer> |
_ignoredNamespaceStack
Ignored namespace stack.
|
private int |
_inIgnoredTag
True if we are processing a paragraph, false otherwise.
|
private RenderingContextHandler |
_renderingContextHandler |
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected SiteManager |
_siteManager
The site manager
|
protected URIResolverExtensionPoint |
_uriResolver
The page URI resolver.
|
static String |
ROLE
The Avalon role.
|
_contentHandler, _inUnmodifiableContent, _lexicalHandler, PROCESSING_INSTRUCTION_UNMODIFIABLE
Constructor and Description |
---|
DefinitionEnhancementHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
_charactersWithDefinitions(char[] ch,
int start,
int length,
Content content)
SAX characters, generating definition tags on words that are present in the glossary.
|
protected Map<String,Definition> |
_getDefinitions(String siteName,
String lang)
Get all the words with definitions to display.
|
protected Page |
_getGlossaryPage(String siteName,
String language)
Get the glossary page in a given site and language.
|
protected String |
_getGlossaryPageHref(String siteName,
String language)
Get the glossary page in a given site and language.
|
protected Map<String,Definition> |
_getWordsAndDefinitions(String siteName,
String lang)
Get all the words with definitions to display.
|
protected Pattern |
_getWordsPattern(Set<String> words)
Get a regexp that matches any of the definition words.
|
protected boolean |
_searchCharacters()
Test if the currently processed characters have to be searched for glossary words or ignored.
|
void |
characters(char[] ch,
int start,
int length) |
void |
contextualize(Context context) |
void |
endElement(String uri,
String localName,
String qName) |
void |
service(ServiceManager serviceManager) |
void |
startDocument() |
void |
startElement(String uri,
String localName,
String qName,
Attributes atts) |
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, saxError, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMapping
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final Set<String> __IGNORE_TAGS
private static final Set<String> __IGNORE_NAMESPACES
protected AmetysObjectResolver _resolver
protected SiteManager _siteManager
protected URIResolverExtensionPoint _uriResolver
protected Map<String,Definition> _definitions
protected String _glossaryHref
protected Map<String,Integer> _ignoredNamespaceStack
private int _inIgnoredTag
private RenderingContextHandler _renderingContextHandler
public DefinitionEnhancementHandler()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class AbstractEnhancementHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class AbstractEnhancementHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class AbstractEnhancementHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class AbstractEnhancementHandler
SAXException
protected boolean _searchCharacters()
protected void _charactersWithDefinitions(char[] ch, int start, int length, Content content) throws SAXException
ch
- the characters from the XML document.start
- the start position in the array.length
- the number of characters to read from the array.content
- the content.SAXException
- if an error occurs generating the XML.protected Map<String,Definition> _getDefinitions(String siteName, String lang)
siteName
- the site name.lang
- the language.protected Map<String,Definition> _getWordsAndDefinitions(String siteName, String lang)
siteName
- the site name.lang
- the language.protected Pattern _getWordsPattern(Set<String> words)
words
- the words.protected String _getGlossaryPageHref(String siteName, String language)
siteName
- the site name.language
- the language.protected Page _getGlossaryPage(String siteName, String language)
siteName
- the site name.language
- the language.