org.mmbase.util.transformers
Class LinkFinder

java.lang.Object
  extended byorg.mmbase.util.transformers.ReaderTransformer
      extended byorg.mmbase.util.transformers.LinkFinder
All Implemented Interfaces:
CharTransformer, Transformer

public class LinkFinder
extends ReaderTransformer
implements CharTransformer

Finds links in the Character String, and makes them 'clickable' for HTML (using a-tags). This implementation is very simple and straightforward. It contains a list of regular expression which are matched on all 'words'. It ignores existing XML markup, and also avoids trailing dots and comments and surrounding quotes and parentheses.

Since:
MMBase-1.7
Author:
Michiel Meeuwissen

Field Summary
protected static java.util.Map urlPatterns
           
 
Constructor Summary
LinkFinder()
           
 
Method Summary
protected  boolean link(java.lang.StringBuffer word, java.io.Writer writer)
          Takes one word (as a StringBuffer), checks if it can be made clickable, and if so, does it.
 java.lang.String toString()
           
 java.io.Writer transform(java.io.Reader r, java.io.Writer w)
           
 
Methods inherited from class org.mmbase.util.transformers.ReaderTransformer
transform, transform, transformBack, transformBack, transformBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.transformers.CharTransformer
transform, transform, transformBack, transformBack, transformBack
 

Field Detail

urlPatterns

protected static java.util.Map urlPatterns
Constructor Detail

LinkFinder

public LinkFinder()
Method Detail

link

protected boolean link(java.lang.StringBuffer word,
                       java.io.Writer writer)
                throws java.io.IOException
Takes one word (as a StringBuffer), checks if it can be made clickable, and if so, does it.

Returns:
true if a replacement occured
Throws:
java.io.IOException

transform

public java.io.Writer transform(java.io.Reader r,
                                java.io.Writer w)
Specified by:
transform in interface CharTransformer
Specified by:
transform in class ReaderTransformer

toString

public java.lang.String toString()
Specified by:
toString in interface Transformer


MMBase build 1.7.1.20041002