public abstract class MarkupParser extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static String | CLASS_ATTACHMENTThe value for anchor element class attributes when used
 for attachments. | 
| static String | CLASS_EDITPAGEThe value for anchor element class attributes when used
 for edit page links. | 
| static String | CLASS_EXTERNALThe value for anchor element class attributes when used
 for external links. | 
| static String | CLASS_FOOTNOTEThe value for anchor element class attributes when used
 for footnote links. | 
| static String | CLASS_FOOTNOTE_REFThe value for anchor element class attributes when used
 for footnote links. | 
| static String | CLASS_INTERWIKIThe value for anchor element class attributes when used
 for interwiki page links. | 
| static String[] | CLASS_TYPES | 
| static String | CLASS_WIKIPAGEThe value for anchor element class attributes when used
 for wiki page (normal) links. | 
| static String | HASHLINK | 
| protected static String | LEGACY_CHARS_ALLOWEDLists all punctuation characters allowed in WikiMarkup. | 
| protected ArrayList<StringTransmutator> | m_attachmentLinkMutatorChain | 
| protected WikiContext | m_context | 
| protected WikiEngine | m_engine | 
| protected ArrayList<StringTransmutator> | m_externalLinkMutatorChain | 
| protected ArrayList<HeadingListener> | m_headingListenerChain | 
| protected PushbackReader | m_in | 
| protected List<org.apache.oro.text.regex.Pattern> | m_inlineImagePatternsKeeps image regexp Patterns | 
| protected boolean | m_inlineImages | 
| protected ArrayList<StringTransmutator> | m_linkMutators | 
| protected LinkParsingOperations | m_linkParsingOperations | 
| protected ArrayList<StringTransmutator> | m_localLinkMutatorChainOptionally stores internal wikilinks | 
| protected boolean | m_parseAccessRules | 
| static String | OUTLINKOutlink css class. | 
| static String | OUTLINK_IMAGEName of the outlink image; relative path to the JSPWiki directory. | 
| static String | PROP_ALLOWHTMLIf set to "true", allows using raw HTML within Wiki text. | 
| static String | PROP_RUNPLUGINSIf set to "true", enables plugins during parsing | 
| static String | PROP_USEOUTLINKIMAGEIf true, all outward links (external links) have a small link image appended. | 
| static String | PROP_USERELNOFOLLOWIf set to "true", all external links are tagged with 'rel="nofollow"' | 
| static String | PUNCTUATION_CHARS_ALLOWEDLists all punctuation characters allowed in page names. | 
| protected static int | PUSHBACK_BUFFER_SIZEAllow this many characters to be pushed back in the stream. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | MarkupParser(WikiContext context,
            Reader in)Constructs a MarkupParser. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAttachmentLinkHook(StringTransmutator mutator)Adds a hook for processing attachment links. | 
| void | addExternalLinkHook(StringTransmutator mutator)Adds a hook for processing external links. | 
| void | addHeadingListener(HeadingListener listener)Adds a HeadingListener to the parser chain. | 
| void | addLinkTransmutator(StringTransmutator mutator)Adds a hook for processing link texts. | 
| void | addLocalLinkHook(StringTransmutator mutator)Adds a hook for processing local links. | 
| static String | cleanLink(String link)Cleans a Wiki name. | 
| static String | cleanLink(String link,
         String allowedChars)Cleans a Wiki name based on a list of characters. | 
| void | disableAccessRules()Disables access rule parsing. | 
| void | enableImageInlining(boolean toggle)Use this to turn on or off image inlining. | 
| List<org.apache.oro.text.regex.Pattern> | getInlineImagePatterns() | 
| int | getPosition()Return the current position in the reader stream. | 
| protected void | initInlineImagePatterns() | 
| boolean | isImageInlining() | 
| boolean | isParseAccessRules() | 
| static org.jdom2.Element | makeError(String error)Writes HTML for error message. | 
| protected int | nextToken()Returns the next token in the stream. | 
| abstract WikiDocument | parse()Parses the document. | 
| protected void | pushBack(int c)Push back any character to the current input. | 
| Reader | setInputReader(Reader in)Replaces the current input character stream with a new one. | 
| static String | wikifyLink(String link)Cleans away extra legacy characters. | 
protected static final int PUSHBACK_BUFFER_SIZE
protected PushbackReader m_in
protected WikiEngine m_engine
protected WikiContext m_context
protected ArrayList<StringTransmutator> m_localLinkMutatorChain
protected ArrayList<StringTransmutator> m_externalLinkMutatorChain
protected ArrayList<StringTransmutator> m_attachmentLinkMutatorChain
protected ArrayList<HeadingListener> m_headingListenerChain
protected ArrayList<StringTransmutator> m_linkMutators
protected boolean m_inlineImages
protected boolean m_parseAccessRules
protected List<org.apache.oro.text.regex.Pattern> m_inlineImagePatterns
protected LinkParsingOperations m_linkParsingOperations
public static final String PROP_ALLOWHTML
public static final String PROP_RUNPLUGINS
protected static final String LEGACY_CHARS_ALLOWED
public static final String PUNCTUATION_CHARS_ALLOWED
public static final String HASHLINK
public static final String OUTLINK_IMAGE
public static final String OUTLINK
public static final String PROP_USEOUTLINKIMAGE
public static final String PROP_USERELNOFOLLOW
public static final String CLASS_WIKIPAGE
public static final String CLASS_EDITPAGE
public static final String CLASS_INTERWIKI
public static final String CLASS_FOOTNOTE
public static final String CLASS_FOOTNOTE_REF
public static final String CLASS_EXTERNAL
public static final String CLASS_ATTACHMENT
public static final String[] CLASS_TYPES
protected MarkupParser(WikiContext context, Reader in)
context - The WikiContext.in - The reader from which we are reading the bytes from.public Reader setInputReader(Reader in)
in - New source for input.  If null, this method does nothing.public void addLinkTransmutator(StringTransmutator mutator)
mutator - The hook to call.  Null is safe.public void addLocalLinkHook(StringTransmutator mutator)
mutator - The hook to call.  Null is safe.public void addExternalLinkHook(StringTransmutator mutator)
mutator - The hook to call.  Null is safe.public void addAttachmentLinkHook(StringTransmutator mutator)
mutator - The hook to call.  Null is safe.public void addHeadingListener(HeadingListener listener)
listener - The listener to add.public void disableAccessRules()
public boolean isParseAccessRules()
public void enableImageInlining(boolean toggle)
toggle - If true, images are inlined (as per set in jspwiki.properties)
                If false, then images won't be inlined; instead, they will be
                treated as standard hyperlinks.public boolean isImageInlining()
protected final void initInlineImagePatterns()
public List<org.apache.oro.text.regex.Pattern> getInlineImagePatterns()
public abstract WikiDocument parse() throws IOException
IOException - If something goes wrong.public int getPosition()
protected final int nextToken() throws IOException, NullPointerException
IOException - If something bad happensNullPointerException - If you have not yet created an input document.protected void pushBack(int c) throws IOException
c - Character to push back.IOException - In case the character cannot be pushed back.public static org.jdom2.Element makeError(String error)
error - The error string.public static String cleanLink(String link)
[ This is a link ] -> This is a link
link - Link to be cleared. Null is safe, and causes this to return null.public static String cleanLink(String link, String allowedChars)
link - Link to be cleared. Null is safe, and causes this to return null.allowedChars - Characters which are allowed in the string.public static String wikifyLink(String link)
[ This is a link ] -> ThisIsALink
link - Link to be cleared. Null is safe, and causes this to return null.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.