com.ecyrd.jspwiki
Class TranslatorReader

java.lang.Object
  extended by java.io.Reader
      extended by com.ecyrd.jspwiki.TranslatorReader
All Implemented Interfaces:
Closeable, Readable

Deprecated.

public class TranslatorReader
extends Reader

Handles conversion from Wiki format into fully featured HTML. This is where all the magic happens. It is CRITICAL that this class is tested, or all Wikis might die horribly.

The output of the HTML has not yet been validated against the HTML DTD. However, it is very simple.

This class is officially deprecated in 2.3, and will be replaced with a dummy class later on. Please see MarkupParser.

Author:
Janne Jalkanen

Nested Class Summary
 class TranslatorReader.TextRenderer
          Deprecated. A very simple class for outputting plain text with no formatting.
 
Field Summary
static int ATTACHMENT
          Deprecated.  
protected static int BOLD
          Deprecated.  
static String DEFAULT_INLINEPATTERN
          Deprecated. The default inlining pattern.
static int EDIT
          Deprecated.  
protected static int ITALIC
          Deprecated.  
static String PROP_ALLOWHTML
          Deprecated. If set to "true", allows using raw HTML within Wiki text.
static String PROP_CAMELCASELINKS
          Deprecated. If true, consider CamelCase hyperlinks as well.
static String PROP_INLINEIMAGEPTRN
          Deprecated. This property defines the inline image pattern.
static String PROP_PLAINURIS
          Deprecated. If true, all hyperlinks are translated as well, regardless whether they are surrounded by brackets.
static String PROP_RUNPLUGINS
          Deprecated. If set to "true", enables plugins during parsing
static String PROP_USEOUTLINKIMAGE
          Deprecated. If true, all outward links (external links) have a small link image appended.
static String PROP_USERELNOFOLLOW
          Deprecated. If set to "true", all external links are tagged with 'rel="nofollow"'
static int READ
          Deprecated.  
protected static int TYPED
          Deprecated.  
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
TranslatorReader(WikiContext context, Reader in)
          Deprecated. Creates a TranslatorReader using the default HTML renderer.
TranslatorReader(WikiContext context, Reader in, TranslatorReader.TextRenderer renderer)
          Deprecated.  
 
Method Summary
 void addAttachmentLinkHook(StringTransmutator mutator)
          Deprecated. Adds a hook for processing attachment links.
 void addExternalLinkHook(StringTransmutator mutator)
          Deprecated. Adds a hook for processing external links.
 void addHeadingListener(HeadingListener listener)
          Deprecated.  
 void addLinkTransmutator(StringTransmutator mutator)
          Deprecated. Adds a hook for processing link texts.
 void addLocalLinkHook(StringTransmutator mutator)
          Deprecated. Adds a hook for processing local links.
static String cleanLink(String link)
          Deprecated. Cleans a Wiki name.
 void close()
          Deprecated.  
 void disableAccessRules()
          Deprecated.  
 void enableImageInlining(boolean toggle)
          Deprecated. Use this to turn on or off image inlining.
 void enablePlugins(boolean toggle)
          Deprecated. Can be used to turn on plugin execution on a translator-reader basis
protected static Collection getImagePatterns(WikiEngine engine)
          Deprecated. Figure out which image suffixes should be inlined.
 String makeLink(int type, String link, String text)
          Deprecated. Write a HTMLized link depending on its type.
 int read()
          Deprecated.  
 int read(char[] buf, int off, int len)
          Deprecated.  
 boolean ready()
          Deprecated.  
 Reader setInputReader(Reader in)
          Deprecated. Replaces the current input character stream with a new one.
protected  void setRenderer(TranslatorReader.TextRenderer renderer)
          Deprecated. Sets the currently used renderer.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ

public static final int READ
Deprecated. 
See Also:
Constant Field Values

EDIT

public static final int EDIT
Deprecated. 
See Also:
Constant Field Values

ATTACHMENT

public static final int ATTACHMENT
Deprecated. 
See Also:
Constant Field Values

PROP_INLINEIMAGEPTRN

public static final String PROP_INLINEIMAGEPTRN
Deprecated. 
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
Deprecated. 
If true, consider CamelCase hyperlinks as well.

See Also:
Constant Field Values

PROP_PLAINURIS

public static final String PROP_PLAINURIS
Deprecated. 
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
Deprecated. 
If true, all outward links (external links) have a small link image appended.

See Also:
Constant Field Values

PROP_ALLOWHTML

public static final String PROP_ALLOWHTML
Deprecated. 
If set to "true", allows using raw HTML within Wiki text. Be warned, this is a VERY dangerous option to set - never turn this on in a publicly allowable Wiki, unless you are absolutely certain of what you're doing.

See Also:
Constant Field Values

PROP_USERELNOFOLLOW

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

See Also:
Constant Field Values

PROP_RUNPLUGINS

public static final String PROP_RUNPLUGINS
Deprecated. 
If set to "true", enables plugins during parsing

See Also:
Constant Field Values

DEFAULT_INLINEPATTERN

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

See Also:
Constant Field Values

BOLD

protected static final int BOLD
Deprecated. 
See Also:
Constant Field Values

ITALIC

protected static final int ITALIC
Deprecated. 
See Also:
Constant Field Values

TYPED

protected static final int TYPED
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

TranslatorReader

public TranslatorReader(WikiContext context,
                        Reader in)
Deprecated. 
Creates a TranslatorReader using the default HTML renderer.


TranslatorReader

public TranslatorReader(WikiContext context,
                        Reader in,
                        TranslatorReader.TextRenderer renderer)
Deprecated. 
Method Detail

setInputReader

public Reader setInputReader(Reader in)
Deprecated. 
Replaces the current input character stream with a new one.

Parameters:
in - New source for input. If null, this method does nothing.
Returns:
the old stream

setRenderer

protected void setRenderer(TranslatorReader.TextRenderer renderer)
Deprecated. 
Sets the currently used renderer. This method is protected because we only want to use it internally for now. The renderer interface is not yet set to stone, so it's not expected that third parties would use this.


addLinkTransmutator

public void addLinkTransmutator(StringTransmutator mutator)
Deprecated. 
Adds a hook for processing link texts. This hook is called when the link text is written into the output stream, and you may use it to modify the text. It does not affect the actual link, only the user-visible text.

Parameters:
mutator - The hook to call. Null is safe.

addLocalLinkHook

public void addLocalLinkHook(StringTransmutator mutator)
Deprecated. 
Adds a hook for processing local links. The engine transforms both non-existing and existing page links.

Parameters:
mutator - The hook to call. Null is safe.

addExternalLinkHook

public void addExternalLinkHook(StringTransmutator mutator)
Deprecated. 
Adds a hook for processing external links. This includes all http:// ftp://, etc. links, including inlined images.

Parameters:
mutator - The hook to call. Null is safe.

addAttachmentLinkHook

public void addAttachmentLinkHook(StringTransmutator mutator)
Deprecated. 
Adds a hook for processing attachment links.

Parameters:
mutator - The hook to call. Null is safe.

addHeadingListener

public void addHeadingListener(HeadingListener listener)
Deprecated. 

disableAccessRules

public void disableAccessRules()
Deprecated. 

enablePlugins

public void enablePlugins(boolean toggle)
Deprecated. 
Can be used to turn on plugin execution on a translator-reader basis


enableImageInlining

public void enableImageInlining(boolean toggle)
Deprecated. 
Use this to turn on or off image inlining.

Parameters:
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.
Since:
2.2.9

getImagePatterns

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

Returns:
Collection of Strings with patterns.

makeLink

public String makeLink(int type,
                       String link,
                       String text)
Deprecated. 
Write a HTMLized link depending on its type. The link mutator chain is processed.

Parameters:
type - Type of the link.
link - The actual link.
text - The user-visible text for the link.

cleanLink

public static String cleanLink(String link)
Deprecated. 
Cleans a Wiki name.

[ This is a link ] -> ThisIsALink

Parameters:
link - Link to be cleared. Null is safe, and causes this to return null.
Returns:
A cleaned link.
Since:
2.0

read

public int read()
         throws IOException
Deprecated. 
Overrides:
read in class Reader
Throws:
IOException

read

public int read(char[] buf,
                int off,
                int len)
         throws IOException
Deprecated. 
Specified by:
read in class Reader
Throws:
IOException

ready

public boolean ready()
              throws IOException
Deprecated. 
Overrides:
ready in class Reader
Throws:
IOException

close

public void close()
Deprecated. 
Specified by:
close in interface Closeable
Specified by:
close in class Reader