Created
March 26, 2013 19:23
-
-
Save icfantv/5248357 to your computer and use it in GitHub Desktop.
JHighlight and GWT/GXT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String xml = "<root><elt>sum stuff</elt><elt anAttribute=\"attr_value\">more stuff</elt></root>"; | |
XmlXhtmlRenderer renderer = new XmlXhtmlRenderer(); | |
try | |
{ | |
result = renderer.highlight("some-text-can-be-anything", xml, "UTF-8", true); | |
LOGGER.trace("added syntax highlighting to XML: {}", result); | |
} | |
catch (IOException ex) | |
{ | |
LOGGER.error("unable to syntax hightlight adi xml for asset: {}", assetKey, ex); | |
throw new RuntimeException("unable to syntax hightlight adi xml", ex); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@external .xml_*, code, h1; | |
.xml_plain | |
{ | |
color: rgb(0, 0, 0); | |
} | |
.xml_tag_name | |
{ | |
color: rgb(0, 55, 255); | |
} | |
.xml_comment | |
{ | |
color: rgb(147, 147, 147); | |
background-color: rgb(247, 247, 247); | |
} | |
.xml_tag_symbols | |
{ | |
color: rgb(0, 59, 255); | |
} | |
.xml_rife_tag | |
{ | |
color: rgb(0, 0, 0); | |
background-color: rgb(228, 230, 160); | |
} | |
.xml_attribute_value | |
{ | |
color: rgb(193, 0, 0); | |
} | |
.xml_attribute_name | |
{ | |
color: rgb(0, 0, 0); | |
font-weight: bold; | |
} | |
.xml_char_data | |
{ | |
color: rgb(0, 0, 0); | |
} | |
.xml_rife_name | |
{ | |
color: rgb(0, 0, 196); | |
background-color: rgb(228, 230, 160); | |
} | |
.xml_processing_instruction | |
{ | |
color: rgb(0, 0, 0); | |
font-weight: bold; | |
font-style: italic; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class XmlCss | |
{ | |
public static final XmlCssResource XML_CSS; | |
public static interface XmlCssResource extends CssResource | |
{ | |
@ClassName("xml_tag_name") | |
String xmlTagName(); | |
@ClassName("xml_attribute_value") | |
String xmlAttributeValue(); | |
@ClassName("xml_processing_instruction") | |
String xmlProcessingInstruction(); | |
@ClassName("xml_attribute_name") | |
String xmlAttributeName(); | |
@ClassName("xml_plain") | |
String xmlPlain(); | |
@ClassName("xml_tag_symbols") | |
String xmlTagSymbols(); | |
@ClassName("xml_rife_tag") | |
String xmlRifeTag(); | |
@ClassName("xml_char_data") | |
String xmlCharData(); | |
@ClassName("xml_comment") | |
String xmlComment(); | |
@ClassName("xml_rife_name") | |
String xmlRifeName(); | |
} | |
public static interface XmlCssBundle extends ClientBundle | |
{ | |
@Source("xml.css") | |
public XmlCssResource css(); | |
} | |
static | |
{ | |
XmlCssBundle bundle = GWT.create(XmlCssBundle.class); | |
XML_CSS = bundle.css(); | |
XML_CSS.ensureInjected(); | |
} | |
private XmlCss() {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment