|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tinyjee.maven.dim.sources.AbstractParametricVelocityTool<VelocityHighlightingTool> org.tinyjee.maven.dim.sources.VelocityHighlightingTool
@DefaultKey(value="highlighter") public class VelocityHighlightingTool
Implements a custom velocity tool that can be used to trigger code highlighting within templates.
Usage within a template:
Highlighted content: $highlighter.highlight("public class MyClass {...}")
Quick Example - Embed the comment of a class with all code blocks (<code><pre>) being highlighted:
%{include|source-content=$highlighter.highlightCodeBlocks($comment)|source-java=my.package.MyClass}
Reference:$highlighter.java("..java-code...")
$highlighter.js("..js-code...")
$highlighter.xml("..xml-code...")
$highlighter.css("..css-code...")
$highlighter.jsp("..jsp-code...")
$highlighter.highlight("..autodetect-code...")
$highlighter.highlight("..brush-name..e.g. 'java'", "..code...")
$highlighter.highlightCodeBlocks("Non-highlighted content.
<code><pre>public class MyClass {...}</pre></code>")
$highlighter.highlightCodeBlocks($comment)
Constructor Summary | |
---|---|
VelocityHighlightingTool()
|
Method Summary | |
---|---|
String |
css(String code)
Shortcut to highlight("css", code) . |
String |
highlight(String code)
Highlights the given code and attempts to auto-select the highlighting scheme. |
String |
highlight(String brush,
String code)
Highlights the given code. |
String |
highlightCodeBlocks(String contentWithCodeBlocks)
Highlights code blocks (<code>) in the given XHTML content and attempts to auto-select the highlighting scheme. |
String |
highlightCodeBlocks(String brush,
String contentWithCodeBlocks)
Highlights code blocks (<code>) in the given XHTML content. |
String |
java(String code)
Shortcut to highlight("java", code) . |
String |
js(String code)
Shortcut to highlight("js", code) . |
String |
jsp(String code)
Shortcut to highlight("html/jsp", code) . |
String |
xml(String code)
Shortcut to highlight("xml", code) . |
Methods inherited from class org.tinyjee.maven.dim.sources.AbstractParametricVelocityTool |
---|
clear, get, nextInvocationParameters, put, remove, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VelocityHighlightingTool() throws MalformedURLException
MalformedURLException
Method Detail |
---|
public String highlight(String code)
code
- the code to highlight.
public String highlight(String brush, String code)
brush
- a brush name to use for highlighting (= highlighting scheme)code
- the code to highlight.
public String highlightCodeBlocks(String contentWithCodeBlocks)
contentWithCodeBlocks
- the content with code blocks to highlight.
public String highlightCodeBlocks(String brush, String contentWithCodeBlocks)
brush
- a brush name to use for highlighting (= highlighting scheme)contentWithCodeBlocks
- the content with code blocks to highlight.
public String java(String code)
highlight("java", code)
.
code
- the code to highlight.
public String js(String code)
highlight("js", code)
.
code
- the code to highlight.
public String css(String code)
highlight("css", code)
.
code
- the code to highlight.
public String xml(String code)
highlight("xml", code)
.
code
- the code to highlight.
public String jsp(String code)
highlight("html/jsp", code)
.
code
- the code to highlight.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |