From e44a7e37b6c7b5961adaffc62b9042b8d442938e Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 13 Nov 2008 09:49:11 +0000 Subject: 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 --- .../js/dojox/highlight/tests/test_highlight.html | 327 +++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 includes/js/dojox/highlight/tests/test_highlight.html (limited to 'includes/js/dojox/highlight/tests/test_highlight.html') diff --git a/includes/js/dojox/highlight/tests/test_highlight.html b/includes/js/dojox/highlight/tests/test_highlight.html new file mode 100644 index 0000000..93b1534 --- /dev/null +++ b/includes/js/dojox/highlight/tests/test_highlight.html @@ -0,0 +1,327 @@ + +
+client-side syntax highlighting for a number of languages.
+ +NOTE: 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. + +
+ +Some Python code:
+ +@requires_authorization
+def somefunc(param1, param2):
+ '''A docstring'''
+ if param1 > param2: # interesting
+ print 'Gre\'ater'
+ print ''
+ return param2 - param1 + 1
+
+class SomeClass:
pass
+
+
+
+
+
+A chunk of 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<$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
+
+
+
+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>
+
+
+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>
+
+
+HTML with Django templates:
+ +{% if articles|length %}
+{% for article in articles %}
+
+{# Striped table #}
+<tr class="{% cycle odd,even %}">
+ <td>{{ article|default:"Hi... "|escape }}</td>
+ <td>{{ article.date|date:"d.m.Y" }}</td>
+</tr>
+
+{% endfor %}
+{% endif %}
+
+{% comment %}
+Comments may be long and
+multiline.
+{% endcomment %}
+
+
+Some CSS code:
+ +body,
+html {
+ font: Tahoma, Arial, san-serif;
+}
+
+#content {
+ width: 100%; /* css comment */
+ height: 100%
+}
+
+p[lang=ru] {
+ color: red;
+}
+
+
+Explicit Python highlight:
+ +for x in [1, 2, 3]:
+ count(x)
+
+
+Disabled highlighting:
+ +<div id="contents">
+ <p>Hello, World!
+</div>
+
+
+Normal dojo-looking 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 <HTML> inline
+ var d = dojo;
+ d.mixin(d,{
+ foo: function(e){
+ d.bar(e);
+ },
+ bar: function(e){
+ alert(e);
+ }
+ });
+});
+
+
+Lazy, xhr'd code:
+ +
+
+Text with inlined JavaScript code: dojo.forEach(a, function(x){ console.log(x); }); — that was the inlined sample.
Markuped code (python), no language was specified:
+ +@requires_authorization
+def somefunc(param1, param2):
+ '''A docstring'''
+ if param1 > param2: # interesting
+ print 'Gre\'ater'
+ print ''
+ return param2 - param1 + 1
+
+class SomeClass:
pass
+
+
+Markuped code, "python" was specified:
+ +@requires_authorization
+def somefunc(param1, param2):
+ '''A docstring'''
+ if param1 > param2: # interesting
+ print 'Gre\'ater'
+ print ''
+ return param2 - param1 + 1
+
+class SomeClass:
pass
+
+
+
+
--
cgit v1.3-2-g0d8e