|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gate.yam.convert.JSPWikiMarkupParser
public class JSPWikiMarkupParser
Parses JSPWiki-style markup into a WikiDocument DOM tree. This class is the heart and soul of JSPWiki : make sure you test properly anything that is added, or else it breaks down horribly.
Field Summary | |
---|---|
static String |
CLASS_EDITPAGE
The value for anchor element class attributes when used for edit page links. |
static String |
CLASS_INTERWIKI
The value for anchor element class attributes when used for interwiki page links. |
static String |
CLASS_WIKIPAGE
The value for anchor element class attributes when used for wiki page (normal) links. |
static String |
DEFAULT_INLINEPATTERN
The default inlining pattern. |
protected ArrayList |
m_attachmentLinkMutatorChain
|
protected ArrayList |
m_externalLinkMutatorChain
|
protected ArrayList |
m_headingListenerChain
|
protected PushbackReader |
m_in
|
protected boolean |
m_inlineImages
|
protected ArrayList |
m_linkMutators
|
protected ArrayList |
m_localLinkMutatorChain
Optionally stores internal wikilinks |
protected boolean |
m_parseAccessRules
|
static String |
PROP_ALLOWHTML
If set to "true", allows using raw HTML within Wiki text. |
static String |
PROP_CAMELCASELINKS
If true, consider CamelCase hyperlinks as well. |
static String |
PROP_INLINEIMAGEPTRN
This property defines the inline image pattern. |
static String |
PROP_PLAINURIS
If true, all hyperlinks are translated as well, regardless whether they are surrounded by brackets. |
static String |
PROP_RUNPLUGINS
If set to "true", enables plugins during parsing |
static String |
PROP_USEATTACHMENTIMAGE
If true, all outward attachment info links have a small link image appended. |
static String |
PROP_USEOUTLINKIMAGE
If true, all outward links (external links) have a small link image appended. |
static String |
PROP_USERELNOFOLLOW
If set to "true", all external links are tagged with 'rel="nofollow"' |
protected static String |
PUNCTUATION_CHARS_ALLOWED
Lists all punctuation characters allowed in WikiMarkup. |
protected static int |
PUSHBACK_BUFFER_SIZE
Allow this many characters to be pushed back in the stream. |
Constructor Summary | |
---|---|
JSPWikiMarkupParser(Reader in)
Creates a markup parser. |
Method Summary | |
---|---|
static String |
cleanLink(String link)
Cleans a Wiki name. |
void |
disableAccessRules()
|
void |
enableImageInlining(boolean toggle)
Use this to turn on or off image inlining. |
static boolean |
getBooleanProperty(Properties props,
String key,
boolean defval)
Gets a boolean property from a standard Properties list. |
static Collection |
getImagePatterns()
Figure out which image suffixes should be inlined. |
int |
getPosition()
Return the current position in the reader stream. |
static boolean |
isExternalLink(String link)
Figures out if a link is an off-site link. |
static boolean |
isNumber(String s)
Returns true, if the argument contains a number, otherwise false. |
static boolean |
isPositive(String val)
Returns true, if the string "val" denotes a positive string. |
static org.jdom.Element |
makeError(String error)
Writes HTML for error message. |
org.jdom.Element |
makeHeading(int level,
String pageName,
String title,
gate.yam.convert.JSPWikiMarkupParser.Heading hd)
Returns XHTML for the start of the heading. |
protected int |
nextToken()
|
org.jdom.Document |
parse()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int PUSHBACK_BUFFER_SIZE
protected PushbackReader m_in
protected ArrayList m_localLinkMutatorChain
protected ArrayList m_externalLinkMutatorChain
protected ArrayList m_attachmentLinkMutatorChain
protected ArrayList m_headingListenerChain
protected ArrayList m_linkMutators
protected boolean m_inlineImages
protected boolean m_parseAccessRules
public static final String PROP_ALLOWHTML
public static final String PROP_RUNPLUGINS
protected static final String PUNCTUATION_CHARS_ALLOWED
public static final String CLASS_WIKIPAGE
public static final String CLASS_EDITPAGE
public static final String CLASS_INTERWIKI
public static final String PROP_INLINEIMAGEPTRN
public static final String PROP_CAMELCASELINKS
public static final String PROP_PLAINURIS
public static final String PROP_USEOUTLINKIMAGE
public static final String PROP_USEATTACHMENTIMAGE
public static final String PROP_USERELNOFOLLOW
public static final String DEFAULT_INLINEPATTERN
Constructor Detail |
---|
public JSPWikiMarkupParser(Reader in)
Method Detail |
---|
public Reader setInputReader(Reader in)
in
- New source for input. If null, this method does nothing.
public void disableAccessRules()
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 int getPosition()
protected int nextToken() throws IOException
IOException
protected void pushBack(int c) throws IOException
IOException
public static String cleanLink(String link)
[ This is a link ] -> ThisIsALink
link
- Link to be cleared. Null is safe, and causes this to return null.
public static Collection getImagePatterns()
public static boolean isExternalLink(String link)
public static boolean getBooleanProperty(Properties props, String key, boolean defval)
The possible values for the property are "true"/"false", "yes"/"no", or "on"/"off". Any value not recognized is always defined as "false".
props
- A list of properties to search.key
- The property key.defval
- The default value to return.
public static boolean isPositive(String val)
val
- Value to check.
public static boolean isNumber(String s)
public static org.jdom.Element makeError(String error)
public org.jdom.Element makeHeading(int level, String pageName, String title, gate.yam.convert.JSPWikiMarkupParser.Heading hd)
level
- title
- the title for the headinghd
- a List to which heading should be addedpublic org.jdom.Document parse() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |