Location: A review of cardiac cellular electrophysiology models @ 0c824288680f / dojo-presentation / js / dojo / dojox / highlight / tests / test_pygments.html
- Author:
- David Nickerson <nickerso@users.sourceforge.net>
- Date:
- 2009-07-07 22:22:32+12:00
- Desc:
- renaming files in order to move to a single reference description for the entire tutorial
- Permanent Source URI:
- https://models.physiomeproject.org/workspace/a1/rawfile/0c824288680f5949ea1972a76176826599ef6d26/dojo-presentation/js/dojo/dojox/highlight/tests/test_pygments.html
Test Pygments-based highlighting
Current theme from the pygments set: Autumn Borland Colorful Default Emacs Friendly Fruity Manni Murphy Native Pastie Perldoc Trac
Javascript:
function initHighlight(block) {
if (block.className.search(/\bno\-highlight\b/) != -1)
return false;
try {
blockText(block);
} catch (e) {
if (e == 'Complex markup')
return;
}//try
var classes = block.className.split(/\s+/);
for (var i = 0; i < classes.length; i++) {
if (LANGUAGES[classes[i]]) {
highlightLanguage(block, classes[i]);
return;
}//if
}//for
highlightAuto(block);
}//initHighlight
Some CSS code:
body,
html {
font: Tahoma, Arial, sans-serif;
}
#content {
width: 100%; /* test comment */
height: 100%
}
p[lang=ru] {
color: red;
}
Some HTML code:
<head>
<title>Title</title>
<body>
<p class="something">Something</p>
<p class=something>Something</p>
<!-- comment -->
<p class>Something</p>
<p class="something" title="p">Something</p>
</body>
A custom XML document:
<?xml version="1.0"?>
<response value="ok">
<text>Ok</text>
<comment/>
<ns:description><![CDATA[
CDATA is <not> magical.
]]></ns:description>
</response>