|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tinyjee.maven.dim.sh.CodeHighlighter
public class CodeHighlighter
Performs code highlighting on the provided source before writing it to the Sink.
| Constructor Summary | |
|---|---|
CodeHighlighter()
|
|
| Method Summary | |
|---|---|
boolean |
attachStylesheet(Sink sink,
Map requestParameters)
Attaches the cascading stylesheet required to do code highlighting to the sink. |
Map<String,String> |
buildHighlighterParams(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
Builds a map of params that can be passed to the SyntaxHighlighter library. |
void |
execute(URL source,
Map requestParameters,
Map<Integer,List<String>> sourceLines,
Sink sink)
Processes the given source lines and writes the results into the sink. |
protected String |
findBrushAlias(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
Finds the name of the code highlighter to use. |
String |
findBrushName(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
Finds the name of the code highlighter to use. |
String |
highlight(Map<Integer,List<String>> sourceLines,
int firstLine,
String brushName,
Map<String,String> params)
Hightlights the given source lines using HTML markup. |
String |
highlight(String brushName,
String sourceContent,
Map<String,String> params)
|
protected boolean |
isCodeSurroundedByHTML(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
Returns true if the source content is HTML with embedded source code of another language. |
protected String |
removeLines(String content,
Collection<Integer> linesToRemove)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CodeHighlighter()
| Method Detail |
|---|
public String highlight(String brushName,
String sourceContent,
Map<String,String> params)
brushName - sourceContent - params -
public String highlight(Map<Integer,List<String>> sourceLines,
int firstLine,
String brushName,
Map<String,String> params)
sourceLines - a map of first-line number to lines.firstLine - set to >= 0 to adjust the first line index.brushName - the name of the brush used for code highlighting, e.g. "java".params - any params to pass to the highlighting library.
public boolean attachStylesheet(Sink sink,
Map requestParameters)
throws IOException
sink - the sink to operate on, may be 'null' to use the global default.requestParameters - the request parameters that may modify the style selection.
IOException - In case of writing the attachment failed.
public void execute(URL source,
Map requestParameters,
Map<Integer,List<String>> sourceLines,
Sink sink)
throws IOException
source - The source URL used to obtain the content (can be 'null').sourceLines - a map of first line number to lines mapping.requestParameters - the original request params.sink - the target sink to write to.
IOException - in case of the process fails.
public String findBrushName(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
source - the source URL.sourceLines - the source content.requestParameters - the request parameters of the macro request.
protected String findBrushAlias(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
source - the source URL.sourceLines - the source content.requestParameters - the request parameters of the macro request.
protected boolean isCodeSurroundedByHTML(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
source - the source URL.sourceLines - the source content.requestParameters - the request parameters of the macro request.
public Map<String,String> buildHighlighterParams(URL source,
Map<Integer,List<String>> sourceLines,
Map requestParameters)
source - the source URL.sourceLines - the source content.requestParameters - the request parameters of the macro request.
protected String removeLines(String content,
Collection<Integer> linesToRemove)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||