summaryrefslogtreecommitdiff
path: root/includes/js/dojox/highlight/tests
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/highlight/tests')
-rw-r--r--includes/js/dojox/highlight/tests/test_highlight.html327
-rw-r--r--includes/js/dojox/highlight/tests/test_pygments.html142
2 files changed, 0 insertions, 469 deletions
diff --git a/includes/js/dojox/highlight/tests/test_highlight.html b/includes/js/dojox/highlight/tests/test_highlight.html
deleted file mode 100644
index 93b1534..0000000
--- a/includes/js/dojox/highlight/tests/test_highlight.html
+++ /dev/null
@@ -1,327 +0,0 @@
-<!DOCTYPE html>
-<head>
- <title>dojox.highlight - syntax highlighting | The Dojo Toolkit</title>
- <style type="text/css">
- @import "../../../dijit/tests/css/dijitTests.css";
-
- /* a sample set of definitions to use as a foundation to color your code */
- @import "../resources/highlight.css";
-
- /* additional styling for this test case */
- 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;
- }
-
- code {
- background: #F0F0F0;
- }
-
- pre code,
- .ruby .subst {
- color: black;
- }
- </style>
-
- <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">
- // initHighlightOnLoad is deprecated.
- // if parseOnLoad==true, the onLoad init stuff is run.
- // if parseOnLoad==false, you can call dojox.highlight.init(domNode)
- //
- // utilizing the dojo build system, the dojox.highlight engine
- // will "do it's best" based on the language maps available
- // at the time of construction.
- //
- dojo.require("dojox.highlight");
-
- // several layer-like files have been provided grouping
- // similar langauges, and a catch all language module
- // dojox.highlight.languages._all is available for "best results"
-
- // we need some language definitions:
- dojo.require("dojox.highlight.languages._all");
- //dojo.require("dojox.highlight.languages._static");
- //dojo.require("dojox.highlight.languages._dynamic");
- //dojo.require("dojox.highlight.languages._www");
-
- var lazyCode = function(){
-
- dojo.query("code").forEach(dojox.highlight.init);
-
- dojo.xhrGet({
- url: "../../../dojo/_base.js",
- load: function(data){
- var n = dojo.byId("foobar"),
- c = document.createElement('div'),
- e = n.parentNode.parentNode;
- c.innerHTML = '<pre><code class="javascript">' + data.replace(/\</gi,"&lt;") + '</code></pre>';
- e.replaceChild(c.firstChild, n.parentNode);
- dojo.query("pre > code", e).forEach(dojox.highlight.init);
- }
- });
- };
- dojo.addOnLoad(lazyCode);
-
- </script>
-</head>
-<body>
-
-<h1 class="testTitle">dojox.highlight</h1>
-
-<p>client-side syntax highlighting for a number of languages.</p>
-
-<p><em>NOTE:</em> All languages listed here have working language definitions, though
-not all exist in the release or dojo subversion. The missing packs are not publically available.
-<span style="display:none">based on</span>
-</p>
-
-<h2>Examples:</h2>
-
-<p>Some Python code:</p>
-
-<pre><code>@requires_authorization
-def somefunc(param1, param2):
- '''A docstring'''
- if param1 > param2: # interesting
- print 'Gre\'ater'
- print ''
- return param2 - param1 + 1
-
-class SomeClass:<br> pass
-</code></pre>
-<!--
-
-<p>Short sample of Ruby:</p>
- FIXME: example needed
--->
-
-<!--
-
- <p>A bit of Perl:</p>
- FIXME: example needed
--->
-
-<p>A chunk of PHP: </p>
-
-<pre><code class="php">
-$opAr = array ( "-a|--append", // a or append toggle, nothing extra
- "-i|--input:", // i or input with next input being needed
- "-l|--list:", // l with input needed
- //"--foo", // broken
- "-f:", // f with no input
- "--wot:" // wot with input, no short
- );
-
-
-$op = bgetop($opAr);
-if (is_array($op)) { print_r($op); }
-
-/* here is the code: */
-
-function bgetop($opAr=array(),$unknown=true) {
-
-$argv = $_SERVER['argv'];
-$argc = $_SERVER['argc'];
-$argPos = 1; // zero is program running
-
-// foreach arg
-while ($argPos&lt;$argc) {
- $arg = $argv[$argPos];
- if ($arg{0}=="-") {
- if ($arg{1}=="-") {
- $var = substr($arg,2,strlen($arg));
- } else { $var = $arg{1}; }
- foreach ($opAr as $opk => $opv) {
- if (!isset($return[$var])) {
- if (strpos($opv,$arg) !== FALSE) {
- // this is where the -f -foo fix needs to be,
- // the partial string exists in this record,
- // but we need to determine if it's accurate
- // somehow (i'm thinking: eregi?)
- if ($accurate=1) {
- // we foudn the key
- if (strpos($opv,':') !== FALSE) {
- // next value is the one to use,
- // then skip it in the parser.
- if (isset($argv[$argPos+1])) {
- $return[$var] = $argv[++$argPos];
- } else {
- $return[$var] = FALSE;
- }
- } else {
- // just set the toggle
- $return[$var] = TRUE;
- }
- // don't check this opAr value again
- unset($opAr[$opk]);
- }
- } // if accurate
- } // !isset already
- } // foreach opAr
- } else { // we weren't expecting a non-hyphened argument, possibly just a filename, or whatnot
- if ($unknown) { $return['unknown'][]=$arg; }
- }
- $argPos++;
-} // while argPos < argc
-
-if (is_array($return)) {
-return $return;
-} else { return 0; }
-
-} // end function bgetop
-
-</code></pre>
-
-<p>A custom XML document:</p>
-
-<pre><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>
-
-<p>Some HTML code:</p>
-
-<pre><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>HTML with Django templates:</p>
-
-<pre><code>{% if articles|length %}
-{% for article in articles %}
-
-{# Striped table #}
-&lt;tr class="{% cycle odd,even %}"&gt;
- &lt;td&gt;{{ article|default:"Hi... "|escape }}&lt;/td&gt;
- &lt;td&gt;{{ article.date|date:"d.m.Y" }}&lt;/td&gt;
-&lt;/tr&gt;
-
-{% endfor %}
-{% endif %}
-
-{% comment %}
-Comments may be long and
-multiline.
-{% endcomment %}
-</code></pre>
-
-<p>Some CSS code:</p>
-
-<pre><code>body,
-html {
- font: Tahoma, Arial, san-serif;
-}
-
-#content {
- width: 100%; /* css comment */
- height: 100%
-}
-
-p[lang=ru] {
- color: red;
-}
-</pre></code>
-
-<p>Explicit Python highlight:</p>
-
-<pre><code class="python">for x in [1, 2, 3]:
- count(x)
-</code></pre>
-
-<p>Disabled highlighting:</p>
-
-<pre><code class="no-highlight">&lt;div id="contents"&gt;
- &lt;p&gt;Hello, World!
-&lt;/div&gt;
-</code></pre>
-
-<p>Normal dojo-looking code</p>
-
-<pre><code>
-dojo.provide("some.object");
-dojo.declare("some.object",null,{
- param: "value",
- _myMethod: function(/* Event */e){
- this.inherited(arguments);
- },
- // comments
- _another: function(){
- dojo.addClass("foo","hovered");
- }
-});
-dojo.addOnLoad(function(){
- //
- // comments with &lt;HTML&gt; inline
- var d = dojo;
- d.mixin(d,{
- foo: function(e){
- d.bar(e);
- },
- bar: function(e){
- alert(e);
- }
- });
-});
-</code></pre>
-
-<p>Lazy, xhr'd code:</p>
-
-<pre><code id="foobar"></code></pre>
-
-<hr>
-
-<p>Text with inlined JavaScript code: <code class="javascript">dojo.forEach(a, function(x){ console.log(x); });</code> &mdash; that was the inlined sample.</p>
-
-<hr>
-
-<p>Markuped code (python), no language was specified:</p>
-
-<pre><code dojoType="dojo.highlight.Code">@requires_authorization
-def somefunc(param1, param2):
- '''A docstring'''
- if param1 > param2: # interesting
- print 'Gre\'ater'
- print ''
- return param2 - param1 + 1
-
-class SomeClass:<br> pass
-</code></pre>
-
-<p>Markuped code, "python" was specified:</p>
-
-<pre><code dojoType="dojo.highlight.Code" class="python">@requires_authorization
-def somefunc(param1, param2):
- '''A docstring'''
- if param1 > param2: # interesting
- print 'Gre\'ater'
- print ''
- return param2 - param1 + 1
-
-class SomeClass:<br> pass
-</code></pre>
-
-
-</body><html>
diff --git a/includes/js/dojox/highlight/tests/test_pygments.html b/includes/js/dojox/highlight/tests/test_pygments.html
deleted file mode 100644
index 6bdced6..0000000
--- a/includes/js/dojox/highlight/tests/test_pygments.html
+++ /dev/null
@@ -1,142 +0,0 @@
-<!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>