Location: A review of cardiac cellular electrophysiology models @ 98909b01e6b2 / dojo-presentation / js / dojo / dojox / highlight / tests / test_pygments.html

Author:
David Nickerson <nickerso@users.sourceforge.net>
Date:
2009-07-07 17:11:57+12:00
Desc:
update for modified HH graphs in tutorial description
Permanent Source URI:
https://models.physiomeproject.org/workspace/a1/rawfile/98909b01e6b21653a5e1cd28865dd259c586d490/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>