aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/highlight/tests/test_pygments.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/highlight/tests/test_pygments.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
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>