jetbrains.buildServer.web.util
Class ColorerSyntaxHighlighter

java.lang.Object
  extended by jetbrains.buildServer.web.util.ColorerSyntaxHighlighter

@NonNls
public class ColorerSyntaxHighlighter
extends java.lang.Object

Highlights source code using JHighlight library. JHighlight supports a rather limited set of languages, so many languages are highlighted on the client-side with a JS library.


Constructor Summary
ColorerSyntaxHighlighter()
           
 
Method Summary
static java.lang.String getStyle(java.lang.String name)
          Returns the style that needs to be embedded in result HTML.
static java.lang.String highlight(java.lang.String source, java.lang.String name)
          Highlight source and output as styled HTML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorerSyntaxHighlighter

public ColorerSyntaxHighlighter()
Method Detail

highlight

@Nullable
public static java.lang.String highlight(@NotNull
                                                  java.lang.String source,
                                                  @NotNull
                                                  java.lang.String name)
                                  throws java.io.IOException
Highlight source and output as styled HTML

Parameters:
source - text
name - source file name to help deduce language
Returns:
styled HTML, or null
Throws:
java.io.IOException - if I/O error occurs

getStyle

@NotNull
public static java.lang.String getStyle(@NotNull
                                                java.lang.String name)
Returns the style that needs to be embedded in result HTML. Currently needed only if JHighlight engine is turned on.

Parameters:
name - the file name to help deduce language
Returns:
the required style