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

Author:
David Nickerson <david.nickerson@gmail.com>
Date:
2021-09-16 00:41:19+12:00
Desc:
Updating Noble 1962 model: * Exposing the membrane potential to the top-level model; * adding SED-ML for the paced and pacemaker variants of the model. Using OpenCOR Snapshot release 2021-09-14.
Permanent Source URI:
https://models.fieldml.org/workspace/a1/rawfile/f954e59183314cd37f86c8832dc81317d01c8ec5/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>