@@ -142,7 +142,6 @@ $docuroot = explode ( PATH_SEP , $_SERVER['DOCUMENT_ROOT'] );
|
|||||||
G::LoadSystem('form');
|
G::LoadSystem('form');
|
||||||
G::LoadSystem('menu');
|
G::LoadSystem('menu');
|
||||||
G::LoadSystem("xmlMenu");
|
G::LoadSystem("xmlMenu");
|
||||||
G::LoadSystem('dvEditor');
|
|
||||||
G::LoadSystem('table');
|
G::LoadSystem('table');
|
||||||
G::LoadSystem('pagedTable');
|
G::LoadSystem('pagedTable');
|
||||||
G::LoadSystem('tree');
|
G::LoadSystem('tree');
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
function DVEditor(where,body,oHiddenInput,height,mode,editorId)
|
|
||||||
{
|
|
||||||
var me=this;
|
|
||||||
var hiddenInput=oHiddenInput;
|
|
||||||
var iframe=$dce("iframe");
|
|
||||||
//NOTE: className no funciona en FIREFOX
|
|
||||||
iframe.style.width="100%";
|
|
||||||
iframe.style.height=height;
|
|
||||||
iframe.style.margin="0px";
|
|
||||||
iframe.style.padding="0px";
|
|
||||||
iframe.style.border="none";
|
|
||||||
where.appendChild(iframe);
|
|
||||||
var head=document.childNodes[0].childNodes[0];
|
|
||||||
var header='';
|
|
||||||
if (iframe.contentWindow) {
|
|
||||||
var doc = iframe.contentWindow.document;
|
|
||||||
} else {
|
|
||||||
var doc = iframe.contentDocument;
|
|
||||||
}
|
|
||||||
var _header = $dce("head");// head.cloneNode(true);
|
|
||||||
for (var i=0;i<head.childNodes.length;i++) {
|
|
||||||
try {
|
|
||||||
if ((head.childNodes[i].tagName==='LINK')&&
|
|
||||||
(head.childNodes[i].type="text/css")) {
|
|
||||||
_header.appendChild(head.childNodes[i].cloneNode(true));
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
header=_header.innerHTML;
|
|
||||||
//alert(header);
|
|
||||||
doc.open();
|
|
||||||
doc.write('<html><head>'+header+'</head><body style="height:100%;padding:0px;margin:0px;border:none;background-color:ThreeDHighlight;cursor:text;">'+body+'</body></html>');
|
|
||||||
doc.close();
|
|
||||||
doc.designMode="on";
|
|
||||||
if (mode=="edit") {
|
|
||||||
doc.contentEditable=true;
|
|
||||||
} else {
|
|
||||||
doc.contentEditable=false;
|
|
||||||
}
|
|
||||||
this.doc=doc;
|
|
||||||
|
|
||||||
me.insertHTML = function (html)
|
|
||||||
{
|
|
||||||
var cmd = 'inserthtml';
|
|
||||||
var bool = false;
|
|
||||||
var value = html;
|
|
||||||
try {
|
|
||||||
doc.execCommand(cmd,bool,value);
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
me.command = function()
|
|
||||||
{
|
|
||||||
var cmd = this.getAttribute('name');
|
|
||||||
var bool = false;
|
|
||||||
var value = this.getAttribute('cmdValue') || null;
|
|
||||||
if (value == 'promptUser') {
|
|
||||||
value = prompt(
|
|
||||||
(typeof(G_STRINGS[this.getAttribute('promptText')])!=='undefined')?
|
|
||||||
G_STRINGS[this.getAttribute('promptText')]:
|
|
||||||
this.getAttribute('promptText')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (editorId) {
|
|
||||||
if (window.ActiveXObject && cmd == 'hilitecolor') {
|
|
||||||
doc.selection.createRange().pasteHTML('<span style ="background-color:' + value + '">' +doc.selection.createRange().text +'</span>');
|
|
||||||
} else {
|
|
||||||
eval("window._editor" +editorId+".doc.execCommand(cmd,bool,value);");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
doc.execCommand(cmd,bool,value);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
me.loadToolBar = function(uri)
|
|
||||||
{
|
|
||||||
var tb=WebResource(uri);
|
|
||||||
if(editorId){ // for multi-edhtmleditor
|
|
||||||
tb.innerHTML = tb.innerHTML.replace(/DVEditorMap/g, "DVEditorMap" + editorId);
|
|
||||||
}
|
|
||||||
iframe.parentNode.insertBefore(tb,iframe);
|
|
||||||
me.setToolBar(tb);
|
|
||||||
};
|
|
||||||
|
|
||||||
me.setToolBar = function(toolbar)
|
|
||||||
{
|
|
||||||
var buttons=toolbar.getElementsByTagName('area');
|
|
||||||
for (var b=0;b<buttons.length;b++) {
|
|
||||||
buttons[b].onclick=me.command;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
me.getHTML = function()
|
|
||||||
{
|
|
||||||
var body='';
|
|
||||||
try {
|
|
||||||
body=doc.getElementsByTagName('body')[0];
|
|
||||||
body=body.innerHTML;
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
return body;
|
|
||||||
};
|
|
||||||
me.setHTML = function(html)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
body=doc.getElementsByTagName('body')[0];
|
|
||||||
body.innerHTML=html;
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
return body;
|
|
||||||
};
|
|
||||||
|
|
||||||
me.refreshHidden = function()
|
|
||||||
{
|
|
||||||
if(hiddenInput)
|
|
||||||
{
|
|
||||||
var html=me.getHTML();
|
|
||||||
var raiseOnChange=hiddenInput.value!==html;
|
|
||||||
hiddenInput.value=html;
|
|
||||||
if (raiseOnChange && hiddenInput.onchange) hiddenInput.onchange();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
me.syncHidden = function(name)
|
|
||||||
{
|
|
||||||
me.refreshHidden();
|
|
||||||
setTimeout(name+".syncHidden('"+name+"')",500);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<div style="background-color:ButtonFace;">
|
|
||||||
<img src='/js/dveditor/core/toolbars/complete3lines.png' usemap='#DVEditorMap' alt='' style='border-style:none' />
|
|
||||||
<map class="dvtoolbar" id='DVEditorMap' name='DVEditorMap'>
|
|
||||||
<area shape='rect' href="#" coords='0,24,24,48' name='fontname' cmdValue='promptUser' promptText='Font name?' value='font-family'/>
|
|
||||||
<area shape='rect' href="#" coords='96,48,120,72' name='inserthtml' cmdValue='promptUser' promptText='Valid HTML snippet' value='html'/>
|
|
||||||
<area shape='rect' href="#" coords='0,48,24,72' name='insertparagraph'/>
|
|
||||||
<area shape='rect' href="#" coords='48,48,72,72' name='insertorderedlist'/>
|
|
||||||
<area shape='rect' href="#" coords='72,48,96,72' name='insertunorderedlist'/>
|
|
||||||
<area shape='rect' href="#" coords='216,0,240,24' name='justifyleft'/>
|
|
||||||
<area shape='rect' href="#" coords='240,0,264,24' name='justifycenter'/>
|
|
||||||
<area shape='rect' href="#" coords='264,0,288,24' name='justifyright'/>
|
|
||||||
<area shape='rect' href="#" coords='288,0,312,24' name='justifyfull'/>
|
|
||||||
<area shape='rect' href="#" coords='72,0,96,24' name='bold'/>
|
|
||||||
<area shape='rect' href="#" coords='96,0,120,24' name='italic'/>
|
|
||||||
<area shape='rect' href="#" coords='120,0,144,24' name='underline'/>
|
|
||||||
<area shape='rect' href="#" coords='24,0,48,24' name='cut'/>
|
|
||||||
<area shape='rect' href="#" coords='0,0,24,24' name='copy'/>
|
|
||||||
<area shape='rect' href="#" coords='48,0,72,24' name='paste'/>
|
|
||||||
<area shape='rect' href="#" coords='264,24,288,48' name='undo'/>
|
|
||||||
<area shape='rect' href="#" coords='288,24,312,48' name='redo'/>
|
|
||||||
<area shape='rect' href="#" coords='120,24,144,48' name='backcolor' cmdValue='promptUser' promptText='Background color?' value='bgcolor'/>
|
|
||||||
<area shape='rect' href="#" coords='144,24,168,48' name='hilitecolor' cmdValue='promptUser' promptText='Hilite color?' value='hilite'/>
|
|
||||||
<area shape='rect' href="#" coords='48,24,72,48' name='increasefontsize'/>
|
|
||||||
<area shape='rect' href="#" coords='72,24,96,48' name='decreasefontsize'/>
|
|
||||||
<area shape='rect' href="#" coords='168,24,192,48' name='formatblock' cmdValue='promptUser' promptText='Which block?' value='formatblock'/>
|
|
||||||
<area shape='rect' href="#" coords='24,24,48,48' name='FontSize' cmdValue='promptUser' promptText='Font size?' value='font-size'/>
|
|
||||||
<area shape='rect' href="#" coords='192,0,216,24' name='superscript'/>
|
|
||||||
<area shape='rect' href="#" coords='168,0,192,24' name='subscript'/>
|
|
||||||
<area shape='rect' href="#" coords='144,0,168,24' name='strikethrough'/>
|
|
||||||
<area shape='rect' href="#" coords='144,48,168,72' name='createLink' cmdValue='promptUser' promptText='URL of link?' value='<a>'/>
|
|
||||||
<area shape='rect' href="#" coords='24,48,48,72' name='inserthorizontalrule'/>
|
|
||||||
<area shape='rect' href="#" coords='192,24,216,48' name='insertimage' cmdValue='promptUser' promptText='Image URI?' value='<img />'/>
|
|
||||||
<area shape='rect' href="#" coords='96,24,120,48' name='forecolor' cmdValue='promptUser' promptText='Text color?' value='fgcolor'/>
|
|
||||||
<area shape='rect' href="#" coords='240,24,264,48' name='outdent'/>
|
|
||||||
<area shape='rect' href="#" coords='216,24,240,48' name='indent'/>
|
|
||||||
<area shape='rect' href="#" coords='120,48,144,72' name='delete'/>
|
|
||||||
<area shape='rect' href="#" coords='168,48,192,72' name='unlink'/>
|
|
||||||
</map>
|
|
||||||
</div>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB |
@@ -1,16 +0,0 @@
|
|||||||
<div style="background-color:ButtonFace;">
|
|
||||||
<img src='/js/dveditor/core/toolbars/smallToolBar.png' usemap='#DVEditorMap' alt='' style='border-style:none' />
|
|
||||||
<map class="dvtoolbar" id='DVEditorMap' name='DVEditorMap'>
|
|
||||||
<area shape='rect' coords='72,0,96,24' title='Justify left' name='justifyleft'/>
|
|
||||||
<area shape='rect' coords='96,0,120,24' title='Justify center' name='justifycenter'/>
|
|
||||||
<area shape='rect' coords='120,0,144,24'title='Justify right' name='justifyright'/>
|
|
||||||
<area shape='rect' coords='144,0,168,24'title='Justifyfull' name='justifyfull'/>
|
|
||||||
<area shape='rect' coords='0,0,24,24' title='Bold' name='bold'/>
|
|
||||||
<area shape='rect' coords='24,0,48,24' title='Italic' name='italic'/>
|
|
||||||
<area shape='rect' coords='48,0,72,24' title='Under line' name='underline'/>
|
|
||||||
<!-- <area shape='rect' coords='168,0,192,24' name='cut'/>
|
|
||||||
<area shape='rect' coords='192,0,216,24' name='copy'/>
|
|
||||||
<area shape='rect' coords='216,0,240,24' name='paste'/>-->
|
|
||||||
<area shape='rect' coords='240,0,264,24' name='createLink' cmdValue='promptUser' promptText='ID_URL_OF_LINK' value='<a>'/>
|
|
||||||
</map>
|
|
||||||
</div>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB |
@@ -1,39 +0,0 @@
|
|||||||
<div style="background-color:ButtonFace;">
|
|
||||||
<img src='/js/dveditor/core/toolbars/toolbar2lines.png' usemap='#DVEditorMap' alt='' style='border-style:none' />
|
|
||||||
<map class="dvtoolbar" id='DVEditorMap' name='DVEditorMap'>
|
|
||||||
<area shape='rect' href="#" coords='312,0,336,24' name='fontname' cmdValue='promptUser' promptText='ID_FONT_NAME' value='font-family'/>
|
|
||||||
<area shape='rect' href="#" coords='264,24,288,48' name='inserthtml' cmdValue='promptUser' promptText='ID_INSERT_HTML' value='html'/>
|
|
||||||
<area shape='rect' href="#" coords='192,24,216,48' name='insertparagraph'/>
|
|
||||||
<area shape='rect' href="#" coords='120,24,144,48' name='insertorderedlist'/>
|
|
||||||
<area shape='rect' href="#" coords='144,24,168,48' name='insertunorderedlist'/>
|
|
||||||
<area shape='rect' href="#" coords='72,0,96,24' name='justifyleft'/>
|
|
||||||
<area shape='rect' href="#" coords='96,0,120,24' name='justifycenter'/>
|
|
||||||
<area shape='rect' href="#" coords='120,0,144,24' name='justifyright'/>
|
|
||||||
<area shape='rect' href="#" coords='144,0,168,24' name='justifyfull'/>
|
|
||||||
<area shape='rect' href="#" coords='0,0,24,24' name='bold'/>
|
|
||||||
<area shape='rect' href="#" coords='24,0,48,24' name='italic'/>
|
|
||||||
<area shape='rect' href="#" coords='48,0,72,24' name='underline'/>
|
|
||||||
<area shape='rect' href="#" coords='168,0,192,24' name='cut'/>
|
|
||||||
<area shape='rect' href="#" coords='192,0,216,24' name='copy'/>
|
|
||||||
<area shape='rect' href="#" coords='216,0,240,24' name='paste'/>
|
|
||||||
<area shape='rect' href="#" coords='264,0,288,24' name='undo'/>
|
|
||||||
<area shape='rect' href="#" coords='288,0,312,24' name='redo'/>
|
|
||||||
<area shape='rect' href="#" coords='360,24,384,48' name='backcolor' cmdValue='promptUser' promptText='ID_BACKGROUND_COLOR' value='bgcolor'/>
|
|
||||||
<area shape='rect' href="#" coords='384,0,408,24' name='hilitecolor' cmdValue='promptUser' promptText='ID_HILITE_COLOR' value='hilite'/>
|
|
||||||
<area shape='rect' href="#" coords='336,0,360,24' name='increasefontsize'/>
|
|
||||||
<area shape='rect' href="#" coords='336,24,360,48' name='decreasefontsize'/>
|
|
||||||
<area shape='rect' href="#" coords='384,24,408,48' name='formatblock' cmdValue='promptUser' promptText='ID_WHICH_BLOCK' value='formatblock'/>
|
|
||||||
<area shape='rect' href="#" coords='312,24,336,48' name='FontSize' cmdValue='promptUser' promptText='ID_FONT_SIZE' value='font-size'/>
|
|
||||||
<area shape='rect' href="#" coords='0,24,24,48' name='superscript'/>
|
|
||||||
<area shape='rect' href="#" coords='24,24,48,48' name='subscript'/>
|
|
||||||
<area shape='rect' href="#" coords='48,24,72,48' name='strikethrough'/>
|
|
||||||
<area shape='rect' href="#" coords='240,0,264,24' name='createLink' cmdValue='promptUser' promptText='ID_URL_OF_LINK' value='<a>'/>
|
|
||||||
<area shape='rect' href="#" coords='216,24,240,48' name='inserthorizontalrule'/>
|
|
||||||
<area shape='rect' href="#" coords='288,24,312,48' name='insertimage' cmdValue='promptUser' promptText='ID_IMAGE_URI' value='<img />'/>
|
|
||||||
<area shape='rect' href="#" coords='360,0,384,24' name='forecolor' cmdValue='promptUser' promptText='ID_FONT_COLOR' value='fgcolor'/>
|
|
||||||
<area shape='rect' href="#" coords='96,24,120,48' name='outdent'/>
|
|
||||||
<area shape='rect' href="#" coords='72,24,96,48' name='indent'/>
|
|
||||||
<area shape='rect' href="#" coords='168,24,192,48' name='delete'/>
|
|
||||||
<area shape='rect' href="#" coords='240,24,264,48' name='unlink'/>
|
|
||||||
</map>
|
|
||||||
</div>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.7 KiB |
@@ -1,19 +0,0 @@
|
|||||||
Syntax highlighting with language autodetection.
|
|
||||||
|
|
||||||
URL: http://softwaremaniacs.org/soft/highlight/en/
|
|
||||||
|
|
||||||
Original author and current maintainer:
|
|
||||||
Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
|
|
||||||
|
|
||||||
Contributors:
|
|
||||||
|
|
||||||
- Peter Leonov <gojpeg@gmail.com>
|
|
||||||
- Victor Karamzin <Victor.Karamzin@enterra-inc.com>
|
|
||||||
- Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
|
|
||||||
- Anton Kovalyov <anton@kovalyov.net>
|
|
||||||
- Nikita Ledyaev <lenikita@yandex.ru>
|
|
||||||
- Konstantin Evdokimenko <qewerty@gmail.com>
|
|
||||||
- Dmitri Roudakov <dmitri@roudakov.ru>
|
|
||||||
- Yuri Ivanov <ivanov@supersoft.ru>
|
|
||||||
- Vladimir Ermakov <vooon341@mail.ru>
|
|
||||||
- Vladimir Gubarkov <xonixx@gmail.com>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
Подсветка синтаксиса с автоопределением языка.
|
|
||||||
|
|
||||||
URL: http://softwaremaniacs.org/soft/highlight/
|
|
||||||
|
|
||||||
Первоначальный автор и ведущий проекта:
|
|
||||||
Иван Сагалаев <Maniac@SoftwareManiacs.Org>
|
|
||||||
|
|
||||||
Внесли свой вклад:
|
|
||||||
|
|
||||||
- Петр Леонов <gojpeg@gmail.com>
|
|
||||||
- Виктор Карамзин <Victor.Karamzin@enterra-inc.com>
|
|
||||||
- Всеволод Соловьёв <vsevolod.solovyov@gmail.com>
|
|
||||||
- Антон Ковалёв <anton@kovalyov.net>
|
|
||||||
- Никита Ледяев <lenikita@yandex.ru>
|
|
||||||
- Константин Евдокименко <qewerty@gmail.com>
|
|
||||||
- Дмитрий Рудаков <dmitri@roudakov.ru>
|
|
||||||
- Юрий Иванов <ivanov@supersoft.ru>
|
|
||||||
- Владимир Ермаков <vooon341@mail.ru>
|
|
||||||
- Владимир Губарьков <xonixx@gmail.com>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
Copyright (c) 2006, Ivan Sagalaev
|
|
||||||
All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of highlight.js nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
||||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
<!-- saved from url=(0013)about:internet -->
|
|
||||||
<!-- ^^^ This is for IE not to show security warning for local files,
|
|
||||||
see http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Highlighted code export
|
|
||||||
Copyright (c) Vladimir Gubarkov <xonixx@gmail.com>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Highlited code export</title>
|
|
||||||
<link rel="stylesheet" href="sample.css">
|
|
||||||
<style type="text/css">
|
|
||||||
#t1, #t2 { width: 100%;}
|
|
||||||
tr { vertical-align: top; }
|
|
||||||
address { margin-top: 4em; }
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="highlight.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script type="text/javascript">
|
|
||||||
injectScripts(ALL_LANGUAGES); // all
|
|
||||||
|
|
||||||
String.prototype.escape = function() {
|
|
||||||
return this.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function doIt() {
|
|
||||||
var viewDiv = document.getElementById("highlight-view");
|
|
||||||
var t1 = document.getElementById("t1");
|
|
||||||
var t2 = document.getElementById("t2");
|
|
||||||
var selector = document.getElementById("langSelector");
|
|
||||||
var selectedLang = selector.options[selector.selectedIndex].value.toLowerCase();
|
|
||||||
initHighlighting.called = false;
|
|
||||||
if(selectedLang) {
|
|
||||||
viewDiv.innerHTML = '<pre><code class="'+selectedLang+'">'+t1.value.escape()+"</code></pre>";
|
|
||||||
initHighlighting(selectedLang);
|
|
||||||
} else { // try auto
|
|
||||||
viewDiv.innerHTML = '<pre><code>' + t1.value.escape() + "</code></pre>";
|
|
||||||
initHighlighting();
|
|
||||||
}
|
|
||||||
t2.value = viewDiv.innerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyToBuffer(textToCopy) {
|
|
||||||
if (window.clipboardData) { // IE
|
|
||||||
window.clipboardData.setData("Text", textToCopy);
|
|
||||||
} else if (window.netscape) { // FF
|
|
||||||
// from http://developer.mozilla.org/en/docs/Using_the_Clipboard
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
|
|
||||||
gClipboardHelper.copyString(textToCopy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var langSelectorHtml = '<label>Language <select id="langSelector">';
|
|
||||||
langSelectorHtml += '<option value="">Auto</option>';
|
|
||||||
for (var lang in LANGUAGES) {
|
|
||||||
langSelectorHtml += '<option value=\"'+lang+'\">'+lang.charAt(0).toUpperCase()+lang.substr(1)+'</option>';
|
|
||||||
}
|
|
||||||
langSelectorHtml += '</select></label>';
|
|
||||||
document.write(langSelectorHtml);
|
|
||||||
</script>
|
|
||||||
<table width="100%">
|
|
||||||
<tr>
|
|
||||||
<td><textarea rows="20" cols="50" id="t1"></textarea></td>
|
|
||||||
<td><textarea rows="20" cols="50" id="t2"></textarea></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Write a code snippet</td>
|
|
||||||
<td>Get HTML to paste anywhere (for actual styles and colors see sample.css)</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table width="98%">
|
|
||||||
<tr>
|
|
||||||
<td><input type="button" value="Export →" onclick="doIt()"/></td>
|
|
||||||
<td align="right"><input type="button" value="Copy to buffer" onclick="copyToBuffer(document.getElementById('t2').value);"/></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div id="highlight-view"></div>
|
|
||||||
<address>
|
|
||||||
Export script: <a href="mailto:xonixx@gmail.com">Vladimir Gubarkov</a><br>
|
|
||||||
Highlighting: <a href="http://softwaremaniacs.org/soft/highlight/">highlight.js</a>
|
|
||||||
</address>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,429 +0,0 @@
|
|||||||
/*
|
|
||||||
Syntax highlighting with language autodetection.
|
|
||||||
http://softwaremaniacs.org/soft/highlight/
|
|
||||||
*/
|
|
||||||
|
|
||||||
var DEFAULT_LANGUAGES = ['python', 'ruby', 'perl', 'php', 'css', 'xml', 'html', 'django', 'javascript', 'java', 'cpp', 'sql', 'smalltalk'];
|
|
||||||
var ALL_LANGUAGES = (DEFAULT_LANGUAGES.join(',') + ',' + ['1c', 'axapta', 'delphi', 'rib', 'rsl', 'vbscript'].join(',')).split(',');
|
|
||||||
var LANGUAGE_GROUPS = {
|
|
||||||
'xml': 'www',
|
|
||||||
'html': 'www',
|
|
||||||
'css': 'www',
|
|
||||||
'django': 'www',
|
|
||||||
'python': 'dynamic',
|
|
||||||
'perl': 'dynamic',
|
|
||||||
'php': 'dynamic',
|
|
||||||
'ruby': 'dynamic',
|
|
||||||
'cpp': 'static',
|
|
||||||
'java': 'static',
|
|
||||||
'delphi': 'static'
|
|
||||||
}
|
|
||||||
|
|
||||||
var IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*';
|
|
||||||
var UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*';
|
|
||||||
var NUMBER_RE = '\\b\\d+(\\.\\d+)?';
|
|
||||||
var C_NUMBER_RE = '\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)';
|
|
||||||
|
|
||||||
// Common modes
|
|
||||||
var APOS_STRING_MODE = {
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'', end: '\'',
|
|
||||||
illegal: '\\n',
|
|
||||||
contains: ['escape'],
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
var QUOTE_STRING_MODE = {
|
|
||||||
className: 'string',
|
|
||||||
begin: '"', end: '"',
|
|
||||||
illegal: '\\n',
|
|
||||||
contains: ['escape'],
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
var BACKSLASH_ESCAPE = {
|
|
||||||
className: 'escape',
|
|
||||||
begin: '\\\\.', end: '^',
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
var C_LINE_COMMENT_MODE = {
|
|
||||||
className: 'comment',
|
|
||||||
begin: '//', end: '$',
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
var C_BLOCK_COMMENT_MODE = {
|
|
||||||
className: 'comment',
|
|
||||||
begin: '/\\*', end: '\\*/'
|
|
||||||
}
|
|
||||||
var HASH_COMMENT_MODE = {
|
|
||||||
className: 'comment',
|
|
||||||
begin: '#', end: '$'
|
|
||||||
}
|
|
||||||
var C_NUMBER_MODE = {
|
|
||||||
className: 'number',
|
|
||||||
begin: C_NUMBER_RE, end: '^',
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
var LANGUAGES = {}
|
|
||||||
var selected_languages = {};
|
|
||||||
|
|
||||||
function Highlighter(language_name, value) {
|
|
||||||
function subMode(lexem) {
|
|
||||||
if (!modes[modes.length - 1].contains)
|
|
||||||
return null;
|
|
||||||
for (var i in modes[modes.length - 1].contains) {
|
|
||||||
var className = modes[modes.length - 1].contains[i];
|
|
||||||
for (var key in language.modes)
|
|
||||||
if (language.modes[key].className == className && language.modes[key].beginRe.test(lexem))
|
|
||||||
return language.modes[key];
|
|
||||||
}//for
|
|
||||||
return null;
|
|
||||||
}//subMode
|
|
||||||
|
|
||||||
function endOfMode(mode_index, lexem) {
|
|
||||||
if (modes[mode_index].end && modes[mode_index].endRe.test(lexem))
|
|
||||||
return 1;
|
|
||||||
if (modes[mode_index].endsWithParent) {
|
|
||||||
var level = endOfMode(mode_index - 1, lexem);
|
|
||||||
return level ? level + 1 : 0;
|
|
||||||
}//if
|
|
||||||
return 0;
|
|
||||||
}//endOfMode
|
|
||||||
|
|
||||||
function isIllegal(lexem) {
|
|
||||||
if (!modes[modes.length - 1].illegalRe)
|
|
||||||
return false;
|
|
||||||
return modes[modes.length - 1].illegalRe.test(lexem);
|
|
||||||
}//isIllegal
|
|
||||||
|
|
||||||
function eatModeChunk(value, index) {
|
|
||||||
if (!modes[modes.length - 1].terminators) {
|
|
||||||
var terminators = [];
|
|
||||||
|
|
||||||
if (modes[modes.length - 1].contains)
|
|
||||||
for (var key in language.modes) {
|
|
||||||
if (contains(modes[modes.length - 1].contains, language.modes[key].className) &&
|
|
||||||
!contains(terminators, language.modes[key].begin))
|
|
||||||
terminators[terminators.length] = language.modes[key].begin;
|
|
||||||
}//for
|
|
||||||
|
|
||||||
var mode_index = modes.length - 1;
|
|
||||||
do {
|
|
||||||
if (modes[mode_index].end && !contains(terminators, modes[mode_index].end))
|
|
||||||
terminators[terminators.length] = modes[mode_index].end;
|
|
||||||
mode_index--;
|
|
||||||
} while (modes[mode_index + 1].endsWithParent);
|
|
||||||
|
|
||||||
if (modes[modes.length - 1].illegal)
|
|
||||||
if (!contains(terminators, modes[modes.length - 1].illegal))
|
|
||||||
terminators[terminators.length] = modes[modes.length - 1].illegal;
|
|
||||||
|
|
||||||
var terminator_re = '(' + terminators[0];
|
|
||||||
for (var i = 0; i < terminators.length; i++)
|
|
||||||
terminator_re += '|' + terminators[i];
|
|
||||||
terminator_re += ')';
|
|
||||||
modes[modes.length - 1].terminators = langRe(language, terminator_re);
|
|
||||||
}//if
|
|
||||||
value = value.substr(index);
|
|
||||||
var match = modes[modes.length - 1].terminators.exec(value);
|
|
||||||
if (!match)
|
|
||||||
return [value, '', true];
|
|
||||||
if (match.index == 0)
|
|
||||||
return ['', match[0], false];
|
|
||||||
else
|
|
||||||
return [value.substr(0, match.index), match[0], false];
|
|
||||||
}//eatModeChunk
|
|
||||||
|
|
||||||
function escape(value) {
|
|
||||||
return value.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>');
|
|
||||||
}//escape
|
|
||||||
|
|
||||||
function keywordMatch(mode, match) {
|
|
||||||
var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]
|
|
||||||
for (var className in mode.keywordGroups) {
|
|
||||||
var value = mode.keywordGroups[className].hasOwnProperty(match_str);
|
|
||||||
if (value)
|
|
||||||
return [className, value];
|
|
||||||
}//for
|
|
||||||
return false;
|
|
||||||
}//keywordMatch
|
|
||||||
|
|
||||||
function processKeywords(buffer) {
|
|
||||||
var mode = modes[modes.length - 1];
|
|
||||||
if (!mode.keywords || !mode.lexems)
|
|
||||||
return escape(buffer);
|
|
||||||
if (!mode.lexemsRe) {
|
|
||||||
var lexems = [];
|
|
||||||
for (var key in mode.lexems)
|
|
||||||
if (!contains(lexems, mode.lexems[key]))
|
|
||||||
lexems[lexems.length] = mode.lexems[key];
|
|
||||||
var lexems_re = '(' + lexems[0];
|
|
||||||
for (var i = 1; i < lexems.length; i++)
|
|
||||||
lexems_re += '|' + lexems[i];
|
|
||||||
lexems_re += ')';
|
|
||||||
mode.lexemsRe = langRe(language, lexems_re, true);
|
|
||||||
}//if
|
|
||||||
var result = '';
|
|
||||||
var last_index = 0;
|
|
||||||
mode.lexemsRe.lastIndex = 0;
|
|
||||||
var match = mode.lexemsRe.exec(buffer);
|
|
||||||
while (match) {
|
|
||||||
result += escape(buffer.substr(last_index, match.index - last_index));
|
|
||||||
keyword_match = keywordMatch(mode, match);
|
|
||||||
if (keyword_match) {
|
|
||||||
keyword_count += keyword_match[1];
|
|
||||||
result += '<span class="'+ keyword_match[0] +'">' + escape(match[0]) + '</span>';
|
|
||||||
} else {
|
|
||||||
result += escape(match[0]);
|
|
||||||
}//if
|
|
||||||
last_index = mode.lexemsRe.lastIndex;
|
|
||||||
match = mode.lexemsRe.exec(buffer);
|
|
||||||
}//while
|
|
||||||
result += escape(buffer.substr(last_index, buffer.length - last_index));
|
|
||||||
return result;
|
|
||||||
}//processKeywords
|
|
||||||
|
|
||||||
function processModeInfo(buffer, lexem, end) {
|
|
||||||
if (end) {
|
|
||||||
result += processKeywords(modes[modes.length - 1].buffer + buffer);
|
|
||||||
return;
|
|
||||||
}//if
|
|
||||||
if (isIllegal(lexem))
|
|
||||||
throw 'Illegal';
|
|
||||||
var new_mode = subMode(lexem);
|
|
||||||
if (new_mode) {
|
|
||||||
modes[modes.length - 1].buffer += buffer;
|
|
||||||
result += processKeywords(modes[modes.length - 1].buffer);
|
|
||||||
if (new_mode.excludeBegin) {
|
|
||||||
result += lexem + '<span class="' + new_mode.className + '">';
|
|
||||||
new_mode.buffer = '';
|
|
||||||
} else {
|
|
||||||
result += '<span class="' + new_mode.className + '">';
|
|
||||||
new_mode.buffer = lexem;
|
|
||||||
}//if
|
|
||||||
modes[modes.length] = new_mode;
|
|
||||||
relevance += modes[modes.length - 1].relevance != undefined ? modes[modes.length - 1].relevance : 1;
|
|
||||||
return;
|
|
||||||
}//if
|
|
||||||
var end_level = endOfMode(modes.length - 1, lexem);
|
|
||||||
if (end_level) {
|
|
||||||
modes[modes.length - 1].buffer += buffer;
|
|
||||||
if (modes[modes.length - 1].excludeEnd) {
|
|
||||||
result += processKeywords(modes[modes.length - 1].buffer) + '</span>' + lexem;
|
|
||||||
} else {
|
|
||||||
result += processKeywords(modes[modes.length - 1].buffer + lexem) + '</span>';
|
|
||||||
}
|
|
||||||
while (end_level > 1) {
|
|
||||||
result += '</span>';
|
|
||||||
end_level--;
|
|
||||||
modes.length--;
|
|
||||||
}//while
|
|
||||||
modes.length--;
|
|
||||||
modes[modes.length - 1].buffer = '';
|
|
||||||
return;
|
|
||||||
}//if
|
|
||||||
}//processModeInfo
|
|
||||||
|
|
||||||
function highlight(value) {
|
|
||||||
var index = 0;
|
|
||||||
language.defaultMode.buffer = '';
|
|
||||||
do {
|
|
||||||
var mode_info = eatModeChunk(value, index);
|
|
||||||
processModeInfo(mode_info[0], mode_info[1], mode_info[2]);
|
|
||||||
index += mode_info[0].length + mode_info[1].length;
|
|
||||||
} while (!mode_info[2]);
|
|
||||||
if(modes.length > 1)
|
|
||||||
throw 'Illegal';
|
|
||||||
}//highlight
|
|
||||||
|
|
||||||
this.language_name = language_name;
|
|
||||||
var language = LANGUAGES[language_name];
|
|
||||||
var modes = [language.defaultMode];
|
|
||||||
var relevance = 0;
|
|
||||||
var keyword_count = 0;
|
|
||||||
var result = '';
|
|
||||||
try {
|
|
||||||
highlight(value);
|
|
||||||
this.relevance = relevance;
|
|
||||||
this.keyword_count = keyword_count;
|
|
||||||
this.result = result;
|
|
||||||
} catch (e) {
|
|
||||||
if (e == 'Illegal') {
|
|
||||||
this.relevance = 0;
|
|
||||||
this.keyword_count = 0;
|
|
||||||
this.result = escape(value);
|
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}//if
|
|
||||||
}//try
|
|
||||||
}//Highlighter
|
|
||||||
|
|
||||||
function contains(array, item) {
|
|
||||||
if (!array)
|
|
||||||
return false;
|
|
||||||
for (var key in array)
|
|
||||||
if (array[key] == item)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}//contains
|
|
||||||
|
|
||||||
function blockText(block) {
|
|
||||||
var result = '';
|
|
||||||
for (var i = 0; i < block.childNodes.length; i++)
|
|
||||||
if (block.childNodes[i].nodeType == 3)
|
|
||||||
result += block.childNodes[i].nodeValue;
|
|
||||||
else if (block.childNodes[i].nodeName == 'BR')
|
|
||||||
result += '\n';
|
|
||||||
else
|
|
||||||
throw 'Complex markup';
|
|
||||||
return result;
|
|
||||||
}//blockText
|
|
||||||
|
|
||||||
function initHighlight(block) {
|
|
||||||
if (block.className.search(/\bno\-highlight\b/) != -1)
|
|
||||||
return;
|
|
||||||
try {
|
|
||||||
blockText(block);
|
|
||||||
} catch (e) {
|
|
||||||
if (e == 'Complex markup')
|
|
||||||
return;
|
|
||||||
}//try
|
|
||||||
var classes = block.className.split(/\s+/);
|
|
||||||
for (var i = 0; i < classes.length; i++) {
|
|
||||||
if (LANGUAGES[classes[i]]) {
|
|
||||||
highlightLanguage(block, classes[i]);
|
|
||||||
return;
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
highlightAuto(block);
|
|
||||||
}//initHighlight
|
|
||||||
|
|
||||||
function highlightLanguage(block, language) {
|
|
||||||
var highlight = new Highlighter(language, blockText(block));
|
|
||||||
// See these 4 lines? This is IE's notion of "block.innerHTML = result". Love this browser :-/
|
|
||||||
var container = $dce('div');
|
|
||||||
container.innerHTML = '<pre><code class="' + block.className + '">' + highlight.result + '</code></pre>';
|
|
||||||
var environment = block.parentNode.parentNode;
|
|
||||||
environment.replaceChild(container.firstChild, block.parentNode);
|
|
||||||
}//highlightLanguage
|
|
||||||
|
|
||||||
function highlightAuto(block) {
|
|
||||||
var result = null;
|
|
||||||
var language = '';
|
|
||||||
var max_relevance = 2;
|
|
||||||
var relevance = 0;
|
|
||||||
var block_text = blockText(block);
|
|
||||||
for (var key in selected_languages) {
|
|
||||||
var highlight = new Highlighter(key, block_text);
|
|
||||||
relevance = highlight.keyword_count + highlight.relevance;
|
|
||||||
if (relevance > max_relevance) {
|
|
||||||
max_relevance = relevance;
|
|
||||||
result = highlight;
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
|
|
||||||
if(result) {
|
|
||||||
// See these 4 lines? This is IE's notion of "block.innerHTML = result". Love this browser :-/
|
|
||||||
var container = $dce('div');
|
|
||||||
container.innerHTML = '<pre><code class="' + result.language_name + '">' + result.result + '</code></pre>';
|
|
||||||
var environment = block.parentNode.parentNode;
|
|
||||||
environment.replaceChild(container.firstChild, block.parentNode);
|
|
||||||
}//if
|
|
||||||
}//highlightAuto
|
|
||||||
|
|
||||||
function langRe(language, value, global) {
|
|
||||||
var mode = 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '');
|
|
||||||
return new RegExp(value, mode);
|
|
||||||
}//re
|
|
||||||
|
|
||||||
function compileRes() {
|
|
||||||
for (var i in LANGUAGES) {
|
|
||||||
var language = LANGUAGES[i];
|
|
||||||
for (var key in language.modes) {
|
|
||||||
if (language.modes[key].begin)
|
|
||||||
language.modes[key].beginRe = langRe(language, '^' + language.modes[key].begin);
|
|
||||||
if (language.modes[key].end)
|
|
||||||
language.modes[key].endRe = langRe(language, '^' + language.modes[key].end);
|
|
||||||
if (language.modes[key].illegal)
|
|
||||||
language.modes[key].illegalRe = langRe(language, '^(?:' + language.modes[key].illegal + ')');
|
|
||||||
language.defaultMode.illegalRe = langRe(language, '^(?:' + language.defaultMode.illegal + ')');
|
|
||||||
}//for
|
|
||||||
}//for
|
|
||||||
}//compileRes
|
|
||||||
|
|
||||||
function compileKeywords() {
|
|
||||||
|
|
||||||
function compileModeKeywords(mode) {
|
|
||||||
if (!mode.keywordGroups) {
|
|
||||||
for (var key in mode.keywords) {
|
|
||||||
if (mode.keywords[key] instanceof Object)
|
|
||||||
mode.keywordGroups = mode.keywords;
|
|
||||||
else
|
|
||||||
mode.keywordGroups = {'keyword': mode.keywords};
|
|
||||||
break;
|
|
||||||
}//for
|
|
||||||
}//if
|
|
||||||
}//compileModeKeywords
|
|
||||||
|
|
||||||
for (var i in LANGUAGES) {
|
|
||||||
var language = LANGUAGES[i];
|
|
||||||
compileModeKeywords(language.defaultMode);
|
|
||||||
for (var key in language.modes) {
|
|
||||||
compileModeKeywords(language.modes[key]);
|
|
||||||
}//for
|
|
||||||
}//for
|
|
||||||
}//compileKeywords
|
|
||||||
|
|
||||||
function initHighlighting() {
|
|
||||||
if (initHighlighting.called)
|
|
||||||
return;
|
|
||||||
initHighlighting.called = true;
|
|
||||||
compileRes();
|
|
||||||
compileKeywords();
|
|
||||||
if (arguments.length) {
|
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
|
||||||
if (LANGUAGES[arguments[i]]) {
|
|
||||||
selected_languages[arguments[i]] = LANGUAGES[arguments[i]];
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
} else
|
|
||||||
selected_languages = LANGUAGES;
|
|
||||||
var pres = document.getElementsByTagName('pre');
|
|
||||||
for (var i = 0; i < pres.length; i++) {
|
|
||||||
if (pres[i].firstChild && pres[i].firstChild.nodeName == 'CODE')
|
|
||||||
initHighlight(pres[i].firstChild);
|
|
||||||
}//for
|
|
||||||
}//initHighlighting
|
|
||||||
|
|
||||||
function injectScripts(languages) {
|
|
||||||
var scripts = document.getElementsByTagName('SCRIPT');
|
|
||||||
for (var i=0; i < scripts.length; i++) {
|
|
||||||
if (scripts[i].src.match(/highlight\.js(\?.+)?$/)) {
|
|
||||||
var path = scripts[i].src.replace(/highlight\.js(\?.+)?$/, '');
|
|
||||||
break;
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
if (languages.length == 0) {
|
|
||||||
languages = DEFAULT_LANGUAGES;
|
|
||||||
}//if
|
|
||||||
var injected = {}
|
|
||||||
for (var i=0; i < languages.length; i++) {
|
|
||||||
var filename = LANGUAGE_GROUPS[languages[i]] ? LANGUAGE_GROUPS[languages[i]] : languages[i];
|
|
||||||
if (!injected[filename]) {
|
|
||||||
document.write('<script type="text/javascript" src="' + path + 'languages/' + filename + '.js"></script>');
|
|
||||||
injected[filename] = true;
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
}//injectScripts
|
|
||||||
|
|
||||||
function initHighlightingOnLoad() {
|
|
||||||
var original_arguments = arguments;
|
|
||||||
injectScripts(arguments);
|
|
||||||
var handler = function(){initHighlighting.apply(null, original_arguments)};
|
|
||||||
if (window.addEventListener) {
|
|
||||||
window.addEventListener('DOMContentLoaded', handler, false);
|
|
||||||
window.addEventListener('load', handler, false);
|
|
||||||
} else if (window.attachEvent)
|
|
||||||
window.attachEvent('onload', handler);
|
|
||||||
else
|
|
||||||
window.onload = handler;
|
|
||||||
}//initHighlightingOnLoad
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
var IDENT_RE_RU = '[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*';
|
|
||||||
var NUMBER_RE = '\\b\\d+(\\.\\d+)?';
|
|
||||||
|
|
||||||
var OneS_KEYWORDS = {'процедура':1,'функция':1,'экспорт':1,'перем':1,'конецфункции':1,'конецпроцедуры':1,'если':1,'тогда':1,'иначе':1,'иначеесли':1,'конецесли':1,'попытка':1,'исключение':1,'конецпопытки':1,'ложь':1,'истина':1,'неопределено':1,'и':1,'или':1,'не':1,'null':1,'для':1,'каждого':1,'из':1,'по':1,'цикл':1,'конеццикла':1};
|
|
||||||
|
|
||||||
LANGUAGES['1c'] = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
contains: ['comment', 'string', 'function', 'preprocessor', 'number'],
|
|
||||||
keywords: OneS_KEYWORDS
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '"', end: '"',
|
|
||||||
contains: ['dquote'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '"', end: '$',
|
|
||||||
contains: ['dquote']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\\|', end: '$',
|
|
||||||
contains: ['dquote']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\\|', end: '"',
|
|
||||||
contains: ['dquote']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'dquote',
|
|
||||||
begin: '""', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'number',
|
|
||||||
begin: NUMBER_RE, end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
begin: IDENT_RE_RU, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
keywords: {'знач':1},
|
|
||||||
contains: ['string']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
begin: '(процедура|функция)', end: '$',
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
keywords: {'процедура': 1, 'экспорт':1, 'функция': 1},
|
|
||||||
contains: ['title','tail','comment'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'tail',
|
|
||||||
begin: '^', endsWithParent: true,
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
contains: ['params', 'export']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'export',
|
|
||||||
begin: 'экспорт', endsWithParent: true,
|
|
||||||
lexems: [IDENT_RE_RU],
|
|
||||||
keywords: {'экспорт': 1},
|
|
||||||
contains: ['comment']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'preprocessor',
|
|
||||||
begin: '#', end: '$',
|
|
||||||
lexems: [IDENT_RE_RU]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//1c
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Axapta definition (с) Dmitri Roudakov <dmitri@roudakov.ru>
|
|
||||||
|
|
||||||
*/
|
|
||||||
LANGUAGES.axapta = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
contains: ['comment', 'string', 'class', 'number', 'preprocessor'],
|
|
||||||
keywords: {'false': 1, 'int': 1, 'abstract': 1, 'private': 1, 'char': 1, 'interface': 1, 'boolean': 1, 'static': 1, 'null': 1, 'if': 1, 'for': 1, 'true': 1, 'while': 1, 'long': 1, 'throw': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'final': 1, 'implements': 1, 'return': 1, 'void': 1, 'enum': 1, 'else': 1, 'break': 1, 'new': 1, 'catch': 1, 'byte': 1, 'super': 1, 'class': 1, 'case': 1, 'short': 1, 'default': 1, 'double': 1, 'public': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1,
|
|
||||||
'reverse':1, 'firstfast':1,'firstonly':1,'forupdate':1,'nofetch':1, 'sum':1, 'avg':1, 'minof':1, 'maxof':1, 'count':1, 'order':1, 'group':1, 'by':1, 'asc':1, 'desc':1, 'index':1, 'hint':1, 'like':1,
|
|
||||||
'dispaly':1, 'edit':1, 'client':1, 'server':1, 'ttsbegin':1, 'ttscommit':1,
|
|
||||||
'str':1, 'real':1, 'date':1, 'container':1, 'anytype':1, 'common':1, 'div':1,'mod':1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
begin: '(class |interface )', end: '{',
|
|
||||||
illegal: ':',
|
|
||||||
keywords: {'class': 1, 'interface': 1},
|
|
||||||
contains: ['inheritance', 'title']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'inheritance',
|
|
||||||
begin: '(implements|extends)', end: '^',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'extends': 1, 'implements': 1},
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
contains: ['string', 'annotation']
|
|
||||||
},
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'preprocessor',
|
|
||||||
begin: '#', end: '$'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//axapta
|
|
||||||
@@ -1,319 +0,0 @@
|
|||||||
LANGUAGES.python = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
illegal: '(</|->)',
|
|
||||||
contains: ['comment', 'string', 'function', 'class', 'number', 'decorator'],
|
|
||||||
keywords: {'and': 1, 'elif': 1, 'is': 1, 'global': 1, 'as': 1, 'in': 1, 'if': 1, 'from': 1, 'raise': 1, 'for': 1, 'except': 1, 'finally': 1, 'print': 1, 'import': 1, 'pass': 1, 'None': 1, 'return': 1, 'exec': 1, 'else': 1, 'break': 1, 'not': 1, 'with': 1, 'class': 1, 'assert': 1, 'yield': 1, 'try': 1, 'while': 1, 'continue': 1, 'del': 1, 'or': 1, 'def': 1, 'lambda': 1}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
begin: '\\bdef ', end: ':',
|
|
||||||
illegal: '$',
|
|
||||||
keywords: {'def': 1},
|
|
||||||
contains: ['title', 'params'],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
begin: '\\bclass ', end: ':',
|
|
||||||
illegal: '[${]',
|
|
||||||
keywords: {'class': 1},
|
|
||||||
contains: ['title', 'params',],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
contains: ['string']
|
|
||||||
},
|
|
||||||
HASH_COMMENT_MODE,
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'\'\'', end: '\'\'\'',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '"""', end: '"""',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'r\'', end: '\'',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'r"', end: '"',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'u\'', end: '(^|[^\\\\])\'',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'u"', end: '(^|[^\\\\])"',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'ur\'', end: '\'',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'ur"', end: '"',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'decorator',
|
|
||||||
begin: '@', end: '$'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//python
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Perl definition (с) Peter Leonov <gojpeg@gmail.com>
|
|
||||||
Test you perl code here: http://wiki.cmsbuilder.ru/Highlite_test
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var PERL_NUMBER_RE = '(\\b0[0-7]+)|(\\b0x[0-9a-fA-F]+)|(\\b[1-9]\\d*(\\.\\d+)?)|0\\b';
|
|
||||||
var PERL_KEYWORDS = {'getpwent': 1, 'getservent': 1, 'quotemeta': 1, 'msgrcv': 1, 'scalar': 1, 'kill': 1, 'dbmclose': 1, 'undef': 1, 'lc': 1, 'ma': 1, 'syswrite': 1, 'tr': 1, 'send': 1, 'umask': 1, 'sysopen': 1, 'shmwrite': 1, 'vec': 1, 'qx': 1, 'utime': 1, 'local': 1, 'oct': 1, 'semctl': 1, 'localtime': 1, 'readpipe': 1, 'do': 1, 'return': 1, 'format': 1, 'read': 1, 'sprintf': 1, 'dbmopen': 1, 'pop': 1, 'getpgrp': 1, 'not': 1, 'getpwnam': 1, 'rewinddir': 1, 'qq': 1, 'fileno': 1, 'qw': 1, 'endprotoent': 1, 'wait': 1, 'sethostent': 1, 'bless': 1, 's': 1, 'opendir': 1, 'continue': 1, 'each': 1, 'sleep': 1, 'endgrent': 1, 'shutdown': 1, 'dump': 1, 'chomp': 1, 'connect': 1, 'getsockname': 1, 'die': 1, 'socketpair': 1, 'close': 1, 'flock': 1, 'exists': 1, 'index': 1, 'shmget': 1, 'sub': 1, 'for': 1, 'endpwent': 1, 'redo': 1, 'lstat': 1, 'msgctl': 1, 'setpgrp': 1, 'abs': 1, 'exit': 1, 'select': 1, 'print': 1, 'ref': 1, 'gethostbyaddr': 1, 'unshift': 1, 'fcntl': 1, 'syscall': 1, 'goto': 1, 'getnetbyaddr': 1, 'join': 1, 'gmtime': 1, 'symlink': 1, 'semget': 1, 'splice': 1, 'x': 1, 'getpeername': 1, 'recv': 1, 'log': 1, 'setsockopt': 1, 'cos': 1, 'last': 1, 'reverse': 1, 'gethostbyname': 1, 'getgrnam': 1, 'study': 1, 'formline': 1, 'endhostent': 1, 'times': 1, 'chop': 1, 'length': 1, 'gethostent': 1, 'getnetent': 1, 'pack': 1, 'getprotoent': 1, 'getservbyname': 1, 'rand': 1, 'mkdir': 1, 'pos': 1, 'chmod': 1, 'y': 1, 'substr': 1, 'endnetent': 1, 'printf': 1, 'next': 1, 'open': 1, 'msgsnd': 1, 'readdir': 1, 'use': 1, 'unlink': 1, 'getsockopt': 1, 'getpriority': 1, 'rindex': 1, 'wantarray': 1, 'hex': 1, 'system': 1, 'getservbyport': 1, 'endservent': 1, 'int': 1, 'chr': 1, 'untie': 1, 'rmdir': 1, 'prototype': 1, 'tell': 1, 'listen': 1, 'fork': 1, 'shmread': 1, 'ucfirst': 1, 'setprotoent': 1, 'else': 1, 'sysseek': 1, 'link': 1, 'getgrgid': 1, 'shmctl': 1, 'waitpid': 1, 'unpack': 1, 'getnetbyname': 1, 'reset': 1, 'chdir': 1, 'grep': 1, 'split': 1, 'require': 1, 'caller': 1, 'lcfirst': 1, 'until': 1, 'warn': 1, 'while': 1, 'values': 1, 'shift': 1, 'telldir': 1, 'getpwuid': 1, 'my': 1, 'getprotobynumber': 1, 'delete': 1, 'and': 1, 'sort': 1, 'uc': 1, 'defined': 1, 'srand': 1, 'accept': 1, 'package': 1, 'seekdir': 1, 'getprotobyname': 1, 'semop': 1, 'our': 1, 'rename': 1, 'seek': 1, 'if': 1, 'q': 1, 'chroot': 1, 'sysread': 1, 'setpwent': 1, 'no': 1, 'crypt': 1, 'getc': 1, 'chown': 1, 'sqrt': 1, 'write': 1, 'setnetent': 1, 'setpriority': 1, 'foreach': 1, 'tie': 1, 'sin': 1, 'msgget': 1, 'map': 1, 'stat': 1, 'getlogin': 1, 'unless': 1, 'elsif': 1, 'truncate': 1, 'exec': 1, 'keys': 1, 'glob': 1, 'tied': 1, 'closedir': 1, 'ioctl': 1, 'socket': 1, 'readlink': 1, 'eval': 1, 'xor': 1, 'readline': 1, 'binmode': 1, 'setservent': 1, 'eof': 1, 'ord': 1, 'bind': 1, 'alarm': 1, 'pipe': 1, 'atan2': 1, 'getgrent': 1, 'exp': 1, 'time': 1, 'push': 1, 'setgrent': 1, 'gt': 1, 'lt': 1, 'or': 1, 'ne': 1, 'm': 1};
|
|
||||||
|
|
||||||
LANGUAGES.perl = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
contains: ['comment', 'string', 'number', 'regexp', 'sub', 'variable', 'operator', 'pod', 'identifier'],
|
|
||||||
keywords: PERL_KEYWORDS
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
|
|
||||||
// variables
|
|
||||||
{
|
|
||||||
className: 'variable',
|
|
||||||
begin: '\\$\\d', end: '^',
|
|
||||||
relevance: 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'variable',
|
|
||||||
begin: '[\\$\\%\\@\\*](\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)', end: '^'
|
|
||||||
},
|
|
||||||
|
|
||||||
// numbers and strings
|
|
||||||
{
|
|
||||||
className: 'number',
|
|
||||||
begin: PERL_NUMBER_RE, end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'q[qwxr]?\\(', end: '[^\\\\]\\)',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: 'qw\\s+q', end: 'q',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '`', end: '`',
|
|
||||||
contains: ['escape']
|
|
||||||
},
|
|
||||||
|
|
||||||
// regexps
|
|
||||||
{
|
|
||||||
className: 'regexp',
|
|
||||||
begin: '(s|tr|y)(/.*?[^\\\\]/|//)(.*?[^\\\\]/|/)[a-z]*', end: '^',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'regexp',
|
|
||||||
begin: '(m|qr)?//[cgimosxe]*', end: '^',
|
|
||||||
relevance: 0 // allows empty "//" which is a common comment delimiter in other languages
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'regexp',
|
|
||||||
begin: '(m|qr)?/.*?[^\\\\/]/[cgimosxe]*', end: '^'
|
|
||||||
},
|
|
||||||
|
|
||||||
// bareword context
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '{\\w+}', end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\-?\\w+\\s*\\=\\>', end: '^',
|
|
||||||
relevance: 5
|
|
||||||
},
|
|
||||||
|
|
||||||
// subroutines
|
|
||||||
{
|
|
||||||
className: 'sub',
|
|
||||||
begin: '\\bsub\\b', end: '(\\s*\\(.*?\\))?[;{]',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'sub':1},
|
|
||||||
contains: ['identifier'],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
|
|
||||||
// operators
|
|
||||||
{
|
|
||||||
className: 'operator',
|
|
||||||
begin: '-\\w\\b', end: '^'
|
|
||||||
},
|
|
||||||
|
|
||||||
// comments
|
|
||||||
HASH_COMMENT_MODE,
|
|
||||||
|
|
||||||
// pod
|
|
||||||
{
|
|
||||||
className: 'pod',
|
|
||||||
begin: '\\=\\w', end: '\\=cut'
|
|
||||||
},
|
|
||||||
|
|
||||||
// identifiers
|
|
||||||
{
|
|
||||||
className: 'identifier',
|
|
||||||
begin: '\\b[a-zA-Z]\\w*\\b', end: '^',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: PERL_KEYWORDS,
|
|
||||||
relevance: 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//perl
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
PHP5 definition (с) Victor Karamzin <Victor.Karamzin@enterra-inc.com>
|
|
||||||
|
|
||||||
*/
|
|
||||||
PHP5_KEYWORDS = {'and': 1, 'include_once': 1, 'list': 1, 'abstract': 1, 'global': 1, 'private': 1, 'echo': 1, 'interface': 1, 'as': 1, 'static': 1, 'endswitch': 1, 'array': 1, 'null': 1, 'if': 1, 'endwhile': 1, 'or': 1, 'const': 1, 'for': 1, 'endforeach': 1, 'self': 1, 'var': 1, 'while': 1, 'isset': 1, 'public': 1, 'protected': 1, 'exit': 1, 'foreach': 1, 'throw': 1, 'elseif': 1, 'extends': 1, 'include': 1, '__FILE__': 1, 'empty': 1, 'require_once': 1, 'function': 1, 'do': 1, 'xor': 1, 'return': 1, 'implements': 1, 'parent': 1, 'clone': 1, 'use': 1, '__CLASS__': 1, '__LINE__': 1, 'else': 1, 'break': 1, 'print': 1, 'eval': 1, 'new': 1, 'catch': 1, '__METHOD__': 1, 'class': 1, 'case': 1, 'exception': 1, 'php_user_filter': 1, 'default': 1, 'die': 1, 'require': 1, '__FUNCTION__': 1, 'enddeclare': 1, 'final': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'endfor': 1, 'endif': 1, 'declare': 1, 'unset': 1};
|
|
||||||
|
|
||||||
PHP_IDENTIFIER_RE = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*';
|
|
||||||
|
|
||||||
LANGUAGES.php = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
contains: ['comment', 'number', 'string', 'variable'],
|
|
||||||
keywords: PHP5_KEYWORDS
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
HASH_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '/\\*', end: '\\*/',
|
|
||||||
contains: ['phpdoc']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'phpdoc',
|
|
||||||
begin: '\\s@[A-Za-z]+', end: '^',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'variable',
|
|
||||||
begin: '\\$' + PHP_IDENTIFIER_RE, end: '^'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
};//php
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Ruby definition (с) Anton Kovalyov <anton@kovalyov.net>
|
|
||||||
|
|
||||||
*/
|
|
||||||
LANGUAGES.ruby = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
contains: ['comment', 'string', 'class', 'function', 'symbol'],
|
|
||||||
keywords: {'and': 1, 'false': 1, 'then': 1, 'defined': 1, 'module': 1, 'in': 1, 'return': 1, 'redo': 1, 'if': 1, 'BEGIN': 1, 'retry': 1, 'end': 1, 'for': 1, 'true': 1, 'self': 1, 'when': 1, 'next': 1, 'until': 1, 'do': 1, 'begin': 1, 'unless': 1, 'END': 1, 'rescue': 1, 'nil': 1, 'else': 1, 'break': 1, 'undef': 1, 'not': 1, 'super': 1, 'class': 1, 'case': 1, 'require': 1, 'yield': 1, 'alias': 1, 'while': 1, 'ensure': 1, 'elsif': 1, 'or': 1, 'def': 1}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
HASH_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '^\\=begin', end: '^\\=end',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'', end: '(^|[^\\\\])\'',
|
|
||||||
contains: ['subst'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '"', end: '(^|[^\\\\])"',
|
|
||||||
contains: ['subst'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'subst',
|
|
||||||
begin: '#\\{', end: '\}',
|
|
||||||
contains: ['string'],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
begin: '\\bdef ', end: '$',
|
|
||||||
illegal: '[{\\:]',
|
|
||||||
keywords: {'def': 1},
|
|
||||||
contains: ['title', 'comment'],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
begin: '\\bclass ', end: '$',
|
|
||||||
illegal: '[{\\:]',
|
|
||||||
contains: ['title', 'comment'],
|
|
||||||
keywords: {'class': 1}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'symbol',
|
|
||||||
begin: ':' + UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: IDENT_RE + "\\s*<\\s*" + IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: 'self.' + IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: IDENT_RE, end: '^'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//ruby
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
LANGUAGES.javascript = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
contains: ['string', 'comment', 'number', 'regexp', 'function'],
|
|
||||||
keywords: {
|
|
||||||
'keyword': {'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1},
|
|
||||||
'literal': {'true': 1, 'false': 1, 'null': 1}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'regexp',
|
|
||||||
begin: '/.*?[^\\\\/]/[gim]*', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
begin: 'function ', end: '{',
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
keywords: {'function': 1},
|
|
||||||
contains: ['title', 'params']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
contains: ['string', 'comment']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//javascript
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
RenderMan Interface Bytestream (c) Konstantin Evdokimenko <qewerty@gmail.com>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
LANGUAGES.rib = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
illegal: '</',
|
|
||||||
contains: ['comment', 'string', 'number'],
|
|
||||||
keywords: {
|
|
||||||
'keyword': {'ReadArchive': 1, 'FrameBegin': 1, 'FrameEnd': 1, 'WorldBegin': 1, 'WorldEnd': 1,
|
|
||||||
'Attribute': 1, 'Display': 1, 'Option': 1, 'Format': 1, 'ShadingRate': 1,
|
|
||||||
'PixelFilter': 1, 'PixelSamples': 1, 'Projection': 1, 'Scale': 1, 'ConcatTransform': 1,
|
|
||||||
'Transform': 1, 'Translate': 1, 'Rotate': 1,
|
|
||||||
'Surface': 1, 'Displacement': 1, 'Atmosphere': 1,
|
|
||||||
'Interior': 1, 'Exterior': 1},
|
|
||||||
'commands': {'WorldBegin': 1, 'WorldEnd': 1, 'FrameBegin': 1, 'FrameEnd': 1,
|
|
||||||
'ReadArchive': 1, 'ShadingRate': 1}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
HASH_COMMENT_MODE,
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE
|
|
||||||
]
|
|
||||||
};//rib
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
RenderMan Shading Language (c) Konstantin Evdokimenko <qewerty@gmail.com>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
LANGUAGES.rsl = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
illegal: '</',
|
|
||||||
contains: ['comment', 'string', 'number', 'preprocessor',
|
|
||||||
'shader', 'shading'],
|
|
||||||
keywords: {
|
|
||||||
'keyword': {'float': 1, 'color': 1, 'point': 1, 'normal': 1, 'vector': 1,
|
|
||||||
'matrix': 1, 'while': 1, 'for': 1, 'if': 1, 'do': 1,
|
|
||||||
'return': 1, 'else': 1, 'break': 1, 'extern': 1, 'continue': 1},
|
|
||||||
'built_in': {'smoothstep': 1, 'calculatenormal': 1, 'faceforward': 1,
|
|
||||||
'normalize': 1, 'ambient': 1, 'diffuse': 1, 'specular': 1,
|
|
||||||
'visibility': 1}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'shader',
|
|
||||||
begin: 'surface |displacement |light |volume |imager ', end: '\\(',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'surface': 1, 'displacement': 1, 'light': 1, 'volume': 1, 'imager': 1}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'shading',
|
|
||||||
begin: 'illuminate|illuminance|gather', end: '\\(',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'illuminate': 1, 'illuminance': 1, 'gather': 1}
|
|
||||||
},
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'preprocessor',
|
|
||||||
begin: '#', end: '$'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//rsl
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
Smalltalk definition (c) Vladimir Gubarkov <xonixx@gmail.com>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var SMALLTALK_KEYWORDS = {'self': 1, 'super': 1, 'nil': 1, 'true': 1, 'false': 1, 'thisContext': 1}; // only 6
|
|
||||||
var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
|
|
||||||
|
|
||||||
LANGUAGES.smalltalk = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
contains: ['comment', 'string', 'class', 'method',
|
|
||||||
'number', 'symbol', 'char', 'localvars', 'array'],
|
|
||||||
keywords: SMALLTALK_KEYWORDS
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
begin: '\\b[A-Z][A-Za-z0-9_]*', end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'symbol',
|
|
||||||
begin: '#' + UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '"', end: '"',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'method',
|
|
||||||
begin: VAR_IDENT_RE+':', end:'^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'char',
|
|
||||||
begin: '\\$.{1}', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'localvars',
|
|
||||||
begin: '\\|\\s*(('+VAR_IDENT_RE+')\\s*)+\\|', end: '^',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'array',
|
|
||||||
begin: '\\#\\(', end: '\\)',
|
|
||||||
contains: ['string', 'char', 'number', 'symbol']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//smalltalk
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
SQL_KEYWORDS = {'all': 1, 'partial': 1, 'global': 1, 'month': 1, 'current_timestamp': 1, 'using': 1, 'go': 1, 'revoke': 1, 'smallint': 1, 'indicator': 1, 'end-exec': 1, 'disconnect': 1, 'zone': 1, 'with': 1, 'character': 1, 'assertion': 1, 'to': 1, 'add': 1, 'current_user': 1, 'usage': 1, 'input': 1, 'local': 1, 'alter': 1, 'match': 1, 'collate': 1, 'real': 1, 'then': 1, 'rollback': 1, 'get': 1, 'read': 1, 'timestamp': 1, 'session_user': 1, 'not': 1, 'integer': 1, 'bit': 1, 'unique': 1, 'day': 1, 'minute': 1, 'desc': 1, 'insert': 1, 'execute': 1, 'like': 1, 'level': 1, 'decimal': 1, 'drop': 1, 'continue': 1, 'isolation': 1, 'found': 1, 'where': 1, 'constraints': 1, 'domain': 1, 'right': 1, 'national': 1, 'some': 1, 'module': 1, 'transaction': 1, 'relative': 1, 'second': 1, 'connect': 1, 'escape': 1, 'close': 1, 'system_user': 1, 'for': 1, 'deferred': 1, 'section': 1, 'cast': 1, 'current': 1, 'sqlstate': 1, 'allocate': 1, 'intersect': 1, 'deallocate': 1, 'numeric': 1, 'public': 1, 'preserve': 1, 'full': 1, 'goto': 1, 'initially': 1, 'asc': 1, 'no': 1, 'key': 1, 'output': 1, 'collation': 1, 'group': 1, 'by': 1, 'union': 1, 'session': 1, 'both': 1, 'last': 1, 'language': 1, 'constraint': 1, 'column': 1, 'of': 1, 'space': 1, 'foreign': 1, 'deferrable': 1, 'prior': 1, 'connection': 1, 'unknown': 1, 'action': 1, 'commit': 1, 'view': 1, 'or': 1, 'first': 1, 'into': 1, 'float': 1, 'year': 1, 'primary': 1, 'cascaded': 1, 'except': 1, 'restrict': 1, 'set': 1, 'references': 1, 'names': 1, 'table': 1, 'outer': 1, 'open': 1, 'select': 1, 'size': 1, 'are': 1, 'rows': 1, 'from': 1, 'prepare': 1, 'distinct': 1, 'leading': 1, 'create': 1, 'only': 1, 'next': 1, 'inner': 1, 'authorization': 1, 'schema': 1, 'corresponding': 1, 'option': 1, 'declare': 1, 'precision': 1, 'immediate': 1, 'else': 1, 'timezone_minute': 1, 'external': 1, 'varying': 1, 'translation': 1, 'true': 1, 'case': 1, 'exception': 1, 'join': 1, 'hour': 1, 'default': 1, 'double': 1, 'scroll': 1, 'value': 1, 'cursor': 1, 'descriptor': 1, 'values': 1, 'dec': 1, 'fetch': 1, 'procedure': 1, 'delete': 1, 'and': 1, 'false': 1, 'int': 1, 'is': 1, 'describe': 1, 'char': 1, 'as': 1, 'at': 1, 'in': 1, 'varchar': 1, 'null': 1, 'trailing': 1, 'any': 1, 'absolute': 1, 'current_time': 1, 'end': 1, 'grant': 1, 'privileges': 1, 'when': 1, 'cross': 1, 'check': 1, 'write': 1, 'current_date': 1, 'pad': 1, 'begin': 1, 'temporary': 1, 'exec': 1, 'time': 1, 'update': 1, 'catalog': 1, 'user': 1, 'sql': 1, 'date': 1, 'on': 1, 'identity': 1, 'timezone_hour': 1, 'natural': 1, 'whenever': 1, 'interval': 1, 'work': 1, 'order': 1, 'cascade': 1, 'diagnostics': 1, 'nchar': 1, 'having': 1, 'left': 1};
|
|
||||||
|
|
||||||
LANGUAGES.sql =
|
|
||||||
{
|
|
||||||
case_insensitive: true,
|
|
||||||
defaultMode:
|
|
||||||
{
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
contains: ['string', 'number', 'comment'],
|
|
||||||
keywords: {
|
|
||||||
'keyword': SQL_KEYWORDS,
|
|
||||||
'aggregate': {'count': 1, 'sum': 1, 'min': 1, 'max': 1, 'avg': 1}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
modes: [
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '--', end: '$'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'', end: '\'',
|
|
||||||
contains: ['escape', 'squote'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'squote',
|
|
||||||
begin: '\'\'', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '"', end: '"',
|
|
||||||
contains: [ 'escape', 'dquote'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'dquote',
|
|
||||||
begin: '""', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '`', end: '`',
|
|
||||||
contains: ['escape']
|
|
||||||
},
|
|
||||||
BACKSLASH_ESCAPE
|
|
||||||
]
|
|
||||||
};//sql
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
LANGUAGES.cpp = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
illegal: '</',
|
|
||||||
contains: ['comment', 'string', 'number', 'preprocessor'],
|
|
||||||
keywords: {'false': 1, 'int': 1, 'float': 1, 'while': 1, 'private': 1, 'char': 1, 'catch': 1, 'export': 1, 'virtual': 1, 'operator': 2, 'sizeof': 2, 'dynamic_cast': 2, 'typedef': 2, 'const_cast': 2, 'const': 1, 'struct': 1, 'for': 1, 'static_cast': 2, 'union': 1, 'namespace': 1, 'unsigned': 1, 'long': 1, 'throw': 1, 'volatile': 2, 'static': 1, 'protected': 1, 'bool': 1, 'template': 1, 'mutable': 1, 'if': 1, 'public': 1, 'friend': 2, 'do': 1, 'return': 1, 'goto': 1, 'auto': 1, 'void': 2, 'enum': 1, 'else': 1, 'break': 1, 'new': 1, 'extern': 1, 'using': 1, 'true': 1, 'class': 1, 'asm': 1, 'case': 1, 'typeid': 1, 'short': 1, 'reinterpret_cast': 2, 'default': 1, 'double': 1, 'register': 1, 'explicit': 1, 'signed': 1, 'typename': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'wchar_t': 1, 'inline': 1, 'delete': 1}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'', end: '[^\\\\]\'',
|
|
||||||
illegal: '[^\\\\][^\']'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'preprocessor',
|
|
||||||
begin: '#', end: '$'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//cpp
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Java definition (с) Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
|
|
||||||
|
|
||||||
*/
|
|
||||||
LANGUAGES.java = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
contains: ['comment', 'string', 'class', 'number', 'javadoc', 'annotation'],
|
|
||||||
keywords: {'false': 1, 'synchronized': 1, 'int': 1, 'abstract': 1, 'float': 1, 'private': 1, 'char': 1, 'interface': 1, 'boolean': 1, 'static': 1, 'null': 1, 'if': 1, 'const': 1, 'for': 1, 'true': 1, 'while': 1, 'long': 1, 'throw': 1, 'strictfp': 1, 'finally': 1, 'protected': 1, 'extends': 1, 'import': 1, 'native': 1, 'final': 1, 'implements': 1, 'return': 1, 'void': 1, 'enum': 1, 'else': 1, 'break': 1, 'transient': 1, 'new': 1, 'catch': 1, 'instanceof': 1, 'byte': 1, 'super': 1, 'class': 1, 'volatile': 1, 'case': 1, 'assert': 1, 'short': 1, 'package': 1, 'default': 1, 'double': 1, 'public': 1, 'try': 1, 'this': 1, 'switch': 1, 'continue': 1, 'throws': 1}
|
|
||||||
},
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
lexems: [UNDERSCORE_IDENT_RE],
|
|
||||||
begin: '(class |interface )', end: '{',
|
|
||||||
illegal: ':',
|
|
||||||
keywords: {'class': 1, 'interface': 1},
|
|
||||||
contains: ['inheritance', 'title']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'inheritance',
|
|
||||||
begin: '(implements|extends)', end: '^',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'extends': 1, 'implements': 1},
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: UNDERSCORE_IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
contains: ['string', 'annotation']
|
|
||||||
},
|
|
||||||
C_NUMBER_MODE,
|
|
||||||
APOS_STRING_MODE,
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'javadoc',
|
|
||||||
begin: '/\\*\\*', end: '\\*/',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'annotation',
|
|
||||||
begin: '@[A-Za-z]+', end: '^'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//java
|
|
||||||
|
|
||||||
|
|
||||||
var DELPHI_KEYWORDS = {'and': 1, 'safecall': 1, 'cdecl': 1, 'then': 1, 'string': 1, 'exports': 1, 'library': 1, 'not': 1, 'pascal': 1, 'set': 1, 'virtual': 1, 'file': 1, 'in': 1, 'array': 1, 'label': 1, 'packed': 1, 'end.': 1, 'index': 1, 'while': 1, 'const': 1, 'raise': 1, 'for': 1, 'to': 1, 'implementation': 1, 'with': 1, 'except': 1, 'overload': 1, 'destructor': 1, 'downto': 1, 'finally': 1, 'program': 1, 'exit': 1, 'unit': 1, 'inherited': 1, 'override': 1, 'if': 1, 'type': 1, 'until': 1, 'function': 1, 'do': 1, 'begin': 1, 'repeat': 1, 'goto': 1, 'nil': 1, 'far': 1, 'initialization': 1, 'object': 1, 'else': 1, 'var': 1, 'uses': 1, 'external': 1, 'resourcestring': 1, 'interface': 1, 'end': 1, 'finalization': 1, 'class': 1, 'asm': 1, 'mod': 1, 'case': 1, 'on': 1, 'shr': 1, 'shl': 1, 'of': 1, 'register': 1, 'xorwrite': 1, 'threadvar': 1, 'try': 1, 'record': 1, 'near': 1, 'stored': 1, 'constructor': 1, 'stdcall': 1, 'inline': 1, 'div': 1, 'out': 1, 'or': 1, 'procedure': 1};
|
|
||||||
var DELPHI_CLASS_KEYWORDS = {'safecall': 1, 'stdcall': 1, 'pascal': 1, 'stored': 1, 'const': 1, 'implementation': 1, 'finalization': 1, 'except': 1, 'to': 1, 'finally': 1, 'program': 1, 'inherited': 1, 'override': 1, 'then': 1, 'exports': 1, 'string': 1, 'read': 1, 'not': 1, 'mod': 1, 'shr': 1, 'try': 1, 'div': 1, 'shl': 1, 'set': 1, 'library': 1, 'message': 1, 'packed': 1, 'index': 1, 'for': 1, 'near': 1, 'overload': 1, 'label': 1, 'downto': 1, 'exit': 1, 'public': 1, 'goto': 1, 'interface': 1, 'asm': 1, 'on': 1, 'of': 1, 'constructor': 1, 'or': 1, 'private': 1, 'array': 1, 'unit': 1, 'raise': 1, 'destructor': 1, 'var': 1, 'type': 1, 'until': 1, 'function': 1, 'else': 1, 'external': 1, 'with': 1, 'case': 1, 'default': 1, 'record': 1, 'while': 1, 'protected': 1, 'property': 1, 'procedure': 1, 'published': 1, 'and': 1, 'cdecl': 1, 'do': 1, 'threadvar': 1, 'file': 1, 'in': 1, 'if': 1, 'end': 1, 'virtual': 1, 'write': 1, 'far': 1, 'out': 1, 'begin': 1, 'repeat': 1, 'nil': 1, 'initialization': 1, 'object': 1, 'uses': 1, 'resourcestring': 1, 'class': 1, 'register': 1, 'xorwrite': 1, 'inline': 1};
|
|
||||||
|
|
||||||
LANGUAGES.delphi = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
illegal: '("|\\$[G-Zg-z]|\\/\\*|</)',
|
|
||||||
contains: ['comment', 'string', 'number', 'function', 'class'],
|
|
||||||
keywords: DELPHI_KEYWORDS
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '{', end: '}'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '\\(\\*', end: '\\*\\)',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
C_LINE_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'number',
|
|
||||||
begin: NUMBER_RE, end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '\'', end: '\'',
|
|
||||||
contains: ['quote'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'string',
|
|
||||||
begin: '(#\\d+)+', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'quote',
|
|
||||||
begin: '\'\'', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
begin: 'function', end: '[:;]',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'function': 1},
|
|
||||||
contains: ['title', 'params', 'comment'],
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'function',
|
|
||||||
begin: '(procedure|constructor|destructor)', end: ';',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'constructor': 1, 'destructor': 1, 'procedure': 1},
|
|
||||||
contains: ['title', 'params', 'comment'],
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: IDENT_RE, end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'params',
|
|
||||||
begin: '\\(', end: '\\)',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: DELPHI_KEYWORDS,
|
|
||||||
contains: ['string']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
begin: '=\\s*class', end: 'end;',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: DELPHI_CLASS_KEYWORDS,
|
|
||||||
contains: ['string', 'comment', 'function']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//delphi
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
VBScript definition (c) Nikita Ledyaev <lenikita@yandex.ru>
|
|
||||||
|
|
||||||
*/
|
|
||||||
LANGUAGES.vbscript = {
|
|
||||||
defaultMode: {
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
contains: ['string', 'comment', 'number', 'built_in'],
|
|
||||||
keywords: {
|
|
||||||
'keyword': {'call' : 1,'class' : 1,'const' : 1,'dim' : 1,'do' : 1,'loop' : 1,'erase' : 1,'execute' : 1,'executeglobal' : 1,'exit' : 1,'for' : 1,'each' : 1,'next' : 1,'function' : 1,'if' : 1,'then' : 1,'else' : 1,'on' : 1, 'error' : 1,'option' : 1, 'explicit' : 1,'private' : 1,'property' : 1,'let' : 1,'get' : 1,'public' : 1,'randomize' : 1,'redim' : 1,'rem' : 1,'select' : 1,'case' : 1,'set' : 1,'stop' : 1,'sub' : 1,'while' : 1,'wend' : 1,'with' : 1, 'end' : 1, 'to' : 1},
|
|
||||||
'built_in': {'lcase': 1, 'month': 1, 'vartype': 1, 'instrrev': 1, 'ubound': 1, 'setlocale': 1, 'getobject': 1, 'rgb': 1, 'getref': 1, 'string': 1, 'weekdayname': 1, 'rnd': 1, 'dateadd': 1, 'monthname': 1, 'now': 1, 'day': 1, 'minute': 1, 'isarray': 1, 'cbool': 1, 'round': 1, 'formatcurrency': 1, 'conversions': 1, 'csng': 1, 'timevalue': 1, 'second': 1, 'year': 1, 'space': 1, 'abs': 1, 'clng': 1, 'timeserial': 1, 'fixs': 1, 'len': 1, 'asc': 1, 'isempty': 1, 'maths': 1, 'dateserial': 1, 'atn': 1, 'timer': 1, 'isobject': 1, 'filter': 1, 'weekday': 1, 'datevalue': 1, 'ccur': 1, 'isdate': 1, 'instr': 1, 'datediff': 1, 'formatdatetime': 1, 'replace': 1, 'isnull': 1, 'right': 1, 'sgn': 1, 'array': 1, 'snumeric': 1, 'log': 1, 'cdbl': 1, 'hex': 1, 'chr': 1, 'lbound': 1, 'msgbox': 1, 'ucase': 1, 'getlocale': 1, 'cos': 1, 'cdate': 1, 'cbyte': 1, 'rtrim': 1, 'join': 1, 'hour': 1, 'oct': 1, 'typename': 1, 'trim': 1, 'strcomp': 1, 'int': 1, 'createobject': 1, 'loadpicture': 1, 'tan': 1, 'formatnumber': 1, 'mid': 1, 'scriptenginebuildversion': 1, 'scriptengine': 1, 'split': 1, 'scriptengineminorversion': 1, 'cint': 1, 'sin': 1, 'datepart': 1, 'ltrim': 1, 'sqr': 1, 'scriptenginemajorversion': 1, 'time': 1, 'derived': 1, 'eval': 1, 'date': 1, 'formatpercent': 1, 'exp': 1, 'inputbox': 1, 'left': 1}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
QUOTE_STRING_MODE,
|
|
||||||
BACKSLASH_ESCAPE,
|
|
||||||
{
|
|
||||||
className: 'comment',
|
|
||||||
begin: '\'', end: '$'
|
|
||||||
},
|
|
||||||
C_NUMBER_MODE
|
|
||||||
]
|
|
||||||
};//vbscript
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
var XML_COMMENT = {
|
|
||||||
className: 'comment',
|
|
||||||
begin: '<!--', end: '-->'
|
|
||||||
};
|
|
||||||
var XML_ATTR = {
|
|
||||||
className: 'attribute',
|
|
||||||
begin: ' [a-zA-Z]+=', end: '^',
|
|
||||||
contains: ['value']
|
|
||||||
};
|
|
||||||
var XML_VALUE = {
|
|
||||||
className: 'value',
|
|
||||||
begin: '"', end: '"'
|
|
||||||
};
|
|
||||||
|
|
||||||
LANGUAGES.xml = {
|
|
||||||
defaultMode: {
|
|
||||||
contains: ['pi', 'comment', 'cdata', 'tag']
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'pi',
|
|
||||||
begin: '<\\?', end: '\\?>',
|
|
||||||
relevance: 10
|
|
||||||
},
|
|
||||||
XML_COMMENT,
|
|
||||||
{
|
|
||||||
className: 'cdata',
|
|
||||||
begin: '<\\!\\[CDATA\\[', end: '\\]\\]>'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'tag',
|
|
||||||
begin: '</?', end: '>',
|
|
||||||
contains: ['title', 'tag_internal'],
|
|
||||||
relevance: 1.5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'title',
|
|
||||||
begin: '[A-Za-z]+', end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'tag_internal',
|
|
||||||
begin: '^', endsWithParent: true,
|
|
||||||
contains: ['attribute'],
|
|
||||||
relevance: 0,
|
|
||||||
illegal: '[\\+\\.]'
|
|
||||||
},
|
|
||||||
XML_ATTR,
|
|
||||||
XML_VALUE
|
|
||||||
]
|
|
||||||
};//xml
|
|
||||||
|
|
||||||
var HTML_TAGS = {'code': 1, 'kbd': 1, 'font': 1, 'noscript': 1, 'style': 1, 'img': 1, 'title': 1, 'menu': 1, 'tt': 1, 'tr': 1, 'param': 1, 'li': 1, 'tfoot': 1, 'th': 1, 'input': 1, 'td': 1, 'dl': 1, 'blockquote': 1, 'fieldset': 1, 'big': 1, 'dd': 1, 'abbr': 1, 'optgroup': 1, 'dt': 1, 'button': 1, 'isindex': 1, 'p': 1, 'small': 1, 'div': 1, 'dir': 1, 'em': 1, 'frame': 1, 'meta': 1, 'sub': 1, 'bdo': 1, 'label': 1, 'acronym': 1, 'sup': 1, 'body': 1, 'xml': 1, 'basefont': 1, 'base': 1, 'br': 1, 'address': 1, 'strong': 1, 'legend': 1, 'ol': 1, 'script': 1, 'caption': 1, 's': 1, 'col': 1, 'h2': 1, 'h3': 1, 'h1': 1, 'h6': 1, 'h4': 1, 'h5': 1, 'table': 1, 'select': 1, 'noframes': 1, 'span': 1, 'area': 1, 'dfn': 1, 'strike': 1, 'cite': 1, 'thead': 1, 'head': 1, 'option': 1, 'form': 1, 'hr': 1, 'var': 1, 'link': 1, 'b': 1, 'colgroup': 1, 'ul': 1, 'applet': 1, 'del': 1, 'iframe': 1, 'pre': 1, 'frameset': 1, 'ins': 1, 'tbody': 1, 'html': 1, 'samp': 1, 'map': 1, 'object': 1, 'a': 1, 'xmlns': 1, 'center': 1, 'textarea': 1, 'i': 1, 'q': 1, 'u': 1};
|
|
||||||
var HTML_DOCTYPE = {
|
|
||||||
className: 'doctype',
|
|
||||||
begin: '<!DOCTYPE', end: '>',
|
|
||||||
relevance: 10
|
|
||||||
};
|
|
||||||
var HTML_ATTR = {
|
|
||||||
className: 'attribute',
|
|
||||||
begin: ' [a-zA-Z]+', end: '^'
|
|
||||||
};
|
|
||||||
var HTML_VALUE = {
|
|
||||||
className: 'value',
|
|
||||||
begin: '[a-zA-Z0-9]+', end: '^'
|
|
||||||
};
|
|
||||||
|
|
||||||
LANGUAGES.html = {
|
|
||||||
defaultMode: {
|
|
||||||
contains: ['tag', 'comment', 'doctype']
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
XML_COMMENT,
|
|
||||||
HTML_DOCTYPE,
|
|
||||||
{
|
|
||||||
className: 'tag',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: HTML_TAGS,
|
|
||||||
begin: '<[A-Za-z/]', end: '>',
|
|
||||||
contains: ['attribute'],
|
|
||||||
illegal: '[\\+\\.]'
|
|
||||||
},
|
|
||||||
XML_ATTR,
|
|
||||||
HTML_ATTR,
|
|
||||||
XML_VALUE,
|
|
||||||
HTML_VALUE
|
|
||||||
]
|
|
||||||
};//html
|
|
||||||
|
|
||||||
LANGUAGES.css = {
|
|
||||||
defaultMode: {
|
|
||||||
contains: ['id', 'class', 'attr_selector', 'rules', 'comment'],
|
|
||||||
keywords: HTML_TAGS,
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
illegal: '='
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
{
|
|
||||||
className: 'id',
|
|
||||||
begin: '\\#[A-Za-z0-9_-]+', end: '^'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'class',
|
|
||||||
begin: '\\.[A-Za-z0-9_-]+', end: '^',
|
|
||||||
relevance: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'attr_selector',
|
|
||||||
begin: '\\[', end: '\\]',
|
|
||||||
illegal: '$'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'rules',
|
|
||||||
begin: '{', end: '}',
|
|
||||||
lexems: ['[A-Za-z-]+'],
|
|
||||||
keywords: {'play-during': 1, 'counter-reset': 1, 'counter-increment': 1, 'min-height': 1, 'quotes': 1, 'border-top': 1, 'pitch': 1, 'font': 1, 'pause': 1, 'list-style-image': 1, 'border-width': 1, 'cue': 1, 'outline-width': 1, 'border-left': 1, 'elevation': 1, 'richness': 1, 'speech-rate': 1, 'border-bottom': 1, 'border-spacing': 1, 'background': 1, 'list-style-type': 1, 'text-align': 1, 'page-break-inside': 1, 'orphans': 1, 'page-break-before': 1, 'text-transform': 1, 'line-height': 1, 'padding-left': 1, 'font-size': 1, 'right': 1, 'word-spacing': 1, 'padding-top': 1, 'outline-style': 1, 'bottom': 1, 'content': 1, 'border-right-style': 1, 'padding-right': 1, 'border-left-style': 1, 'voice-family': 1, 'background-color': 1, 'border-bottom-color': 1, 'outline-color': 1, 'unicode-bidi': 1, 'max-width': 1, 'font-family': 1, 'caption-side': 1, 'border-right-width': 1, 'pause-before': 1, 'border-top-style': 1, 'color': 1, 'border-collapse': 1, 'border-bottom-width': 1, 'float': 1, 'height': 1, 'max-height': 1, 'margin-right': 1, 'border-top-width': 1, 'speak': 1, 'speak-header': 1, 'top': 1, 'cue-before': 1, 'min-width': 1, 'width': 1, 'font-variant': 1, 'border-top-color': 1, 'background-position': 1, 'empty-cells': 1, 'direction': 1, 'border-right': 1, 'visibility': 1, 'padding': 1, 'border-style': 1, 'background-attachment': 1, 'overflow': 1, 'border-bottom-style': 1, 'cursor': 1, 'margin': 1, 'display': 1, 'border-left-width': 1, 'letter-spacing': 1, 'vertical-align': 1, 'clip': 1, 'border-color': 1, 'list-style': 1, 'padding-bottom': 1, 'pause-after': 1, 'speak-numeral': 1, 'margin-left': 1, 'widows': 1, 'border': 1, 'font-style': 1, 'border-left-color': 1, 'pitch-range': 1, 'background-repeat': 1, 'table-layout': 1, 'margin-bottom': 1, 'speak-punctuation': 1, 'font-weight': 1, 'border-right-color': 1, 'page-break-after': 1, 'position': 1, 'white-space': 1, 'text-indent': 1, 'background-image': 1, 'volume': 1, 'stress': 1, 'outline': 1, 'clear': 1, 'z-index': 1, 'text-decoration': 1, 'margin-top': 1, 'azimuth': 1, 'cue-after': 1, 'left': 1, 'list-style-position': 1},
|
|
||||||
contains: ['comment', 'value']
|
|
||||||
},
|
|
||||||
C_BLOCK_COMMENT_MODE,
|
|
||||||
{
|
|
||||||
className: 'value',
|
|
||||||
begin: ':', end: ';', endsWithParent: true,
|
|
||||||
excludeBegin: true, excludeEnd: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//css
|
|
||||||
|
|
||||||
LANGUAGES.django = {
|
|
||||||
defaultMode: {
|
|
||||||
contains: ['tag', 'comment', 'doctype', 'template_comment', 'template_tag', 'variable']
|
|
||||||
},
|
|
||||||
case_insensitive: true,
|
|
||||||
modes: [
|
|
||||||
XML_COMMENT,
|
|
||||||
HTML_DOCTYPE,
|
|
||||||
{
|
|
||||||
className: 'tag',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: HTML_TAGS,
|
|
||||||
begin: '<[A-Za-z/]', end: '>',
|
|
||||||
contains: ['attribute', 'template_comment', 'template_tag', 'variable']
|
|
||||||
},
|
|
||||||
XML_ATTR,
|
|
||||||
HTML_ATTR,
|
|
||||||
{
|
|
||||||
className: 'value',
|
|
||||||
begin: '"', end: '"',
|
|
||||||
contains: ['template_comment', 'template_tag', 'variable']
|
|
||||||
},
|
|
||||||
HTML_VALUE,
|
|
||||||
{
|
|
||||||
className: 'template_comment',
|
|
||||||
begin: '\\{\\%\\s*comment\\s*\\%\\}', end: '\\{\\%\\s*endcomment\\s*\\%\\}'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'template_comment',
|
|
||||||
begin: '\\{#', end: '#\\}'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'template_tag',
|
|
||||||
begin: '\\{\\%', end: '\\%\\}',
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'comment': 1, 'endcomment': 1, 'load': 1, 'templatetag': 1, 'ifchanged': 1, 'endifchanged': 1, 'if': 1, 'endif': 1, 'firstof': 1, 'for': 1, 'endfor': 1, 'in': 1, 'ifnotequal': 1, 'endifnotequal': 1, 'widthratio': 1, 'extends': 1, 'include': 1, 'spaceless': 1, 'endspaceless': 1, 'regroup': 1, 'by': 1, 'as': 1, 'ifequal': 1, 'endifequal': 1, 'ssi': 1, 'now': 1, 'with': 1, 'cycle': 1, 'url': 1, 'filter': 1, 'endfilter': 1, 'debug': 1, 'block': 1, 'endblock': 1, 'else': 1},
|
|
||||||
contains: ['filter']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'variable',
|
|
||||||
begin: '\\{\\{', end: '\\}\\}',
|
|
||||||
contains: ['filter']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'filter',
|
|
||||||
begin: '\\|[A-Za-z]+\\:?', end: '^', excludeEnd: true,
|
|
||||||
lexems: [IDENT_RE],
|
|
||||||
keywords: {'truncatewords': 1, 'removetags': 1, 'linebreaksbr': 1, 'yesno': 1, 'get_digit': 1, 'timesince': 1, 'random': 1, 'striptags': 1, 'filesizeformat': 1, 'escape': 1, 'linebreaks': 1, 'length_is': 1, 'ljust': 1, 'rjust': 1, 'cut': 1, 'urlize': 1, 'fix_ampersands': 1, 'title': 1, 'floatformat': 1, 'capfirst': 1, 'pprint': 1, 'divisibleby': 1, 'add': 1, 'make_list': 1, 'unordered_list': 1, 'urlencode': 1, 'timeuntil': 1, 'urlizetrunc': 1, 'wordcount': 1, 'stringformat': 1, 'linenumbers': 1, 'slice': 1, 'date': 1, 'dictsort': 1, 'dictsortreversed': 1, 'default_if_none': 1, 'pluralize': 1, 'lower': 1, 'join': 1, 'center': 1, 'default': 1, 'truncatewords_html': 1, 'upper': 1, 'length': 1, 'phone2numeric': 1, 'wordwrap': 1, 'time': 1, 'addslashes': 1, 'slugify': 1, 'first': 1},
|
|
||||||
contains: ['argument']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
className: 'argument',
|
|
||||||
begin: '"', end: '"'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};//django
|
|
||||||
@@ -1,310 +0,0 @@
|
|||||||
# Highlight.js
|
|
||||||
|
|
||||||
Highlight.js highlights syntax in code examples on blogs, forums and
|
|
||||||
in fact on any web pages. It's very easy to use because it works
|
|
||||||
automatically: finds blocks of code, detects a language, highlights it.
|
|
||||||
|
|
||||||
Autodetection can be fine tuned when it fails by itself (see "Heuristics").
|
|
||||||
|
|
||||||
## Installation and usage
|
|
||||||
|
|
||||||
The script is installed by linking to a single file and making a single
|
|
||||||
initialization call:
|
|
||||||
|
|
||||||
<script type="text/javascript" src="highlight.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
initHighlightingOnLoad();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
Autodetection can work a bit slow if it includes too many languages and code
|
|
||||||
blocks are large. To speed up highlighting in this case you can pass to the
|
|
||||||
initialization function only those languages that you actually use on your pages:
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
initHighlightingOnLoad('html', 'css');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
When called this way highlight.js will dynamically load appropriate language
|
|
||||||
files and thus will also weigh less than with the default set that includes all
|
|
||||||
languages implemented.
|
|
||||||
|
|
||||||
Then the script looks in your page for fragments `<pre><code>...</code></pre>`
|
|
||||||
that are used traditionally to mark up code examples. Their content is
|
|
||||||
marked up by logical pieces with defined class names. The classes are
|
|
||||||
used to actually style the code elements:
|
|
||||||
|
|
||||||
.comment {
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.keyword {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.python .string {
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.html .atribute .value {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
You can use included sample.css as a starting point for you own style.
|
|
||||||
|
|
||||||
A full list of available classes is below ("Languages").
|
|
||||||
|
|
||||||
### WordPress plugin
|
|
||||||
|
|
||||||
Generally installing highlight.js in a [WordPress][wp] blog is no different
|
|
||||||
than for any other web page. However it can also be installed as a plugin.
|
|
||||||
This is useful if your blog is located on a shared hosting and you don't
|
|
||||||
have a permission to edit template and style files. Or it may be more convenient
|
|
||||||
to you this way.
|
|
||||||
|
|
||||||
To install the plugin copy the whole directory with highlight.js to the
|
|
||||||
WordPress plugins directory. After this you can activate and deactivate it
|
|
||||||
from the Plugins panel. There is also a page "highlight.js" under the Options
|
|
||||||
menu where you can set a list of languages and style rules. Insanely convenient :-)
|
|
||||||
|
|
||||||
[wp]: http://wordpress.org/
|
|
||||||
|
|
||||||
|
|
||||||
## Export
|
|
||||||
|
|
||||||
File export.html contains a little program that shows and allows to copy and paste
|
|
||||||
an HTML code generated by the highlighter for any code snippet. This can be useful
|
|
||||||
in situations when one can't use the script itself on a site.
|
|
||||||
|
|
||||||
|
|
||||||
## Languages
|
|
||||||
|
|
||||||
This is a full list of available classes corresponding to languages'
|
|
||||||
syntactic structures.
|
|
||||||
|
|
||||||
Python:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string (of any type)
|
|
||||||
comment comment
|
|
||||||
decorator @-decorator for functions
|
|
||||||
function function header "def some_name(...):"
|
|
||||||
class class header "class SomeName(...):"
|
|
||||||
title name of a function or a class inside a header
|
|
||||||
params everything inside parentheses in a function's or class' header
|
|
||||||
|
|
||||||
Ruby:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
string string
|
|
||||||
subst in-string substitution (#{...})
|
|
||||||
comment comment
|
|
||||||
function function header "def some_name(...):"
|
|
||||||
class class header "class SomeName(...):"
|
|
||||||
title name of a function or a class inside a header
|
|
||||||
symbol symbol
|
|
||||||
|
|
||||||
Perl:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
comment comment
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
regexp regular expression
|
|
||||||
sub subroutine header (from "sub" till "{")
|
|
||||||
variable variable starting with "$", "%", "@"
|
|
||||||
operator operator
|
|
||||||
pod plain old doc
|
|
||||||
|
|
||||||
PHP:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string (of any type)
|
|
||||||
comment comment
|
|
||||||
phpdoc phpdoc params in comments
|
|
||||||
variable variable starting with "$"
|
|
||||||
|
|
||||||
XML:
|
|
||||||
|
|
||||||
tag any tag from "<" till ">"
|
|
||||||
comment comment
|
|
||||||
pi processing instruction (<?php ... ?>)
|
|
||||||
cdata CDATA section
|
|
||||||
attribute attribute
|
|
||||||
value attribute's value
|
|
||||||
|
|
||||||
HTML:
|
|
||||||
|
|
||||||
keyword HTML tag
|
|
||||||
tag any tag from "<" till ">"
|
|
||||||
comment comment
|
|
||||||
doctype <!DOCTYPE ... > declaration
|
|
||||||
attribute tag's attribute with or without value
|
|
||||||
value attribute's value
|
|
||||||
|
|
||||||
CSS:
|
|
||||||
|
|
||||||
keyword HTML tag when in selectors, CSS keyword when in rules
|
|
||||||
id #some_name in selectors
|
|
||||||
class .some_name in selectors
|
|
||||||
attr_selector attribute selector (square brackets in a[href^=http://])
|
|
||||||
comment comment
|
|
||||||
rules everything from "{" till "}"
|
|
||||||
value property's value inside a rule, from ":" till ";" or
|
|
||||||
till the end of rule block
|
|
||||||
|
|
||||||
Django:
|
|
||||||
|
|
||||||
keyword HTML tag in HTML, default tags and default filters in templates
|
|
||||||
tag any tag from "<" till ">"
|
|
||||||
comment comment
|
|
||||||
doctype <!DOCTYPE ... > declaration
|
|
||||||
attribute tag's attribute with or withou value
|
|
||||||
value attribute's value
|
|
||||||
template_tag template tag {% .. %}
|
|
||||||
variable template variable {{ .. }}
|
|
||||||
template_comment template comment, both {# .. #} and {% comment %}
|
|
||||||
filter filter from "|" till the next filter or the end of tag
|
|
||||||
argument filter argument
|
|
||||||
|
|
||||||
Javascript:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
comment comment
|
|
||||||
number number
|
|
||||||
literal special literal: "true", "false" and "null"
|
|
||||||
string string
|
|
||||||
regexp regular expression
|
|
||||||
function header of a function
|
|
||||||
title name of a function inside a header
|
|
||||||
params everything inside parentheses in a function's header
|
|
||||||
|
|
||||||
VBScript:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment comment
|
|
||||||
built_in built-in function
|
|
||||||
|
|
||||||
Delphi:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
comment comment (of any type)
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
function header of a function, procedure, constructor and destructor
|
|
||||||
title name of a function, procedure, constructor or destructor
|
|
||||||
inside a header
|
|
||||||
params everything inside parentheses in a function's header
|
|
||||||
class class' body from "= class" till "end;"
|
|
||||||
|
|
||||||
Java:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment commment
|
|
||||||
annotaion annotation
|
|
||||||
javadoc javadoc comment
|
|
||||||
class class header from "class" till "{"
|
|
||||||
title class name inside a header
|
|
||||||
params everything in parentheses inside a class header
|
|
||||||
inheritance keywords "extends" and "implements" inside class header
|
|
||||||
|
|
||||||
C++:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string and character
|
|
||||||
comment comment
|
|
||||||
preprocessor preprocessor directive
|
|
||||||
|
|
||||||
RenderMan (RSL):
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment comment
|
|
||||||
preprocessor preprocessor directive
|
|
||||||
shader sahder keywords
|
|
||||||
shading shading keywords
|
|
||||||
built_in built-in function
|
|
||||||
|
|
||||||
RenderMan (RIB):
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment comment
|
|
||||||
commands command
|
|
||||||
|
|
||||||
SQL:
|
|
||||||
|
|
||||||
keyword keyword (mostly SQL'92 and SQL'99)
|
|
||||||
number number
|
|
||||||
string string (of any type: "..", '..', `..`)
|
|
||||||
comment comment
|
|
||||||
aggregate aggregate function
|
|
||||||
|
|
||||||
Smalltalk:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment commment
|
|
||||||
symbol symbol
|
|
||||||
array array
|
|
||||||
class name of a class
|
|
||||||
char char
|
|
||||||
localvars block of local variables
|
|
||||||
|
|
||||||
Axapta:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment commment
|
|
||||||
class class header from "class" till "{"
|
|
||||||
title class name inside a header
|
|
||||||
params everything in parentheses inside a class header
|
|
||||||
inheritance keywords "extends" and "implements" inside class header
|
|
||||||
preprocessor preprocessor directive
|
|
||||||
|
|
||||||
1C:
|
|
||||||
|
|
||||||
keyword keyword
|
|
||||||
number number
|
|
||||||
string string
|
|
||||||
comment commment
|
|
||||||
function header of function or procudure
|
|
||||||
title function name inside a header
|
|
||||||
params everything in parentheses inside a function header
|
|
||||||
preprocessor preprocessor directive
|
|
||||||
|
|
||||||
## Heuristics
|
|
||||||
|
|
||||||
Autodetection of a code's language is done with a simple heuristics:
|
|
||||||
the program tries to highlight a fragment with all available languages and
|
|
||||||
counts all syntactic structures that it finds along the way. The language
|
|
||||||
with greatest count wins.
|
|
||||||
|
|
||||||
This means that in short fragments the probability of an error is high
|
|
||||||
(and it really happens sometimes). In this cases you can set the fragment's
|
|
||||||
language explicitly by assigning a class to the `<code>` element:
|
|
||||||
|
|
||||||
<pre><code class="html">...</code></pre>
|
|
||||||
|
|
||||||
To disable highlighting of a fragment altogether use "no-highlight" class:
|
|
||||||
|
|
||||||
<pre><code class="no-highlight">...</code></pre>
|
|
||||||
|
|
||||||
## Contacts
|
|
||||||
|
|
||||||
Version: 3.5
|
|
||||||
URL: http://softwaremaniacs.org/soft/highlight/en/
|
|
||||||
Author: Ivan Sagalaev (Maniac@SoftwareManiacs.Org)
|
|
||||||
|
|
||||||
For the license terms see LICENSE files.
|
|
||||||
For the list of contributors see AUTHORS.en.txt file.
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
# Highlight.js
|
|
||||||
|
|
||||||
Highlight.js нужен для подсветки синтаксиса в примерах кода в блогах,
|
|
||||||
форумах и вообще на любых веб-страницах. Пользоваться им очень просто,
|
|
||||||
потому что работает он автоматически: сам находит блоки кода, сам
|
|
||||||
определяет язык, сам подсвечивает.
|
|
||||||
|
|
||||||
Автоопределением языка можно управлять, когда оно не справляется само (см.
|
|
||||||
дальше "Эвристика").
|
|
||||||
|
|
||||||
## Подключение и использование
|
|
||||||
|
|
||||||
Скрипт подключается одним файлом и одним вызовом инициализирующей
|
|
||||||
функции:
|
|
||||||
|
|
||||||
<script type="text/javascript" src="highlight.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
initHighlightingOnLoad();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
Автоматическое определение языков может работать довольно медленно, когда
|
|
||||||
в него включено много языков, а фрагменты кода обширны. Чтобы ускорить
|
|
||||||
процесс, можно перечислить в вызове инициализирующей функции только те
|
|
||||||
языки, которые используются в тексте:
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
initHighlightingOnLoad('html', 'css');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
При вызов таким образом highlight.js динамически подгружает соответствующие
|
|
||||||
языковые файлы и таким образом весит меньше, чем с набором по умолчанию,
|
|
||||||
который включает все реализованные языки.
|
|
||||||
|
|
||||||
Дальше скрипт ищет на странице конструкции `<pre><code>...</code></pre>`,
|
|
||||||
которые традиционно используются для написания кода, и код в них
|
|
||||||
размечается на куски, помеченные разными значениями классов. Классам
|
|
||||||
этим затем надо задать в стилях нужные цвета например так:
|
|
||||||
|
|
||||||
.comment {
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
.keyword {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.python .string {
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.html .atribute .value {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
Можно использовать sample.css из комплекта как стартовую точку для собственного
|
|
||||||
стиля.
|
|
||||||
|
|
||||||
Полный список классов для разных языков приведен ниже ("Языки").
|
|
||||||
|
|
||||||
### Плагин к WordPress
|
|
||||||
|
|
||||||
Вообще, подключение highlight.js к блогу на [WordPress][wp] ничем не отличается
|
|
||||||
от подключения куда-либо еще. Однако он может быть подключен к блогу и как плагин.
|
|
||||||
Это удобно, если блог находится на общественном сервере, где вы не можете
|
|
||||||
свободно редактировать файлы, или просто если вы привыкли пользоваться плагинами.
|
|
||||||
|
|
||||||
Для установки плагина надо скопировать всю директорию с файлами highlight.js в
|
|
||||||
директорию плагинов WordPress. После этого в панели плагинов его можно
|
|
||||||
будет включать и отключать. В меню Options также добавляется страничка
|
|
||||||
highlight.js, где можно настраивать список языков и CSS-стили. Удобно до одурения :-).
|
|
||||||
|
|
||||||
[wp]: http://wordpress.org/
|
|
||||||
|
|
||||||
|
|
||||||
## Экспорт
|
|
||||||
|
|
||||||
В файле export.html находится небольшая программка, которая показывает и дает
|
|
||||||
скопировать непосредственно HTML-код подсветки для любого заданного фрагмента кода.
|
|
||||||
Это может понадобится например на сайте, на котором нельзя подключить сам скрипт
|
|
||||||
highlight.js.
|
|
||||||
|
|
||||||
|
|
||||||
## Языки
|
|
||||||
|
|
||||||
В списке приведены все языки, которые знает библиотека с классами,
|
|
||||||
соответствующими различным синтаксическим частям.
|
|
||||||
|
|
||||||
Python:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка (любого типа)
|
|
||||||
comment комментарий
|
|
||||||
decorator @-декоратор функции
|
|
||||||
function заголовок функции "def some_name(...):"
|
|
||||||
class заголовок класса "class SomeName(...):"
|
|
||||||
title название функции или класса внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка функции или класса
|
|
||||||
|
|
||||||
Ruby:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
string строка
|
|
||||||
subst внутристроковая подстановка (#{...})
|
|
||||||
comment комментарий
|
|
||||||
function заголовок функции "def ..."
|
|
||||||
class заголовок класса "class ..."
|
|
||||||
title название функции или класса внутри заголовка
|
|
||||||
symbol символ
|
|
||||||
|
|
||||||
Perl:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
comment комментарий
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
regexp регулярное выражение
|
|
||||||
sub заголовок процедуры (от "sub" до "{")
|
|
||||||
variable переменная, начинающаяся с "$", "%", "@"
|
|
||||||
operator оператор
|
|
||||||
pod документация (plain old doc)
|
|
||||||
|
|
||||||
PHP:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка (любого типа)
|
|
||||||
comment комментарий
|
|
||||||
phpdoc параметры phpdoc в комментарии
|
|
||||||
variable переменная, начинающаяся с "$"
|
|
||||||
|
|
||||||
XML:
|
|
||||||
|
|
||||||
tag любой открывающий или закрывающий тег от "<" до ">"
|
|
||||||
comment комментарий
|
|
||||||
pi инструкции обработки (<?php ... ?>)
|
|
||||||
cdata раздел CDATA
|
|
||||||
attribute атрибут
|
|
||||||
value значение атрибута
|
|
||||||
|
|
||||||
HTML:
|
|
||||||
|
|
||||||
keyword тег языка HTML
|
|
||||||
tag любой открывающий или закрывающий тег от "<" до ">"
|
|
||||||
comment комментарий
|
|
||||||
doctype объявление <!DOCTYPE ... >
|
|
||||||
attribute атрибут внутри тега со значением или без
|
|
||||||
value значение атрибута
|
|
||||||
|
|
||||||
CSS:
|
|
||||||
|
|
||||||
keyword тег языка HTML в селекторах или свойство CSS в правилах
|
|
||||||
id #some_name в селекторах
|
|
||||||
class .some_name в селекторах
|
|
||||||
attr_selector селектор атрибутов (квадатные скобоки в a[href^=http://])
|
|
||||||
comment комментарий
|
|
||||||
rules все от "{" до "}"
|
|
||||||
value значение свойства внутри правила, все от ":" до ";" или
|
|
||||||
до конца блока правил
|
|
||||||
|
|
||||||
Django:
|
|
||||||
|
|
||||||
keyword тег HTML в HTML, встроенные шаблонные теги и фильтры в шаблонах
|
|
||||||
tag любой открывающий или закрывающий тег от "<" до ">"
|
|
||||||
comment комментарий
|
|
||||||
doctype объявление <!DOCTYPE ... >
|
|
||||||
attribute атрибут внутри тега со значением или без
|
|
||||||
value значение атрибута
|
|
||||||
template_tag шаблонный тег {% .. %}
|
|
||||||
variable шаблонная переменная {{ .. }}
|
|
||||||
template_comment шаблонный комментарий, и {# .. #}, и {% comment %}
|
|
||||||
filter фильтр от "|" до следующего фильтра или до конца тега
|
|
||||||
argument аргумент фильтра
|
|
||||||
|
|
||||||
Javascript:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
comment комментарий
|
|
||||||
number число
|
|
||||||
literal специальное слово: "true", "false" и "null"
|
|
||||||
string строка
|
|
||||||
regexp регулярное выражение
|
|
||||||
function заголовок функции
|
|
||||||
title название функции внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка функции
|
|
||||||
|
|
||||||
VBScript:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
comment комментарий
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
built_in встроенная функция
|
|
||||||
|
|
||||||
Delphi:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
comment комментарий (любого типа)
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
function заголовок функции, процедуры, конструктора или деструктора
|
|
||||||
title название функции, процедуры, конструктора или деструктора
|
|
||||||
внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка функций
|
|
||||||
class тело класса от "= class" до "end;"
|
|
||||||
|
|
||||||
Java:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
annotaion аннотация
|
|
||||||
javadoc javadoc-комментарии
|
|
||||||
class заголовок класса от "class" до "{"
|
|
||||||
title название класса внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка класса
|
|
||||||
inheritance слова "extends" и "implements" внутри заголовка класса
|
|
||||||
|
|
||||||
C++:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка и одиночный символ
|
|
||||||
comment комментарий
|
|
||||||
preprocessor директива препроцессора
|
|
||||||
|
|
||||||
RenderMan (RSL):
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
preprocessor директива препроцессора
|
|
||||||
shader ключевое слово шейдеров
|
|
||||||
shading ключевое слово затенений
|
|
||||||
built_in встроенная функция
|
|
||||||
|
|
||||||
RenderMan (RIB):
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
commands команда
|
|
||||||
|
|
||||||
SQL:
|
|
||||||
|
|
||||||
keyword ключевое слово (в основном из SQL'92 и SQL'99)
|
|
||||||
number число
|
|
||||||
string строка (любого типа: "..", '..', `..`)
|
|
||||||
comment комментарий
|
|
||||||
aggregate агрегатная функция
|
|
||||||
|
|
||||||
Smalltalk:
|
|
||||||
|
|
||||||
keyword ключевое слово
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
symbol символ
|
|
||||||
array массив
|
|
||||||
class имя класса
|
|
||||||
char буква
|
|
||||||
localvars блок локальных переменных
|
|
||||||
|
|
||||||
Axapta:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
class заголовок класса от "class" до "{"
|
|
||||||
title название класса внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка класса
|
|
||||||
inheritance слова "extends" и "implements" внутри заголовка класса
|
|
||||||
preprocessor директива препроцессора
|
|
||||||
|
|
||||||
1С:
|
|
||||||
|
|
||||||
keyword ключевое слово языка
|
|
||||||
number число
|
|
||||||
string строка
|
|
||||||
comment комментарий
|
|
||||||
function заголовок функции или процедуры
|
|
||||||
title название функции внутри заголовка
|
|
||||||
params все, что в скобках внутри заголовка функции
|
|
||||||
preprocessor директива препроцессора
|
|
||||||
|
|
||||||
|
|
||||||
## Эвристика
|
|
||||||
|
|
||||||
Определение языка, на котором написан фрагмент, делается с помощью
|
|
||||||
довольно простой эвристики: программа пытается расцветить фрагмент всеми
|
|
||||||
языками подряд, и для каждого языка считает количество подошедших
|
|
||||||
синтаксически конструкций и ключевых слов. Для какого языка нашлось больше,
|
|
||||||
тот и выбирается.
|
|
||||||
|
|
||||||
Это означает, что в коротких фрагментах высока вероятность ошибки, что
|
|
||||||
периодически и случается. Чтобы указать язык фрагмента явно, надо написать
|
|
||||||
его название в виде класса к элементу `<code>`:
|
|
||||||
|
|
||||||
<pre><code class="html">...</code></pre>
|
|
||||||
|
|
||||||
Чтобы запретить расцветку фрагмента вообще, используется класс "no-highlight":
|
|
||||||
|
|
||||||
<pre><code class="no-highlight">...</code></pre>
|
|
||||||
|
|
||||||
## Координаты
|
|
||||||
|
|
||||||
Версия: 3.5
|
|
||||||
URL: http://softwaremaniacs.org/soft/highlight/
|
|
||||||
Автор: Иван Сагалаев (Maniac@SoftwareManiacs.Org)
|
|
||||||
|
|
||||||
Лицензионное соглашение читайте в файле LICENSE.
|
|
||||||
Список соавторов читайте в файле AUTHORS.ru.txt
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/*
|
|
||||||
You can use this file as is or as a starting point for you own styling
|
|
||||||
*/
|
|
||||||
|
|
||||||
pre code[class]:after {
|
|
||||||
content: 'highlight: ' attr(class);
|
|
||||||
display: block; text-align: right;
|
|
||||||
font-size: smaller;
|
|
||||||
color: #CCC; background: white;
|
|
||||||
border-top: solid 1px;
|
|
||||||
padding-top: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre code {
|
|
||||||
display: block;
|
|
||||||
background: #F0F0F0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre code,
|
|
||||||
.ruby .subst {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.string,
|
|
||||||
.function .title,
|
|
||||||
.class .title,
|
|
||||||
.tag .attribute .value,
|
|
||||||
.css .rules .value,
|
|
||||||
.preprocessor,
|
|
||||||
.ruby .symbol,
|
|
||||||
.built_in,
|
|
||||||
.sql .aggregate,
|
|
||||||
.django .template_tag,
|
|
||||||
.django .variable,
|
|
||||||
.smalltalk .class {
|
|
||||||
color: #800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment,
|
|
||||||
.java .annotation,
|
|
||||||
.template_comment {
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.number,
|
|
||||||
.regexp,
|
|
||||||
.javascript .literal,
|
|
||||||
.smalltalk .symbol,
|
|
||||||
.smalltalk .char {
|
|
||||||
color: #080;
|
|
||||||
}
|
|
||||||
|
|
||||||
.javadoc,
|
|
||||||
.ruby .string,
|
|
||||||
.python .decorator,
|
|
||||||
.django .filter .argument,
|
|
||||||
.smalltalk .localvars,
|
|
||||||
.smalltalk .array,
|
|
||||||
.css .attr_selector,
|
|
||||||
.xml .pi {
|
|
||||||
color: #88F;
|
|
||||||
}
|
|
||||||
|
|
||||||
.keyword,
|
|
||||||
.css .id,
|
|
||||||
.phpdoc,
|
|
||||||
.function .title,
|
|
||||||
.class .title,
|
|
||||||
.vbscript .built_in,
|
|
||||||
.sql .aggregate,
|
|
||||||
.rsl .built_in,
|
|
||||||
.smalltalk .class,
|
|
||||||
.xml .tag .title {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
@@ -1,620 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<head>
|
|
||||||
<title>Highlight</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="sample.css">
|
|
||||||
|
|
||||||
<script type="text/javascript" src="highlight.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
initHighlightingOnLoad('1c', 'axapta', 'cpp', 'delphi', 'xml', 'html', 'css', 'django', 'java', 'javascript', 'perl', 'php', 'python', 'rib', 'rsl', 'ruby', 'smalltalk', 'sql', 'vbscript');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Some Python code:
|
|
||||||
|
|
||||||
<pre><code>@requires_authorization
|
|
||||||
def somefunc(param1, param2):
|
|
||||||
'''A docstring'''
|
|
||||||
if param1 > param2: # interesting
|
|
||||||
print 'Gre\'ater'
|
|
||||||
print ''
|
|
||||||
return param2 - param1 + 1
|
|
||||||
|
|
||||||
class SomeClass:<br> pass
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Short sample of Ruby:
|
|
||||||
|
|
||||||
<pre><code># Ruby support for highlight.js
|
|
||||||
|
|
||||||
class CategoriesController < ApplicationController
|
|
||||||
layout "core"
|
|
||||||
|
|
||||||
before_filter :login_required
|
|
||||||
before_filter :xhr_required, :only => [:create, :update]
|
|
||||||
before_filter :admin_privileges_required, :except => [:show]
|
|
||||||
|
|
||||||
=begin
|
|
||||||
This method creates a category. Very difficult to understand, huh?
|
|
||||||
=end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@category = Category.create(params[:category])
|
|
||||||
flash[:notice] = "Category #{@category + "..."} was successfully created"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>A bit of Perl:
|
|
||||||
|
|
||||||
<pre><code># loads object
|
|
||||||
sub load
|
|
||||||
{
|
|
||||||
my $c = shift;
|
|
||||||
my $id = shift;
|
|
||||||
|
|
||||||
my $flds = $c->db_load($id,@_) || do { Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef };
|
|
||||||
|
|
||||||
my $o = $c->_perl_new();
|
|
||||||
|
|
||||||
$id12 = $id;
|
|
||||||
$o->{'ID'} = $id12 + 123;
|
|
||||||
|
|
||||||
$o->{'PAPA'} = $flds->{'PAPA'};
|
|
||||||
#$o->{'SHCUT'} = $flds->{'SHCUT'};
|
|
||||||
|
|
||||||
my $p = $o->props;
|
|
||||||
|
|
||||||
#if($o->{'SHCUT'})
|
|
||||||
#{
|
|
||||||
# $flds = $o->db_load($o->{'SHCUT'},@_);
|
|
||||||
#}
|
|
||||||
|
|
||||||
my $vt;
|
|
||||||
for my $key (keys %$p)
|
|
||||||
{
|
|
||||||
if(${$vt.'::property'})
|
|
||||||
{
|
|
||||||
$o->{$key . '_real'} = $flds->{$key};
|
|
||||||
tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$o->{$key} = $flds->{$key};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$o->save if delete $o->{'_save_after_load'};
|
|
||||||
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>A chunk of PHP:
|
|
||||||
|
|
||||||
<pre><code>require_once 'Zend.php';
|
|
||||||
require_once 'Zend/Uri/Exception.php';
|
|
||||||
require_once 'Zend/Uri/Http.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Zend_Uri_Mailto
|
|
||||||
*/
|
|
||||||
require_once 'Zend/Uri/Mailto.php';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @category Zend
|
|
||||||
* @package Zend_Uri
|
|
||||||
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
|
|
||||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
||||||
*/
|
|
||||||
abstract class Zend_Uri
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scheme of this URI (http, ftp, etc.)
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $_scheme = "";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a string representation of this URI.
|
|
||||||
*
|
|
||||||
* @see getUri()
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function __toString()
|
|
||||||
{
|
|
||||||
return $this->getUri();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static public function check($uri)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$uri = self::factory($uri);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $uri->valid();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain
|
|
||||||
* only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
|
|
||||||
*
|
|
||||||
* @param string $uri
|
|
||||||
* @throws Zend_Uri_Exception
|
|
||||||
* @return Zend_Uri
|
|
||||||
*/
|
|
||||||
static public function factory($uri = 'http')
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Separate the scheme from the scheme-specific parts
|
|
||||||
* @link http://www.faqs.org/rfcs/rfc2396.html
|
|
||||||
*/
|
|
||||||
$uri = explode(':', $uri, 2);
|
|
||||||
$scheme = strtolower($uri[0]);
|
|
||||||
$schemeSpecify = isset($uri[1]) ? $uri[1] : '';
|
|
||||||
|
|
||||||
if (!strlen($scheme)) {
|
|
||||||
throw new Zend_Uri_Exception('An empty string was supplied for the scheme');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
|
|
||||||
if (!ctype_alnum($scheme)) {
|
|
||||||
throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>A custom XML document:
|
|
||||||
|
|
||||||
<pre><code><?xml version="1.0"?>
|
|
||||||
<response value="ok">
|
|
||||||
<text>Ok</text>
|
|
||||||
<comment/>
|
|
||||||
<description><![CDATA[
|
|
||||||
CDATA is <not> magical.
|
|
||||||
]]></description>
|
|
||||||
</response>
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Some HTML code:
|
|
||||||
|
|
||||||
<pre><code><head>
|
|
||||||
<title>Title</title>
|
|
||||||
<body>
|
|
||||||
<p class="something">Something</p>
|
|
||||||
<p class=something>Something</p>
|
|
||||||
<!-- comment -->
|
|
||||||
<p class>Something</p>
|
|
||||||
<p class="something" title="p">Something</p>
|
|
||||||
</body>
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>HTML with Django templates:
|
|
||||||
|
|
||||||
<pre><code>{% if articles|length %}
|
|
||||||
{% for article in articles %}
|
|
||||||
|
|
||||||
{# Striped table #}
|
|
||||||
<tr class="{% cycle odd,even %}">
|
|
||||||
<td>{{ article|default:"Hi... "|escape }}</td>
|
|
||||||
<td>{{ article.date|date:"d.m.Y" }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
Comments may be long and
|
|
||||||
multiline.
|
|
||||||
{% endcomment %}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Some CSS code:
|
|
||||||
|
|
||||||
<pre><code>body,
|
|
||||||
html {
|
|
||||||
font: Tahoma, Arial, san-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
#content {
|
|
||||||
width: 100%; /* комментарий */
|
|
||||||
height: 100%
|
|
||||||
}
|
|
||||||
|
|
||||||
p[lang=ru] {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
</pre></code>
|
|
||||||
|
|
||||||
<p>Javascript here too (right from the source, mind you):
|
|
||||||
|
|
||||||
<pre><code>function initHighlight(block) {
|
|
||||||
if (block.className.search(/\bno\-highlight\b/) != -1)
|
|
||||||
return false;
|
|
||||||
try {
|
|
||||||
blockText(block);
|
|
||||||
} catch (e) {
|
|
||||||
if (e == 'Complex markup')
|
|
||||||
return;
|
|
||||||
}//try
|
|
||||||
var classes = block.className.split(/\s+/);
|
|
||||||
for (var i = 0; i < classes.length; i++) {
|
|
||||||
if (LANGUAGES[classes[i]]) {
|
|
||||||
highlightLanguage(block, classes[i]);
|
|
||||||
return;
|
|
||||||
}//if
|
|
||||||
}//for
|
|
||||||
highlightAuto(block);
|
|
||||||
}//initHighlight</code></pre>
|
|
||||||
|
|
||||||
<p>VBScript
|
|
||||||
|
|
||||||
<pre><code>' creating configuration storage and initializing with default values
|
|
||||||
Set cfg = CreateObject("Scripting.Dictionary")
|
|
||||||
cfg.add "dest", ""
|
|
||||||
cfg.add "dest_gz", ""
|
|
||||||
cfg.add "gzip_exe", ""
|
|
||||||
cfg.add "perl_exe", ""
|
|
||||||
cfg.add "uncompressed_postfix", ""
|
|
||||||
|
|
||||||
' reading ini file
|
|
||||||
for i = 0 to ubound(ini_strings)
|
|
||||||
s = trim(ini_strings(i))
|
|
||||||
|
|
||||||
' skipping empty strings and comments
|
|
||||||
if mid(s, 1, 1) <> "#" and len(s) > 0 then
|
|
||||||
' obtaining key and value
|
|
||||||
parts = split(s, "=", -1, 1)
|
|
||||||
|
|
||||||
if ubound(parts)+1 = 2 then
|
|
||||||
parts(0) = trim(parts(0))
|
|
||||||
parts(1) = trim(parts(1))
|
|
||||||
|
|
||||||
' reading configuration and filenames
|
|
||||||
select case lcase(parts(0))
|
|
||||||
case "dest" cfg.item("dest") = parts(1)
|
|
||||||
case "dest_gz" cfg.item("dest_gz") = parts(1)
|
|
||||||
case "gzip_exe" cfg.item("gzip_exe") = parts(1)
|
|
||||||
case "perl_exe" cfg.item("perl_exe") = parts(1)
|
|
||||||
case "uncompressed_postfix" cfg.item("uncompressed_postfix") = parts(1)
|
|
||||||
case "f"
|
|
||||||
options = split(parts(1), "|", -1, 1)
|
|
||||||
if ubound(options)+1 = 2 then
|
|
||||||
' 0: filename, 1: options
|
|
||||||
ff.add trim(options(0)), trim(options(1))
|
|
||||||
end if
|
|
||||||
end select
|
|
||||||
end if
|
|
||||||
end if
|
|
||||||
next</code></pre>
|
|
||||||
|
|
||||||
<P>Delphi code
|
|
||||||
|
|
||||||
<pre><code>TList=Class(TObject)
|
|
||||||
Private
|
|
||||||
Some: String;
|
|
||||||
Public
|
|
||||||
Procedure Inside;
|
|
||||||
End;{TList}
|
|
||||||
|
|
||||||
Procedure CopyFile(InFileName,var OutFileName:String);
|
|
||||||
Const
|
|
||||||
BufSize=4096; (* Huh? *)
|
|
||||||
Var
|
|
||||||
InFile,OutFile:TStream;
|
|
||||||
Buffer:Array[1..BufSize] Of Byte;
|
|
||||||
ReadBufSize:Integer;
|
|
||||||
Begin
|
|
||||||
InFile:=Nil;
|
|
||||||
OutFile:=Nil;
|
|
||||||
Try
|
|
||||||
InFile:=TFileStream.Create(InFileName,fmOpenRead);
|
|
||||||
OutFile:=TFileStream.Create(OutFileName,fmCreate);
|
|
||||||
Repeat
|
|
||||||
ReadBufSize:=InFile.Read(Buffer,BufSize);
|
|
||||||
OutFile.Write(Buffer,ReadBufSize);
|
|
||||||
Until ReadBufSize<>BufSize;
|
|
||||||
Log('File '''+InFileName+''' copied'#13#10);
|
|
||||||
Finally
|
|
||||||
InFile.Free;
|
|
||||||
OutFile.Free;
|
|
||||||
End;{Try}
|
|
||||||
End;{CopyFile}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>From Java world:
|
|
||||||
|
|
||||||
<pre><code>package l2f.gameserver.model;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mother class of all character objects of the world (PC, NPC...)<BR><BR>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public abstract class L2Character extends L2Object
|
|
||||||
{
|
|
||||||
protected static final Logger _log = Logger.getLogger(L2Character.class.getName());
|
|
||||||
|
|
||||||
public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0001; // not sure
|
|
||||||
public static final Short ABNORMAL_EFFECT_POISON = 0x0002;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel the AI.<BR><BR>
|
|
||||||
*/
|
|
||||||
public void detachAI()
|
|
||||||
{
|
|
||||||
_ai = null;
|
|
||||||
//jbf = null;
|
|
||||||
if (1 > 5)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveTo(int x, int y, int z)
|
|
||||||
{
|
|
||||||
moveTo(x, y, z, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Task of AI notification */
|
|
||||||
@SuppressWarnings( { "nls", "unqualified-field-access", "boxing" })
|
|
||||||
public class NotifyAITask implements Runnable
|
|
||||||
{
|
|
||||||
private final CtrlEvent _evt;
|
|
||||||
|
|
||||||
public NotifyAITask(CtrlEvent evt)
|
|
||||||
{
|
|
||||||
this._evt = evt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getAI().notifyEvent(_evt, null, null);
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
_log.warning("Exception " + t);
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int HP_REGEN_FLAG = 1;
|
|
||||||
private static final int MP_REGEN_FLAG = 2;
|
|
||||||
private static final int CP_REGEN_FLAG = 4;
|
|
||||||
|
|
||||||
/** The table containing the List of all stacked effect in progress for each Stack group Identifier */
|
|
||||||
private ConcurrentHashMap<String, Short> _stackedEffects = null;
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>C++:
|
|
||||||
|
|
||||||
<pre><code>#include <iostream>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
|
|
||||||
/* An annoying "Hello World" example */
|
|
||||||
for (unsigned i = 0; i < 0xFFFF; i++)
|
|
||||||
cout << "Hello, World!" << endl;
|
|
||||||
|
|
||||||
char c = '\n'; // just a test
|
|
||||||
char *s = "\\\\"; // another test
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Bet you didn't expect to see a highlighted RenderMan (both RenderMan
|
|
||||||
Shading Language and RenderMan Interface Bytestream):</p>
|
|
||||||
|
|
||||||
<pre><code>#define TEST_DEFINE 3.14
|
|
||||||
/* plastic surface shader
|
|
||||||
*
|
|
||||||
* Pixie is:
|
|
||||||
* (c) Copyright 1999-2003 Okan Arikan. All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;
|
|
||||||
color specularcolor = 1;) {
|
|
||||||
normal Nf = faceforward (normalize(N),I);
|
|
||||||
Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks*specular(Nf,-normalize(I),roughness);
|
|
||||||
Oi = Os;
|
|
||||||
Ci *= Oi;
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<pre><code>FrameBegin 0
|
|
||||||
Display "Scene" "framebuffer" "rgb"
|
|
||||||
Option "searchpath" "shader" "+&:/home/kew"
|
|
||||||
Option "trace" "int maxdepth" [4]
|
|
||||||
Attribute "visibility" "trace" [1]
|
|
||||||
Attribute "irradiance" "maxerror" [0.1]
|
|
||||||
Attribute "visibility" "transmission" "opaque"
|
|
||||||
Format 640 480 1.0
|
|
||||||
ShadingRate 2
|
|
||||||
PixelFilter "catmull-rom" 1 1
|
|
||||||
PixelSamples 4 4
|
|
||||||
Projection "perspective" "fov" 49.5502811377
|
|
||||||
Scale 1 1 -1
|
|
||||||
ConcatTransform [-0.105581186712 -0.336664259434 0.935686826706 0.0
|
|
||||||
|
|
||||||
0.994097530842 -0.0121211335063 0.107810914516 0.0
|
|
||||||
|
|
||||||
-0.0249544940889 0.941546678543 0.335956931114 0.0
|
|
||||||
|
|
||||||
0.103667020798 -1.30126297474 -6.22769546509 1.0]
|
|
||||||
|
|
||||||
WorldBegin
|
|
||||||
|
|
||||||
ReadArchive "/home/qewerty/blends/my/instances/Lamp.002_Light/instance.rib"
|
|
||||||
Surface "plastic"
|
|
||||||
ReadArchive "/home/qewerty/blends/my/instances/Cube.004_Mesh/instance.rib"
|
|
||||||
# ReadArchive "/home/qewerty/blends/my/instances/Sphere.010_Mesh/instance.rib"
|
|
||||||
# ReadArchive "/home/qewerty/blends/my/instances/Sphere.009_Mesh/instance.rib"
|
|
||||||
ReadArchive "/home/qewerty/blends/my/instances/Sphere.006_Mesh/instance.rib"
|
|
||||||
|
|
||||||
WorldEnd
|
|
||||||
FrameEnd
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>SQL:
|
|
||||||
|
|
||||||
<pre><code>BEGIN;
|
|
||||||
CREATE TABLE "cicero_topic" (
|
|
||||||
"id" serial NOT NULL PRIMARY KEY,
|
|
||||||
"forum_id" integer NOT NULL,
|
|
||||||
"subject" varchar(255) NOT NULL,
|
|
||||||
"created" timestamp with time zone NOT NULL
|
|
||||||
);
|
|
||||||
ALTER TABLE "cicero_topic"
|
|
||||||
ADD CONSTRAINT forum_id_refs_id_4be56999
|
|
||||||
FOREIGN KEY ("forum_id")
|
|
||||||
REFERENCES "cicero_forum" ("id")
|
|
||||||
DEFERRABLE INITIALLY DEFERRED;
|
|
||||||
|
|
||||||
-- Initials
|
|
||||||
insert into "cicero_forum" ("slug", "name", "group", "ordering") values ('test', 'Тест''овый форум', 'Тест', 0);
|
|
||||||
|
|
||||||
-- Indices
|
|
||||||
CREATE INDEX "cicero_topic_forum_id" ON "cicero_topic" ("forum_id");
|
|
||||||
|
|
||||||
-- Test
|
|
||||||
select count(*) from cicero_forum;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Good old classic SmallTalk:
|
|
||||||
|
|
||||||
<pre><code>Object>>method: num
|
|
||||||
"comment 123"
|
|
||||||
| var1 var2 |
|
|
||||||
(1 to: num) do: [:i | |var| ^i].
|
|
||||||
Klass with: var1.
|
|
||||||
Klass new.
|
|
||||||
arr := #('123' 123.345 #hello Transcript var $@).
|
|
||||||
arr := #().
|
|
||||||
var2 = arr at: 3.
|
|
||||||
^ self abc
|
|
||||||
|
|
||||||
heapExample
|
|
||||||
"HeapTest new heapExample"
|
|
||||||
"Create a sorted collection of numbers, remove the elements
|
|
||||||
sequentially and add new objects randomly.
|
|
||||||
Note: This is the kind of benchmark a heap is designed for."
|
|
||||||
| n rnd array time sorted |
|
|
||||||
n := 5000.
|
|
||||||
"# of elements to sort"
|
|
||||||
rnd := Random new.
|
|
||||||
array := (1 to: n)
|
|
||||||
collect: [:i | rnd next].
|
|
||||||
"First, the heap version"
|
|
||||||
time := Time
|
|
||||||
millisecondsToRun: [sorted := Heap withAll: array.
|
|
||||||
1
|
|
||||||
to: n
|
|
||||||
do: [:i |
|
|
||||||
sorted removeFirst.
|
|
||||||
sorted add: rnd next]].
|
|
||||||
Transcript cr; show: 'Time for Heap: ' , time printString , ' msecs'.
|
|
||||||
"The quicksort version"
|
|
||||||
time := Time
|
|
||||||
millisecondsToRun: [sorted := SortedCollection withAll: array.
|
|
||||||
1
|
|
||||||
to: n
|
|
||||||
do: [:i |
|
|
||||||
sorted removeFirst.
|
|
||||||
sorted add: rnd next]].
|
|
||||||
Transcript cr; show: 'Time for SortedCollection: ' , time printString , ' msecs'
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Axapta:
|
|
||||||
|
|
||||||
<pre><code>class ExchRateLoadBatch extends RunBaseBatch
|
|
||||||
{
|
|
||||||
ExchRateLoad rbc;
|
|
||||||
container currencies;
|
|
||||||
boolean actual;
|
|
||||||
boolean overwrite;
|
|
||||||
date beg;
|
|
||||||
date end;
|
|
||||||
|
|
||||||
#define.CurrentVersion(5)
|
|
||||||
|
|
||||||
#localmacro.CurrentList
|
|
||||||
currencies,
|
|
||||||
actual,
|
|
||||||
beg,
|
|
||||||
end
|
|
||||||
#endmacro
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean unpack(container packedClass)
|
|
||||||
{
|
|
||||||
container base;
|
|
||||||
boolean ret;
|
|
||||||
Integer version = runbase::getVersion(packedClass);
|
|
||||||
|
|
||||||
switch (version)
|
|
||||||
{
|
|
||||||
case #CurrentVersion:
|
|
||||||
[version, #CurrentList] = packedClass;
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>And this is a russian enterpise system "1С":
|
|
||||||
|
|
||||||
<pre><code class="1c">
|
|
||||||
#Если Клиент Тогда
|
|
||||||
Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий
|
|
||||||
Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции
|
|
||||||
x=ТекстСообщения+ТекстСообщения2+"
|
|
||||||
|строка1
|
|
||||||
|строка2
|
|
||||||
|строка3";
|
|
||||||
КонецФункции
|
|
||||||
#КонецЕсли
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ОБРАБОТЧИКИ СОБЫТИЙ
|
|
||||||
//
|
|
||||||
|
|
||||||
// Процедура ПриНачалеРаботыСистемы
|
|
||||||
//
|
|
||||||
Процедура ПриНачалеРаботыСистемы()
|
|
||||||
|
|
||||||
Обработки.Помощник.ПолучитьФорму("Форма").Открыть();
|
|
||||||
|
|
||||||
КонецПроцедуры
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<p>Explicit Python highlight:
|
|
||||||
|
|
||||||
<pre><code class="python">for x in [1, 2, 3]:
|
|
||||||
count(x)
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Disabled highlighting:
|
|
||||||
|
|
||||||
<pre><code class="no-highlight"><div id="contents">
|
|
||||||
<p>Hello, World!
|
|
||||||
</div>
|
|
||||||
</code></pre>
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
Plugin Name: highlight.js
|
|
||||||
Plugin URI: http://softwaremaniacs.org/soft/highlight/
|
|
||||||
Description: Syntax highlighting with language autodetection
|
|
||||||
Version: 3.5
|
|
||||||
Author: Ivan Sagalaev
|
|
||||||
Author URI: http://softwaremaniacs.org/about/
|
|
||||||
*/
|
|
||||||
|
|
||||||
add_option('hljs_languages', '');
|
|
||||||
if (!get_option('hljs_script_path')) {
|
|
||||||
$components = explode('/', dirname(__FILE__));
|
|
||||||
$l = sizeof($components);
|
|
||||||
$script_path = get_settings('home') . '/' . $components[$l - 3] . '/' . $components[$l - 2] . '/' . $components[$l - 1];
|
|
||||||
add_option('hljs_script_path', $script_path . '/highlight.js');
|
|
||||||
}
|
|
||||||
add_option('hljs_css', '');
|
|
||||||
|
|
||||||
function init_highlighting_on_load() {
|
|
||||||
$languages_str = get_option('hljs_languages');
|
|
||||||
if ($languages_str) {
|
|
||||||
$languages = explode(',', $languages_str);
|
|
||||||
foreach ($languages as $i => $language) {
|
|
||||||
$languages[$i] = '\'' . trim($language) . '\'';
|
|
||||||
}
|
|
||||||
$languages_str = implode(', ', $languages);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<script type="text/javascript" src="<?php echo get_option('hljs_script_path');?>"></script>
|
|
||||||
<script type="text/javascript">initHighlightingOnLoad(<?php echo $languages_str; ?>);</script>
|
|
||||||
<?php
|
|
||||||
$css = get_option('hljs_css');
|
|
||||||
if ($css) {?>
|
|
||||||
<style type="text/css">
|
|
||||||
<?php echo $css ?>
|
|
||||||
</style>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action('wp_head', 'init_highlighting_on_load');
|
|
||||||
|
|
||||||
function add_hljs_subpanel() {
|
|
||||||
if (function_exists('add_options_page')) {
|
|
||||||
add_options_page('highlight.js options', 'highlight.js', 0, __FILE__, 'hljs_subpanel');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action('admin_menu', 'add_hljs_subpanel');
|
|
||||||
|
|
||||||
function hljs_subpanel() {
|
|
||||||
if (isset($_POST['hljs_script_path'])) {
|
|
||||||
update_option('hljs_languages', $_POST['hljs_languages']);
|
|
||||||
update_option('hljs_script_path', $_POST['hljs_script_path']);
|
|
||||||
update_option('hljs_css', $_POST['hljs_css']);
|
|
||||||
?><div class="updated"><p><strong>Options updated.</strong></p></div><?php
|
|
||||||
} ?>
|
|
||||||
<div class="wrap">
|
|
||||||
<form method="post">
|
|
||||||
<h2>highlight.js options</h2>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<p><label for="id_hljs_languages">Highlight Languages:</label> <input type="text" name="hljs_languages" id="id_hljs_languages" value="<?php echo get_option('hljs_languages'); ?>" /></p>
|
|
||||||
<p><small>List here languages that you want to highlight on your blog like this: php, html, css. Empty string means "all known languages". For the list
|
|
||||||
of supported languages refer to <a href="http://softwaremaniacs.org/soft/highlight/">highlight.js homepage</a>.</small></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<p><label for="id_hljs_script_path">Path to highlight.js:</label> <input type="text" name="hljs_script_path" id="id_hljs_script_path" value="<?php echo get_option('hljs_script_path'); ?>" /></p>
|
|
||||||
<p><small>Let's you place the script in a convenient place</small></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<p><label for="id_hljs_css">Custom CSS:</label></p>
|
|
||||||
<p><textarea name="hljs_css" id="id_hljs_css" rows="20" cols="70"><?php echo get_option('hljs_css'); ?></textarea></p>
|
|
||||||
<p><small>Normally styling of code snippets goes into site's main CSS files. But you can
|
|
||||||
write it here if you can't access site's CSS or just like it this way.</small></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="submit">
|
|
||||||
<input type="submit" name="info_update" value="Update options »" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div><?php
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
/* PACKAGE : json.js 2007-03-21
|
|
||||||
*/
|
|
||||||
if (!Object.prototype.toJSONString) {
|
|
||||||
Array.prototype.toJSONString = function () {
|
|
||||||
var a = ['['],
|
|
||||||
b,
|
|
||||||
i,
|
|
||||||
l = this.length,
|
|
||||||
v;
|
|
||||||
function p(s) {
|
|
||||||
if (b) {
|
|
||||||
a.push(',');
|
|
||||||
}
|
|
||||||
a.push(s);
|
|
||||||
b = true;
|
|
||||||
}
|
|
||||||
for (i = 0; i < l; i += 1) {
|
|
||||||
v = this[i];
|
|
||||||
switch (typeof v) {
|
|
||||||
case 'undefined':
|
|
||||||
case 'function':
|
|
||||||
case 'unknown':
|
|
||||||
break;
|
|
||||||
case 'object':
|
|
||||||
if (v) {
|
|
||||||
if (typeof v.toJSONString === 'function') {
|
|
||||||
p(v.toJSONString());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p("null");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
p(v.toJSONString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
a.push(']');
|
|
||||||
return a.join('');
|
|
||||||
};
|
|
||||||
Boolean.prototype.toJSONString = function () {
|
|
||||||
return String(this);
|
|
||||||
};
|
|
||||||
Date.prototype.toJSONString = function () {
|
|
||||||
function f(n) {
|
|
||||||
return n < 10 ? '0' + n : n;
|
|
||||||
}
|
|
||||||
return '"' + this.getFullYear() + '-' +
|
|
||||||
f(this.getMonth() + 1) + '-' +
|
|
||||||
f(this.getDate()) + 'T' +
|
|
||||||
f(this.getHours()) + ':' +
|
|
||||||
f(this.getMinutes()) + ':' +
|
|
||||||
f(this.getSeconds()) + '"';
|
|
||||||
};
|
|
||||||
Number.prototype.toJSONString = function () {
|
|
||||||
return isFinite(this) ? String(this) : "null";
|
|
||||||
};
|
|
||||||
Object.prototype.toJSONString = function () {
|
|
||||||
var a = ['{'],
|
|
||||||
b,
|
|
||||||
k,
|
|
||||||
v;
|
|
||||||
function p(s) {
|
|
||||||
if (b) {
|
|
||||||
a.push(',');
|
|
||||||
}
|
|
||||||
a.push(k.toJSONString(), ':', s);
|
|
||||||
b = true;
|
|
||||||
}
|
|
||||||
for (k in this) {
|
|
||||||
if (this.hasOwnProperty(k)) {
|
|
||||||
v = this[k];
|
|
||||||
switch (typeof v) {
|
|
||||||
case 'undefined':
|
|
||||||
case 'function':
|
|
||||||
case 'unknown':
|
|
||||||
break;
|
|
||||||
case 'object':
|
|
||||||
if (v) {
|
|
||||||
if (typeof v.toJSONString === 'function') {
|
|
||||||
p(v.toJSONString());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p("null");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
p(v.toJSONString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
a.push('}');
|
|
||||||
return a.join('');
|
|
||||||
};
|
|
||||||
|
|
||||||
(function (s) {
|
|
||||||
var m = {
|
|
||||||
'\b': '\\b',
|
|
||||||
'\t': '\\t',
|
|
||||||
'\n': '\\n',
|
|
||||||
'\f': '\\f',
|
|
||||||
'\r': '\\r',
|
|
||||||
'"' : '\\"',
|
|
||||||
'\\': '\\\\'
|
|
||||||
};
|
|
||||||
s.parseJSON = function (filter) {
|
|
||||||
try {
|
|
||||||
if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.
|
|
||||||
test(this)) {
|
|
||||||
var j = eval('(' + this + ')');
|
|
||||||
if (typeof filter === 'function') {
|
|
||||||
|
|
||||||
function walk(k, v) {
|
|
||||||
if (v && typeof v === 'object') {
|
|
||||||
for (var i in v) {
|
|
||||||
if (v.hasOwnProperty(i)) {
|
|
||||||
v[i] = walk(i, v[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filter(k, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
j = walk('', j);
|
|
||||||
}
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
throw new SyntaxError("parseJSON");
|
|
||||||
};
|
|
||||||
|
|
||||||
s.toJSONString = function () {
|
|
||||||
if (/["\\\x00-\x1f]/.test(this)) {
|
|
||||||
return '"' + this.replace(/([\x00-\x1f\\"])/g, function(a, b) {
|
|
||||||
var c = m[b];
|
|
||||||
if (c) {
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
c = b.charCodeAt();
|
|
||||||
return '\\u00' +
|
|
||||||
Math.floor(c / 16).toString(16) +
|
|
||||||
(c % 16).toString(16);
|
|
||||||
}) + '"';
|
|
||||||
}
|
|
||||||
return '"' + this + '"';
|
|
||||||
};
|
|
||||||
})(String.prototype);
|
|
||||||
}
|
|
||||||
@@ -1,248 +0,0 @@
|
|||||||
/*
|
|
||||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
|
||||||
* Digest Algorithm, as defined in RFC 1321.
|
|
||||||
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
|
|
||||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
|
||||||
* Distributed under the BSD License
|
|
||||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Configurable variables. You may need to tweak these to be compatible with
|
|
||||||
* the server-side, but the defaults work in most cases.
|
|
||||||
*/
|
|
||||||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
|
|
||||||
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
|
|
||||||
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are the functions you'll usually want to call
|
|
||||||
* They take string arguments and return either hex or base-64 encoded strings
|
|
||||||
*/
|
|
||||||
var hex_md5 = md5 = function(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
|
|
||||||
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
|
|
||||||
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
|
|
||||||
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
|
|
||||||
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
|
|
||||||
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Calculate the MD5 of an array of little-endian words, and a bit length
|
|
||||||
*/
|
|
||||||
function core_md5(x, len)
|
|
||||||
{
|
|
||||||
/* append padding */
|
|
||||||
x[len >> 5] |= 0x80 << ((len) % 32);
|
|
||||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
|
||||||
|
|
||||||
var a = 1732584193;
|
|
||||||
var b = -271733879;
|
|
||||||
var c = -1732584194;
|
|
||||||
var d = 271733878;
|
|
||||||
|
|
||||||
for(var i = 0; i < x.length; i += 16)
|
|
||||||
{
|
|
||||||
var olda = a;
|
|
||||||
var oldb = b;
|
|
||||||
var oldc = c;
|
|
||||||
var oldd = d;
|
|
||||||
|
|
||||||
a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
|
|
||||||
d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
|
|
||||||
c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
|
|
||||||
b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
|
|
||||||
a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
|
|
||||||
d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
|
|
||||||
c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
|
|
||||||
b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
|
|
||||||
a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
|
|
||||||
d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
|
|
||||||
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
|
|
||||||
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
|
|
||||||
a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
|
|
||||||
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
|
|
||||||
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
|
|
||||||
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
|
|
||||||
|
|
||||||
a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
|
|
||||||
d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
|
|
||||||
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
|
|
||||||
b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
|
|
||||||
a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
|
|
||||||
d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
|
|
||||||
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
|
|
||||||
b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
|
|
||||||
a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
|
|
||||||
d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
|
|
||||||
c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
|
|
||||||
b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
|
|
||||||
a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
|
|
||||||
d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
|
|
||||||
c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
|
|
||||||
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
|
|
||||||
|
|
||||||
a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
|
|
||||||
d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
|
|
||||||
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
|
|
||||||
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
|
|
||||||
a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
|
|
||||||
d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
|
|
||||||
c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
|
|
||||||
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
|
|
||||||
a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
|
|
||||||
d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
|
|
||||||
c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
|
|
||||||
b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
|
|
||||||
a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
|
|
||||||
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
|
|
||||||
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
|
|
||||||
b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
|
|
||||||
|
|
||||||
a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
|
|
||||||
d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
|
|
||||||
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
|
|
||||||
b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
|
|
||||||
a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
|
|
||||||
d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
|
|
||||||
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
|
|
||||||
b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
|
|
||||||
a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
|
|
||||||
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
|
|
||||||
c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
|
|
||||||
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
|
|
||||||
a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
|
|
||||||
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
|
|
||||||
c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
|
|
||||||
b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
|
|
||||||
|
|
||||||
a = safe_add(a, olda);
|
|
||||||
b = safe_add(b, oldb);
|
|
||||||
c = safe_add(c, oldc);
|
|
||||||
d = safe_add(d, oldd);
|
|
||||||
}
|
|
||||||
return Array(a, b, c, d);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These functions implement the four basic operations the algorithm uses.
|
|
||||||
*/
|
|
||||||
function md5_cmn(q, a, b, x, s, t)
|
|
||||||
{
|
|
||||||
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
|
|
||||||
}
|
|
||||||
function md5_ff(a, b, c, d, x, s, t)
|
|
||||||
{
|
|
||||||
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
|
||||||
}
|
|
||||||
function md5_gg(a, b, c, d, x, s, t)
|
|
||||||
{
|
|
||||||
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
|
||||||
}
|
|
||||||
function md5_hh(a, b, c, d, x, s, t)
|
|
||||||
{
|
|
||||||
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
|
||||||
}
|
|
||||||
function md5_ii(a, b, c, d, x, s, t)
|
|
||||||
{
|
|
||||||
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Calculate the HMAC-MD5, of a key and some data
|
|
||||||
*/
|
|
||||||
function core_hmac_md5(key, data)
|
|
||||||
{
|
|
||||||
var bkey = str2binl(key);
|
|
||||||
if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
|
|
||||||
|
|
||||||
var ipad = Array(16), opad = Array(16);
|
|
||||||
for(var i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
ipad[i] = bkey[i] ^ 0x36363636;
|
|
||||||
opad[i] = bkey[i] ^ 0x5C5C5C5C;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
|
|
||||||
return core_md5(opad.concat(hash), 512 + 128);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
||||||
* to work around bugs in some JS interpreters.
|
|
||||||
*/
|
|
||||||
function safe_add(x, y)
|
|
||||||
{
|
|
||||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
|
||||||
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
||||||
return (msw << 16) | (lsw & 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bitwise rotate a 32-bit number to the left.
|
|
||||||
*/
|
|
||||||
function bit_rol(num, cnt)
|
|
||||||
{
|
|
||||||
return (num << cnt) | (num >>> (32 - cnt));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert a string to an array of little-endian words
|
|
||||||
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
|
|
||||||
*/
|
|
||||||
function str2binl(str)
|
|
||||||
{
|
|
||||||
var bin = new Array();
|
|
||||||
var mask = (1 << chrsz) - 1;
|
|
||||||
for(var i = 0; i < str.length * chrsz; i += chrsz)
|
|
||||||
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
|
|
||||||
return bin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert an array of little-endian words to a string
|
|
||||||
*/
|
|
||||||
function binl2str(bin)
|
|
||||||
{
|
|
||||||
var str = "";
|
|
||||||
var mask = (1 << chrsz) - 1;
|
|
||||||
for(var i = 0; i < bin.length * 32; i += chrsz)
|
|
||||||
str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert an array of little-endian words to a hex string.
|
|
||||||
*/
|
|
||||||
function binl2hex(binarray)
|
|
||||||
{
|
|
||||||
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
|
|
||||||
var str = "";
|
|
||||||
for(var i = 0; i < binarray.length * 4; i++)
|
|
||||||
{
|
|
||||||
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
|
|
||||||
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert an array of little-endian words to a base-64 string
|
|
||||||
*/
|
|
||||||
function binl2b64(binarray)
|
|
||||||
{
|
|
||||||
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
||||||
var str = "";
|
|
||||||
for(var i = 0; i < binarray.length * 4; i += 3)
|
|
||||||
{
|
|
||||||
var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
|
|
||||||
| (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
|
|
||||||
| ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
|
|
||||||
for(var j = 0; j < 4; j++)
|
|
||||||
{
|
|
||||||
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
|
|
||||||
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
@@ -77,7 +77,6 @@ class Bootstrap
|
|||||||
self::registerClass("DBRecordSet", PATH_GULLIVER . "class.dbrecordset.php");
|
self::registerClass("DBRecordSet", PATH_GULLIVER . "class.dbrecordset.php");
|
||||||
self::registerClass("DBSession", PATH_GULLIVER . "class.dbsession.php");
|
self::registerClass("DBSession", PATH_GULLIVER . "class.dbsession.php");
|
||||||
self::registerClass("DBTable", PATH_GULLIVER . "class.dbtable.php");
|
self::registerClass("DBTable", PATH_GULLIVER . "class.dbtable.php");
|
||||||
self::registerClass("XmlForm_Field_HTML", PATH_GULLIVER . "class.dvEditor.php");
|
|
||||||
self::registerClass("dynaFormHandler", PATH_GULLIVER . "class.dynaformhandler.php");
|
self::registerClass("dynaFormHandler", PATH_GULLIVER . "class.dynaformhandler.php");
|
||||||
self::registerClass("G_Error", PATH_GULLIVER . "class.error.php");
|
self::registerClass("G_Error", PATH_GULLIVER . "class.error.php");
|
||||||
self::registerClass("filterForm", PATH_GULLIVER . "class.filterForm.php");
|
self::registerClass("filterForm", PATH_GULLIVER . "class.filterForm.php");
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* class.dvEditor.php
|
|
||||||
*
|
|
||||||
* @package gulliver.system
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//XmlForm_Field_DVEditor
|
|
||||||
/**
|
|
||||||
* XmlForm_Field_HTML class definition
|
|
||||||
* It is useful to see dynaforms how are built
|
|
||||||
*
|
|
||||||
* @package gulliver.system
|
|
||||||
* @author
|
|
||||||
*
|
|
||||||
* @copyright (C) 2002 by Colosa Development Team.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class XmlForm_Field_HTML extends XmlForm_Field
|
|
||||||
{
|
|
||||||
public $toolbarSet = 'smallToolBar';
|
|
||||||
public $width = '100%';
|
|
||||||
public $height = '200';
|
|
||||||
public $defaultValue = '<br/>';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* render function is drawing the dynaform
|
|
||||||
*
|
|
||||||
* @author
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param string $value
|
|
||||||
* @param string $owner
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function render($value = null, $owner = null)
|
|
||||||
{
|
|
||||||
$value = ($value == '') ? '<br/>' : $value;
|
|
||||||
$html = "<div style='width:" . $this->width . ";'>";
|
|
||||||
$html .= "<input id='form[" . $this->name . "]' name='form[" . $this->name . "]' type='hidden' value=' " . htmlentities( $value, ENT_QUOTES, 'UTF-8' ) . "' />";
|
|
||||||
$html .= "</div>";
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* attachEvents function is putting its events
|
|
||||||
*
|
|
||||||
* @author
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param string $element
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function attachEvents ($element)
|
|
||||||
{
|
|
||||||
$html = 'window._editor' . $this->name . '=new DVEditor(getField("' . $this->name . '").parentNode,getField("' . $this->name . '").value,element,"' . $this->height . '","' . $this->mode . '");';
|
|
||||||
if ($this->mode == "edit") {
|
|
||||||
$html .= 'window._editor' . $this->name . '.loadToolBar("/js/dveditor/core/toolbars/' . $this->toolbarSet . '.html");';
|
|
||||||
}
|
|
||||||
$html .= 'window._editor' . $this->name . '.syncHidden("window._editor' . $this->name . '");';
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
|
|
||||||
require_once PATH_TRUNK . 'gulliver/system/class.dvEditor.php';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:22.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class classXmlForm_Field_HTMLTest extends PHPUnit_Framework_TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var XmlForm_Field_HTML
|
|
||||||
*/
|
|
||||||
protected $object;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the fixture, for example, opens a network connection.
|
|
||||||
* This method is called before a test is executed.
|
|
||||||
*/
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
$attributes = array('type'=>'input');
|
|
||||||
$fieldNode = new Xml_Node('testField', 'type', 'value', $attributes);
|
|
||||||
$this->object = new XmlForm_Field_HTML($fieldNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the default method to test, if the class still having
|
|
||||||
* the same number of methods.
|
|
||||||
*/
|
|
||||||
public function testNumberOfMethodsInThisClass()
|
|
||||||
{
|
|
||||||
$methods = get_class_methods('XmlForm_Field_HTML'); $this->assertTrue( count($methods) == 25);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers XmlForm_Field_HTML::render
|
|
||||||
* @todo Implement testrender().
|
|
||||||
*/
|
|
||||||
public function testrender()
|
|
||||||
{
|
|
||||||
$methods = get_class_methods($this->object);
|
|
||||||
$this->assertTrue( in_array('render', $methods ), 'exists method render' );
|
|
||||||
$r = new ReflectionMethod('XmlForm_Field_HTML', 'render');
|
|
||||||
$params = $r->getParameters();
|
|
||||||
$this->assertTrue( $params[0]->getName() == 'value');
|
|
||||||
$this->assertTrue( $params[0]->isArray() == false);
|
|
||||||
$this->assertTrue( $params[0]->isOptional () == false);
|
|
||||||
$this->assertTrue( $params[1]->getName() == 'owner');
|
|
||||||
$this->assertTrue( $params[1]->isArray() == false);
|
|
||||||
$this->assertTrue( $params[1]->isOptional () == true);
|
|
||||||
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @covers XmlForm_Field_HTML::attachEvents
|
|
||||||
* @todo Implement testattachEvents().
|
|
||||||
*/
|
|
||||||
public function testattachEvents()
|
|
||||||
{
|
|
||||||
$methods = get_class_methods($this->object);
|
|
||||||
$this->assertTrue( in_array('attachEvents', $methods ), 'exists method attachEvents' );
|
|
||||||
$r = new ReflectionMethod('XmlForm_Field_HTML', 'attachEvents');
|
|
||||||
$params = $r->getParameters();
|
|
||||||
$this->assertTrue( $params[0]->getName() == 'element');
|
|
||||||
$this->assertTrue( $params[0]->isArray() == false);
|
|
||||||
$this->assertTrue( $params[0]->isOptional () == false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -113,7 +113,6 @@ Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
|
|||||||
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
|
|
||||||
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
||||||
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
||||||
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ class PmBootstrap extends Bootstrap
|
|||||||
$this->autoloader->registerClass('form', PATH_GULLIVER . 'class.form');
|
$this->autoloader->registerClass('form', PATH_GULLIVER . 'class.form');
|
||||||
$this->autoloader->registerClass('menu', PATH_GULLIVER . 'class.menu');
|
$this->autoloader->registerClass('menu', PATH_GULLIVER . 'class.menu');
|
||||||
$this->autoloader->registerClass('xmlMenu', PATH_GULLIVER . 'class.xmlMenu');
|
$this->autoloader->registerClass('xmlMenu', PATH_GULLIVER . 'class.xmlMenu');
|
||||||
$this->autoloader->registerClass('dvEditor', PATH_GULLIVER . 'class.dvEditor');
|
|
||||||
$this->autoloader->registerClass('wysiwygEditor', PATH_GULLIVER . 'class.wysiwygEditor');
|
$this->autoloader->registerClass('wysiwygEditor', PATH_GULLIVER . 'class.wysiwygEditor');
|
||||||
$this->autoloader->registerClass('Controller', PATH_GULLIVER . 'class.controller');
|
$this->autoloader->registerClass('Controller', PATH_GULLIVER . 'class.controller');
|
||||||
$this->autoloader->registerClass('HttpProxyController', PATH_GULLIVER . 'class.httpProxyController');
|
$this->autoloader->registerClass('HttpProxyController', PATH_GULLIVER . 'class.httpProxyController');
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ try {
|
|||||||
G::LoadSystem('form');
|
G::LoadSystem('form');
|
||||||
G::LoadSystem('menu');
|
G::LoadSystem('menu');
|
||||||
G::LoadSystem('xmlMenu');
|
G::LoadSystem('xmlMenu');
|
||||||
G::LoadSystem('dvEditor');
|
|
||||||
G::LoadSystem('table');
|
G::LoadSystem('table');
|
||||||
G::LoadSystem('pagedTable');
|
G::LoadSystem('pagedTable');
|
||||||
G::LoadSystem('httpProxyController');
|
G::LoadSystem('httpProxyController');
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ if (! defined ('PATH_HOME')) {
|
|||||||
G::LoadSystem ('form');
|
G::LoadSystem ('form');
|
||||||
G::LoadSystem ('menu');
|
G::LoadSystem ('menu');
|
||||||
G::LoadSystem ("xmlMenu");
|
G::LoadSystem ("xmlMenu");
|
||||||
G::LoadSystem ('dvEditor');
|
|
||||||
G::LoadSystem ('table');
|
G::LoadSystem ('table');
|
||||||
G::LoadSystem ('pagedTable');
|
G::LoadSystem ('pagedTable');
|
||||||
G::LoadClass ('system');
|
G::LoadClass ('system');
|
||||||
|
|||||||
@@ -26,24 +26,12 @@
|
|||||||
"mini": "gulliver/js/common/core/webResource.js",
|
"mini": "gulliver/js/common/core/webResource.js",
|
||||||
"minify": true
|
"minify": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "dveditor",
|
|
||||||
"full": "gulliver/js/dveditor/core/dveditor.js",
|
|
||||||
"mini": "gulliver/js/dveditor/core/dveditor.js",
|
|
||||||
"minify": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "tree",
|
"name": "tree",
|
||||||
"full": "gulliver/js/common/tree/tree.js",
|
"full": "gulliver/js/common/tree/tree.js",
|
||||||
"mini": "gulliver/js/common/tree/tree.js",
|
"mini": "gulliver/js/common/tree/tree.js",
|
||||||
"minify": true
|
"minify": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "json",
|
|
||||||
"full": "gulliver/js/json/core/json.js",
|
|
||||||
"mini": "gulliver/js/json/core/json.js",
|
|
||||||
"minify": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "form",
|
"name": "form",
|
||||||
"full": "gulliver/js/form/core/form.js",
|
"full": "gulliver/js/form/core/form.js",
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ if (! defined ('PATH_HOME')) {
|
|||||||
G::LoadSystem ('form');
|
G::LoadSystem ('form');
|
||||||
G::LoadSystem ('menu');
|
G::LoadSystem ('menu');
|
||||||
G::LoadSystem ("xmlMenu");
|
G::LoadSystem ("xmlMenu");
|
||||||
G::LoadSystem ('dvEditor');
|
|
||||||
G::LoadSystem ('table');
|
G::LoadSystem ('table');
|
||||||
G::LoadSystem ('pagedTable');
|
G::LoadSystem ('pagedTable');
|
||||||
G::LoadClass ('system');
|
G::LoadClass ('system');
|
||||||
|
|||||||
@@ -228,8 +228,6 @@ class dynaformEditor extends WebResource
|
|||||||
$G_PUBLISH->AddContent('panel-close');
|
$G_PUBLISH->AddContent('panel-close');
|
||||||
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2);
|
$oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js",2);
|
||||||
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
|
$oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
|
||||||
//$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js');
|
|
||||||
//$oHeadPublisher->addScriptFile('/codepress/codepress.js',1);
|
|
||||||
|
|
||||||
$oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1);
|
$oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js',1);
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,6 @@
|
|||||||
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
|
|
||||||
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
|
||||||
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
||||||
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
||||||
@@ -98,7 +97,7 @@
|
|||||||
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
|
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
|
||||||
|
|
||||||
Bootstrap::registerSystemClasses();
|
Bootstrap::registerSystemClasses();
|
||||||
|
|
||||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeFunction.php');
|
||||||
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
require_once( PATH_THIRDPARTY . 'pake' . PATH_SEP . 'pakeGetopt.class.php');
|
||||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* classDvEditorTest.php
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
|
||||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
|
||||||
}
|
|
||||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
|
||||||
|
|
||||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
|
||||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
|
||||||
G::LoadSystem ( 'xmlform');
|
|
||||||
G::LoadSystem ( 'xmlDocument');
|
|
||||||
G::LoadSystem ( 'form');
|
|
||||||
G::LoadSystem ( 'dvEditor');
|
|
||||||
|
|
||||||
$t = new lime_test( 3, new lime_output_color());
|
|
||||||
$obj = "XmlForm_Field_HTML";
|
|
||||||
$method = array ( );
|
|
||||||
$testItems = 0;
|
|
||||||
$class_methods = get_class_methods('XmlForm_Field_HTML');
|
|
||||||
foreach ($class_methods as $method_name) {
|
|
||||||
$methods[ $testItems ] = $method_name;
|
|
||||||
$testItems++;
|
|
||||||
}
|
|
||||||
$t->diag('class XmlForm_Field_HTML' );
|
|
||||||
$t->is( $testItems , 18, "class XmlForm_Field_HTML " . $testItems . " methods." );
|
|
||||||
$t->is( $obj , 'XmlForm_Field_HTML', 'class XmlForm_Field_HTML created');
|
|
||||||
$t->todo( 'review all pendings in this class');
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* classHtmlAreaTest.php
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( !defined ('PATH_THIRDPARTY') ) {
|
|
||||||
require_once( $_SERVER['PWD']. '/test/bootstrap/unit.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once( PATH_THIRDPARTY . 'lime/lime.php');
|
|
||||||
define ( 'G_ENVIRONMENT', G_TEST_ENV);
|
|
||||||
require_once( PATH_CORE . 'config' . PATH_SEP . 'environments.php');
|
|
||||||
|
|
||||||
global $G_ENVIRONMENTS;
|
|
||||||
if ( isset ( $G_ENVIRONMENTS ) ) {
|
|
||||||
$dbfile = $G_ENVIRONMENTS[ G_TEST_ENV ][ 'dbfile'];
|
|
||||||
if ( !file_exists ( $dbfile ) ) {
|
|
||||||
printf("%s \n", pakeColor::colorize( "dbfile $dbfile doesn't exist for environment " . G_ENVIRONMENT , 'ERROR'));
|
|
||||||
exit (200);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
include ( $dbfile );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
exit (201);
|
|
||||||
G::LoadThirdParty('pear/json','class.json');
|
|
||||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
|
||||||
G::LoadSystem ( 'xmlform');
|
|
||||||
G::LoadSystem ( 'xmlDocument');
|
|
||||||
G::LoadSystem ( 'xmlDocument');
|
|
||||||
G::LoadSystem ( 'form');
|
|
||||||
G::LoadSystem ( 'htmlArea');
|
|
||||||
$method = array ( );
|
|
||||||
$method = get_class_methods('XmlForm_Field_HTML');
|
|
||||||
$t = new lime_test( 3, new lime_output_color());
|
|
||||||
$t->diag('class XmlForm_Field_HTML' );
|
|
||||||
$t->is( count($method) , 18, "class XmlForm_Field_HTML " . count($method) . " methods." );
|
|
||||||
$t->todo( 'seems this class is unused. Fatal error: Call to a member function findNode()');
|
|
||||||
$t->todo( 'is this class an useful class, or we can delete it ???');
|
|
||||||
|
|
||||||
@@ -263,7 +263,6 @@
|
|||||||
G::LoadSystem('form');
|
G::LoadSystem('form');
|
||||||
G::LoadSystem('menu');
|
G::LoadSystem('menu');
|
||||||
G::LoadSystem("xmlMenu");
|
G::LoadSystem("xmlMenu");
|
||||||
G::LoadSystem('dvEditor');
|
|
||||||
G::LoadSystem('wysiwygEditor');
|
G::LoadSystem('wysiwygEditor');
|
||||||
G::LoadSystem('controller');
|
G::LoadSystem('controller');
|
||||||
G::LoadSystem('httpProxyController');
|
G::LoadSystem('httpProxyController');
|
||||||
|
|||||||
Reference in New Issue
Block a user