public class HTMLTokenRenderer extends Object implements TokenRenderer
java.css.
white-space is sufficient for browsers
to preserve white space within <span> tags. But Swing Editor seems to require
explicit nbsp; for white spaces within <span> tags.
line.nnn where nnn is the actual line number without
any leading zero.
| Modifier and Type | Field and Description |
|---|---|
static String |
CSS_ANNOTATION |
static String |
CSS_COMMENT |
static String |
CSS_CUSTOM
The CSS named styles.
|
static String |
CSS_DECIMAL |
static String |
CSS_ENUM |
static String |
CSS_KEYWORD |
static String |
CSS_LINE_NO |
static String |
CSS_LITERAL |
static String |
HTML_BR_TAG |
static String |
HTML_SPACE |
static String |
NEW_LINE |
| Constructor and Description |
|---|
HTMLTokenRenderer() |
| Modifier and Type | Method and Description |
|---|---|
String |
endLine(int line)
Gets a end-of-line string: a HTML <br> tag followed by carriage return and line feed.
|
boolean |
getAddExplicitSpace()
Affirms if explicit
will be added at the HTML output. |
boolean |
getAddLineBreak()
Affirms if explicit line break (carriage return and line feed) will be added
at the HTML output.
|
boolean |
getAnchorLineNumber()
Affirms if an anchor will be created on every line.
|
String |
getEpilogue()
Gets the closing <BODY> and <HTML> tags
|
String |
getLineNumberFormat()
Gets the format string to format line number such as
"%%0%4d"
for a 4-digit number with leading zeros. |
String |
getPrologue()
Gets the opening <BODY> and <HTML> tags and the <link type="stylesheet"> clause.
|
boolean |
getShowLineNumber()
Affirms if a line number will be added in HTML output.
|
String |
getStylesheet()
Gets the stylesheet to be linked at HTML output.
|
String |
newLine(int line)
Gets a string for beginning of a new line.
|
String |
render(int decision,
org.antlr.runtime.Token token)
Produce a string representation of the given token.
|
void |
setAddExplicitSpace(boolean addSpace)
Sets if explicit
will be added at the HTML output. |
void |
setAddLineBreak(boolean addLineBreak)
Sets if explicit line break (carriage return and line feed) will be added
at the HTML output.
|
void |
setAnchorLineNumber(boolean anchorLineNumber)
Sets if an anchor will be created on every line.
|
void |
setLineNumberFormat(String lineNumberFormat)
Sets the format string to format line number such as
"%%0%4d"
for a 4-digit number with leading zeros. |
void |
setShowLineNumber(boolean showLineNumber)
Sets if a line number will be added in HTML output.
|
void |
setStylesheet(String stylesheet)
Sets the stylesheet to be linked at the HTML output.
|
public static final String CSS_CUSTOM
public static final String CSS_KEYWORD
public static final String CSS_ANNOTATION
public static final String CSS_ENUM
public static final String CSS_COMMENT
public static final String CSS_LITERAL
public static final String CSS_DECIMAL
public static final String CSS_LINE_NO
public static final String NEW_LINE
public static final String HTML_BR_TAG
public static final String HTML_SPACE
public String endLine(int line)
endLine in interface TokenRendererline - the line being endedpublic String newLine(int line)
newLine in interface TokenRendererline - the current line numberpublic String render(int decision, org.antlr.runtime.Token token)
TokenRendererrender in interface TokenRendererdecision - the index of the decision (or the context) in which
the current token is being processed. The index refers to ANTLR
DebugEventListener.enterDecision(int).token - the token to be rendered. Can be a hidden token as well.public String getPrologue()
getPrologue in interface TokenRendererpublic String getEpilogue()
getEpilogue in interface TokenRendererpublic String getStylesheet()
public void setStylesheet(String stylesheet)
public boolean getShowLineNumber()
public void setShowLineNumber(boolean showLineNumber)
public boolean getAnchorLineNumber()
public void setAnchorLineNumber(boolean anchorLineNumber)
public boolean getAddLineBreak()
endLine(int)public void setAddLineBreak(boolean addLineBreak)
endLine(int)public boolean getAddExplicitSpace()
will be added at the HTML output.public void setAddExplicitSpace(boolean addSpace)
will be added at the HTML output.public String getLineNumberFormat()
"%%0%4d"
for a 4-digit number with leading zeros.public void setLineNumberFormat(String lineNumberFormat)
"%%0%4d"
for a 4-digit number with leading zeros.Copyright © 2006–2018 Apache Software Foundation. All rights reserved.