com.ecyrd.jspwiki.parser
Class JSPWikiMarkupParser

java.lang.Object
  extended by com.ecyrd.jspwiki.parser.MarkupParser
      extended by com.ecyrd.jspwiki.parser.JSPWikiMarkupParser

public class JSPWikiMarkupParser
extends MarkupParser

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.

Since:
2.4
Author:
Janne Jalkanen

Field Summary
static String DEFAULT_INLINEPATTERN
          The default inlining pattern.
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_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"'
 
Fields inherited from class com.ecyrd.jspwiki.parser.MarkupParser
m_attachmentLinkMutatorChain, m_context, m_engine, m_externalLinkMutatorChain, m_headingListenerChain, m_in, m_inlineImages, m_linkMutators, m_localLinkMutatorChain, m_parseAccessRules, PROP_ALLOWHTML, PROP_RUNPLUGINS, PUNCTUATION_CHARS_ALLOWED, PUSHBACK_BUFFER_SIZE
 
Constructor Summary
JSPWikiMarkupParser(WikiContext context, Reader in)
          Creates a markup parser.
 
Method Summary
static Collection getImagePatterns(WikiEngine engine)
          Figure out which image suffixes should be inlined.
static boolean isExternalLink(String link)
          Figures out if a link is an off-site link.
static Element makeError(String error)
          Writes HTML for error message.
 Element makeHeading(int level, String title, Heading hd)
          Returns XHTML for the start of the heading.
 WikiDocument parse()
          Parses the document.
 
Methods inherited from class com.ecyrd.jspwiki.parser.MarkupParser
addAttachmentLinkHook, addExternalLinkHook, addHeadingListener, addLinkTransmutator, addLocalLinkHook, cleanLink, disableAccessRules, enableImageInlining, setInputReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_INLINEIMAGEPTRN

public static final String PROP_INLINEIMAGEPTRN
This property defines the inline image pattern. It's current value is jspwiki.translatorReader.inlinePattern

See Also:
Constant Field Values

PROP_CAMELCASELINKS

public static final String PROP_CAMELCASELINKS
If true, consider CamelCase hyperlinks as well.

See Also:
Constant Field Values

PROP_PLAINURIS

public static final String PROP_PLAINURIS
If true, all hyperlinks are translated as well, regardless whether they are surrounded by brackets.

See Also:
Constant Field Values

PROP_USEOUTLINKIMAGE

public static final String PROP_USEOUTLINKIMAGE
If true, all outward links (external links) have a small link image appended.

See Also:
Constant Field Values

PROP_USEATTACHMENTIMAGE

public static final String PROP_USEATTACHMENTIMAGE
If true, all outward attachment info links have a small link image appended.

See Also:
Constant Field Values

PROP_USERELNOFOLLOW

public static final String PROP_USERELNOFOLLOW
If set to "true", all external links are tagged with 'rel="nofollow"'

See Also:
Constant Field Values

DEFAULT_INLINEPATTERN

public static final String DEFAULT_INLINEPATTERN
The default inlining pattern. Currently "*.png"

See Also:
Constant Field Values
Constructor Detail

JSPWikiMarkupParser

public JSPWikiMarkupParser(WikiContext context,
                           Reader in)
Creates a markup parser.

Method Detail

getImagePatterns

public static Collection getImagePatterns(WikiEngine engine)
Figure out which image suffixes should be inlined.

Returns:
Collection of Strings with patterns.

isExternalLink

public static boolean isExternalLink(String link)
Figures out if a link is an off-site link. This recognizes the most common protocols by checking how it starts.

Since:
2.4

makeError

public static Element makeError(String error)
Writes HTML for error message.


makeHeading

public Element makeHeading(int level,
                           String title,
                           Heading hd)
Returns XHTML for the start of the heading. Also sets the line-end emitter.

Parameters:
level -
title - the title for the heading
hd - a List to which heading should be added

parse

public WikiDocument parse()
                   throws IOException
Description copied from class: MarkupParser
Parses the document.

Specified by:
parse in class MarkupParser
Returns:
the parsed document, as a WikiDocument
Throws:
IOException