/* 
    JSPWiki - a JSP-based WikiWiki clone.

    Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package com.ecyrd.jspwiki.tags;

import java.io.IOException;
import java.io.StringReader;

import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
import com.ecyrd.jspwiki.TranslatorReader;

/**
 *  Writes the author name of the current page.
 *
 *  @author Janne Jalkanen
 *  @since 2.0
 */
public class AuthorTag
    extends WikiTagBase
{
    private static final long serialVersionUID = 0L;
    
    public final int doWikiStartTag()
        throws IOException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        WikiPage   page   = m_wikiContext.getPage();

        String author = page.getAuthor();

        if( author != null )
        {
            if( engine.pageExists(author) )
            {
                // FIXME: It's very boring to have to do this.
                //        Slow, too.

                TranslatorReader tr = new TranslatorReader( m_wikiContext, 
                                                            new StringReader("") );
                author = tr.makeLink( TranslatorReader.READ,
                                      author,
                                      author );
            }
            pageContext.getOut().print( author );

        }
        else
        {
            pageContext.getOut().print( "unknown" );
        }

        return SKIP_BODY;
    }
}

@@ -919,37 +919,8 @@
 ion;
-%0Aimport java.io.StringReader;
 %0A%0Aim
@@ -1018,77 +1018,232 @@
 iki.
-TranslatorReader;%0A%0A/**%0A *  Writes the author name of the current page
+parser.MarkupParser;%0Aimport com.ecyrd.jspwiki.parser.WikiDocument;%0Aimport com.ecyrd.jspwiki.render.RenderingManager;%0A%0A/**%0A *  Writes the author name of the current page, including a link to that page,%0A *  if that page exists
 .%0A *
@@ -1837,74 +1837,61 @@
     
-TranslatorReader t
+RenderingManager mg
 r = 
-new TranslatorReader( m_wikiContext, %0A      
+engine.getRenderingManager();%0A
     
@@ -1894,32 +1894,33 @@
                 
+%0A
                 
@@ -1923,54 +1923,85 @@
     
-                      new StringReader(%22%22)
+MarkupParser p = mgr.getParser( m_wikiContext, %22%5B%22+author+%22%7C%22+author+%22%5D%22
  );%0A
+%0A
     
@@ -2016,52 +2016,35 @@
     
-author = tr.makeLink( TranslatorReader.READ,
+WikiDocument d = p.parse();
 %0A   
@@ -2048,36 +2048,33 @@
                 
-    
+%0A
                 
@@ -2077,62 +2077,46 @@
     
-  
 author
-,%0A                                      author
+ = mgr.getHTML( m_wikiContext, d
  );%0A

Converted to new MarkupParser.