org.jboss.highlight.renderer
Class JavaXhtmlRenderer

java.lang.Object
  extended by com.uwyn.jhighlight.renderer.XhtmlRenderer
      extended by org.jboss.highlight.renderer.JavaXhtmlRenderer
All Implemented Interfaces:
com.uwyn.jhighlight.renderer.Renderer

public class JavaXhtmlRenderer
extends com.uwyn.jhighlight.renderer.XhtmlRenderer

Generates highlighted syntax in XHTML from Java source.

Since:
1.0
Version:
$Revision$
Author:
Geert Bevin (gbevin[remove] at uwyn dot com), Mark Newton (mark.newton@jboss.org)

Field Summary
static java.util.HashMap DEFAULT_CSS
           
 
Constructor Summary
JavaXhtmlRenderer()
           
 
Method Summary
protected  java.lang.String getCssClass(int style)
           
protected  java.util.Map getDefaultCssStyles()
           
protected  com.uwyn.jhighlight.highlighter.ExplicitStateHighlighter getHighlighter()
           
 void highlight(java.lang.String name, java.io.InputStream in, java.io.OutputStream out, java.lang.String encoding, boolean fragment)
          Transforms source code that's provided through an InputStream to highlighted syntax in XHTML and writes it back to an OutputStream.
 
Methods inherited from class com.uwyn.jhighlight.renderer.XhtmlRenderer
getCssClassDefinitions, getXhtmlFooter, getXhtmlHeader, getXhtmlHeaderFragment, highlight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CSS

public static final java.util.HashMap DEFAULT_CSS
Constructor Detail

JavaXhtmlRenderer

public JavaXhtmlRenderer()
Method Detail

highlight

public void highlight(java.lang.String name,
                      java.io.InputStream in,
                      java.io.OutputStream out,
                      java.lang.String encoding,
                      boolean fragment)
               throws java.io.IOException
Transforms source code that's provided through an InputStream to highlighted syntax in XHTML and writes it back to an OutputStream.

If the highlighting has to become a fragment, no CSS styles will be generated.

For complete documents, there's a collection of default styles that will be included. It's possible to override these by changing the provided jhighlight.properties file. It's best to look at this file in the JHighlight archive and modify the styles that are there already.

Specified by:
highlight in interface com.uwyn.jhighlight.renderer.Renderer
Overrides:
highlight in class com.uwyn.jhighlight.renderer.XhtmlRenderer
Parameters:
name - The name of the source file.
in - The input stream that provides the source code that needs to be transformed.
out - The output stream to which to resulting XHTML should be written.
encoding - The encoding that will be used to read and write the text.
fragment - true if the generated XHTML should be a fragment; or false if it should be a complete page
Throws:
java.io.IOException
Since:
1.0
See Also:
XhtmlRenderer.highlight(String, String, String, boolean)

getDefaultCssStyles

protected java.util.Map getDefaultCssStyles()
Specified by:
getDefaultCssStyles in class com.uwyn.jhighlight.renderer.XhtmlRenderer

getCssClass

protected java.lang.String getCssClass(int style)
Specified by:
getCssClass in class com.uwyn.jhighlight.renderer.XhtmlRenderer

getHighlighter

protected com.uwyn.jhighlight.highlighter.ExplicitStateHighlighter getHighlighter()
Specified by:
getHighlighter in class com.uwyn.jhighlight.renderer.XhtmlRenderer


Copyright © 2009 JBoss.org. All Rights Reserved.