|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BrushResolver
BrushResolver
defines an interface that may be implemented and registered via service loading to register additional
javascript brushes (= language support) for the syntax highlighting library.
package my.package;
public class MyBrushResolver implements BrushResolver {
public Collection<URL> resolveBrushes() {
return Collections.singleton(getClass().getResource("/my/package/my-brush.js"));
}
public String detectBrushAlias(URL source, Map<Integer, List<String>> sourceContent) {
return source.getPath().toLowerCase().endsWith(".my-extension") ? "my-brush-alias" : null;
}
}
Register the implementation using service loading:
META-INF/services/
org.tinyjee.maven.dim.sh.BrushResolver
my.package.MyBrushResolver
Method Summary | |
---|---|
String |
detectBrushAlias(URL source,
Map<Integer,List<String>> sourceContent)
Auto Detects the brush alias name from the source URL or content. |
Collection<URL> |
resolveBrushes()
Returns a list of URLs that point to ".JS" or ".ZIP" files containing additional brush definitions. |
Method Detail |
---|
Collection<URL> resolveBrushes()
String detectBrushAlias(URL source, Map<Integer,List<String>> sourceContent)
source
- the source URL (.. to be used for extension matching).sourceContent
- the extracted content of the source
(.. to be used for content based matching, e.g. shebang).
resolveBrushes()
or 'null' if no alias can be resolved.
Note: If the content is HTML with a compiled / script language inside tags, the returned value is
"html/[brush-alias]" (e.g. JSP would map to "html/java").
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |