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

Author:
David Nickerson <david.nickerson@gmail.com>
Date:
2021-09-17 15:50:49+12:00
Desc:
tweak html formatting
Permanent Source URI:
https://models.fieldml.org/workspace/a1/rawfile/1b3862589abf79ae9119ee0b5e99a8b785d762e1/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>