summaryrefslogtreecommitdiff
path: root/includes/js/dojox/highlight/tests/test_pygments.html
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/highlight/tests/test_pygments.html')
-rw-r--r--includes/js/dojox/highlight/tests/test_pygments.html142
1 files changed, 142 insertions, 0 deletions
diff --git a/includes/js/dojox/highlight/tests/test_pygments.html b/includes/js/dojox/highlight/tests/test_pygments.html
new file mode 100644
index 0000000..6bdced6
--- /dev/null
+++ b/includes/js/dojox/highlight/tests/test_pygments.html
@@ -0,0 +1,142 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>dojox.highlight.pygments - syntax highlighting | The Dojo Toolkit</title>
+ <style type="text/css">
+ @import "../../../dijit/tests/css/dijitTests.css";
+
+ /* CSS rules for debugging */
+
+ pre code[class]:after {
+ content: 'highlight: ' attr(class);
+ display: block; text-align: right;
+ font-size: smaller;
+ color: #CCC; background: white;
+ border-top: solid 1px;
+ padding-top: 0.5em;
+ }
+
+ pre code {
+ display: block;
+ }
+ </style>
+
+ <!-- a sample set of definitions to use as a foundation to color your code -->
+ <link rel="stylesheet" type="text/css" href="../resources/pygments/default.css" />
+
+ <script type="text/javascript" djConfig="parseOnLoad: true, isDebug: true" src="../../../dojo/dojo.js"></script>
+ <!--
+ <script type="text/javascript" src="../_base.js"></script>
+ <script type="text/javascript" src="../languages/pygments/xml.js"></script>
+ <script type="text/javascript" src="../languages/pygments/html.js"></script>
+ <script type="text/javascript" src="../languages/pygments/css.js"></script>
+ <script type="text/javascript" src="../languages/pygments/javascript.js"></script>
+ -->
+
+ <script type="text/javascript">
+ dojo.require("dojox.highlight");
+ /*
+ dojo.require("dojox.highlight.languages.pygments.xml");
+ dojo.require("dojox.highlight.languages.pygments.html");
+ dojo.require("dojox.highlight.languages.pygments.css");
+ dojo.require("dojox.highlight.languages.pygments.javascript");
+ */
+ dojo.require("dojox.highlight.languages.pygments._www");
+ dojo.require("dojo.parser");
+
+ dojo.addOnLoad(function(){
+ var sel = dojo.byId("theme"),
+ sty = dojo.query("link[rel='stylesheet']", document.head)[0];
+ dojo.query("option[value='default']", sel)[0].selected = "selected";
+ dojo.connect(sel, "onchange", function(){
+ sty.href = "../resources/pygments/" + sel.value + ".css";
+ });
+ });
+ </script>
+</head>
+<body>
+<h1>Test Pygments-based highlighting</h1>
+
+<p>Current theme from the pygments set:
+<select id="theme">
+ <option value="autumn">Autumn</option>
+ <option value="borland">Borland</option>
+ <option value="colorful">Colorful</option>
+ <option value="default">Default</option>
+ <option value="emacs">Emacs</option>
+ <option value="friendly">Friendly</option>
+ <option value="fruity">Fruity</option>
+ <option value="manni">Manni</option>
+ <option value="murphy">Murphy</option>
+ <option value="native">Native</option>
+ <option value="pastie">Pastie</option>
+ <option value="perldoc">Perldoc</option>
+ <option value="trac">Trac</option>
+</select>
+</p>
+
+<p>Javascript:</p>
+
+<pre><code dojoType="dojox.highlight.Code">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 &lt; classes.length; i++) {
+ if (LANGUAGES[classes[i]]) {
+ highlightLanguage(block, classes[i]);
+ return;
+ }//if
+ }//for
+ highlightAuto(block);
+}//initHighlight</code></pre>
+
+<p>Some CSS code:</p>
+
+<pre><code dojoType="dojox.highlight.Code">body,
+html {
+ font: Tahoma, Arial, sans-serif;
+}
+
+#content {
+ width: 100%; /* test comment */
+ height: 100%
+}
+
+p[lang=ru] {
+ color: red;
+}
+</pre></code>
+
+<p>Some HTML code:</p>
+
+<pre><code dojoType="dojox.highlight.Code">&lt;head&gt;
+ &lt;title&gt;Title&lt;/title&gt;
+&lt;body&gt;
+ &lt;p class="something"&gt;Something&lt;/p&gt;
+ &lt;p class=something&gt;Something&lt;/p&gt;
+ &lt;!-- comment --&gt;
+ &lt;p class&gt;Something&lt;/p&gt;
+ &lt;p class="something" title="p"&gt;Something&lt;/p&gt;
+&lt;/body&gt;
+</code></pre>
+
+<p>A custom XML document:</p>
+
+<pre><code dojoType="dojox.highlight.Code">&lt;?xml version="1.0"?&gt;
+&lt;response value="ok"&gt;
+ &lt;text&gt;Ok&lt;/text&gt;
+ &lt;comment/&gt;
+ &lt;ns:description&gt;&lt;![CDATA[
+ CDATA is &lt;not&gt; magical.
+ ]]&gt;&lt;/ns:description&gt;
+&lt;/response&gt;
+</code></pre>
+
+</body>
+</html>