Automatic grading Google Summer of Code project (Epaile assignment module) by Arkaitz Garo, First commit.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?PHP // $Id$
|
||||
// assignment.php - created with Moodle 1.7 beta + (2006101003)
|
||||
|
||||
|
||||
$string['addtest'] = 'Add new test';
|
||||
$string['allowdeleting'] = 'Allow deleting';
|
||||
$string['allowmaxfiles'] = 'Maximum number of uploaded files';
|
||||
$string['allownotes'] = 'Allow notes';
|
||||
@@ -10,6 +10,7 @@ $string['assignment:grade'] = 'Grade assignment';
|
||||
$string['assignment:submit'] = 'Submit assignment';
|
||||
$string['assignment:view'] = 'View assignment';
|
||||
$string['assignmentdetails'] = 'Assignment details';
|
||||
$string['assignmentlangs'] = 'Programming language';
|
||||
$string['assignmentmail'] = '$a->teacher has posted some feedback on your
|
||||
assignment submission for \'$a->assignment\'
|
||||
|
||||
@@ -24,9 +25,13 @@ $string['assignmenttype'] = 'Assignment type';
|
||||
$string['availabledate'] = 'Available from';
|
||||
$string['comment'] = 'Comment';
|
||||
$string['commentinline'] = 'Comment inline';
|
||||
$string['compileerrors'] = 'Compile errors';
|
||||
$string['configitemstocount'] = 'Nature of items to be counted for student submissions in online assignments.';
|
||||
$string['configmaxbytes'] = 'Default maximum assignment size for all assignments on the site (subject to course limits and other local settings)';
|
||||
$string['configmaxcpu'] = 'Default maximum assignment cpu time for all assignments on the site (subject to other local settings)';
|
||||
$string['configmaxmem'] = 'Default maximum assignment memory usage for all assignments on the site (subject to other local settings)';
|
||||
$string['confirmdeletefile'] = 'Are you absolutely sure you want to delete this file?<br /><strong>$a</strong>';
|
||||
$string['crondate'] = 'Cron date';
|
||||
$string['deletefilefailed'] = 'Deleting of file failed.';
|
||||
$string['description'] = 'Description';
|
||||
$string['draft'] = 'Draft';
|
||||
@@ -46,6 +51,7 @@ for <i>\'$a->assignment\'</i><br /><br />
|
||||
It is <a href=\"$a->url\">available on the web site</a>.';
|
||||
$string['emailteachers'] = 'Email alerts to teachers';
|
||||
$string['emptysubmission'] = 'You have not submitted anything yet';
|
||||
$string['exactouput'] = 'Exact output';
|
||||
$string['existingfiledeleted'] = 'Existing file has been deleted: $a';
|
||||
$string['failedupdatefeedback'] = 'Failed to update submission feedback for user $a';
|
||||
$string['feedback'] = 'Feedback';
|
||||
@@ -73,9 +79,23 @@ $string['helpuploadsingle'] = '<p>This type of assignment allows each participan
|
||||
single file, of any type.</p> <p>This might be a Word processor document, an image,
|
||||
a zipped web site, or anything you ask them to submit.</p>';
|
||||
$string['hideintro'] = 'Hide description before available date';
|
||||
$string['ignorespace'] = 'Ignore spaces';
|
||||
$string['ignorecase'] = 'Ignore Upcase / Lowcase';
|
||||
$string['input'] = 'Input';
|
||||
$string['langbash'] = 'Bash';
|
||||
$string['langc'] = 'C';
|
||||
$string['langcpp'] = 'C++';
|
||||
$string['langhaskell'] = 'Haskell';
|
||||
$string['langjava'] = 'Java';
|
||||
$string['langpascal'] = 'Pascal';
|
||||
$string['langperl'] = 'Perl';
|
||||
$string['late'] = '$a late';
|
||||
$string['loading'] = 'Grade process in progress... please wait';
|
||||
$string['maximumcpu'] = 'Maximum CPU time (seconds)';
|
||||
$string['maximumgrade'] = 'Maximum grade';
|
||||
$string['maximummem'] = 'Maximum memory usage';
|
||||
$string['maximumsize'] = 'Maximum size';
|
||||
$string['maximumfilesize'] = 'Maximum source file size';
|
||||
$string['modulename'] = 'Assignment';
|
||||
$string['modulenameplural'] = 'Assignments';
|
||||
$string['newsubmissions'] = 'Assignments submitted';
|
||||
@@ -90,12 +110,15 @@ $string['notesupdateerror'] = 'Error when updating notes';
|
||||
$string['notgradedyet'] = 'Not graded yet';
|
||||
$string['notsubmittedyet'] = 'Not submitted yet';
|
||||
$string['onceassignmentsent'] = 'Once the assignment is sent for marking, you will no longer be able to delete or attach file(s). Do you want to continue?';
|
||||
$string['output'] = 'Output';
|
||||
$string['outputfilter'] = 'Output filter';
|
||||
$string['overwritewarning'] = 'Warning: uploading again will REPLACE your current submission';
|
||||
$string['pagesize'] = 'Submissions shown per page';
|
||||
$string['preventlate'] = 'Prevent late submissions';
|
||||
$string['quickgrade'] = 'Allow quick grading';
|
||||
$string['responsefiles'] = 'Response files';
|
||||
$string['reviewed'] = 'Reviewed';
|
||||
$string['runtimeerrors'] = 'Runtime errors';
|
||||
$string['saveallfeedback'] = 'Save all my feedback';
|
||||
$string['sendformarking'] = 'Send for marking';
|
||||
$string['submission'] = 'Submission';
|
||||
@@ -109,8 +132,10 @@ $string['submitedformarking'] = 'Assignment was already submitted for marking an
|
||||
$string['submitformarking'] = 'Final submission for assignment marking';
|
||||
$string['submitted'] = 'Submitted';
|
||||
$string['submittedfiles'] = 'Submitted files';
|
||||
$string['tests'] = 'Program tests';
|
||||
$string['typeoffline'] = 'Offline activity';
|
||||
$string['typeonline'] = 'Online text';
|
||||
$string['typeprogram'] = 'Epaile';
|
||||
$string['typeupload'] = 'Advanced uploading of files';
|
||||
$string['typeuploadsingle'] = 'Upload a single file';
|
||||
$string['unfinalize'] = 'Revert to draft';
|
||||
|
||||
@@ -29,6 +29,47 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">assignment_maxcpu:</td>
|
||||
<td>
|
||||
<?php
|
||||
/**
|
||||
* TODO: create a function in moodlelib.php.
|
||||
* Actually present in /mod/assignment/type/program/assignment.class.php -> assignment_program_get_max_cpu_times
|
||||
*/
|
||||
require_once $CFG->dirroot.'/mod/assignment/type/program/assignment.class.php';
|
||||
DEFINE('MAX_CPU',60);
|
||||
|
||||
unset($choices);
|
||||
$choices = assignment_program_get_max_cpu_times(MAX_CPU);
|
||||
choose_from_menu($choices, "assignment_maxcpu", $CFG->assignment_maxcpu, "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configmaxcpu", "assignment") ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">assignment_maxmem:</td>
|
||||
<td>
|
||||
<?php
|
||||
/**
|
||||
* TODO: create a function in moodlelib.php.
|
||||
* Actually present in /mod/assignment/type/program/assignment.class.php -> assignment_program_get_max_mem_usages
|
||||
*/
|
||||
DEFINE('MAX_MEM',10485760);
|
||||
|
||||
unset($choices);
|
||||
$choices = assignment_program_get_max_memory_usages(MAX_MEM);
|
||||
choose_from_menu($choices, "assignment_maxmem", $CFG->assignment_maxmem, "");
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("configmaxmem", "assignment") ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
--
|
||||
-- Table structure for table `mdl_assignment_epaile_results`
|
||||
--
|
||||
|
||||
CREATE TABLE `prefix_assignment_epaile_results` (
|
||||
`id` bigint(10) NOT NULL auto_increment,
|
||||
`submission` bigint(10) NOT NULL,
|
||||
`test` bigint(10) NOT NULL,
|
||||
`runtime` bigint(10) NOT NULL,
|
||||
`status` varchar(50) collate utf8_unicode_ci NOT NULL COMMENT 'Possible values: Accepted, Wrong answer, Internal error',
|
||||
`output` varchar(255) collate utf8_unicode_ci default NULL COMMENT 'Program output',
|
||||
`error` text collate utf8_unicode_ci COMMENT 'Runtime error',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Test results' AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `mdl_assignment_epaile_submissions`
|
||||
--
|
||||
|
||||
CREATE TABLE `prefix_assignment_epaile_submissions` (
|
||||
`id` bigint(10) unsigned NOT NULL auto_increment,
|
||||
`submission` bigint(10) unsigned NOT NULL default '0',
|
||||
`compileerrors` text collate utf8_unicode_ci,
|
||||
`compiletime` bigint(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `prefix_epaisubm_epa_ix` (`submission`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Info about submitted assignments' AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `mdl_assignment_epaile_tests`
|
||||
--
|
||||
|
||||
CREATE TABLE `prefix_assignment_epaile_tests ` (
|
||||
`id` bigint(10) unsigned NOT NULL auto_increment,
|
||||
`assignment` bigint(10) unsigned NOT NULL default '0',
|
||||
`input` varchar(255) collate utf8_unicode_ci NOT NULL COMMENT 'Program input',
|
||||
`output` varchar(255) collate utf8_unicode_ci NOT NULL COMMENT 'Expected output',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `prefix_epaitest_epa_ix` (`assignment`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Info about assignment tests' AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Add new field to `assignment` table
|
||||
--
|
||||
ALTER TABLE `prefix_assignment` ADD `lang` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL AFTER `var5` ;
|
||||
|
||||
--
|
||||
-- Some values for `config` table
|
||||
--
|
||||
INSERT INTO `prefix_config` (`name`,`value`) VALUES ('assignment_maxmem', '512000'),('assignment_maxcpu', '15');
|
||||
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
/* tests.js (v1.0 - 2007/06/18)
|
||||
* ********************************************************************* *
|
||||
* by Arkaitz Garro, June 2007 *
|
||||
* Copyright (c) 2007 Arkaitz Garro. All Rights Reserved. *
|
||||
* *
|
||||
* This code is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details: *
|
||||
* *
|
||||
* http://www.gnu.org/copyleft/gpl.html *
|
||||
* ********************************************************************* *
|
||||
* This JavaScript add / delete tests dynamicaly *
|
||||
* *
|
||||
* @author Arkaitz Garro *
|
||||
* @package epaile *
|
||||
* ********************************************************************* *
|
||||
*/
|
||||
|
||||
// Add a new test
|
||||
function addTest() {
|
||||
divTest = document.createElement("tbody"); // New Test container
|
||||
divTest.setAttribute("id","test"+id);
|
||||
divTest.appendChild(createTitle()); // New title row
|
||||
divTest.appendChild(createBoxes()); // New boxes row
|
||||
document.getElementById("tests").appendChild(divTest);
|
||||
id++;
|
||||
}
|
||||
|
||||
// Delete an existing test
|
||||
function delTest(testId) {
|
||||
var divTest = document.getElementById("test"+testId);
|
||||
document.getElementById("tests").removeChild(divTest);
|
||||
id--;
|
||||
}
|
||||
|
||||
// Create test title (Test+id)
|
||||
function createTitle() {
|
||||
|
||||
trTitle = document.createElement("tr"); // New title row
|
||||
tdTitle = document.createElement("td"); // New title cell
|
||||
aDel = document.createElement("a"); // New link 'Delete test'
|
||||
imgDel = document.createElement("img"); // New image 'Delete test'
|
||||
txtTest = document.createElement("strong") // New Test text
|
||||
|
||||
|
||||
trTitle.setAttribute("valign","top"); // Set attributes to title row
|
||||
trTitle.setAttribute("style","border-bottom: 1px solid #BBBBBB;"); // Set attributes to title row
|
||||
tdTitle.setAttribute("colspan","2"); // Set attributes to title cell
|
||||
aDel.setAttribute("href","#"); // Set attributes to link
|
||||
aDel.setAttribute("onclick","Javascript:delTest("+id+");"); // Set attributes to link
|
||||
imgDel.setAttribute("src",pixpath+"/t/switch_minus.gif"); // Set attributes to image
|
||||
|
||||
// Title structure
|
||||
txtTest.appendChild(document.createTextNode(" Test"));
|
||||
aDel.appendChild(imgDel);
|
||||
tdTitle.appendChild(aDel);
|
||||
tdTitle.appendChild(txtTest);
|
||||
trTitle.appendChild(tdTitle);
|
||||
|
||||
return trTitle;
|
||||
}
|
||||
|
||||
// Create input / output boxes
|
||||
function createBoxes() {
|
||||
|
||||
tr = document.createElement("tr"); // New row
|
||||
tdIn = document.createElement("td"); // New 'input' cell
|
||||
tdOut = document.createElement("td"); // New 'output' cell
|
||||
tbIn = document.createElement("input"); // New 'input' textBox
|
||||
tbOut = document.createElement("input"); // New 'output' textBox
|
||||
txtIn = document.createElement("strong") // New input text
|
||||
txtOut = document.createElement("strong") // New output text
|
||||
|
||||
tdIn.setAttribute("align","right"); // Set attributes to cell
|
||||
|
||||
tbIn.setAttribute("type","text"); // Set attributes to textBox 'input'
|
||||
tbIn.setAttribute("name","input[]"); // Set attributes to textBox 'input'
|
||||
tbIn.setAttribute("size","30"); // Set attributes to textBox 'input'
|
||||
|
||||
tbOut.setAttribute("type","text"); // Set attributes to textBox 'output'
|
||||
tbOut.setAttribute("name","output[]"); // Set attributes to textBox 'output'
|
||||
tbOut.setAttribute("size","30"); // Set attributes to textBox 'output'
|
||||
tbIn.focus();
|
||||
|
||||
|
||||
// Row structure
|
||||
txtIn.appendChild(document.createTextNode("Input: "));
|
||||
txtOut.appendChild(document.createTextNode("Output: "));
|
||||
tdIn.appendChild(txtIn);
|
||||
tdIn.appendChild(tbIn);
|
||||
tdOut.appendChild(txtOut);
|
||||
tdOut.appendChild(tbOut);
|
||||
tr.appendChild(tdIn);
|
||||
tr.appendChild(tdOut);
|
||||
|
||||
return tr;
|
||||
}
|
||||
//-->
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bash compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
#
|
||||
# This script does not actually "compile" the source, but writes a
|
||||
# shell script that will function as the executable: when called, it
|
||||
# will execute the source with the correct interpreter syntax, thus
|
||||
# allowing this interpreted source to be used transparantly as if it
|
||||
# was compiled to a standalone binary.
|
||||
#
|
||||
# NOTICE: this compiler script cannot be used with the USE_CHROOT
|
||||
# configuration option turned on! (Unless proper preconfiguration of
|
||||
# the chroot environment has been taken care of.)
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
RUNOPTIONS="--noprofile --norc -r -p"
|
||||
|
||||
# Check for '#!' interpreter line: don't allow it to prevent teams
|
||||
# from passing options to the interpreter.
|
||||
if grep '^#!' $SOURCE &>/dev/null ; then
|
||||
echo "Error: interpreter statement(s) found:"
|
||||
grep -n '^#!' $SOURCE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check bash syntax:
|
||||
bash $RUNOPTIONS -n $SOURCE
|
||||
EXITCODE=$?
|
||||
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
|
||||
|
||||
# Write executing script:
|
||||
cat > $DEST <<EOF
|
||||
#!/bin/sh
|
||||
# Generated shell-script to execute bash interpreter on source.
|
||||
|
||||
exec bash $RUNOPTIONS $SOURCE
|
||||
EOF
|
||||
|
||||
chmod a+x $DEST
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# C compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
# -Wall: Report all warnings
|
||||
# -O2: Level 2 optimizations (default for speed)
|
||||
# -static: Static link with all libraries
|
||||
# -lm: Link with math-library (has to be last argument!)
|
||||
gcc -Wall -O2 -static -o $DEST $SOURCE -lm
|
||||
exit $?
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# C++ compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
# -Wall: Report all warnings
|
||||
# -O2: Level 2 optimizations (default for speed)
|
||||
# -static: Static link with all libraries
|
||||
g++ -Wall -O2 -static -o $DEST $SOURCE
|
||||
exit $?
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Haskell compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
# -Wall: Report all warnings
|
||||
# -O: Optimize
|
||||
# -static: Static link Haskell libraries
|
||||
# -optl-static: Pass '-static' option to the linker
|
||||
ghc -Wall -O -static -optl-static -o $DEST $SOURCE
|
||||
exitcode=$?
|
||||
|
||||
# clean created files:
|
||||
rm -f $DEST.o Main.hi
|
||||
|
||||
exit $exitcode
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Java compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
#
|
||||
# This script byte-compiles with the Sun javac compiler and generates
|
||||
# a shell script to run it with the java interpreter later.
|
||||
#
|
||||
# NOTICE: this compiler script cannot be used with the USE_CHROOT
|
||||
# configuration option turned on, unless proper preconfiguration of
|
||||
# the chroot environment has been taken care of!
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
MEMLIMIT="$3"
|
||||
|
||||
# Sun java needs filename to match main class:
|
||||
MAINCLASS=Main
|
||||
|
||||
SOURCEDIR=${SOURCE%/*}
|
||||
[ "$SOURCEDIR" = "$SOURCE" ] && SOURCEDIR='.'
|
||||
TMP="$SOURCEDIR/$MAINCLASS"
|
||||
|
||||
cp $SOURCE $TMP.java
|
||||
|
||||
# Byte-compile:
|
||||
javac $TMP.java
|
||||
EXITCODE=$?
|
||||
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
|
||||
|
||||
# Check for class file:
|
||||
if [ ! -f "$TMP.class" ]; then
|
||||
echo "Error: byte-compiled class file '$TMP.class' not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Calculate Java program memlimit as MEMLIMIT - max. JVM memory usage:
|
||||
MEMLIMITJAVA=$(($MEMLIMIT - 204800))
|
||||
|
||||
# Write executing script:
|
||||
# Executes java byte-code interpreter with following options
|
||||
# -Xmx: maximum size of memory allocation pool
|
||||
# -Xrs: reduces usage signals by java, because that generates debug
|
||||
# output when program is terminated on timelimit exceeded.
|
||||
cat > $DEST <<EOF
|
||||
#!/bin/sh
|
||||
# Generated shell-script to execute java interpreter on source.
|
||||
|
||||
cd $SOURCEDIR
|
||||
exec java -Xrs -Xmx${MEMLIMITJAVA}k $MAINCLASS
|
||||
EOF
|
||||
|
||||
chmod a+x $DEST
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Psacal compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
# -viwn: Verbose warnings, notes and informational messages
|
||||
# -02: Level 2 optimizations (default for speed)
|
||||
# -Sg: Support label and goto commands (for those who need it ;-)
|
||||
# -XS: Static link with all libraries
|
||||
fpc -viwn -O2 -Sg -XS -o$DEST $SOURCE
|
||||
exitcode=$?
|
||||
|
||||
# clean created object files:
|
||||
rm -f $DEST.o
|
||||
|
||||
exit $exitcode
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Perl compile wrapper-script for 'test_solution.sh'.
|
||||
# See that script for syntax and more info.
|
||||
#
|
||||
# This script does not actually "compile" the source, but writes a
|
||||
# shell script that will function as the executable: when called, it
|
||||
# will execute the source with the correct interpreter syntax, thus
|
||||
# allowing this interpreted source to be used transparantly as if it
|
||||
# was compiled to a standalone binary.
|
||||
#
|
||||
# NOTICE: this compiler script cannot be used with the USE_CHROOT
|
||||
# configuration option turned on! (Unless proper preconfiguration of
|
||||
# the chroot environment has been taken care of.)
|
||||
|
||||
SOURCE="$1"
|
||||
DEST="$2"
|
||||
|
||||
# Check for '#!' interpreter line: don't allow it to prevent teams
|
||||
# from passing options to the interpreter.
|
||||
if grep '^#!' $SOURCE &>/dev/null ; then
|
||||
echo "Error: interpreter statement(s) found:"
|
||||
grep -n '^#!' $SOURCE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check perl syntax:
|
||||
perl -c -W $SOURCE
|
||||
EXITCODE=$?
|
||||
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
|
||||
|
||||
# Write executing script:
|
||||
cat > $DEST <<EOF
|
||||
#!/bin/sh
|
||||
# Generated shell-script to execute perl interpreter on source.
|
||||
|
||||
exec perl $SOURCE
|
||||
EOF
|
||||
|
||||
chmod a+x $DEST
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,62 @@
|
||||
<!-- Javascript functions -->
|
||||
<script src="../mod/assignment/type/program/js/tests.js" type="text/javascript"></script>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
// Global variable id: Number of test + 1
|
||||
var id = <?php echo $numtests+1 ?>;
|
||||
|
||||
var pixpath = '<?php echo $CFG->pixpath ?>';
|
||||
</script>
|
||||
<!-- End -->
|
||||
|
||||
<!-- Program tests -->
|
||||
<table align="center" cellpadding="5" cellspacing="0" id="tests">
|
||||
<?php
|
||||
if($tests) {
|
||||
// Tests allready defined (update assignment)
|
||||
$i = 1;
|
||||
foreach($tests as $tstObj => $tstValue) {
|
||||
?>
|
||||
<tbody id="test<?php echo $i ?>">
|
||||
<tr valign="top" style="border-bottom: 1px solid #BBBBBB;">
|
||||
<td colspan="2">
|
||||
<a href="#" onclick="Javascript:delTest(<?php echo $i ?>);">
|
||||
<img src="<?php echo $CFG->pixpath ?>/t/switch_minus.gif" alt="Delete" title="<?php print_string('deletetest', 'epaile') ?>" /></a> <strong>Test</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><?php print_string('input', 'assignment') ?>:</strong> <input type="text" name="input[]" size="30" value="<?php p($tstValue->input) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<strong><?php print_string('output', 'assignment') ?>:</strong> <input type="text" name="output[]" size="30" value="<?php p($tstValue->output) ?>">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
// New assignment
|
||||
for($i=1; $i<=$numtests; $i++) {
|
||||
?>
|
||||
<tbody id="test<?php echo $i ?>">
|
||||
<tr valign="top" style="border-bottom: 1px solid #BBBBBB;">
|
||||
<td colspan="2"><a href="#" onclick="Javascript:delTest(<?php echo $i ?>);"><img src="<?php echo $CFG->pixpath ?>/t/switch_minus.gif" alt="Delete" title="Delete test" /></a> <strong>Test</strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"><strong><?php print_string('input', 'assignment') ?>:</strong> <input type="text" name="input[]" size="30" value=""></td>
|
||||
<td><strong><?php print_string('output', 'assignment') ?>:</strong> <input type="text" name="output[]" size="30" value=""></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<table align="center" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td align="left" colspan="2"><a href="Javascript:addTest();"><img src="<?php echo $CFG->pixpath ?>/t/switch_plus.gif" alt="Add" title="<?php print_string('addtest', 'assignment') ?>" /> <?php print_string('addtest', 'assignment') ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- End program tests -->
|
||||
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title><?php echo $file ?></title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<pre name="code" class="<?php echo $lang ?>"><?php echo $code ?></pre>
|
||||
<p align="center">
|
||||
<?php
|
||||
close_window_button();
|
||||
?>
|
||||
</p>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/Styles/SyntaxHighlighter.css"></link>
|
||||
<script class="javascript" src="syntaxhighlighter/Scripts/shCore.js"></script>
|
||||
<script class="javascript" src="syntaxhighlighter/Scripts/shBrushJava.js"></script>
|
||||
<script language="javascript">
|
||||
dp.SyntaxHighlighter.ClipboardSwf = '/syntaxhighlighter/flash/clipboard.swf';
|
||||
dp.SyntaxHighlighter.HighlightAll('code');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/* source.php (v1.0 - 2007/06/26)
|
||||
* ********************************************************************* *
|
||||
* by Arkaitz Garro, July 2007 *
|
||||
* Copyright (c) 2007 Arkaitz Garro. All Rights Reserved. *
|
||||
* This code is based in actual assigment module. *
|
||||
* *
|
||||
* This code is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details: *
|
||||
* *
|
||||
* http://www.gnu.org/copyleft/gpl.html *
|
||||
* ********************************************************************* *
|
||||
* Use of SyntaxHighlighter *
|
||||
* Free syntax highlighter written in Javascript *
|
||||
* http://code.google.com/p/syntaxhighlighter/ *
|
||||
* ********************************************************************* *
|
||||
*/
|
||||
|
||||
|
||||
require_once('../../../../config.php');
|
||||
require_once('../../lib.php');
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT); // Course Module ID
|
||||
$e = optional_param('a', 0, PARAM_INT); // Epaile ID
|
||||
$userid = optional_param('userid', 0, PARAM_INT); // User ID
|
||||
$file = optional_param('file', NULL, PARAM_CLEANHTML); // File to show
|
||||
|
||||
if ($id) {
|
||||
if (!$cm = get_coursemodule_from_id('assignment', $id)) {
|
||||
error(get_string('error_invalidcoursemodule','assignment'));
|
||||
}
|
||||
|
||||
if (!$assignment = get_record('assignment', 'id', $cm->instance)) {
|
||||
error(get_string('error_invalidepaileid','assignment'));
|
||||
}
|
||||
|
||||
if (!$course = get_record('course', 'id', $assignment->course)) {
|
||||
error(get_string('error_misconfiguredcourse','assignment'));
|
||||
}
|
||||
} else {
|
||||
if (!$assignment = get_record('assignment', 'id', $e)) {
|
||||
error(get_string('error_incorrectmodule','assignment'));
|
||||
}
|
||||
if (!$course = get_record('course', 'id', $assignment->course)) {
|
||||
error(get_string('error_misconfiguredcourse','assignment'));
|
||||
}
|
||||
if (!$cm = get_coursemodule_from_instance('assignment', $assignment->id, $course->id)) {
|
||||
error(get_string('error_invalidcoursemodule','assignment'));
|
||||
}
|
||||
}
|
||||
|
||||
if(!$userid)
|
||||
error(get_string('nouser','assignment'));
|
||||
|
||||
if(!$file)
|
||||
error(get_string('nosuchfile','assignment'));
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
// Load up the required assignment code
|
||||
require('assignment.class.php');
|
||||
$assignmentinstance = new assignment_program($cm->id, $assignment, $cm, $course);
|
||||
|
||||
$filearea = $assignmentinstance->file_area_name($userid);
|
||||
|
||||
if ($basedir = $assignmentinstance->file_area($userid)) {
|
||||
require_once($CFG->libdir.'/filelib.php');
|
||||
|
||||
if ($CFG->slasharguments) {
|
||||
$ffurl = "$CFG->dataroot/$filearea/$file";
|
||||
} else {
|
||||
$ffurl = "$CFG->dataroot/$filearea/$file";
|
||||
}
|
||||
}
|
||||
|
||||
if($gestor = fopen($ffurl,'r')) {
|
||||
$code = fread($gestor, filesize($ffurl));
|
||||
fclose($gestor);
|
||||
} else {
|
||||
error(get_string('filereaderror','assignment'));
|
||||
}
|
||||
|
||||
$lang = $assignmentinstance->get_language();
|
||||
|
||||
include('source.html');
|
||||
?>
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
dp.sh.Brushes.CSharp = function()
|
||||
{
|
||||
var keywords = 'abstract as base bool break byte case catch char checked class const ' +
|
||||
'continue decimal default delegate do double else enum event explicit ' +
|
||||
'extern false finally fixed float for foreach get goto if implicit in int ' +
|
||||
'interface internal is lock long namespace new null object operator out ' +
|
||||
'override params private protected public readonly ref return sbyte sealed set ' +
|
||||
'short sizeof stackalloc static string struct switch this throw true try ' +
|
||||
'typeof uint ulong unchecked unsafe ushort using virtual void while';
|
||||
|
||||
this.regexList = [
|
||||
// There's a slight problem with matching single line comments and figuring out
|
||||
// a difference between // and ///. Using lookahead and lookbehind solves the
|
||||
// problem, unfortunately JavaScript doesn't support lookbehind. So I'm at a
|
||||
// loss how to translate that regular expression to JavaScript compatible one.
|
||||
// { regex: new RegExp('(?<!/)//(?!/).*$|(?<!/)////(?!/).*$|/\\*[^\\*]*(.)*?\\*/', 'gm'), css: 'comment' }, // one line comments starting with anything BUT '///' and multiline comments
|
||||
// { regex: new RegExp('(?<!/)///(?!/).*$', 'gm'), css: 'comments' }, // XML comments starting with ///
|
||||
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // c# keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-c';
|
||||
this.Style = '.dp-c .vars { color: #d00; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.CSharp.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.CSharp.Aliases = ['c#', 'c-sharp', 'csharp'];
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Code Syntax Highlighter for C++(Windows Platform).
|
||||
* Version 0.0.2
|
||||
* Copyright (C) 2006 Shin, YoungJin.
|
||||
* http://www.jiniya.net/lecture/techbox/test.html
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
|
||||
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
dp.sh.Brushes.Cpp = function()
|
||||
{
|
||||
var datatypes =
|
||||
'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
|
||||
'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
|
||||
'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
|
||||
'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
|
||||
'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
|
||||
'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
|
||||
'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
|
||||
'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
|
||||
'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
|
||||
'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
|
||||
'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
|
||||
'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
|
||||
'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
|
||||
'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
|
||||
'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
|
||||
'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
|
||||
'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
|
||||
'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
|
||||
'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
|
||||
'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
|
||||
'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
|
||||
'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
|
||||
'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
|
||||
'va_list wchar_t wctrans_t wctype_t wint_t signed';
|
||||
|
||||
var keywords =
|
||||
'break case catch class const __finally __exception __try ' +
|
||||
'const_cast continue private public protected __declspec ' +
|
||||
'default delete deprecated dllexport dllimport do dynamic_cast ' +
|
||||
'else enum explicit extern if for friend goto inline ' +
|
||||
'mutable naked namespace new noinline noreturn nothrow ' +
|
||||
'register reinterpret_cast return selectany ' +
|
||||
'sizeof static static_cast struct switch template this ' +
|
||||
'thread throw true false try typedef typeid typename union ' +
|
||||
'using uuid virtual void volatile whcar_t while';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp('^ *#.*', 'gm'), css: 'preprocessor' },
|
||||
{ regex: new RegExp(this.GetKeywords(datatypes), 'gm'), css: 'datatypes' },
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-cpp';
|
||||
this.Style = '.dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Cpp.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Cpp.Aliases = ['cpp', 'c', 'c++'];
|
||||
@@ -0,0 +1,52 @@
|
||||
dp.sh.Brushes.CSS = function()
|
||||
{
|
||||
var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
|
||||
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
|
||||
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
|
||||
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
|
||||
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
|
||||
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
|
||||
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
|
||||
'height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
|
||||
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
|
||||
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
|
||||
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
|
||||
'quotes richness right size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
|
||||
'table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
|
||||
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index important';
|
||||
|
||||
var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
|
||||
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
|
||||
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
|
||||
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
|
||||
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
|
||||
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
|
||||
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
|
||||
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
|
||||
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
|
||||
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
|
||||
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
|
||||
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
|
||||
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
|
||||
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
|
||||
|
||||
var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp('\\#[a-zA-Z0-9]{3,6}', 'g'), css: 'colors' }, // html colors
|
||||
{ regex: new RegExp('(\\d+)(px|pt|\:)', 'g'), css: 'string' }, // size specifications
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(this.GetKeywords(values), 'g'), css: 'string' }, // values
|
||||
{ regex: new RegExp(this.GetKeywords(fonts), 'g'), css: 'string' } // fonts
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-css';
|
||||
this.Style = '.dp-css .colors { color: darkred; }' +
|
||||
'.dp-css .vars { color: #d00; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.CSS.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.CSS.Aliases = ['css'];
|
||||
@@ -0,0 +1,34 @@
|
||||
/* Delphi brush is contributed by Eddie Shipman */
|
||||
dp.sh.Brushes.Delphi = function()
|
||||
{
|
||||
var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
|
||||
'case char class comp const constructor currency destructor div do double ' +
|
||||
'downto else end except exports extended false file finalization finally ' +
|
||||
'for function goto if implementation in inherited int64 initialization ' +
|
||||
'integer interface is label library longint longword mod nil not object ' +
|
||||
'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
|
||||
'pint64 pointer private procedure program property pshortstring pstring ' +
|
||||
'pvariant pwidechar pwidestring protected public published raise real real48 ' +
|
||||
'record repeat set shl shortint shortstring shr single smallint string then ' +
|
||||
'threadvar to true try type unit until uses val var varirnt while widechar ' +
|
||||
'widestring with word write writeln xor';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp('\\(\\*[\\s\\S]*?\\*\\)', 'gm'), css: 'comment' }, // multiline comments (* *)
|
||||
{ regex: new RegExp('{(?!\\$)[\\s\\S]*?}', 'gm'), css: 'comment' }, // multiline comments { }
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp('\\{\\$[a-zA-Z]+ .+\\}', 'g'), css: 'directive' }, // Compiler Directives and Region tags
|
||||
{ regex: new RegExp('\\b[\\d\\.]+\\b', 'g'), css: 'number' }, // numbers 12345
|
||||
{ regex: new RegExp('\\$[a-zA-Z0-9]+\\b', 'g'), css: 'number' }, // numbers $F5D3
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-delphi';
|
||||
this.Style = '.dp-delphi .number { color: blue; }' +
|
||||
'.dp-delphi .directive { color: #008284; }' +
|
||||
'.dp-delphi .vars { color: #000; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Delphi.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Delphi.Aliases = ['delphi', 'pascal'];
|
||||
@@ -0,0 +1,22 @@
|
||||
dp.sh.Brushes.JScript = function()
|
||||
{
|
||||
var keywords = 'abstract boolean break byte case catch char class const continue debugger ' +
|
||||
'default delete do double else enum export extends false final finally float ' +
|
||||
'for function goto if implements import in instanceof int interface long native ' +
|
||||
'new null package private protected public return short static super switch ' +
|
||||
'synchronized this throw throws transient true try typeof var void volatile while with';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keywords
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-c';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.JScript.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.JScript.Aliases = ['js', 'jscript', 'javascript'];
|
||||
@@ -0,0 +1,28 @@
|
||||
dp.sh.Brushes.Java = function()
|
||||
{
|
||||
var keywords = 'abstract assert boolean break byte case catch char class const ' +
|
||||
'continue default do double else enum extends ' +
|
||||
'false final finally float for goto if implements import ' +
|
||||
'instanceof int interface long native new null ' +
|
||||
'package private protected public return ' +
|
||||
'short static strictfp super switch synchronized this throw throws true ' +
|
||||
'transient try void volatile while';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'number' }, // numbers
|
||||
{ regex: new RegExp('(?!\\@interface\\b)\\@[\\$\\w]+\\b', 'g'), css: 'annotation' }, // annotation @anno
|
||||
{ regex: new RegExp('\\@interface\\b', 'g'), css: 'keyword' }, // @interface keyword
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-j';
|
||||
this.Style = '.dp-j .annotation { color: #646464; }' +
|
||||
'.dp-j .number { color: #C00000; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Java.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Java.Aliases = ['java'];
|
||||
@@ -0,0 +1,60 @@
|
||||
dp.sh.Brushes.Php = function()
|
||||
{
|
||||
var funcs = 'abs acos acosh addcslashes addslashes ' +
|
||||
'array_change_key_case array_chunk array_combine array_count_values array_diff '+
|
||||
'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
|
||||
'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
|
||||
'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
|
||||
'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
|
||||
'array_push array_rand array_reduce array_reverse array_search array_shift '+
|
||||
'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
|
||||
'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
|
||||
'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
|
||||
'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
|
||||
'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
|
||||
'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
|
||||
'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
|
||||
'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
|
||||
'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
|
||||
'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
|
||||
'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
|
||||
'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
|
||||
'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
|
||||
'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
|
||||
'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
|
||||
'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
|
||||
'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
|
||||
'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
|
||||
'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
|
||||
'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
|
||||
'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
|
||||
'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+
|
||||
'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
|
||||
'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
|
||||
'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
|
||||
'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
|
||||
'strtoupper strtr strval substr substr_compare';
|
||||
|
||||
var keywords = 'and or xor __FILE__ __LINE__ array as break case ' +
|
||||
'cfunction class const continue declare default die do else ' +
|
||||
'elseif empty enddeclare endfor endforeach endif endswitch endwhile ' +
|
||||
'extends for foreach function include include_once global if ' +
|
||||
'new old_function return static switch use require require_once ' +
|
||||
'var while __FUNCTION__ __CLASS__ ' +
|
||||
'__METHOD__ abstract interface public implements extends private protected throw';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp('\\$\\w+', 'g'), css: 'vars' }, // variables
|
||||
{ regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func' }, // functions
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-c';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Php.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Php.Aliases = ['php'];
|
||||
@@ -0,0 +1,30 @@
|
||||
/* Python 2.3 syntax contributed by Gheorghe Milas */
|
||||
dp.sh.Brushes.Python = function()
|
||||
{
|
||||
var keywords = 'and assert break class continue def del elif else ' +
|
||||
'except exec finally for from global if import in is ' +
|
||||
'lambda not or pass print raise return try yield while';
|
||||
|
||||
var special = 'None True False self cls class_'
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' },
|
||||
{ regex: new RegExp("^\\s*@\\w+", 'gm'), css: 'decorator' },
|
||||
{ regex: new RegExp("(['\"]{3})([^\\1])*?\\1", 'gm'), css: 'comment' },
|
||||
{ regex: new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"', 'gm'), css: 'string' },
|
||||
{ regex: new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'", 'gm'), css: 'string' },
|
||||
{ regex: new RegExp("\\b\\d+\\.?\\w*", 'g'), css: 'number' },
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' },
|
||||
{ regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'special' },
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-py';
|
||||
this.Style = '.dp-py .builtins { color: #ff1493; }' +
|
||||
'.dp-py .magicmethods { color: #808080; }' +
|
||||
'.dp-py .exceptions { color: brown; }' +
|
||||
'.dp-py .types { color: brown; font-style: italic; }' +
|
||||
'.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Python.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Python.Aliases = ['py', 'python'];
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Ruby 1.8.4 syntax contributed by Erik Peterson */
|
||||
dp.sh.Brushes.Ruby = function()
|
||||
{
|
||||
var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
|
||||
'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
|
||||
'self super then throw true undef unless until when while yield';
|
||||
|
||||
var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
|
||||
'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
|
||||
'ThreadGroup Thread Time TrueClass'
|
||||
|
||||
this.regexList = [
|
||||
{ regex: dp.sh.RegexLib.SingleLinePerlComments, css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp(':[a-z][A-Za-z0-9_]*', 'g'), css: 'symbol' }, // symbols
|
||||
{ regex: new RegExp('(\\$|@@|@)\\w+', 'g'), css: 'variable' }, // $global, @instance, and @@class variables
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
|
||||
{ regex: new RegExp(this.GetKeywords(builtins), 'gm'), css: 'builtin' } // builtins
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-rb';
|
||||
this.Style = '.dp-rb .symbol { color: #a70; }' +
|
||||
'.dp-rb .variable { color: #a70; font-weight: bold; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Ruby.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Ruby.Aliases = ['ruby', 'rails', 'ror'];
|
||||
@@ -0,0 +1,42 @@
|
||||
dp.sh.Brushes.Sql = function()
|
||||
{
|
||||
var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
|
||||
'current_user day isnull left lower month nullif replace right ' +
|
||||
'session_user space substring sum system_user upper user year';
|
||||
|
||||
var keywords = 'absolute action add after alter as asc at authorization begin bigint ' +
|
||||
'binary bit by cascade char character check checkpoint close collate ' +
|
||||
'column commit committed connect connection constraint contains continue ' +
|
||||
'create cube current current_date current_time cursor database date ' +
|
||||
'deallocate dec decimal declare default delete desc distinct double drop ' +
|
||||
'dynamic else end end-exec escape except exec execute false fetch first ' +
|
||||
'float for force foreign forward free from full function global goto grant ' +
|
||||
'group grouping having hour ignore index inner insensitive insert instead ' +
|
||||
'int integer intersect into is isolation key last level load local max min ' +
|
||||
'minute modify move name national nchar next no numeric of off on only ' +
|
||||
'open option order out output partial password precision prepare primary ' +
|
||||
'prior privileges procedure public read real references relative repeatable ' +
|
||||
'restrict return returns revoke rollback rollup rows rule schema scroll ' +
|
||||
'second section select sequence serializable set size smallint static ' +
|
||||
'statistics table temp temporary then time timestamp to top transaction ' +
|
||||
'translation trigger true truncate uncommitted union unique update values ' +
|
||||
'varchar varying view when where with work';
|
||||
|
||||
var operators = 'all and any between cross in join like not null or outer some';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp('--(.*)$', 'gm'), css: 'comment' }, // one line and multiline comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings
|
||||
{ regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings
|
||||
{ regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'func' }, // functions
|
||||
{ regex: new RegExp(this.GetKeywords(operators), 'gmi'), css: 'op' }, // operators and such
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-sql';
|
||||
this.Style = '.dp-sql .func { color: #ff1493; }' +
|
||||
'.dp-sql .op { color: #808080; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Sql.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Sql.Aliases = ['sql'];
|
||||
@@ -0,0 +1,29 @@
|
||||
dp.sh.Brushes.Vb = function()
|
||||
{
|
||||
var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
|
||||
'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
|
||||
'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
|
||||
'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
|
||||
'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
|
||||
'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
|
||||
'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
|
||||
'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
|
||||
'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
|
||||
'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
|
||||
'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
|
||||
'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
|
||||
'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
|
||||
'Variant When While With WithEvents WriteOnly Xor';
|
||||
|
||||
this.regexList = [
|
||||
{ regex: new RegExp('\'.*$', 'gm'), css: 'comment' }, // one line comments
|
||||
{ regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings
|
||||
{ regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion
|
||||
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // c# keyword
|
||||
];
|
||||
|
||||
this.CssClass = 'dp-vb';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Vb.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Vb.Aliases = ['vb', 'vb.net'];
|
||||
@@ -0,0 +1,70 @@
|
||||
dp.sh.Brushes.Xml = function()
|
||||
{
|
||||
this.CssClass = 'dp-xml';
|
||||
this.Style = '.dp-xml .cdata { color: #ff1493; }' +
|
||||
'.dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }' +
|
||||
'.dp-xml .attribute { color: red; }' +
|
||||
'.dp-xml .attribute-value { color: blue; }';
|
||||
}
|
||||
|
||||
dp.sh.Brushes.Xml.prototype = new dp.sh.Highlighter();
|
||||
dp.sh.Brushes.Xml.Aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml'];
|
||||
|
||||
dp.sh.Brushes.Xml.prototype.ProcessRegexList = function()
|
||||
{
|
||||
function push(array, value)
|
||||
{
|
||||
array[array.length] = value;
|
||||
}
|
||||
|
||||
/* If only there was a way to get index of a group within a match, the whole XML
|
||||
could be matched with the expression looking something like that:
|
||||
|
||||
(<!\[CDATA\[\s*.*\s*\]\]>)
|
||||
| (<!--\s*.*\s*?-->)
|
||||
| (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)*
|
||||
| (</?)(.*?)(/?>)
|
||||
*/
|
||||
var index = 0;
|
||||
var match = null;
|
||||
var regex = null;
|
||||
|
||||
// Match CDATA in the following format <![ ... [ ... ]]>
|
||||
// (\<|<)\!\[[\w\s]*?\[(.|\s)*?\]\](\>|>)
|
||||
this.GetMatches(new RegExp('(\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\>|>)', 'gm'), 'cdata');
|
||||
|
||||
// Match comments
|
||||
// (\<|<)!--\s*.*\s*?--(\>|>)
|
||||
this.GetMatches(new RegExp('(\<|<)!--\\s*.*\\s*?--(\>|>)', 'gm'), 'comments');
|
||||
|
||||
// Match attributes and their values
|
||||
// (:|\w+)\s*=\s*(".*?"|\'.*?\'|\w+)*
|
||||
regex = new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*|(\\w+)', 'gm'); // Thanks to Tomi Blinnikka of Yahoo! for fixing namespaces in attributes
|
||||
while((match = regex.exec(this.code)) != null)
|
||||
{
|
||||
if(match[1] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
push(this.matches, new dp.sh.Match(match[1], match.index, 'attribute'));
|
||||
|
||||
// if xml is invalid and attribute has no property value, ignore it
|
||||
if(match[2] != undefined)
|
||||
{
|
||||
push(this.matches, new dp.sh.Match(match[2], match.index + match[0].indexOf(match[2]), 'attribute-value'));
|
||||
}
|
||||
}
|
||||
|
||||
// Match opening and closing tag brackets
|
||||
// (\<|<)/*\?*(?!\!)|/*\?*(\>|>)
|
||||
this.GetMatches(new RegExp('(\<|<)/*\\?*(?!\\!)|/*\\?*(\>|>)', 'gm'), 'tag');
|
||||
|
||||
// Match tag names
|
||||
// (\<|<)/*\?*\s*(\w+)
|
||||
regex = new RegExp('(?:\<|<)/*\\?*\\s*([:\\w-\.]+)', 'gm');
|
||||
while((match = regex.exec(this.code)) != null)
|
||||
{
|
||||
push(this.matches, new dp.sh.Match(match[1], match.index + match[0].indexOf(match[1]), 'tag-name'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:"<html><head><title>About...</title></head><body class=\"dp-about\"><table cellspacing=\"0\"><tr><td class=\"copy\"><p class=\"title\">dp.SyntaxHighlighter</div><div class=\"para\">Version: {V}</p><p><a href=\"http://www.dreamprojections.com/syntaxhighlighter/?ref=about\" target=\"_blank\">http://www.dreamprojections.com/syntaxhighlighter</a></p>©2004-2007 Alex Gorbatchev.</td></tr><tr><td class=\"footer\"><input type=\"button\" class=\"close\" value=\"OK\" onClick=\"window.close()\"/></td></tr></table></body></html>"},ClipboardSwf:null,Version:"1.5"}};
|
||||
dp.SyntaxHighlighter=dp.sh;
|
||||
dp.sh.Toolbar.Commands={ExpandSource:{label:"+ expand source",check:function(_1){
|
||||
return _1.collapse;
|
||||
},func:function(_2,_3){
|
||||
_2.parentNode.removeChild(_2);
|
||||
_3.div.className=_3.div.className.replace("collapsed","");
|
||||
}},ViewSource:{label:"view plain",func:function(_4,_5){
|
||||
var _6=_5.originalCode.replace(/</g,"<");
|
||||
var _7=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");
|
||||
_7.document.write("<textarea style=\"width:99%;height:99%\">"+_6+"</textarea>");
|
||||
_7.document.close();
|
||||
}},CopyToClipboard:{label:"copy to clipboard",check:function(){
|
||||
return window.clipboardData!=null||dp.sh.ClipboardSwf!=null;
|
||||
},func:function(_8,_9){
|
||||
var _a=_9.originalCode;
|
||||
if(window.clipboardData){
|
||||
window.clipboardData.setData("text",_a);
|
||||
}else{
|
||||
if(dp.sh.ClipboardSwf!=null){
|
||||
var _b=_9.flashCopier;
|
||||
if(_b==null){
|
||||
_b=document.createElement("div");
|
||||
_9.flashCopier=_b;
|
||||
_9.div.appendChild(_b);
|
||||
}
|
||||
_b.innerHTML="<embed src=\""+dp.sh.ClipboardSwf+"\" FlashVars=\"clipboard="+encodeURIComponent(_a)+"\" width=\"0\" height=\"0\" type=\"application/x-shockwave-flash\"></embed>";
|
||||
}
|
||||
}
|
||||
alert("The code is in your clipboard now");
|
||||
}},PrintSource:{label:"print",func:function(_c,_d){
|
||||
var _e=document.createElement("IFRAME");
|
||||
var _f=null;
|
||||
_e.style.cssText="position:absolute;width:0px;height:0px;left:-500px;top:-500px;";
|
||||
document.body.appendChild(_e);
|
||||
_f=_e.contentWindow.document;
|
||||
dp.sh.Utils.CopyStyles(_f,window.document);
|
||||
_f.write("<div class=\""+_d.div.className.replace("collapsed","")+" printing\">"+_d.div.innerHTML+"</div>");
|
||||
_f.close();
|
||||
_e.contentWindow.focus();
|
||||
_e.contentWindow.print();
|
||||
alert("Printing...");
|
||||
document.body.removeChild(_e);
|
||||
}},About:{label:"?",func:function(_10){
|
||||
var wnd=window.open("","_blank","dialog,width=300,height=150,scrollbars=0");
|
||||
var doc=wnd.document;
|
||||
dp.sh.Utils.CopyStyles(doc,window.document);
|
||||
doc.write(dp.sh.Strings.AboutDialog.replace("{V}",dp.sh.Version));
|
||||
doc.close();
|
||||
wnd.focus();
|
||||
}}};
|
||||
dp.sh.Toolbar.Create=function(_13){
|
||||
var div=document.createElement("DIV");
|
||||
div.className="tools";
|
||||
for(var _15 in dp.sh.Toolbar.Commands){
|
||||
var cmd=dp.sh.Toolbar.Commands[_15];
|
||||
if(cmd.check!=null&&!cmd.check(_13)){
|
||||
continue;
|
||||
}
|
||||
div.innerHTML+="<a href=\"#\" onclick=\"dp.sh.Toolbar.Command('"+_15+"',this);return false;\">"+cmd.label+"</a>";
|
||||
}
|
||||
return div;
|
||||
};
|
||||
dp.sh.Toolbar.Command=function(_17,_18){
|
||||
var n=_18;
|
||||
while(n!=null&&n.className.indexOf("dp-highlighter")==-1){
|
||||
n=n.parentNode;
|
||||
}
|
||||
if(n!=null){
|
||||
dp.sh.Toolbar.Commands[_17].func(_18,n.highlighter);
|
||||
}
|
||||
};
|
||||
dp.sh.Utils.CopyStyles=function(_1a,_1b){
|
||||
var _1c=_1b.getElementsByTagName("link");
|
||||
for(var i=0;i<_1c.length;i++){
|
||||
if(_1c[i].rel.toLowerCase()=="stylesheet"){
|
||||
_1a.write("<link type=\"text/css\" rel=\"stylesheet\" href=\""+_1c[i].href+"\"></link>");
|
||||
}
|
||||
}
|
||||
};
|
||||
dp.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp("\"(?:\\.|(\\\\\\\")|[^\\\"\"])*\"","g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'","g")};
|
||||
dp.sh.Match=function(_1e,_1f,css){
|
||||
this.value=_1e;
|
||||
this.index=_1f;
|
||||
this.length=_1e.length;
|
||||
this.css=css;
|
||||
};
|
||||
dp.sh.Highlighter=function(){
|
||||
this.noGutter=false;
|
||||
this.addControls=true;
|
||||
this.collapse=false;
|
||||
this.tabsToSpaces=true;
|
||||
this.wrapColumn=80;
|
||||
this.showColumns=true;
|
||||
};
|
||||
dp.sh.Highlighter.SortCallback=function(m1,m2){
|
||||
if(m1.index<m2.index){
|
||||
return -1;
|
||||
}else{
|
||||
if(m1.index>m2.index){
|
||||
return 1;
|
||||
}else{
|
||||
if(m1.length<m2.length){
|
||||
return -1;
|
||||
}else{
|
||||
if(m1.length>m2.length){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
dp.sh.Highlighter.prototype.CreateElement=function(_23){
|
||||
var _24=document.createElement(_23);
|
||||
_24.highlighter=this;
|
||||
return _24;
|
||||
};
|
||||
dp.sh.Highlighter.prototype.GetMatches=function(_25,css){
|
||||
var _27=0;
|
||||
var _28=null;
|
||||
while((_28=_25.exec(this.code))!=null){
|
||||
this.matches[this.matches.length]=new dp.sh.Match(_28[0],_28.index,css);
|
||||
}
|
||||
};
|
||||
dp.sh.Highlighter.prototype.AddBit=function(str,css){
|
||||
if(str==null||str.length==0){
|
||||
return;
|
||||
}
|
||||
var _2b=this.CreateElement("SPAN");
|
||||
str=str.replace(/ /g," ");
|
||||
str=str.replace(/</g,"<");
|
||||
str=str.replace(/\n/gm," <br>");
|
||||
if(css!=null){
|
||||
if((/br/gi).test(str)){
|
||||
var _2c=str.split(" <br>");
|
||||
for(var i=0;i<_2c.length;i++){
|
||||
_2b=this.CreateElement("SPAN");
|
||||
_2b.className=css;
|
||||
_2b.innerHTML=_2c[i];
|
||||
this.div.appendChild(_2b);
|
||||
if(i+1<_2c.length){
|
||||
this.div.appendChild(this.CreateElement("BR"));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
_2b.className=css;
|
||||
_2b.innerHTML=str;
|
||||
this.div.appendChild(_2b);
|
||||
}
|
||||
}else{
|
||||
_2b.innerHTML=str;
|
||||
this.div.appendChild(_2b);
|
||||
}
|
||||
};
|
||||
dp.sh.Highlighter.prototype.IsInside=function(_2e){
|
||||
if(_2e==null||_2e.length==0){
|
||||
return false;
|
||||
}
|
||||
for(var i=0;i<this.matches.length;i++){
|
||||
var c=this.matches[i];
|
||||
if(c==null){
|
||||
continue;
|
||||
}
|
||||
if((_2e.index>c.index)&&(_2e.index<c.index+c.length)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
dp.sh.Highlighter.prototype.ProcessRegexList=function(){
|
||||
for(var i=0;i<this.regexList.length;i++){
|
||||
this.GetMatches(this.regexList[i].regex,this.regexList[i].css);
|
||||
}
|
||||
};
|
||||
dp.sh.Highlighter.prototype.ProcessSmartTabs=function(_32){
|
||||
var _33=_32.split("\n");
|
||||
var _34="";
|
||||
var _35=4;
|
||||
var tab="\t";
|
||||
function InsertSpaces(_37,pos,_39){
|
||||
var _3a=_37.substr(0,pos);
|
||||
var _3b=_37.substr(pos+1,_37.length);
|
||||
var _3c="";
|
||||
for(var i=0;i<_39;i++){
|
||||
_3c+=" ";
|
||||
}
|
||||
return _3a+_3c+_3b;
|
||||
}
|
||||
function ProcessLine(_3e,_3f){
|
||||
if(_3e.indexOf(tab)==-1){
|
||||
return _3e;
|
||||
}
|
||||
var pos=0;
|
||||
while((pos=_3e.indexOf(tab))!=-1){
|
||||
var _41=_3f-pos%_3f;
|
||||
_3e=InsertSpaces(_3e,pos,_41);
|
||||
}
|
||||
return _3e;
|
||||
}
|
||||
for(var i=0;i<_33.length;i++){
|
||||
_34+=ProcessLine(_33[i],_35)+"\n";
|
||||
}
|
||||
return _34;
|
||||
};
|
||||
dp.sh.Highlighter.prototype.SwitchToList=function(){
|
||||
var _43=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n");
|
||||
var _44=_43.split("\n");
|
||||
if(this.addControls==true){
|
||||
this.bar.appendChild(dp.sh.Toolbar.Create(this));
|
||||
}
|
||||
if(this.showColumns){
|
||||
var div=this.CreateElement("div");
|
||||
var _46=this.CreateElement("div");
|
||||
var _47=10;
|
||||
var i=1;
|
||||
while(i<=150){
|
||||
if(i%_47==0){
|
||||
div.innerHTML+=i;
|
||||
i+=(i+"").length;
|
||||
}else{
|
||||
div.innerHTML+="·";
|
||||
i++;
|
||||
}
|
||||
}
|
||||
_46.className="columns";
|
||||
_46.appendChild(div);
|
||||
this.bar.appendChild(_46);
|
||||
}
|
||||
for(var i=0,lineIndex=this.firstLine;i<_44.length-1;i++,lineIndex++){
|
||||
var li=this.CreateElement("LI");
|
||||
var _4b=this.CreateElement("SPAN");
|
||||
li.className=(i%2==0)?"alt":"";
|
||||
_4b.innerHTML=_44[i]+" ";
|
||||
li.appendChild(_4b);
|
||||
this.ol.appendChild(li);
|
||||
}
|
||||
this.div.innerHTML="";
|
||||
};
|
||||
dp.sh.Highlighter.prototype.Highlight=function(_4c){
|
||||
function Trim(str){
|
||||
return str.replace(/^\s*(.*?)[\s\n]*$/g,"$1");
|
||||
}
|
||||
function Chop(str){
|
||||
return str.replace(/\n*$/,"").replace(/^\n*/,"");
|
||||
}
|
||||
function Unindent(str){
|
||||
var _50=str.split("\n");
|
||||
var _51=new Array();
|
||||
var _52=new RegExp("^\\s*","g");
|
||||
var min=1000;
|
||||
for(var i=0;i<_50.length&&min>0;i++){
|
||||
if(Trim(_50[i]).length==0){
|
||||
continue;
|
||||
}
|
||||
var _55=_52.exec(_50[i]);
|
||||
if(_55!=null&&_55.length>0){
|
||||
min=Math.min(_55[0].length,min);
|
||||
}
|
||||
}
|
||||
if(min>0){
|
||||
for(var i=0;i<_50.length;i++){
|
||||
_50[i]=_50[i].substr(min);
|
||||
}
|
||||
}
|
||||
return _50.join("\n");
|
||||
}
|
||||
function Copy(_57,_58,_59){
|
||||
return _57.substr(_58,_59-_58);
|
||||
}
|
||||
var pos=0;
|
||||
if(_4c==null){
|
||||
_4c="";
|
||||
}
|
||||
this.originalCode=_4c;
|
||||
this.code=Chop(Unindent(_4c));
|
||||
this.div=this.CreateElement("DIV");
|
||||
this.bar=this.CreateElement("DIV");
|
||||
this.ol=this.CreateElement("OL");
|
||||
this.matches=new Array();
|
||||
this.div.className="dp-highlighter";
|
||||
this.div.highlighter=this;
|
||||
this.bar.className="bar";
|
||||
this.ol.start=this.firstLine;
|
||||
if(this.CssClass!=null){
|
||||
this.ol.className=this.CssClass;
|
||||
}
|
||||
if(this.collapse){
|
||||
this.div.className+=" collapsed";
|
||||
}
|
||||
if(this.noGutter){
|
||||
this.div.className+=" nogutter";
|
||||
}
|
||||
if(this.tabsToSpaces==true){
|
||||
this.code=this.ProcessSmartTabs(this.code);
|
||||
}
|
||||
this.ProcessRegexList();
|
||||
if(this.matches.length==0){
|
||||
this.AddBit(this.code,null);
|
||||
this.SwitchToList();
|
||||
this.div.appendChild(this.ol);
|
||||
return;
|
||||
}
|
||||
this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);
|
||||
for(var i=0;i<this.matches.length;i++){
|
||||
if(this.IsInside(this.matches[i])){
|
||||
this.matches[i]=null;
|
||||
}
|
||||
}
|
||||
for(var i=0;i<this.matches.length;i++){
|
||||
var _5d=this.matches[i];
|
||||
if(_5d==null||_5d.length==0){
|
||||
continue;
|
||||
}
|
||||
this.AddBit(Copy(this.code,pos,_5d.index),null);
|
||||
this.AddBit(_5d.value,_5d.css);
|
||||
pos=_5d.index+_5d.length;
|
||||
}
|
||||
this.AddBit(this.code.substr(pos),null);
|
||||
this.SwitchToList();
|
||||
this.div.appendChild(this.bar);
|
||||
this.div.appendChild(this.ol);
|
||||
};
|
||||
dp.sh.Highlighter.prototype.GetKeywords=function(str){
|
||||
return "\\b"+str.replace(/ /g,"\\b|\\b")+"\\b";
|
||||
};
|
||||
dp.sh.HighlightAll=function(_5f,_60,_61,_62,_63,_64){
|
||||
function FindValue(){
|
||||
var a=arguments;
|
||||
for(var i=0;i<a.length;i++){
|
||||
if(a[i]==null){
|
||||
continue;
|
||||
}
|
||||
if(typeof (a[i])=="string"&&a[i]!=""){
|
||||
return a[i]+"";
|
||||
}
|
||||
if(typeof (a[i])=="object"&&a[i].value!=""){
|
||||
return a[i].value+"";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function IsOptionSet(_67,_68){
|
||||
for(var i=0;i<_68.length;i++){
|
||||
if(_68[i]==_67){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function GetOptionValue(_6a,_6b,_6c){
|
||||
var _6d=new RegExp("^"+_6a+"\\[(\\w+)\\]$","gi");
|
||||
var _6e=null;
|
||||
for(var i=0;i<_6b.length;i++){
|
||||
if((_6e=_6d.exec(_6b[i]))!=null){
|
||||
return _6e[1];
|
||||
}
|
||||
}
|
||||
return _6c;
|
||||
}
|
||||
function FindTagsByName(_70,_71,_72){
|
||||
var _73=document.getElementsByTagName(_72);
|
||||
for(var i=0;i<_73.length;i++){
|
||||
if(_73[i].getAttribute("name")==_71){
|
||||
_70.push(_73[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var _75=[];
|
||||
var _76=null;
|
||||
var _77={};
|
||||
var _78="innerHTML";
|
||||
FindTagsByName(_75,_5f,"pre");
|
||||
FindTagsByName(_75,_5f,"textarea");
|
||||
if(_75.length==0){
|
||||
return;
|
||||
}
|
||||
for(var _79 in dp.sh.Brushes){
|
||||
var _7a=dp.sh.Brushes[_79].Aliases;
|
||||
if(_7a==null){
|
||||
continue;
|
||||
}
|
||||
for(var i=0;i<_7a.length;i++){
|
||||
_77[_7a[i]]=_79;
|
||||
}
|
||||
}
|
||||
for(var i=0;i<_75.length;i++){
|
||||
var _7d=_75[i];
|
||||
var _7e=FindValue(_7d.attributes["class"],_7d.className,_7d.attributes["language"],_7d.language);
|
||||
var _7f="";
|
||||
if(_7e==null){
|
||||
continue;
|
||||
}
|
||||
_7e=_7e.split(":");
|
||||
_7f=_7e[0].toLowerCase();
|
||||
if(_77[_7f]==null){
|
||||
continue;
|
||||
}
|
||||
_76=new dp.sh.Brushes[_77[_7f]]();
|
||||
_7d.style.display="none";
|
||||
_76.noGutter=(_60==null)?IsOptionSet("nogutter",_7e):!_60;
|
||||
_76.addControls=(_61==null)?!IsOptionSet("nocontrols",_7e):_61;
|
||||
_76.collapse=(_62==null)?IsOptionSet("collapse",_7e):_62;
|
||||
_76.showColumns=(_64==null)?IsOptionSet("showcolumns",_7e):_64;
|
||||
if(_76.Style){
|
||||
document.write("<style>"+_76.Style+"</style>");
|
||||
}
|
||||
_76.firstLine=(_63==null)?parseInt(GetOptionValue("firstline",_7e,1)):_63;
|
||||
_76.Highlight(_7d[_78]);
|
||||
_76.source=_7d;
|
||||
_7d.parentNode.insertBefore(_76.div,_7d);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
/**
|
||||
* Code Syntax Highlighter.
|
||||
* Version 1.5
|
||||
* Copyright (C) 2004-2007 Alex Gorbatchev.
|
||||
* http://www.dreamprojections.com/syntaxhighlighter/
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
|
||||
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// create namespaces
|
||||
//
|
||||
var dp = {
|
||||
sh :
|
||||
{
|
||||
Toolbar : {},
|
||||
Utils : {},
|
||||
RegexLib: {},
|
||||
Brushes : {},
|
||||
Strings : {
|
||||
AboutDialog : '<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>©2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'
|
||||
},
|
||||
ClipboardSwf : null,
|
||||
Version : '1.5'
|
||||
}
|
||||
};
|
||||
|
||||
// make an alias
|
||||
dp.SyntaxHighlighter = dp.sh;
|
||||
|
||||
//
|
||||
// Toolbar functions
|
||||
//
|
||||
|
||||
dp.sh.Toolbar.Commands = {
|
||||
ExpandSource: {
|
||||
label: '+ expand source',
|
||||
check: function(highlighter) { return highlighter.collapse; },
|
||||
func: function(sender, highlighter)
|
||||
{
|
||||
sender.parentNode.removeChild(sender);
|
||||
highlighter.div.className = highlighter.div.className.replace('collapsed', '');
|
||||
}
|
||||
},
|
||||
|
||||
// opens a new windows and puts the original unformatted source code inside.
|
||||
ViewSource: {
|
||||
label: 'view plain',
|
||||
func: function(sender, highlighter)
|
||||
{
|
||||
var code = highlighter.originalCode.replace(/</g, '<');
|
||||
var wnd = window.open('', '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0');
|
||||
wnd.document.write('<textarea style="width:99%;height:99%">' + code + '</textarea>');
|
||||
wnd.document.close();
|
||||
}
|
||||
},
|
||||
|
||||
// Copies the original source code in to the clipboard. Uses either IE only method or Flash object if ClipboardSwf is set
|
||||
CopyToClipboard: {
|
||||
label: 'copy to clipboard',
|
||||
check: function() { return window.clipboardData != null || dp.sh.ClipboardSwf != null; },
|
||||
func: function(sender, highlighter)
|
||||
{
|
||||
var code = highlighter.originalCode;
|
||||
|
||||
if(window.clipboardData)
|
||||
{
|
||||
window.clipboardData.setData('text', code);
|
||||
}
|
||||
else if(dp.sh.ClipboardSwf != null)
|
||||
{
|
||||
var flashcopier = highlighter.flashCopier;
|
||||
|
||||
if(flashcopier == null)
|
||||
{
|
||||
flashcopier = document.createElement('div');
|
||||
highlighter.flashCopier = flashcopier;
|
||||
highlighter.div.appendChild(flashcopier);
|
||||
}
|
||||
|
||||
flashcopier.innerHTML = '<embed src="' + dp.sh.ClipboardSwf + '" FlashVars="clipboard='+encodeURIComponent(code)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
|
||||
}
|
||||
|
||||
alert('The code is in your clipboard now');
|
||||
}
|
||||
},
|
||||
|
||||
// creates an invisible iframe, puts the original source code inside and prints it
|
||||
PrintSource: {
|
||||
label: 'print',
|
||||
func: function(sender, highlighter)
|
||||
{
|
||||
var iframe = document.createElement('IFRAME');
|
||||
var doc = null;
|
||||
|
||||
// this hides the iframe
|
||||
iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
doc = iframe.contentWindow.document;
|
||||
|
||||
dp.sh.Utils.CopyStyles(doc, window.document);
|
||||
doc.write('<div class="' + highlighter.div.className.replace('collapsed', '') + ' printing">' + highlighter.div.innerHTML + '</div>');
|
||||
doc.close();
|
||||
|
||||
iframe.contentWindow.focus();
|
||||
iframe.contentWindow.print();
|
||||
|
||||
alert('Printing...');
|
||||
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
},
|
||||
|
||||
About: {
|
||||
label: '?',
|
||||
func: function(highlighter)
|
||||
{
|
||||
var wnd = window.open('', '_blank', 'dialog,width=300,height=150,scrollbars=0');
|
||||
var doc = wnd.document;
|
||||
|
||||
dp.sh.Utils.CopyStyles(doc, window.document);
|
||||
|
||||
doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version));
|
||||
doc.close();
|
||||
wnd.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// creates a <div /> with all toolbar links
|
||||
dp.sh.Toolbar.Create = function(highlighter)
|
||||
{
|
||||
var div = document.createElement('DIV');
|
||||
|
||||
div.className = 'tools';
|
||||
|
||||
for(var name in dp.sh.Toolbar.Commands)
|
||||
{
|
||||
var cmd = dp.sh.Toolbar.Commands[name];
|
||||
|
||||
if(cmd.check != null && !cmd.check(highlighter))
|
||||
continue;
|
||||
|
||||
div.innerHTML += '<a href="#" onclick="dp.sh.Toolbar.Command(\'' + name + '\',this);return false;">' + cmd.label + '</a>';
|
||||
}
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
// executes toolbar command by name
|
||||
dp.sh.Toolbar.Command = function(name, sender)
|
||||
{
|
||||
var n = sender;
|
||||
|
||||
while(n != null && n.className.indexOf('dp-highlighter') == -1)
|
||||
n = n.parentNode;
|
||||
|
||||
if(n != null)
|
||||
dp.sh.Toolbar.Commands[name].func(sender, n.highlighter);
|
||||
}
|
||||
|
||||
// copies all <link rel="stylesheet" /> from 'target' window to 'dest'
|
||||
dp.sh.Utils.CopyStyles = function(destDoc, sourceDoc)
|
||||
{
|
||||
var links = sourceDoc.getElementsByTagName('link');
|
||||
|
||||
for(var i = 0; i < links.length; i++)
|
||||
if(links[i].rel.toLowerCase() == 'stylesheet')
|
||||
destDoc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
|
||||
}
|
||||
|
||||
//
|
||||
// Common reusable regular expressions
|
||||
//
|
||||
dp.sh.RegexLib = {
|
||||
MultiLineCComments : new RegExp('/\\*[\\s\\S]*?\\*/', 'gm'),
|
||||
SingleLineCComments : new RegExp('//.*$', 'gm'),
|
||||
SingleLinePerlComments : new RegExp('#.*$', 'gm'),
|
||||
DoubleQuotedString : new RegExp('"(?:\\.|(\\\\\\")|[^\\""])*"','g'),
|
||||
SingleQuotedString : new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'", 'g')
|
||||
};
|
||||
|
||||
//
|
||||
// Match object
|
||||
//
|
||||
dp.sh.Match = function(value, index, css)
|
||||
{
|
||||
this.value = value;
|
||||
this.index = index;
|
||||
this.length = value.length;
|
||||
this.css = css;
|
||||
}
|
||||
|
||||
//
|
||||
// Highlighter object
|
||||
//
|
||||
dp.sh.Highlighter = function()
|
||||
{
|
||||
this.noGutter = false;
|
||||
this.addControls = true;
|
||||
this.collapse = false;
|
||||
this.tabsToSpaces = true;
|
||||
this.wrapColumn = 80;
|
||||
this.showColumns = true;
|
||||
}
|
||||
|
||||
// static callback for the match sorting
|
||||
dp.sh.Highlighter.SortCallback = function(m1, m2)
|
||||
{
|
||||
// sort matches by index first
|
||||
if(m1.index < m2.index)
|
||||
return -1;
|
||||
else if(m1.index > m2.index)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
// if index is the same, sort by length
|
||||
if(m1.length < m2.length)
|
||||
return -1;
|
||||
else if(m1.length > m2.length)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.CreateElement = function(name)
|
||||
{
|
||||
var result = document.createElement(name);
|
||||
result.highlighter = this;
|
||||
return result;
|
||||
}
|
||||
|
||||
// gets a list of all matches for a given regular expression
|
||||
dp.sh.Highlighter.prototype.GetMatches = function(regex, css)
|
||||
{
|
||||
var index = 0;
|
||||
var match = null;
|
||||
|
||||
while((match = regex.exec(this.code)) != null)
|
||||
this.matches[this.matches.length] = new dp.sh.Match(match[0], match.index, css);
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.AddBit = function(str, css)
|
||||
{
|
||||
if(str == null || str.length == 0)
|
||||
return;
|
||||
|
||||
var span = this.CreateElement('SPAN');
|
||||
|
||||
// str = str.replace(/&/g, '&');
|
||||
str = str.replace(/ /g, ' ');
|
||||
str = str.replace(/</g, '<');
|
||||
// str = str.replace(/</g, '<');
|
||||
// str = str.replace(/>/g, '>');
|
||||
str = str.replace(/\n/gm, ' <br>');
|
||||
|
||||
// when adding a piece of code, check to see if it has line breaks in it
|
||||
// and if it does, wrap individual line breaks with span tags
|
||||
if(css != null)
|
||||
{
|
||||
if((/br/gi).test(str))
|
||||
{
|
||||
var lines = str.split(' <br>');
|
||||
|
||||
for(var i = 0; i < lines.length; i++)
|
||||
{
|
||||
span = this.CreateElement('SPAN');
|
||||
span.className = css;
|
||||
span.innerHTML = lines[i];
|
||||
|
||||
this.div.appendChild(span);
|
||||
|
||||
// don't add a <BR> for the last line
|
||||
if(i + 1 < lines.length)
|
||||
this.div.appendChild(this.CreateElement('BR'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
span.className = css;
|
||||
span.innerHTML = str;
|
||||
this.div.appendChild(span);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
span.innerHTML = str;
|
||||
this.div.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
// checks if one match is inside any other match
|
||||
dp.sh.Highlighter.prototype.IsInside = function(match)
|
||||
{
|
||||
if(match == null || match.length == 0)
|
||||
return false;
|
||||
|
||||
for(var i = 0; i < this.matches.length; i++)
|
||||
{
|
||||
var c = this.matches[i];
|
||||
|
||||
if(c == null)
|
||||
continue;
|
||||
|
||||
if((match.index > c.index) && (match.index < c.index + c.length))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.ProcessRegexList = function()
|
||||
{
|
||||
for(var i = 0; i < this.regexList.length; i++)
|
||||
this.GetMatches(this.regexList[i].regex, this.regexList[i].css);
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code)
|
||||
{
|
||||
var lines = code.split('\n');
|
||||
var result = '';
|
||||
var tabSize = 4;
|
||||
var tab = '\t';
|
||||
|
||||
// This function inserts specified amount of spaces in the string
|
||||
// where a tab is while removing that given tab.
|
||||
function InsertSpaces(line, pos, count)
|
||||
{
|
||||
var left = line.substr(0, pos);
|
||||
var right = line.substr(pos + 1, line.length); // pos + 1 will get rid of the tab
|
||||
var spaces = '';
|
||||
|
||||
for(var i = 0; i < count; i++)
|
||||
spaces += ' ';
|
||||
|
||||
return left + spaces + right;
|
||||
}
|
||||
|
||||
// This function process one line for 'smart tabs'
|
||||
function ProcessLine(line, tabSize)
|
||||
{
|
||||
if(line.indexOf(tab) == -1)
|
||||
return line;
|
||||
|
||||
var pos = 0;
|
||||
|
||||
while((pos = line.indexOf(tab)) != -1)
|
||||
{
|
||||
// This is pretty much all there is to the 'smart tabs' logic.
|
||||
// Based on the position within the line and size of a tab,
|
||||
// calculate the amount of spaces we need to insert.
|
||||
var spaces = tabSize - pos % tabSize;
|
||||
|
||||
line = InsertSpaces(line, pos, spaces);
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
// Go through all the lines and do the 'smart tabs' magic.
|
||||
for(var i = 0; i < lines.length; i++)
|
||||
result += ProcessLine(lines[i], tabSize) + '\n';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.SwitchToList = function()
|
||||
{
|
||||
// thanks to Lachlan Donald from SitePoint.com for this <br/> tag fix.
|
||||
var html = this.div.innerHTML.replace(/<(br)\/?>/gi, '\n');
|
||||
var lines = html.split('\n');
|
||||
|
||||
if(this.addControls == true)
|
||||
this.bar.appendChild(dp.sh.Toolbar.Create(this));
|
||||
|
||||
// add columns ruler
|
||||
if(this.showColumns)
|
||||
{
|
||||
var div = this.CreateElement('div');
|
||||
var columns = this.CreateElement('div');
|
||||
var showEvery = 10;
|
||||
var i = 1;
|
||||
|
||||
while(i <= 150)
|
||||
{
|
||||
if(i % showEvery == 0)
|
||||
{
|
||||
div.innerHTML += i;
|
||||
i += (i + '').length;
|
||||
}
|
||||
else
|
||||
{
|
||||
div.innerHTML += '·';
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
columns.className = 'columns';
|
||||
columns.appendChild(div);
|
||||
this.bar.appendChild(columns);
|
||||
}
|
||||
|
||||
for(var i = 0, lineIndex = this.firstLine; i < lines.length - 1; i++, lineIndex++)
|
||||
{
|
||||
var li = this.CreateElement('LI');
|
||||
var span = this.CreateElement('SPAN');
|
||||
|
||||
// uses .line1 and .line2 css styles for alternating lines
|
||||
li.className = (i % 2 == 0) ? 'alt' : '';
|
||||
span.innerHTML = lines[i] + ' ';
|
||||
|
||||
li.appendChild(span);
|
||||
this.ol.appendChild(li);
|
||||
}
|
||||
|
||||
this.div.innerHTML = '';
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.Highlight = function(code)
|
||||
{
|
||||
function Trim(str)
|
||||
{
|
||||
return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
|
||||
}
|
||||
|
||||
function Chop(str)
|
||||
{
|
||||
return str.replace(/\n*$/, '').replace(/^\n*/, '');
|
||||
}
|
||||
|
||||
function Unindent(str)
|
||||
{
|
||||
var lines = str.split('\n');
|
||||
var indents = new Array();
|
||||
var regex = new RegExp('^\\s*', 'g');
|
||||
var min = 1000;
|
||||
|
||||
// go through every line and check for common number of indents
|
||||
for(var i = 0; i < lines.length && min > 0; i++)
|
||||
{
|
||||
if(Trim(lines[i]).length == 0)
|
||||
continue;
|
||||
|
||||
var matches = regex.exec(lines[i]);
|
||||
|
||||
if(matches != null && matches.length > 0)
|
||||
min = Math.min(matches[0].length, min);
|
||||
}
|
||||
|
||||
// trim minimum common number of white space from the begining of every line
|
||||
if(min > 0)
|
||||
for(var i = 0; i < lines.length; i++)
|
||||
lines[i] = lines[i].substr(min);
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
// This function returns a portions of the string from pos1 to pos2 inclusive
|
||||
function Copy(string, pos1, pos2)
|
||||
{
|
||||
return string.substr(pos1, pos2 - pos1);
|
||||
}
|
||||
|
||||
var pos = 0;
|
||||
|
||||
if(code == null)
|
||||
code = '';
|
||||
|
||||
this.originalCode = code;
|
||||
this.code = Chop(Unindent(code));
|
||||
this.div = this.CreateElement('DIV');
|
||||
this.bar = this.CreateElement('DIV');
|
||||
this.ol = this.CreateElement('OL');
|
||||
this.matches = new Array();
|
||||
|
||||
this.div.className = 'dp-highlighter';
|
||||
this.div.highlighter = this;
|
||||
|
||||
this.bar.className = 'bar';
|
||||
|
||||
// set the first line
|
||||
this.ol.start = this.firstLine;
|
||||
|
||||
if(this.CssClass != null)
|
||||
this.ol.className = this.CssClass;
|
||||
|
||||
if(this.collapse)
|
||||
this.div.className += ' collapsed';
|
||||
|
||||
if(this.noGutter)
|
||||
this.div.className += ' nogutter';
|
||||
|
||||
// replace tabs with spaces
|
||||
if(this.tabsToSpaces == true)
|
||||
this.code = this.ProcessSmartTabs(this.code);
|
||||
|
||||
this.ProcessRegexList();
|
||||
|
||||
// if no matches found, add entire code as plain text
|
||||
if(this.matches.length == 0)
|
||||
{
|
||||
this.AddBit(this.code, null);
|
||||
this.SwitchToList();
|
||||
this.div.appendChild(this.ol);
|
||||
return;
|
||||
}
|
||||
|
||||
// sort the matches
|
||||
this.matches = this.matches.sort(dp.sh.Highlighter.SortCallback);
|
||||
|
||||
// The following loop checks to see if any of the matches are inside
|
||||
// of other matches. This process would get rid of highligted strings
|
||||
// inside comments, keywords inside strings and so on.
|
||||
for(var i = 0; i < this.matches.length; i++)
|
||||
if(this.IsInside(this.matches[i]))
|
||||
this.matches[i] = null;
|
||||
|
||||
// Finally, go through the final list of matches and pull the all
|
||||
// together adding everything in between that isn't a match.
|
||||
for(var i = 0; i < this.matches.length; i++)
|
||||
{
|
||||
var match = this.matches[i];
|
||||
|
||||
if(match == null || match.length == 0)
|
||||
continue;
|
||||
|
||||
this.AddBit(Copy(this.code, pos, match.index), null);
|
||||
this.AddBit(match.value, match.css);
|
||||
|
||||
pos = match.index + match.length;
|
||||
}
|
||||
|
||||
this.AddBit(this.code.substr(pos), null);
|
||||
|
||||
this.SwitchToList();
|
||||
this.div.appendChild(this.bar);
|
||||
this.div.appendChild(this.ol);
|
||||
}
|
||||
|
||||
dp.sh.Highlighter.prototype.GetKeywords = function(str)
|
||||
{
|
||||
return '\\b' + str.replace(/ /g, '\\b|\\b') + '\\b';
|
||||
}
|
||||
|
||||
// highlightes all elements identified by name and gets source code from specified property
|
||||
dp.sh.HighlightAll = function(name, showGutter /* optional */, showControls /* optional */, collapseAll /* optional */, firstLine /* optional */, showColumns /* optional */)
|
||||
{
|
||||
function FindValue()
|
||||
{
|
||||
var a = arguments;
|
||||
|
||||
for(var i = 0; i < a.length; i++)
|
||||
{
|
||||
if(a[i] == null)
|
||||
continue;
|
||||
|
||||
if(typeof(a[i]) == 'string' && a[i] != '')
|
||||
return a[i] + '';
|
||||
|
||||
if(typeof(a[i]) == 'object' && a[i].value != '')
|
||||
return a[i].value + '';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function IsOptionSet(value, list)
|
||||
{
|
||||
for(var i = 0; i < list.length; i++)
|
||||
if(list[i] == value)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function GetOptionValue(name, list, defaultValue)
|
||||
{
|
||||
var regex = new RegExp('^' + name + '\\[(\\w+)\\]$', 'gi');
|
||||
var matches = null;
|
||||
|
||||
for(var i = 0; i < list.length; i++)
|
||||
if((matches = regex.exec(list[i])) != null)
|
||||
return matches[1];
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
function FindTagsByName(list, name, tagName)
|
||||
{
|
||||
var tags = document.getElementsByTagName(tagName);
|
||||
|
||||
for(var i = 0; i < tags.length; i++)
|
||||
if(tags[i].getAttribute('name') == name)
|
||||
list.push(tags[i]);
|
||||
}
|
||||
|
||||
var elements = [];
|
||||
var highlighter = null;
|
||||
var registered = {};
|
||||
var propertyName = 'innerHTML';
|
||||
|
||||
// for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
|
||||
FindTagsByName(elements, name, 'pre');
|
||||
FindTagsByName(elements, name, 'textarea');
|
||||
|
||||
if(elements.length == 0)
|
||||
return;
|
||||
|
||||
// register all brushes
|
||||
for(var brush in dp.sh.Brushes)
|
||||
{
|
||||
var aliases = dp.sh.Brushes[brush].Aliases;
|
||||
|
||||
if(aliases == null)
|
||||
continue;
|
||||
|
||||
for(var i = 0; i < aliases.length; i++)
|
||||
registered[aliases[i]] = brush;
|
||||
}
|
||||
|
||||
for(var i = 0; i < elements.length; i++)
|
||||
{
|
||||
var element = elements[i];
|
||||
var options = FindValue(
|
||||
element.attributes['class'], element.className,
|
||||
element.attributes['language'], element.language
|
||||
);
|
||||
var language = '';
|
||||
|
||||
if(options == null)
|
||||
continue;
|
||||
|
||||
options = options.split(':');
|
||||
|
||||
language = options[0].toLowerCase();
|
||||
|
||||
if(registered[language] == null)
|
||||
continue;
|
||||
|
||||
// instantiate a brush
|
||||
highlighter = new dp.sh.Brushes[registered[language]]();
|
||||
|
||||
// hide the original element
|
||||
element.style.display = 'none';
|
||||
|
||||
highlighter.noGutter = (showGutter == null) ? IsOptionSet('nogutter', options) : !showGutter;
|
||||
highlighter.addControls = (showControls == null) ? !IsOptionSet('nocontrols', options) : showControls;
|
||||
highlighter.collapse = (collapseAll == null) ? IsOptionSet('collapse', options) : collapseAll;
|
||||
highlighter.showColumns = (showColumns == null) ? IsOptionSet('showcolumns', options) : showColumns;
|
||||
|
||||
// write out custom brush style
|
||||
if(highlighter.Style)
|
||||
document.write('<style>' + highlighter.Style + '</style>');
|
||||
|
||||
// first line idea comes from Andrew Collington, thanks!
|
||||
highlighter.firstLine = (firstLine == null) ? parseInt(GetOptionValue('firstline', options, 1)) : firstLine;
|
||||
|
||||
highlighter.Highlight(element[propertyName]);
|
||||
|
||||
highlighter.source = element;
|
||||
|
||||
element.parentNode.insertBefore(highlighter.div, element);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
.dp-highlighter
|
||||
{
|
||||
font-family: "Consolas", "Courier New", Courier, mono;
|
||||
font-size: 12px;
|
||||
background-color: #E7E5DC;
|
||||
width: 99%;
|
||||
overflow: auto;
|
||||
margin: 18px 0px 18px 0px;
|
||||
padding-top: 1px; /* adds a little border on top when controls are hidden */
|
||||
}
|
||||
|
||||
.dp-highlighter .bar
|
||||
{
|
||||
padding-left: 45px;
|
||||
}
|
||||
|
||||
.dp-highlighter.collapsed .bar,
|
||||
.dp-highlighter.nogutter .bar
|
||||
{
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.dp-highlighter ol
|
||||
{
|
||||
list-style: decimal; /* for ie */
|
||||
list-style: decimal-leading-zero; /* better look for others */
|
||||
background-color: #fff;
|
||||
margin: 0px 0px 1px 45px; /* 1px bottom margin seems to fix occasional Firefox scrolling */
|
||||
padding: 0px;
|
||||
color: #5C5C5C;
|
||||
}
|
||||
|
||||
.dp-highlighter.nogutter ol
|
||||
{
|
||||
list-style-type: none !important;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
.dp-highlighter ol li,
|
||||
.dp-highlighter .columns div
|
||||
{
|
||||
border-left: 3px solid #6CE26C;
|
||||
background-color: #f8f8f8;
|
||||
padding-left: 10px;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.dp-highlighter.nogutter ol li,
|
||||
.dp-highlighter.nogutter .columns div
|
||||
{
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.dp-highlighter .columns
|
||||
{
|
||||
color: gray;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dp-highlighter .columns div
|
||||
{
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.dp-highlighter ol li.alt
|
||||
{
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.dp-highlighter ol li span
|
||||
{
|
||||
color: Black;
|
||||
}
|
||||
|
||||
/* Adjust some properties when collapsed */
|
||||
|
||||
.dp-highlighter.collapsed ol
|
||||
{
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.dp-highlighter.collapsed ol li
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Additional modifications when in print-view */
|
||||
|
||||
.dp-highlighter.printing
|
||||
{
|
||||
border: none;
|
||||
}
|
||||
|
||||
.dp-highlighter.printing .tools
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.dp-highlighter.printing li
|
||||
{
|
||||
display: list-item !important;
|
||||
}
|
||||
|
||||
/* Styles for the tools */
|
||||
|
||||
.dp-highlighter .tools
|
||||
{
|
||||
padding: 3px 8px 3px 10px;
|
||||
font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||
color: silver;
|
||||
background-color: #f8f8f8;
|
||||
text-align1: right;
|
||||
padding-bottom: 10px;
|
||||
border-left: 3px solid #6CE26C;
|
||||
}
|
||||
|
||||
.dp-highlighter.nogutter .tools
|
||||
{
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
.dp-highlighter.collapsed .tools
|
||||
{
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.dp-highlighter .tools a
|
||||
{
|
||||
font-size: 9px;
|
||||
color: #a0a0a0;
|
||||
text-decoration: none;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.dp-highlighter .tools a:hover
|
||||
{
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* About dialog styles */
|
||||
|
||||
.dp-about { background-color: #fff; margin: 0px; padding: 0px; }
|
||||
.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; }
|
||||
.dp-about td { padding: 10px; vertical-align: top; }
|
||||
.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; }
|
||||
.dp-about .title { color: red; font-weight: bold; }
|
||||
.dp-about .para { margin: 0 0 4px 0; }
|
||||
.dp-about .footer { background-color: #ECEADB; border-top: 1px solid #fff; text-align: right; }
|
||||
.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; width: 60px; height: 22px; }
|
||||
|
||||
/* Language specific styles */
|
||||
|
||||
.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; }
|
||||
.dp-highlighter .string { color: blue; }
|
||||
.dp-highlighter .keyword { color: #069; font-weight: bold; }
|
||||
.dp-highlighter .preprocessor { color: gray; }
|
||||
@@ -0,0 +1,63 @@
|
||||
@import url(undohtml.css);
|
||||
|
||||
body
|
||||
{
|
||||
background-color: #fff;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1, h2, h3 { font-weight: normal; margin: 0px 0px 10px 0px; }
|
||||
h1 { font-size: 200%; border-bottom: 5px solid #f0f0f0; padding-bottom: 5px; font-family: "Trebuchet MS", Trebuchet, Verdana, sans-serif; }
|
||||
h2 { font-size: 150%; margin-left: 20%; }
|
||||
h3 { font-size: 120%; }
|
||||
|
||||
li a
|
||||
{
|
||||
color: blue;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover
|
||||
{
|
||||
background-color: #FFFF00 !important;
|
||||
}
|
||||
|
||||
li a:visited
|
||||
{
|
||||
background-color: #ececec;
|
||||
}
|
||||
|
||||
.layout
|
||||
{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.column1
|
||||
{
|
||||
width: 15%;
|
||||
border-right: 15px solid silver;
|
||||
background-color: #f0f0f0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.column1 h3
|
||||
{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.column2
|
||||
{
|
||||
position: absolute;
|
||||
left: 20%;
|
||||
top: 0px;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.footer
|
||||
{
|
||||
margin-top: 20px;
|
||||
width: 15%;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>dp.SyntaxHighlighter Tests</title>
|
||||
<link type="text/css" rel="stylesheet" href="../Styles/SyntaxHighlighter.css"></link>
|
||||
<link href="../Styles/TestPages.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>dp.SyntaxHighlighter 1.4.1 Tests and Samples (<a href="http://www.dreamprojections.com/syntaxhighlighter/">dreamprojections.com/syntaxhighlighter</a>)</h1>
|
||||
|
||||
<h2><!-- TemplateBeginEditable name="Title" -->Title<!-- TemplateEndEditable --></h2>
|
||||
|
||||
<div class="layout">
|
||||
|
||||
<div class="column1">
|
||||
<h3>Languages:</h3>
|
||||
<ol>
|
||||
<li><a href="../CSharp.html">C#</a></li>
|
||||
<li><a href="../CSS.html">CSS</a></li>
|
||||
<li><a href="../Cpp.html">C++</a></li>
|
||||
<li><a href="../Delphi.html">Delphi</a></li>
|
||||
<li><a href="../Java.html">Java</a></li>
|
||||
<li><a href="../JavaScript.html">JavaScript</a></li>
|
||||
<li><a href="../PHP.html">PHP</a></li>
|
||||
<li><a href="../Python.html">Python</a></li>
|
||||
<li><a href="../Ruby.html">Ruby</a></li>
|
||||
<li><a href="../SQL.html">SQL</a></li>
|
||||
<li><a href="../VB.html">Visual Basic</a></li>
|
||||
<li><a href="../XML.html">XML / HTML</a></li>
|
||||
</ol>
|
||||
<h3>Features:</h3>
|
||||
<ol>
|
||||
<li><a href="../SmartTabs.html">Smart tabs</a></li>
|
||||
<li><a href="../FirstLine.html">First line</a> </li>
|
||||
<li><a href="../CollapseCode.html">Expand code</a></li>
|
||||
<li><a href="../ShowColumns.html">Show columns</a></li>
|
||||
<li><a href="../NoGutter.html">No gutter</a></li>
|
||||
<li><a href="../NoControls.html">No controls</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="column2">
|
||||
Text body before.
|
||||
<hr/>
|
||||
<!-- TemplateBeginEditable name="Code" -->
|
||||
<pre name="code" class="">
|
||||
</pre>
|
||||
<!-- TemplateEndEditable -->
|
||||
<hr/>
|
||||
Text body after.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Copyright 2004-2007 Alex Gorbatchev.<br/>
|
||||
</div>
|
||||
|
||||
<script class="javascript" src="../Scripts/shCore.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushCSharp.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushPhp.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushJScript.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushJava.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushVb.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushSql.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushXml.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushDelphi.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushPython.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushRuby.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushCss.js"></script>
|
||||
<script class="javascript" src="../Scripts/shBrushCpp.js"></script>
|
||||
<script class="javascript">
|
||||
dp.SyntaxHighlighter.ClipboardSwf = 'Scripts/clipboard.swf';
|
||||
dp.SyntaxHighlighter.HighlightAll('code');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user