Class SourceHighlighter
java.lang.Object
org.jacoco.report.internal.html.page.SourceHighlighter
Creates a highlighted output of a source file.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSourceHighlighter
(Locale locale) Creates a new highlighter with default settings. -
Method Summary
Modifier and TypeMethodDescription(package private) HTMLElement
highlight
(HTMLElement pre, ILine line, int lineNr) void
render
(HTMLElement parent, ISourceNode source, Reader contents) Highlights the given source file.private void
renderCodeLine
(HTMLElement pre, String linesrc, ILine line, int lineNr) void
setLanguage
(String lang) Specifies the source language.private HTMLElement
-
Field Details
-
locale
-
lang
-
-
Constructor Details
-
SourceHighlighter
Creates a new highlighter with default settings.- Parameters:
locale
- locale for tooltip rendering
-
-
Method Details
-
setLanguage
Specifies the source language. This value might be used for syntax highlighting. Default is "java".- Parameters:
lang
- source language identifier
-
render
Highlights the given source file.- Parameters:
parent
- parent HTML elementsource
- highlighting informationcontents
- contents of the source file- Throws:
IOException
- problems while reading the source file or writing the output
-
renderCodeLine
private void renderCodeLine(HTMLElement pre, String linesrc, ILine line, int lineNr) throws IOException - Throws:
IOException
-
highlight
- Throws:
IOException
-
span
private HTMLElement span(HTMLElement parent, String id, String style1, String style2, String title, ICounter branches) throws IOException - Throws:
IOException
-