first commit

This commit is contained in:
/usr/bin/nano
2017-04-15 01:34:36 +03:00
commit c715e2a604
5325 changed files with 329700 additions and 0 deletions

View File

@@ -0,0 +1,371 @@
CKEDITOR.dialog.add( 'syntaxhighlightDialog', function( editor ) {
var getDefaultOptions=function() {
var options=new Object();
var validLangs=['applescript','actionscript3','as3','bash','shell','sh','coldfusion','cf','cpp','c','c#','c-sharp','csharp','css','delphi','pascal','pas','diff','patch','erl','erlang','groovy','haxe','hx','java','jfx','javafx','js','jscript','javascript','perl','Perl','pl','php','text','plain','powershell','ps','posh','py','python','ruby','rails','ror','rb','sass','scss','scala','sql','ts','typescript','vb','vbnet','xml','xhtml','xslt','html'];
options.hideGutter=String(editor.config.syntaxhighlight_hideGutter).toLowerCase()==='true';
options.hideControls=String(editor.config.syntaxhighlight_hideControls).toLowerCase()==='true';
options.collapse=String(editor.config.syntaxhighlight_collapse).toLowerCase()==='true';
options.showColumns=String(editor.config.syntaxhighlight_showColumns).toLowerCase()==='true';
options.noWrap=String(editor.config.syntaxhighlight_noWrap).toLowerCase()==='true';
options.firstLine=editor.config.syntaxhighlight_firstLine;
options.highlightChecked=String(editor.config.syntaxhighlight_highlightChecked).toLowerCase()==='true';
options.highlight=editor.config.syntaxhighlight_highlight;
options.lang=(validLangs.indexOf(editor.config.syntaxhighlight_lang)>-1) ? editor.config.syntaxhighlight_lang : 'as3';
options.code=editor.config.syntaxhighlight_code;
return options
};
var getOptionsForString=function(optionsString) {
var options=getDefaultOptions();
if(optionsString) {
if(optionsString.indexOf('brush')>-1) {
var match=/brush:[ ]*(\w*)/.exec(optionsString);
if(match!=null&&match.length>0) {
options.lang=match[1].replace(/^\s+|\s+$/g,'');
if(options.lang=='actionscript') options.lang='as3';
else if(options.lang=='shell'||options.lang=='sh') options.lang='bash';
else if(options.lang=='coldfusion') options.lang='cf';
else if(options.lang=='c') options.lang='cpp';
else if(options.lang=='c#'||options.lang=='c-sharp') options.lang='csharp';
else if(options.lang=='pascal'||options.lang=='pas') options.lang='delphi';
else if(options.lang=='patch') options.lang='diff';
else if(options.lang=='erlang') options.lang='erl';
else if(options.lang=='haxe') options.lang='hx';
else if(options.lang=='jfx') options.lang='javafx';
else if(options.lang=='js'||options.lang=='javascript') options.lang='jscript';
else if(options.lang=='Perl'||options.lang=='pl') options.lang='perl';
else if(options.lang=='text') options.lang='plain';
else if(options.lang=='powershell'||options.lang=='posh') options.lang='ps';
else if(options.lang=='py') options.lang='python';
else if(options.lang=='rails'||options.lang=='ror'||options.lang=='rb') options.lang='ruby';
else if(options.lang=='sass') options.lang='scss';
else if(options.lang=='typescript') options.lang='ts';
else if(options.lang=='vbnet') options.lang='vb';
else if(options.lang=='xhtml'||options.lang=='xslt'||options.lang=='html') options.lang='xml'
}
}
if(optionsString.indexOf('gutter')>-1) {
options.hideGutter=true
}
if(optionsString.indexOf('toolbar')>-1) {
options.hideControls=true
}
if(optionsString.indexOf('collapse')>-1) {
options.collapse=true
}
if(optionsString.indexOf('first-line')>-1) {
var match=/first-line:[ ]*([0-9]{1,4})/.exec(optionsString);
if(match!=null&&match.length>0&&match[1]>1) {
options.firstLine=match[1]
}
}
if(optionsString.indexOf('highlight')>-1) {
if(optionsString.match(/highlight:[ ]*\[[0-9]+(,[0-9]+)*\]/)) {
var match_hl=/highlight:[ ]*\[(.*)\]/.exec(optionsString);
if(match_hl!=null&&match_hl.length>0) {
options.highlightChecked=true;
options.highlight=match_hl[1]
}
}
}
if(optionsString.indexOf('ruler')>-1) {
options.showColumns=true
}
if(optionsString.indexOf('wrap-lines')>-1) {
options.noWrap=true
}
}
return options
};
var getStringForOptions=function(optionsObject) {
var result='brush:'+optionsObject.lang+';';
if(optionsObject.hideGutter) {
result+='gutter:false;'
}
if(optionsObject.hideControls) {
result+='toolbar:false;'
}
if(optionsObject.collapse) {
result+='collapse:true;'
}
if(optionsObject.showColumns) {
result+='ruler:true;'
}
if(optionsObject.noWrap) {
result+='wrap-lines:false;'
}
if(optionsObject.firstLine.length>0) {
optionsObject.firstLine=optionsObject.firstLine.replace(/[^0-9]+/g,'');
if(optionsObject.firstLine.length>0&&optionsObject.firstLine>1) {
result+='first-line:'+optionsObject.firstLine+';'
}
}
if(optionsObject.highlight!=null&&optionsObject.highlight.length>0) {
optionsObject.highlight=optionsObject.highlight.replace(/[^\d,]+/g,'').replace(/,{2,}/g,',').replace(/(^,)|(,$)/g,'');
if(optionsObject.highlight.length>0) {
result+='highlight:['+optionsObject.highlight.replace(/\s/gi,'')+'];'
}
}
return result
};
return {
title : editor.lang.syntaxhighlight.title,
minWidth : 500,
minHeight : 400,
contents : [
{
id : 'source',
label : editor.lang.syntaxhighlight.sourceTab,
accessKey : 'S',
elements : [
{
type : 'vbox',
children : [
{
id : 'cmbLang',
type : 'select',
labelLayout : 'horizontal',
label : editor.lang.syntaxhighlight.langLbl,
widths : ['25%','75%'],
items : [
['ActionScript3','as3'],
['AppleScript','applescript'],
['Bash (Shell)','bash'],
['ColdFusion','cf'],
['C#','csharp'],
['C++','cpp'],
['CSS','css'],
['Delphi','delphi'],
['Diff','diff'],
['Erlang','erl'],
['Groovy','groovy'],
['Haxe','hx'],
['Javascript','jscript'],
['Java','java'],
['Java FX','javafx'],
['Perl','perl'],
['PHP','php'],
['Plain (Text)','plain'],
['PowerShell','ps'],
['Python','python'],
['Ruby','ruby'],
['Sass','scss'],
['Scala','scala'],
['SQL','sql'],
['TypeScript','ts'],
['VB','vb'],
['XML/XHTML','xml']
],
setup : function(data) {
if(data.lang) {
this.setValue(data.lang)
}
},
commit : function(data) {
data.lang=this.getValue()
}
}
]
},
{
type : 'textarea',
id : 'hl_code',
rows : 22,
style : 'width:100%',
validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.syntaxhighlight.sourceTextareaEmptyError ),
setup : function(data) {
if(data.code) {
this.setValue(data.code)
}
},
commit : function(data) {
data.code=this.getValue()
}
}
]
},
{
id : 'advanced',
label : editor.lang.syntaxhighlight.advancedTab,
accessKey : 'A',
elements : [
{
type : 'vbox',
children : [
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.hideGutter+'</strong>'
},
{
type : 'checkbox',
id : 'hide_gutter',
label : editor.lang.syntaxhighlight.hideGutterLbl,
setup : function(data) {
this.setValue(data.hideGutter)
},
commit : function(data) {
data.hideGutter=this.getValue()
}
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.hideControls+'</strong>'
},
{
type : 'checkbox',
id : 'hide_controls',
label : editor.lang.syntaxhighlight.hideControlsLbl,
setup : function(data) {
this.setValue(data.hideControls)
},
commit : function(data) {
data.hideControls=this.getValue()
}
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.collapse+'</strong>'
},
{
type : 'checkbox',
id : 'collapse',
label : editor.lang.syntaxhighlight.collapseLbl,
setup : function(data) {
this.setValue(data.collapse)
},
commit : function(data) {
data.collapse=this.getValue()
}
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.showColumns+'</strong>'
},
{
type : 'checkbox',
id : 'show_columns',
label : editor.lang.syntaxhighlight.showColumnsLbl,
setup : function(data) {
this.setValue(data.showColumns)
},
commit : function(data) {
data.showColumns=this.getValue()
}
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.lineWrap+'</strong>'
},
{
type : 'checkbox',
id : 'line_wrap',
label : editor.lang.syntaxhighlight.lineWrapLbl,
setup : function(data) {
this.setValue(data.noWrap)
},
commit : function(data) {
data.noWrap=this.getValue()
}
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.lineCount+'</strong>'
},
{
type : 'hbox',
widths : ['5%','95%'],
children : [
{
type : 'text',
id : 'default_lc',
style : 'width:15%;',
label : '',
setup : function(data) {
if(data.firstLine>1) {
this.setValue(data.firstLine)
}
},
commit : function(data) {
if(this.getValue()&&this.getValue()!='') {
data.firstLine=this.getValue()
}
}
}
]
},
{
type : 'html',
html : '<strong>'+editor.lang.syntaxhighlight.highlight+'</strong>'
},
{
type : 'hbox',
widths : ['5%','95%'],
children : [
{
type : 'text',
id : 'default_hl',
style : 'width:40%;',
label : '',
setup : function(data) {
if(data.highlight!=null) {
this.setValue(data.highlight)
}
},
commit : function(data) {
if(this.getValue()&&this.getValue()!='') {
data.highlight=this.getValue()
}
}
}
]
},
{
type : 'hbox',
widths : ['5%','95%'],
children : [
{
type : 'html',
html : '<i>'+editor.lang.syntaxhighlight.highlightLbl+'</i>'
}
]
}
]
}
]
}
],
onShow : function() {
var editor=this.getParentEditor();
var selection=editor.getSelection();
var element=selection.getStartElement();
var preElement=element&&element.getAscendant('pre',true);
var text='';
var optionsObj=null;
if(preElement) {
code=preElement.getHtml().replace(/<br>/g,"\n").replace(/&nbsp;/g,' ').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&');
optionsObj=getOptionsForString(preElement.getAttribute('class'));
optionsObj.code=code
} else {
optionsObj=getDefaultOptions()
}
this.setupContent(optionsObj)
},
onOk : function() {
var editor=this.getParentEditor();
var selection=editor.getSelection();
var element=selection.getStartElement();
var preElement=element&&element.getAscendant('pre',true);
var data=getDefaultOptions();
this.commitContent(data);
var optionsString=getStringForOptions(data);
if(preElement) {
preElement.setAttribute('class', optionsString);
preElement.setText(data.code)
} else {
var newElement=new CKEDITOR.dom.element('pre');
newElement.setAttribute('class', optionsString);
newElement.setText(data.code);
editor.insertElement(newElement)
}
}
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

View File

@@ -0,0 +1,21 @@
CKEDITOR.plugins.setLang( 'syntaxhighlight', 'de', {
title:'Einen Quelltextabschnitt einfügen oder aktualisieren',
contextTitle:'Quelltext bearbeiten',
sourceTab:'Quelltext',
langLbl:'Sprache auswählen',
sourceTextareaEmptyError:'Das Quelltext-Feld darf nicht leer sein.',
advancedTab:'Erweitert',
hideGutter:'Verstecke Seitenleiste',
hideGutterLbl:'Verstecke Seitenleiste und Zeilennummern.',
hideControls:'Verstecke Kontrollfelder',
hideControlsLbl:'Verstecke die Menüleiste über dem Quelltextblock.',
collapse:'Einklappen',
collapseLbl:'Klappe den Quelltextblock standartmäßig ein. (Kontrollfelder müssen aktiviert werden)',
showColumns:'Spalten anzeigen',
showColumnsLbl:'Zeige Spalten jeder Zeile in der Kopfzeile an.',
lineWrap:'Zeilenumbruch',
lineWrapLbl:'Deaktiviere Zeilenumbrüche.',
lineCount:'Nummerierung der ersten Zeile (falls ungleich 1)',
highlight:'Zeilen hervorheben',
highlightLbl:'Geben Sie kommasepariert die Zeilen ein, die sie hervorheben wollen, z.B. <em style="font-style:italic">3,10,15</em>.'
});

View File

@@ -0,0 +1,21 @@
CKEDITOR.plugins.setLang( 'syntaxhighlight', 'en', {
title:'Add or update a code snippet',
contextTitle:'Edit source code',
sourceTab:'Source code',
langLbl:'Select language',
sourceTextareaEmptyError:'Source code mustn\'t be empty.',
advancedTab:'Advanced',
hideGutter:'Hide gutter',
hideGutterLbl:'Hide gutter & line numbers.',
hideControls:'Hide controls',
hideControlsLbl:'Hide code controls at the top of the code block.',
collapse:'Collapse',
collapseLbl:'Collapse the code block by default. (controls need to be turned on)',
showColumns:'Show columns',
showColumnsLbl:'Show row columns in the first line.',
lineWrap:'Disable line wrapping',
lineWrapLbl:'Switch off line wrapping.',
lineCount:'Default line count',
highlight:'Highlight lines',
highlightLbl:'Enter a comma seperated lines of lines you want to highlight, eg <em style="font-style:italic">3,10,15</em>.'
});

View File

@@ -0,0 +1,21 @@
CKEDITOR.plugins.setLang('syntaxhighlight', 'fr', {
title:'Ajouter ou modifier un morceau de code source',
contextTitle:'&Eacute;diter le code source',
sourceTab:'Code source',
langLbl:'Sélectionnez le langage:',
sourceTextareaEmptyError:'Le code source ne doit pas être vide',
advancedTab:'Avancé',
hideGutter:'Cacher la marge',
hideGutterLbl:'Cacher la marge et les numéros de ligne.',
hideControls:'Cacher la barre d\'outils',
hideControlsLbl:'Cacher la barre d\'outils en haut du bloc de code.',
collapse:'Réduire le code',
collapseLbl:'Réduire le bloc de code par défaut. (la barre d\'outils doit être activée)',
showColumns:'Montrer les colonnes',
showColumnsLbl:'Montrer les colonnes sur la première ligne.',
lineWrap:'Désactiver le retour à la ligne automatique',
lineWrapLbl:'Désactiver le retour à la ligne automatique (ne fonctionne plus avec SyntaxHighlighter 3).',
lineCount:'Numéro de la première ligne (différent de 1)',
highlight:'Surligner les lignes',
highlightLbl:'Entrez les numéros des lignes que vous souhaitez surligner, séparés par des virgules. ex <em style="font-style:italic">3,10,15</em>.'
});

View File

@@ -0,0 +1,133 @@
CKEDITOR.plugins.add( 'syntaxhighlight', {
requires : 'dialog',
lang : 'en,de,fr', // %REMOVE_LINE_CORE%
icons : 'syntaxhighlight', // %REMOVE_LINE_CORE%
init : function( editor ) {
editor.addCommand( 'syntaxhighlightDialog', new CKEDITOR.dialogCommand( 'syntaxhighlightDialog', {
allowedContent: 'pre(*)',
requiredContent: 'pre(*)'
} ) );
editor.ui.addButton && editor.ui.addButton( 'Syntaxhighlight',
{
label : editor.lang.syntaxhighlight.title,
command : 'syntaxhighlightDialog',
toolbar : 'insert,98'
} );
if ( editor.contextMenu ) {
editor.addMenuGroup( 'syntaxhighlightGroup' );
editor.addMenuItem( 'syntaxhighlightItem', {
label: editor.lang.syntaxhighlight.contextTitle,
icon: this.path + 'icons/syntaxhighlight.png',
command: 'syntaxhighlightDialog',
group: 'syntaxhighlightGroup'
});
editor.contextMenu.addListener( function( element ) {
if ( element.getAscendant( 'pre', true ) ) {
return { syntaxhighlightItem: CKEDITOR.TRISTATE_OFF };
}
});
}
CKEDITOR.dialog.add( 'syntaxhighlightDialog', this.path + 'dialogs/syntaxhighlight.js' );
}
});
/**
* Whether the "Hide gutter & line numbers" checkbox is checked by default in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_hideGutter = false;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_hideGutter = false;
/**
* Whether the "Hide code controls at the top of the code block" checkbox is checked by default in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_hideControls = false;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_hideControls = false;
/**
* Whether the "Collapse the code block by default" checkbox is checked by default in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_collapse = false;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_collapse = false;
/**
* Whether the "Show row columns in the first line" checkbox is checked by default in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_showColumns = false;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_showColumns = false;
/**
* Whether the "Switch off line wrapping" checkbox is checked by default in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_noWrap = false;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_noWrap = false;
/**
* "Default line count" text-field default value in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_firstLine = 0;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_firstLine = 0;
/**
* "Enter a comma seperated lines of lines you want to highlight" text-field default value in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_highlight = null;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_highlight = null;
/**
* "Select language" select default selection in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_lang = null;
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_lang = null;
/**
* Default content of the "Code" textarea in the
* Syntaxhighlight dialog.
*
* config.syntaxhighlight_code = '';
*
* @cfg
* @member CKEDITOR.config
*/
CKEDITOR.config.syntaxhighlight_code = '';