- Welcome to Ladies Learning Code! -
-In partnership with:
- 
+
+
+
+
- 
Hello, may I have your order?
- - - -
Enter in your secret passcode here to see the great prices:
-Enter in your secret passcode here to see the great prices:
-
-
-
-
-
- Hello, may I have your order?
- - - -
Hello, may I have your order?
- - - -
| t |
+ * @author Lea Verou
+ */
+
+(function(){
+
+var _ = window.Highlight = {
+ languages: {
+ javascript: {
+ 'comment': /(\/\*.*?\*\/)|\/\/.*?(\r?\n|$)/g,
+ 'regex': /\/(\\?.)+?\/[gim]{0,3}/g,
+ 'string': /(('|").*?(\2))/g, // used to be: /'.*?'|".*?"/g,
+ 'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null)\b/g,
+ 'boolean': /\b(true|false)\b/g,
+ 'number': /\b-?(0x)?\d*\.?\d+\b/g,
+ 'operator': /([-+!=<>]|<){1,3}/g,
+ 'ignore': /&(lt|gt|amp);/gi,
+ 'punctuation': /[{}[\];(),.]/g
+ },
+ css: {
+ 'comment': /\/\*[\w\W]*?\*\//g,
+ 'url': /url\((?:'|")?(.+?)(?:'|")?\)/gi,
+ 'atrule': /@[\w-]+?(\s+[^{]+)?(?=\s*{)/gi,
+ 'selector': /[^\{\}\s][^\{\}]+(?=\s*\{)/g,
+ 'property': /(\b|\B)[a-z-]+(?=\s*:)/ig,
+ 'important': /\B!important\b/gi,
+ 'ignore': /&(lt|gt|amp);/gi,
+ 'punctuation': /[\{\};:]/g
+ },
+ html: {
+ 'comment': /<!--[\w\W]*?--(>|>)/g,
+ 'tag': {
+ 'pattern': /(<|<)\/?[\w\W]+?(>|>)/gi,
+ 'inside': {
+ 'attr-value': {
+ 'pattern': /[\w:-]+=(('|").*?(\2)|[^\s>]+(?=>|&|\s))/gi,
+ 'inside': {
+ 'attr-name': /^[\w:-]+(?==)/gi,
+ 'punctuation': /=/g
+ }
+ },
+ 'attr-name': /\s[\w:-]+(?=\s)/gi,
+ 'punctuation': /<\/?|\/?>/g
+ }
+ },
+ 'entity': /&#?[\da-z]{1,8};/gi
+ }
+ },
+
+ isInited: function(code) {
+ return code.hasAttribute('data-highlighted');
+ },
+
+ init: function(code) {
+ if(!code || _.isInited(code)) {
+ return; // or should I rehighlight?
+ }
+
+ var lang = _.languages[code.getAttribute('lang')];
+
+ if(!lang) {
+ return;
+ }
+
+ code.normalize();
+
+ var text = code.textContent
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/\u00a0/g, ' ');
+
+ code.innerHTML = _.do(text, lang);
+
+ code.setAttribute('data-highlighted', 'true');
+ },
+
+ do: function(text, tokens) {
+ var strarr = [text];
+
+ for(var token in tokens) {
+ var pattern = tokens[token],
+ inside = pattern.inside;
+ pattern = pattern.pattern || pattern;
+
+ for(var i=0; i' + content + ''
+ },
+
+ container: function(container) {
+ if(!container) {
+ return;
+ }
+
+ var codes = container.querySelectorAll('code[lang]');
+
+ for(var i=0; i 0 && dummy.style.length >= declarationCount;
+ },
+
+ setupSubjects: function(subjects) {
+ for (var i=0; i -1
+ ) { // 0, +, -
+
+ var fontSize;
+
+ if(code === 48) {
+ fontSize = 100;
+ }
+ else {
+ fontSize = (code == 61 || code == 187? 10 : -10) + (+this.getAttribute('data-size') || 100);
+ }
+
+ evt.preventDefault();
+
+ if(40 <= fontSize && fontSize <= 200) {
+ this.setAttribute('data-size', fontSize);
+ }
+
+ return false;
+ }
+
+ me.update();
+ });
+ }
+
+ this.raw = this.getCSS().indexOf('{') > -1;
+
+ if (window.SlideShow) {
+ this.slide = SlideShow.getSlide(element);
+
+ // Remove it after we're done with it, to save on resources
+ addEventListener('hashchange', function() {
+ if(location.hash == '#' + me.slide.id) {
+ me.update();
+ }
+ else if(me.raw && me.style && me.style.parentNode) {
+ head.removeChild(me.style);
+ }
+ }, false);
+
+ if(location.hash == '#' + me.slide.id) {
+ this.update();
+ }
+ }
+ else {
+ this.update();
+ }
+}
+
+self.prototype = {
+ update: function() {
+ var code = this.getCSS(),
+ previousRaw = this.raw;
+
+ this.raw = code.indexOf('{') > -1;
+
+ var supportedStyle = StyleFix.fix(code, this.raw);
+
+ if (previousRaw != this.raw) {
+ if (previousRaw && !this.raw) {
+ head.removeChild(this.style);
+ }
+ else {
+ this.textField.classList.remove('error');
+ CSSEdit.updateStyle(this.subjects, '', 'data-originalstyle');
+ }
+ }
+
+ if (this.raw) {
+ if (!this.style) {
+ this.style = document.createElement('style');
+ }
+
+ if (!this.style.parentNode) {
+ head.appendChild(this.style);
+ }
+
+ this.style.textContent = supportedStyle;
+ }
+ else {
+ var valid = CSSEdit.updateStyle(this.subjects, code, 'data-originalstyle');
+
+ if(this.textField && this.textField.classList) {
+ this.textField.classList[valid? 'remove' : 'add']('error');
+ }
+ }
+ },
+
+ getCSS: function() {
+ return this.textField ? this.textField.value : this.subjects[0].getAttribute('style');
+ }
+};
+
+var sizeStyles = '';
+for(var i=40; i<=200; i++) {
+ sizeStyles += '\r\ntextarea[data-size="' + i + '"] { font-size: ' + i + '%; }';
+}
+
+var style = document.createElement('style');
+style.textContent = sizeStyles;
+document.head.appendChild(style);
+
+})(document.head);
\ No newline at end of file
diff --git a/framework/scripts/plugins/highlight/highlight-8.4.min.js b/framework/scripts/plugins/highlight/highlight-8.4.min.js
new file mode 100644
index 0000000..1bd8fca
--- /dev/null
+++ b/framework/scripts/plugins/highlight/highlight-8.4.min.js
@@ -0,0 +1,2 @@
+!function(e){"undefined"!=typeof exports?e(exports):(window.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return window.hljs}))}(function(e){function t(e){return e.replace(/&/gm,"&").replace(//gm,">")}function r(e){return e.nodeName.toLowerCase()}function n(e,t){var r=e&&e.exec(t);return r&&0==r.index}function a(e){var t=(e.className+" "+(e.parentNode?e.parentNode.className:"")).split(/\s+/);return t=t.map(function(e){return e.replace(/^lang(uage)?-/,"")}),t.filter(function(e){return N(e)||/no(-?)highlight/.test(e)})[0]}function i(e,t){var r={};for(var n in e)r[n]=e[n];if(t)for(var n in t)r[n]=t[n];return r}function s(e){var t=[];return function n(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(t.push({event:"start",offset:a,node:i}),a=n(i,a),r(i).match(/br|hr|img|input/)||t.push({event:"stop",offset:a,node:i}));return a}(e,0),t}function c(e,n,a){function i(){return e.length&&n.length?e[0].offset!=n[0].offset?e[0].offset"}function c(e){u+=""+r(e)+">"}function o(e){("start"==e.event?s:c)(e.node)}for(var l=0,u="",d=[];e.length||n.length;){var b=i();if(u+=t(a.substr(l,b[0].offset-l)),l=b[0].offset,b==e){d.reverse().forEach(c);do o(b.splice(0,1)[0]),b=i();while(b==e&&b.length&&b[0].offset==l);d.reverse().forEach(s)}else"start"==b[0].event?d.push(b[0].node):d.pop(),o(b.splice(0,1)[0])}return u+t(a.substr(l))}function o(e){function t(e){return e&&e.source||e}function r(r,n){return RegExp(t(r),"m"+(e.cI?"i":"")+(n?"g":""))}function n(a,s){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var c={},o=function(t,r){e.cI&&(r=r.toLowerCase()),r.split(" ").forEach(function(e){var r=e.split("|");c[r[0]]=[t,r[1]?Number(r[1]):1]})};"string"==typeof a.k?o("keyword",a.k):Object.keys(a.k).forEach(function(e){o(e,a.k[e])}),a.k=c}a.lR=r(a.l||/\b[A-Za-z0-9_]+\b/,!0),s&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=r(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=r(a.e)),a.tE=t(a.e)||"",a.eW&&s.tE&&(a.tE+=(a.e?"|":"")+s.tE)),a.i&&(a.iR=r(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var l=[];a.c.forEach(function(e){e.v?e.v.forEach(function(t){l.push(i(e,t))}):l.push("self"==e?a:e)}),a.c=l,a.c.forEach(function(e){n(e,a)}),a.starts&&n(a.starts,s);var u=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(t).filter(Boolean);a.t=u.length?r(u.join("|"),!0):{exec:function(){return null}}}}n(e)}function l(e,r,a,i){function s(e,t){for(var r=0;r";return i+=e+'">',i+t+s}function f(){if(!k.k)return t(S);var e="",r=0;k.lR.lastIndex=0;for(var n=k.lR.exec(S);n;){e+=t(S.substr(r,n.index-r));var a=b(k,n);a?(E+=a[1],e+=p(a[0],t(n[0]))):e+=t(n[0]),r=k.lR.lastIndex,n=k.lR.exec(S)}return e+t(S.substr(r))}function m(){if(k.sL&&!w[k.sL])return t(S);var e=k.sL?l(k.sL,S,!0,x[k.sL]):u(S);return k.r>0&&(E+=e.r),"continuous"==k.subLanguageMode&&(x[k.sL]=e.top),p(e.language,e.value,!1,!0)}function g(){return void 0!==k.sL?m():f()}function _(e,r){var n=e.cN?p(e.cN,"",!0):"";e.rB?(M+=n,S=""):e.eB?(M+=t(r)+n,S=""):(M+=n,S=r),k=Object.create(e,{parent:{value:k}})}function h(e,r){if(S+=e,void 0===r)return M+=g(),0;var n=s(r,k);if(n)return M+=g(),_(n,r),n.rB?0:r.length;var a=c(k,r);if(a){var i=k;i.rE||i.eE||(S+=r),M+=g();do k.cN&&(M+=""),E+=k.r,k=k.parent;while(k!=a.parent);return i.eE&&(M+=t(r)),S="",a.starts&&_(a.starts,""),i.rE?0:r.length}if(d(r,k))throw new Error('Illegal lexeme "'+r+'" for mode "'+(k.cN||"")+'"');return S+=r,r.length||1}var y=N(e);if(!y)throw new Error('Unknown language: "'+e+'"');o(y);for(var k=i||y,x={},M="",C=k;C!=y;C=C.parent)C.cN&&(M=p(C.cN,"",!0)+M);var S="",E=0;try{for(var B,I,L=0;;){if(k.t.lastIndex=L,B=k.t.exec(r),!B)break;I=h(r.substr(L,B.index-L),B[0]),L=B.index+I}h(r.substr(L));for(var C=k;C.parent;C=C.parent)C.cN&&(M+="");return{r:E,value:M,language:e,top:k}}catch(R){if(-1!=R.message.indexOf("Illegal"))return{r:0,value:t(r)};throw R}}function u(e,r){r=r||v.languages||Object.keys(w);var n={r:0,value:t(e)},a=n;return r.forEach(function(t){if(N(t)){var r=l(t,e,!1);r.language=t,r.r>a.r&&(a=r),r.r>n.r&&(a=n,n=r)}}),a.language&&(n.second_best=a),n}function d(e){return v.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,t){return t.replace(/\t/g,v.tabReplace)})),v.useBR&&(e=e.replace(/\n/g,"
")),e}function b(e,t,r){var n=t?y[t]:r,a=[e.trim()];return e.match(/(\s|^)hljs(\s|$)/)||a.push("hljs"),n&&a.push(n),a.join(" ").trim()}function p(e){var t=a(e);if(!/no(-?)highlight/.test(t)){var r;v.useBR?(r=document.createElementNS("http://www.w3.org/1999/xhtml","div"),r.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/
/g,"\n")):r=e;var n=r.textContent,i=t?l(t,n,!0):u(n),o=s(r);if(o.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=i.value,i.value=c(o,s(p),n)}i.value=d(i.value),e.innerHTML=i.value,e.className=b(e.className,t,i.language),e.result={language:i.language,re:i.r},i.second_best&&(e.second_best={language:i.second_best.language,re:i.second_best.r})}}function f(e){v=i(v,e)}function m(){if(!m.called){m.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function g(){addEventListener("DOMContentLoaded",m,!1),addEventListener("load",m,!1)}function _(t,r){var n=w[t]=r(e);n.aliases&&n.aliases.forEach(function(e){y[e]=t})}function h(){return Object.keys(w)}function N(e){return w[e]||w[y[e]]}var v={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},w={},y={};return e.highlight=l,e.highlightAuto=u,e.fixMarkup=d,e.highlightBlock=p,e.configure=f,e.initHighlighting=m,e.initHighlightingOnLoad=g,e.registerLanguage=_,e.listLanguages=h,e.getLanguage=N,e.inherit=i,e.IR="[a-zA-Z][a-zA-Z0-9_]*",e.UIR="[a-zA-Z_][a-zA-Z0-9_]*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/},e.CLCM={cN:"comment",b:"//",e:"$",c:[e.PWM]},e.CBCM={cN:"comment",b:"/\\*",e:"\\*/",c:[e.PWM]},e.HCM={cN:"comment",b:"#",e:"$",c:[e.PWM]},e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e}),hljs.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"tag",b:"?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]},r={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},n={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,e.NM,r,n,t]}}),hljs.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module global window document"},r="[A-Za-z$_][0-9A-Za-z$_]*",n={cN:"subst",b:/#\{/,e:/}/,k:t},a=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,n]},{b:/"/,e:/"/,c:[e.BE,n]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[n,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{cN:"property",b:"@"+r},{b:"`",e:"`",eB:!0,eE:!0,sL:"javascript"}];n.c=a;var i=e.inherit(e.TM,{b:r}),s="(\\(.*\\))?\\s*\\B[-=]>",c={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(a)}]};return{aliases:["coffee","cson","iced"],k:t,i:/\/\*/,c:a.concat([{cN:"comment",b:"###",e:"###",c:[e.PWM]},e.HCM,{cN:"function",b:"^\\s*"+r+"\\s*=\\s*"+s,e:"[-=]>",rB:!0,c:[i,c]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:s,e:"[-=]>",rB:!0,c:[c]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{cN:"attribute",b:r+":",e:":",rB:!0,rE:!0,r:0}])}}),hljs.registerLanguage("cpp",function(e){var t={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginaryintmax_t uintmax_t int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_tint_least8_t uint_least8_t int_least16_t uint_least16_t int_least32_t uint_least32_tint_least64_t uint_least64_t int_fast8_t uint_fast8_t int_fast16_t uint_fast16_t int_fast32_tuint_fast32_t int_fast64_t uint_fast64_t intptr_t uintptr_t atomic_bool atomic_char atomic_scharatomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llongatomic_ullong atomic_wchar_t atomic_char16_t atomic_char32_t atomic_intmax_t atomic_uintmax_tatomic_intptr_t atomic_uintptr_t atomic_size_t atomic_ptrdiff_t atomic_int_least8_t atomic_int_least16_tatomic_int_least32_t atomic_int_least64_t atomic_uint_least8_t atomic_uint_least16_t atomic_uint_least32_tatomic_uint_least64_t atomic_int_fast8_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_tatomic_uint_fast8_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c","h","c++","h++"],k:t,i:"",c:[e.CLCM,e.CBCM,e.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},e.CNM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line pragma",c:[{b:'include\\s*[<"]',e:'[>"]',k:"include",i:"\\n"},e.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:t,c:["self"]},{b:e.IR+"::"},{bK:"new throw return",r:0},{cN:"function",b:"("+e.IR+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("cs",function(e){var t="abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",r=e.IR+"(<"+e.IR+">)?";return{aliases:["csharp"],k:t,i:/::/,c:[{cN:"comment",b:"///",e:"$",rB:!0,c:[{cN:"xmlDocTag",v:[{b:"///",r:0},{b:""},{b:"?",e:">"}]}]},e.CLCM,e.CBCM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class namespace interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}}),hljs.registerLanguage("css",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",r={cN:"function",b:t+"\\(",rB:!0,eE:!0,e:"\\("};return{cI:!0,i:"[=/|']",c:[e.CBCM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[r,e.ASM,e.QSM,e.CSSNM]}]},{cN:"tag",b:t,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[e.CBCM,{cN:"rule",b:"[^\\s]",rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{cN:"value",eW:!0,eE:!0,c:[r,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}}),hljs.registerLanguage("diff",function(){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}),hljs.registerLanguage("http",function(){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:!0}}]}}),hljs.registerLanguage("ini",function(e){return{cI:!0,i:/\S/,c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:!0,k:"on off true false yes no",c:[e.QSM,e.NM],r:0}]}]}}),hljs.registerLanguage("java",function(e){var t=e.UIR+"(<"+e.UIR+">)?",r="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",n="(\\b(0b[01_]+)|\\b0[xX][a-fA-F0-9_]+|(\\b[\\d_]+(\\.[\\d_]*)?|\\.[\\d_]+)([eE][-+]?\\d+)?)[lLfF]?",a={cN:"number",b:n,r:0};return{aliases:["jsp"],k:r,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},a,{cN:"annotation",b:"@[A-Za-z]+"}]}}),hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document"},c:[{cN:"pi",r:10,v:[{b:/^\s*('|")use strict('|")/},{b:/^\s*('|")use asm('|")/}]},e.ASM,e.QSM,e.CLCM,e.CBCM,e.CNM,{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[e.CLCM,e.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0}]}}),hljs.registerLanguage("json",function(e){var t={literal:"true false null"},r=[e.QSM,e.CNM],n={cN:"value",e:",",eW:!0,eE:!0,c:r,k:t},a={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:n}],i:"\\S"},i={b:"\\[",e:"\\]",c:[e.inherit(n,{cN:null})],i:"\\S"};return r.splice(r.length,0,a,i),{c:r,k:t,i:"\\S"}}),hljs.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,t]}]}}),hljs.registerLanguage("xml",function(){var e="[A-Za-z0-9\\._:-]+",t={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"},r={eW:!0,i:/,r:0,c:[t,{cN:"attribute",b:e,r:0},{b:"=",r:0,c:[{cN:"value",c:[t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",rE:!0,sL:"css"}},{cN:"tag",b:"",rE:!0,sL:"javascript"}},t,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"?",e:"/?>",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},r]}]}}),hljs.registerLanguage("markdown",function(){return{aliases:["md","mkdown","mkd"],c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"link_reference",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link_url",e:"$"}}]}]}}),hljs.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},r={eW:!0,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[t]},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"title",b:e.UIR,starts:r}],r:0}],i:"[^\\s\\}]"}}),hljs.registerLanguage("objectivec",function(e){var t={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSData NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView NSView NSViewController NSWindow NSWindowController NSSet NSUUID NSIndexSet UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection NSURLSession NSURLSessionDataTask NSURLSessionDownloadTask NSURLSessionUploadTask NSURLResponseUIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},r=/[a-zA-Z@][a-zA-Z0-9_]*/,n="@interface @class @protocol @implementation";return{aliases:["m","mm","objc","obj-c"],k:t,l:r,i:"",c:[e.CLCM,e.CBCM,e.CNM,e.QSM,{cN:"string",v:[{b:'@"',e:'"',i:"\\n",c:[e.BE]},{b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"}]},{cN:"preprocessor",b:"#",e:"$",c:[{cN:"title",v:[{b:'"',e:'"'},{b:"<",e:">"}]}]},{cN:"class",b:"("+n.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:n,l:r,c:[e.UTM]},{cN:"variable",b:"\\."+e.UIR,r:0}]}}),hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},n={b:"->{",e:"}"},a={cN:"variable",v:[{b:/\$\d/},{b:/[\$\%\@](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},{b:/[\$\%\@][^\s\w{]/,r:0}]},i={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},s=[e.BE,r,a],c=[a,e.HCM,i,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:!0},n,{cN:"string",c:s,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,i,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];return r.c=c,n.c=c,{aliases:["pl"],k:t,c:c}}),hljs.registerLanguage("php",function(e){var t={cN:"variable",b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},r={cN:"preprocessor",b:/<\?(php)?|\?>/},n={cN:"string",c:[e.BE,r],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},a={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.CLCM,e.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},r]},{cN:"comment",b:"__halt_compiler.+?;",eW:!0,k:"__halt_compiler",l:e.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[e.BE]},r,t,{b:/->+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",t,e.CBCM,n,a]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},n,a]}}),hljs.registerLanguage("python",function(e){var t={cN:"prompt",b:/^(>>>|\.\.\.) /},r={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[t],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[t],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},n={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},a={cN:"params",b:/\(/,e:/\)/,c:["self",t,n,r]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[t,n,r,e.HCM,{v:[{cN:"function",bK:"def",r:10},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n]/,c:[e.UTM,a]},{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}}),hljs.registerLanguage("ruby",function(e){var t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",n={cN:"yardoctag",b:"@[A-Za-z]+"},a={cN:"value",b:"#<",e:">"},i={cN:"comment",v:[{b:"#",e:"$",c:[n]},{b:"^\\=begin",e:"^\\=end",c:[n],r:10},{b:"^__END__",e:"\\n$"}]},s={cN:"subst",b:"#\\{",e:"}",k:r},c={cN:"string",c:[e.BE,s],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},o={cN:"params",b:"\\(",e:"\\)",k:r},l=[c,a,i,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+e.IR+"::)?"+e.IR}]},i]},{cN:"function",bK:"def",e:" |$|;",r:0,c:[e.inherit(e.TM,{b:t}),o,i]},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[c,{b:t}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[a,i,{cN:"regexp",c:[e.BE,s],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];s.c=l,o.c=l;var u="[>?]>",d="[\\w#]+\\(\\w+\\):\\d+:\\d+>",b="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",p=[{b:/^\s*=>/,cN:"status",starts:{e:"$",c:l}},{cN:"prompt",b:"^("+u+"|"+d+"|"+b+")",starts:{e:"$",c:l}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:r,c:[i].concat(p).concat(l)}}),hljs.registerLanguage("sql",function(e){var t={cN:"comment",b:"--",e:"$"};return{cI:!0,i:/[<>]/,c:[{cN:"operator",bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate savepoint release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup",e:/;/,eW:!0,k:{keyword:"abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length character_length charindex charset check checksum checksum_agg choose close coalesce coercibility collate collation collationproperty column columns columns_updated commit compress concat concat_ws concurrent connect connection connection_id consistent constraint constraints continue contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime data database databases datalength date_add date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec engine engines eomonth errors escape escaped event eventdata events except exception exec execute exists exp explain export_set extended external extract fast fetch field fields find_in_set first first_value floor flush for force foreign format found found_rows from from_base64 from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner innodb input insert install instr intersect into is is_free_lock is_ipv4 is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names national natural nchar next no no_write_to_binlog not now nullif nvarchar oct octet_length of old_password on only open optimize option optionally or ord order outer outfile output pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges procedure procedure_analyze processlist profile profiles public publishingservername purge quarter query quick quote quotename radians rand read references regexp relative relaylog release release_lock rename repair repeat replace replicate reset restore restrict return returns reverse revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll sec_to_time second section select serializable server session session_user set sha sha1 sha2 share show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sql_variant_property sqlstate sqrt square start starting status std stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short validate_password_strength value values var var_pop var_samp variables variance varp version view warnings week weekday weekofyear weight_string when whenever where with work write xml xor year yearweek zon",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int integer interval number numeric real serial smallint varchar varying int8 serial8 text"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}
+});
\ No newline at end of file
diff --git a/framework/scripts/plugins/highlight/highlight.js b/framework/scripts/plugins/highlight/highlight.js
new file mode 100755
index 0000000..3e6b894
--- /dev/null
+++ b/framework/scripts/plugins/highlight/highlight.js
@@ -0,0 +1,32 @@
+// START CUSTOM REVEAL.JS INTEGRATION
+(function() {
+ if( typeof window.addEventListener === 'function' ) {
+ var hljs_nodes = document.querySelectorAll( 'pre code' );
+
+ for( var i = 0, len = hljs_nodes.length; i < len; i++ ) {
+ var element = hljs_nodes[i];
+
+ // trim whitespace if data-trim attribute is present
+ if( element.hasAttribute( 'data-trim' ) && typeof element.innerHTML.trim === 'function' ) {
+ element.innerHTML = element.innerHTML.trim();
+ }
+
+ // Now escape html unless prevented by author
+ if( ! element.hasAttribute( 'data-noescape' )) {
+ element.innerHTML = element.innerHTML.replace(//g,">");
+ }
+
+ // re-highlight when focus is lost (for edited code)
+ element.addEventListener( 'focusout', function( event ) {
+ hljs.highlightBlock( event.currentTarget );
+ }, false );
+ }
+ }
+})();
+// END CUSTOM REVEAL.JS INTEGRATION
+
+// highlight.js build includes support for:
+// All languages in master + fsharp
+
+
+var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+(q.parentNode?q.parentNode.className:"")).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=(""+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q'+M[0]+""}else{r+=M[0]}O=A.lR.lastIndex;M=A.lR.exec(L)}return r+L.substr(O)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function K(){return A.sL!==undefined?z():H()}function J(M,r){var L=M.cN?'':"";if(M.rB){x+=L;w=""}else{if(M.eB){x+=l(r)+L;w=""}else{x+=L;w=r}}A=Object.create(M,{parent:{value:A}})}function D(L,r){w+=L;if(r===undefined){x+=K();return 0}var N=o(r,A);if(N){x+=K();J(N,r);return N.rB?0:r.length}var O=s(A,r);if(O){var M=A;if(!(M.rE||M.eE)){w+=r}x+=K();do{if(A.cN){x+=""}B+=A.r;A=A.parent}while(A!=O.parent);if(M.eE){x+=l(r)}w="";if(O.starts){J(O.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw new Error('Illegal lexem "'+r+'" for mode "'+(A.cN||"")+'"')}w+=r;return r.length||1}var G=e[E];f(G);var A=G;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(F);if(!u){break}q=D(F.substr(p,u.index-p),u[0]);p=u.index+q}D(F.substr(p));return{r:B,keyword_count:v,value:x,language:E}}catch(I){if(I.message.indexOf("Illegal")!=-1){return{r:0,keyword_count:0,value:l(F)}}else{throw I}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s,false);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v,true):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES["1c"]=function(b){var f="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*";var c="возврат дата для если и или иначе иначеесли исключение конецесли конецпопытки конецпроцедуры конецфункции конеццикла константа не перейти перем перечисление по пока попытка прервать продолжить процедура строка тогда фс функция цикл число экспорт";var e="ansitooem oemtoansi ввестивидсубконто ввестидату ввестизначение ввестиперечисление ввестипериод ввестиплансчетов ввестистроку ввестичисло вопрос восстановитьзначение врег выбранныйплансчетов вызватьисключение датагод датамесяц датачисло добавитьмесяц завершитьработусистемы заголовоксистемы записьжурналарегистрации запуститьприложение зафиксироватьтранзакцию значениевстроку значениевстрокувнутр значениевфайл значениеизстроки значениеизстрокивнутр значениеизфайла имякомпьютера имяпользователя каталогвременныхфайлов каталогиб каталогпользователя каталогпрограммы кодсимв командасистемы конгода конецпериодаби конецрассчитанногопериодаби конецстандартногоинтервала конквартала конмесяца коннедели лев лог лог10 макс максимальноеколичествосубконто мин монопольныйрежим названиеинтерфейса названиенабораправ назначитьвид назначитьсчет найти найтипомеченныенаудаление найтиссылки началопериодаби началостандартногоинтервала начатьтранзакцию начгода начквартала начмесяца начнедели номерднягода номерднянедели номернеделигода нрег обработкаожидания окр описаниеошибки основнойжурналрасчетов основнойплансчетов основнойязык открытьформу открытьформумодально отменитьтранзакцию очиститьокносообщений периодстр полноеимяпользователя получитьвремята получитьдатута получитьдокументта получитьзначенияотбора получитьпозициюта получитьпустоезначение получитьта прав праводоступа предупреждение префиксавтонумерации пустаястрока пустоезначение рабочаядаттьпустоезначение рабочаядата разделительстраниц разделительстрок разм разобратьпозициюдокумента рассчитатьрегистрына рассчитатьрегистрыпо сигнал симв символтабуляции создатьобъект сокрл сокрлп сокрп сообщить состояние сохранитьзначение сред статусвозврата стрдлина стрзаменить стрколичествострок стрполучитьстроку стрчисловхождений сформироватьпозициюдокумента счетпокоду текущаядата текущеевремя типзначения типзначениястр удалитьобъекты установитьтана установитьтапо фиксшаблон формат цел шаблон";var a={cN:"dquote",b:'""'};var d={cN:"string",b:'"',e:'"|$',c:[a],r:0};var g={cN:"string",b:"\\|",e:'"|$',c:[a]};return{cI:true,l:f,k:{keyword:c,built_in:e},c:[b.CLCM,b.NM,d,g,{cN:"function",b:"(процедура|функция)",e:"$",l:f,k:"процедура функция",c:[{cN:"title",b:f},{cN:"tail",eW:true,c:[{cN:"params",b:"\\(",e:"\\)",l:f,k:"знач",c:[d,g]},{cN:"export",b:"экспорт",eW:true,l:f,k:"экспорт",c:[b.CLCM]}]},b.CLCM]},{cN:"preprocessor",b:"#",e:"$"},{cN:"date",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}}(hljs);hljs.LANGUAGES.actionscript=function(a){var d="[a-zA-Z_$][a-zA-Z0-9_$]*";var c="([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)";var e={cN:"rest_arg",b:"[.]{3}",e:d,r:10};var b={cN:"title",b:d};return{k:{keyword:"as break case catch class const continue default delete do dynamic each else extends final finally for function get if implements import in include instanceof interface internal is namespace native new override package private protected public return set static super switch this throw try typeof use var void while with",literal:"true false null undefined"},c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{cN:"package",bWK:true,e:"{",k:"package",c:[b]},{cN:"class",bWK:true,e:"{",k:"class interface",c:[{bWK:true,k:"extends implements"},b]},{cN:"preprocessor",bWK:true,e:";",k:"import include"},{cN:"function",bWK:true,e:"[{;]",k:"function",i:"\\S",c:[b,{cN:"params",b:"\\(",e:"\\)",c:[a.ASM,a.QSM,a.CLCM,a.CBLCLM,e]},{cN:"type",b:":",e:c,r:10}]}]}}(hljs);hljs.LANGUAGES.apache=function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{cI:true,k:{keyword:"acceptfilter acceptmutex acceptpathinfo accessfilename action addalt addaltbyencoding addaltbytype addcharset adddefaultcharset adddescription addencoding addhandler addicon addiconbyencoding addiconbytype addinputfilter addlanguage addmoduleinfo addoutputfilter addoutputfilterbytype addtype alias aliasmatch allow allowconnect allowencodedslashes allowoverride anonymous anonymous_logemail anonymous_mustgiveemail anonymous_nouserid anonymous_verifyemail authbasicauthoritative authbasicprovider authdbduserpwquery authdbduserrealmquery authdbmgroupfile authdbmtype authdbmuserfile authdefaultauthoritative authdigestalgorithm authdigestdomain authdigestnccheck authdigestnonceformat authdigestnoncelifetime authdigestprovider authdigestqop authdigestshmemsize authgroupfile authldapbinddn authldapbindpassword authldapcharsetconfig authldapcomparednonserver authldapdereferencealiases authldapgroupattribute authldapgroupattributeisdn authldapremoteuserattribute authldapremoteuserisdn authldapurl authname authnprovideralias authtype authuserfile authzdbmauthoritative authzdbmtype authzdefaultauthoritative authzgroupfileauthoritative authzldapauthoritative authzownerauthoritative authzuserauthoritative balancermember browsermatch browsermatchnocase bufferedlogs cachedefaultexpire cachedirlength cachedirlevels cachedisable cacheenable cachefile cacheignorecachecontrol cacheignoreheaders cacheignorenolastmod cacheignorequerystring cachelastmodifiedfactor cachemaxexpire cachemaxfilesize cacheminfilesize cachenegotiateddocs cacheroot cachestorenostore cachestoreprivate cgimapextension charsetdefault charsetoptions charsetsourceenc checkcaseonly checkspelling chrootdir contentdigest cookiedomain cookieexpires cookielog cookiename cookiestyle cookietracking coredumpdirectory customlog dav davdepthinfinity davgenericlockdb davlockdb davmintimeout dbdexptime dbdkeep dbdmax dbdmin dbdparams dbdpersist dbdpreparesql dbdriver defaulticon defaultlanguage defaulttype deflatebuffersize deflatecompressionlevel deflatefilternote deflatememlevel deflatewindowsize deny directoryindex directorymatch directoryslash documentroot dumpioinput dumpiologlevel dumpiooutput enableexceptionhook enablemmap enablesendfile errordocument errorlog example expiresactive expiresbytype expiresdefault extendedstatus extfilterdefine extfilteroptions fileetag filterchain filterdeclare filterprotocol filterprovider filtertrace forcelanguagepriority forcetype forensiclog gracefulshutdowntimeout group header headername hostnamelookups identitycheck identitychecktimeout imapbase imapdefault imapmenu include indexheadinsert indexignore indexoptions indexorderdefault indexstylesheet isapiappendlogtoerrors isapiappendlogtoquery isapicachefile isapifakeasync isapilognotsupported isapireadaheadbuffer keepalive keepalivetimeout languagepriority ldapcacheentries ldapcachettl ldapconnectiontimeout ldapopcacheentries ldapopcachettl ldapsharedcachefile ldapsharedcachesize ldaptrustedclientcert ldaptrustedglobalcert ldaptrustedmode ldapverifyservercert limitinternalrecursion limitrequestbody limitrequestfields limitrequestfieldsize limitrequestline limitxmlrequestbody listen listenbacklog loadfile loadmodule lockfile logformat loglevel maxclients maxkeepaliverequests maxmemfree maxrequestsperchild maxrequestsperthread maxspareservers maxsparethreads maxthreads mcachemaxobjectcount mcachemaxobjectsize mcachemaxstreamingbuffer mcacheminobjectsize mcacheremovalalgorithm mcachesize metadir metafiles metasuffix mimemagicfile minspareservers minsparethreads mmapfile mod_gzip_on mod_gzip_add_header_count mod_gzip_keep_workfiles mod_gzip_dechunk mod_gzip_min_http mod_gzip_minimum_file_size mod_gzip_maximum_file_size mod_gzip_maximum_inmem_size mod_gzip_temp_dir mod_gzip_item_include mod_gzip_item_exclude mod_gzip_command_version mod_gzip_can_negotiate mod_gzip_handle_methods mod_gzip_static_suffix mod_gzip_send_vary mod_gzip_update_static modmimeusepathinfo multiviewsmatch namevirtualhost noproxy nwssltrustedcerts nwsslupgradeable options order passenv pidfile protocolecho proxybadheader proxyblock proxydomain proxyerroroverride proxyftpdircharset proxyiobuffersize proxymaxforwards proxypass proxypassinterpolateenv proxypassmatch proxypassreverse proxypassreversecookiedomain proxypassreversecookiepath proxypreservehost proxyreceivebuffersize proxyremote proxyremotematch proxyrequests proxyset proxystatus proxytimeout proxyvia readmename receivebuffersize redirect redirectmatch redirectpermanent redirecttemp removecharset removeencoding removehandler removeinputfilter removelanguage removeoutputfilter removetype requestheader require rewritebase rewritecond rewriteengine rewritelock rewritelog rewriteloglevel rewritemap rewriteoptions rewriterule rlimitcpu rlimitmem rlimitnproc satisfy scoreboardfile script scriptalias scriptaliasmatch scriptinterpretersource scriptlog scriptlogbuffer scriptloglength scriptsock securelisten seerequesttail sendbuffersize serveradmin serveralias serverlimit servername serverpath serverroot serversignature servertokens setenv setenvif setenvifnocase sethandler setinputfilter setoutputfilter ssienableaccess ssiendtag ssierrormsg ssistarttag ssitimeformat ssiundefinedecho sslcacertificatefile sslcacertificatepath sslcadnrequestfile sslcadnrequestpath sslcarevocationfile sslcarevocationpath sslcertificatechainfile sslcertificatefile sslcertificatekeyfile sslciphersuite sslcryptodevice sslengine sslhonorciperorder sslmutex ssloptions sslpassphrasedialog sslprotocol sslproxycacertificatefile sslproxycacertificatepath sslproxycarevocationfile sslproxycarevocationpath sslproxyciphersuite sslproxyengine sslproxymachinecertificatefile sslproxymachinecertificatepath sslproxyprotocol sslproxyverify sslproxyverifydepth sslrandomseed sslrequire sslrequiressl sslsessioncache sslsessioncachetimeout sslusername sslverifyclient sslverifydepth startservers startthreads substitute suexecusergroup threadlimit threadsperchild threadstacksize timeout traceenable transferlog typesconfig unsetenv usecanonicalname usecanonicalphysicalport user userdir virtualdocumentroot virtualdocumentrootip virtualscriptalias virtualscriptaliasip win32disableacceptex xbithack",literal:"on off"},c:[a.HCM,{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,{cN:"tag",b:"?",e:">"},a.QSM]}}(hljs);hljs.LANGUAGES.applescript=function(a){var b=a.inherit(a.QSM,{i:""});var e={cN:"title",b:a.UIR};var d={cN:"params",b:"\\(",e:"\\)",c:["self",a.CNM,b]};var c=[{cN:"comment",b:"--",e:"$",},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self",{b:"--",e:"$"}]},a.HCM];return{k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[b,a.CNM,{cN:"type",b:"\\bPOSIX file\\b"},{cN:"command",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"constant",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{cN:"property",b:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{cN:"function_start",bWK:true,k:"on",i:"[${=;\\n]",c:[e,d]}].concat(c),i:"//"}}(hljs);hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,r:0,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"",rE:true,sL:"css"}},{cN:"tag",b:"';
+
+ }
+
+ /**
+ * Parses a data string into multiple slides based
+ * on the passed in separator arguments.
+ */
+ function slidify( markdown, options ) {
+
+ options = getSlidifyOptions( options );
+
+ var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
+ horizontalSeparatorRegex = new RegExp( options.separator );
+
+ var matches,
+ lastIndex = 0,
+ isHorizontal,
+ wasHorizontal = true,
+ content,
+ sectionStack = [];
+
+ // iterate until all blocks between separators are stacked up
+ while( matches = separatorRegex.exec( markdown ) ) {
+ notes = null;
+
+ // determine direction (horizontal by default)
+ isHorizontal = horizontalSeparatorRegex.test( matches[0] );
+
+ if( !isHorizontal && wasHorizontal ) {
+ // create vertical stack
+ sectionStack.push( [] );
+ }
+
+ // pluck slide content from markdown input
+ content = markdown.substring( lastIndex, matches.index );
+
+ if( isHorizontal && wasHorizontal ) {
+ // add to horizontal stack
+ sectionStack.push( content );
+ }
+ else {
+ // add to vertical stack
+ sectionStack[sectionStack.length-1].push( content );
+ }
+
+ lastIndex = separatorRegex.lastIndex;
+ wasHorizontal = isHorizontal;
+ }
+
+ // add the remaining slide
+ ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
+
+ var markdownSections = '';
+
+ // flatten the hierarchical stack, and insert tags
+ for( var i = 0, len = sectionStack.length; i < len; i++ ) {
+ // vertical
+ if( sectionStack[i] instanceof Array ) {
+ markdownSections += '';
+
+ sectionStack[i].forEach( function( child ) {
+ markdownSections += '' + createMarkdownSlide( child, options ) + ' ';
+ } );
+
+ markdownSections += ' ';
+ }
+ else {
+ markdownSections += '' + createMarkdownSlide( sectionStack[i], options ) + ' ';
+ }
+ }
+
+ return markdownSections;
+
+ }
+
+ /**
+ * Parses any current data-markdown slides, splits
+ * multi-slide markdown into separate sections and
+ * handles loading of external markdown.
+ */
+ function processSlides() {
+
+ var sections = document.querySelectorAll( '[data-markdown]'),
+ section;
+
+ for( var i = 0, len = sections.length; i < len; i++ ) {
+
+ section = sections[i];
+
+ if( section.getAttribute( 'data-markdown' ).length ) {
+
+ var xhr = new XMLHttpRequest(),
+ url = section.getAttribute( 'data-markdown' );
+
+ datacharset = section.getAttribute( 'data-charset' );
+
+ // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
+ if( datacharset != null && datacharset != '' ) {
+ xhr.overrideMimeType( 'text/html; charset=' + datacharset );
+ }
+
+ xhr.onreadystatechange = function() {
+ if( xhr.readyState === 4 ) {
+ if ( xhr.status >= 200 && xhr.status < 300 ) {
+
+ section.outerHTML = slidify( xhr.responseText, {
+ separator: section.getAttribute( 'data-separator' ),
+ verticalSeparator: section.getAttribute( 'data-vertical' ),
+ notesSeparator: section.getAttribute( 'data-notes' ),
+ attributes: getForwardedAttributes( section )
+ });
+
+ }
+ else {
+
+ section.outerHTML = '' +
+ 'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
+ 'Check your browser\'s JavaScript console for more details.' +
+ 'Remember that you need to serve the presentation HTML from a HTTP server.
' +
+ ' ';
+
+ }
+ }
+ };
+
+ xhr.open( 'GET', url, false );
+
+ try {
+ xhr.send();
+ }
+ catch ( e ) {
+ alert( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
+ }
+
+ }
+ else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-vertical' ) || section.getAttribute( 'data-notes' ) ) {
+
+ section.outerHTML = slidify( getMarkdownFromSlide( section ), {
+ separator: section.getAttribute( 'data-separator' ),
+ verticalSeparator: section.getAttribute( 'data-vertical' ),
+ notesSeparator: section.getAttribute( 'data-notes' ),
+ attributes: getForwardedAttributes( section )
+ });
+
+ }
+ else {
+ section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
+ }
+ }
+
+ }
+
+ /**
+ * Check if a node value has the attributes pattern.
+ * If yes, extract it and add that value as one or several attributes
+ * the the terget element.
+ *
+ * You need Cache Killer on Chrome to see the effect on any FOM transformation
+ * directly on refresh (F5)
+ * http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277
+ */
+ function addAttributeInElement( node, elementTarget, separator ) {
+
+ var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
+ var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
+ var nodeValue = node.nodeValue;
+ if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
+
+ var classes = matches[1];
+ nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
+ node.nodeValue = nodeValue;
+ while( matchesClass = mardownClassRegex.exec( classes ) ) {
+ elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Add attributes to the parent element of a text node,
+ * or the element of an attribute node.
+ */
+ function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
+
+ if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
+ previousParentElement = element;
+ for( var i = 0; i < element.childNodes.length; i++ ) {
+ childElement = element.childNodes[i];
+ if ( i > 0 ) {
+ j = i - 1;
+ while ( j >= 0 ) {
+ aPreviousChildElement = element.childNodes[j];
+ if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
+ previousParentElement = aPreviousChildElement;
+ break;
+ }
+ j = j - 1;
+ }
+ }
+ parentSection = section;
+ if( childElement.nodeName == "section" ) {
+ parentSection = childElement ;
+ previousParentElement = childElement ;
+ }
+ if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
+ addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
+ }
+ }
+ }
+
+ if ( element.nodeType == Node.COMMENT_NODE ) {
+ if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
+ addAttributeInElement( element, section, separatorSectionAttributes );
+ }
+ }
+ }
+
+ /**
+ * Converts any current data-markdown slides in the
+ * DOM to HTML.
+ */
+ function convertSlides() {
+
+ var sections = document.querySelectorAll( '[data-markdown]');
+
+ for( var i = 0, len = sections.length; i < len; i++ ) {
+
+ var section = sections[i];
+
+ // Only parse the same slide once
+ if( !section.getAttribute( 'data-markdown-parsed' ) ) {
+
+ section.setAttribute( 'data-markdown-parsed', true )
+
+ var notes = section.querySelector( 'aside.notes' );
+ var markdown = getMarkdownFromSlide( section );
+
+ section.innerHTML = marked( markdown );
+ addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
+ section.parentNode.getAttribute( 'data-element-attributes' ) ||
+ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
+ section.getAttribute( 'data-attributes' ) ||
+ section.parentNode.getAttribute( 'data-attributes' ) ||
+ DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
+
+ // If there were notes, we need to re-add them after
+ // having overwritten the section's HTML
+ if( notes ) {
+ section.appendChild( notes );
+ }
+
+ }
+
+ }
+
+ }
+
+ // API
+ return {
+
+ initialize: function() {
+ processSlides();
+ convertSlides();
+ },
+
+ // TODO: Do these belong in the API?
+ processSlides: processSlides,
+ convertSlides: convertSlides,
+ slidify: slidify
+
+ };
+
+}));
diff --git a/framework/scripts/plugins/markdown/marked.js b/framework/scripts/plugins/markdown/marked.js
new file mode 100755
index 0000000..ca558fb
--- /dev/null
+++ b/framework/scripts/plugins/markdown/marked.js
@@ -0,0 +1,37 @@
+/**
+ * marked - a markdown parser
+ * Copyright (c) 2011-2013, Christopher Jeffrey. (MIT Licensed)
+ * https://github.com/chjj/marked
+ */
+
+(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
+text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";block.html=replace(block.html)("comment",/\x3c!--[\s\S]*?--\x3e/)("closed",
+/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1",
+"\\2")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm)if(this.options.tables)this.rules=block.tables;else this.rules=block.gfm}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};
+Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1)this.tokens.push({type:"space"})}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,
+"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,
+"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);
+bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+
+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item[item.length-1]==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script",text:cap[0]});continue}if(top&&
+(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^\x3c!--[\s\S]*?--\x3e|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
+code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;
+if(!this.links)throw new Error("Tokens array requires a `links` property.");if(this.options.gfm)if(this.options.breaks)this.rules=inline.breaks;else this.rules=inline.gfm;else if(this.options.pedantic)this.rules=inline.pedantic}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);
+out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1][6]===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=''+text+"";continue}if(cap=this.rules.url.exec(src)){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=''+text+"";continue}if(cap=this.rules.tag.exec(src)){src=src.substring(cap[0].length);
+out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);out+=this.outputLink(cap,{href:cap[2],title:cap[3]});continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0][0];src=cap[0].substring(1)+src;continue}out+=this.outputLink(cap,link);continue}if(cap=this.rules.strong.exec(src)){src=
+src.substring(cap[0].length);out+=""+this.output(cap[2]||cap[1])+"";continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=""+this.output(cap[2]||cap[1])+"";continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=""+escape(cap[2],true)+"";continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+="
";continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=""+
+this.output(cap[1])+"";continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(cap[0]);continue}if(src)throw new Error("Infinite loop on byte: "+src.charCodeAt(0));}return out};InlineLexer.prototype.outputLink=function(cap,link){if(cap[0][0]!=="!")return'"+this.output(cap[1])+"";else return'
"};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i0.5)ch="x"+ch.toString(16);out+=""+ch+";"}return out};function Parser(options){this.tokens=[];this.token=null;
+this.options=options||marked.defaults}Parser.parse=function(src,options){var parser=new Parser(options);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options);this.tokens=src.reverse();var out="";while(this.next())out+=this.tok();return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;
+while(this.peek().type==="text")body+="\n"+this.next().text;return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"
\n";case "heading":return""+this.inline.output(this.token.text)+" \n";case "code":if(this.options.highlight){var code=this.options.highlight(this.token.text,this.token.lang);if(code!=null&&code!==this.token.text){this.token.escaped=true;this.token.text=code}}if(!this.token.escaped)this.token.text=
+escape(this.token.text,true);return""+this.token.text+"
\n";case "table":var body="",heading,i,row,cell,j;body+="\n\n";for(i=0;i'+heading+"\n":""+heading+" \n"}body+=" \n\n";body+="\n";for(i=0;i\n";for(j=0;j'+cell+"\n":""+cell+" \n"}body+="\n"}body+=" \n";return"\n"+body+"
\n";case "blockquote_start":var body="";while(this.next().type!=="blockquote_end")body+=this.tok();return"\n"+body+"
\n";case "list_start":var type=this.token.ordered?"ol":"ul",body="";while(this.next().type!=="list_end")body+=
+this.tok();return"<"+type+">\n"+body+""+type+">\n";case "list_item_start":var body="";while(this.next().type!=="list_item_end")body+=this.token.type==="text"?this.parseText():this.tok();return""+body+" \n";case "loose_item_start":var body="";while(this.next().type!=="list_item_end")body+=this.tok();return""+body+" \n";case "html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;case "paragraph":return""+this.inline.output(this.token.text)+
+"
\n";case "text":return""+this.parseText()+"
\n"}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=
+1,target,key;for(;iAn error occured:"+escape(e.message+"",true)+"
";throw e;}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:""};marked.Parser=Parser;marked.parser=Parser.parse;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;
+marked.parse=marked;if(typeof exports==="object")module.exports=marked;else if(typeof define==="function"&&define.amd)define(function(){return marked});else this.marked=marked}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
diff --git a/framework/scripts/prefixfree.min.js b/framework/scripts/prefixfree.min.js
new file mode 100644
index 0000000..be1d354
--- /dev/null
+++ b/framework/scripts/prefixfree.min.js
@@ -0,0 +1,5 @@
+/**
+ * StyleFix 1.0.3 & PrefixFree 1.0.7
+ * @author Lea Verou
+ * MIT license
+ */(function(){function t(e,t){return[].slice.call((t||document).querySelectorAll(e))}if(!window.addEventListener)return;var e=window.StyleFix={link:function(t){try{if(t.rel!=="stylesheet"||t.hasAttribute("data-noprefix"))return}catch(n){return}var r=t.href||t.getAttribute("data-href"),i=r.replace(/[^\/]+$/,""),s=t.parentNode,o=new XMLHttpRequest,u;o.onreadystatechange=function(){o.readyState===4&&u()};u=function(){var n=o.responseText;if(n&&t.parentNode&&(!o.status||o.status<400||o.status>600)){n=e.fix(n,!0,t);if(i){n=n.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,t,n){return/^([a-z]{3,10}:|\/|#)/i.test(n)?e:'url("'+i+n+'")'});var r=i.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");n=n.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+r,"gi"),"$1")}var u=document.createElement("style");u.textContent=n;u.media=t.media;u.disabled=t.disabled;u.setAttribute("data-href",t.getAttribute("href"));s.insertBefore(u,t);s.removeChild(t);u.media=t.media}};try{o.open("GET",r);o.send(null)}catch(n){if(typeof XDomainRequest!="undefined"){o=new XDomainRequest;o.onerror=o.onprogress=function(){};o.onload=u;o.open("GET",r);o.send(null)}}t.setAttribute("data-inprogress","")},styleElement:function(t){if(t.hasAttribute("data-noprefix"))return;var n=t.disabled;t.textContent=e.fix(t.textContent,!0,t);t.disabled=n},styleAttribute:function(t){var n=t.getAttribute("style");n=e.fix(n,!1,t);t.setAttribute("style",n)},process:function(){t('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link);t("style").forEach(StyleFix.styleElement);t("[style]").forEach(StyleFix.styleAttribute)},register:function(t,n){(e.fixers=e.fixers||[]).splice(n===undefined?e.fixers.length:n,0,t)},fix:function(t,n,r){for(var i=0;i-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig,function(e,t,n,r){return t+(n||"")+"linear-gradient("+(90-r)+"deg"}));e=t("functions","(\\s|:|,)","\\s*\\(","$1"+s+"$2(",e);e=t("keywords","(\\s|:)","(\\s|;|\\}|$)","$1"+s+"$2$3",e);e=t("properties","(^|\\{|\\s|;)","\\s*:","$1"+s+"$2:",e);if(n.properties.length){var o=RegExp("\\b("+n.properties.join("|")+")(?!:)","gi");e=t("valueProperties","\\b",":(.+?);",function(e){return e.replace(o,s+"$1")},e)}if(r){e=t("selectors","","\\b",n.prefixSelector,e);e=t("atrules","@","\\b","@"+s+"$1",e)}e=e.replace(RegExp("-"+s,"g"),"-");e=e.replace(/-\*-(?=[a-z]+)/gi,n.prefix);return e},property:function(e){return(n.properties.indexOf(e)?n.prefix:"")+e},value:function(e,r){e=t("functions","(^|\\s|,)","\\s*\\(","$1"+n.prefix+"$2(",e);e=t("keywords","(^|\\s)","(\\s|$)","$1"+n.prefix+"$2$3",e);return e},prefixSelector:function(e){return e.replace(/^:{1,2}/,function(e){return e+n.prefix})},prefixProperty:function(e,t){var r=n.prefix+e;return t?StyleFix.camelCase(r):r}};(function(){var e={},t=[],r={},i=getComputedStyle(document.documentElement,null),s=document.createElement("div").style,o=function(n){if(n.charAt(0)==="-"){t.push(n);var r=n.split("-"),i=r[1];e[i]=++e[i]||1;while(r.length>3){r.pop();var s=r.join("-");u(s)&&t.indexOf(s)===-1&&t.push(s)}}},u=function(e){return StyleFix.camelCase(e)in s};if(i.length>0)for(var a=0;a element, we may need it for slides that don't have titles
+var documentTitle = document.title + '';
+
+var _ = window.SlideShow = function(slide) {
+ var me = this;
+
+ // Set instance
+ if(!window.slideshow) {
+ window.slideshow = this;
+ }
+
+ // Current slide
+ this.index = this.slide = slide || 0;
+
+ // Current .delayed item in the slide
+ this.item = 0;
+
+ // Create timer, if needed
+ this.duration = body.getAttribute('data-duration');
+
+ if(this.duration > 0) {
+ var timer = document.createElement('div');
+
+ timer.id = 'timer';
+ timer.setAttribute('style', PrefixFree.prefixCSS('transition-duration: ' + this.duration * 60 + 's;'));
+ body.appendChild(timer);
+
+ addEventListener('load', function() {
+ timer.className = 'end';
+
+ setTimeout(function() {
+ timer.classList.add('overtime');
+ }, me.duration * 60000);
+ });
+ }
+
+ // Create slide indicator
+ this.indicator = document.createElement('div');
+
+ this.indicator.id = 'indicator';
+ body.appendChild(this.indicator);
+
+ // Add on screen navigation
+ var onscreen = document.createElement('nav');
+ onscreen.id = 'onscreen-nav';
+
+ var prev = document.createElement('button');
+ prev.className = 'onscreen-nav prev';
+ prev.textContent = '◀';
+ prev.type = 'button';
+ prev.onclick = function() { me.previous(); }
+
+ var next = document.createElement('button');
+ next.className = 'onscreen-nav next';
+ next.textContent = 'Next ▶';
+ next.type = 'button';
+ next.onclick = function() { me.next(); }
+
+ onscreen.appendChild(prev);
+ onscreen.appendChild(next);
+ onscreen.style.display = 'none';
+ document.body.appendChild(onscreen);
+
+ // Expand multiple imported slides
+ $$('.slide[data-base][data-src*=" "]').forEach(function(slide) {
+ var hashes = slide.getAttribute('data-src').split(/\s+/).forEach(function (hash) {
+ var s = slide.cloneNode(true);
+ s.setAttribute('data-src', hash);
+ slide.parentNode.insertBefore(s, slide);
+ });
+
+ slide.parentNode.removeChild(slide);
+ });
+
+ // Get the slide elements into an array
+ this.slides = $$('.slide', body);
+
+ // Get the overview
+ this.overview = function(evt) {
+ if(body.classList.contains('show-thumbnails')) {
+ body.classList.remove('show-thumbnails');
+ body.classList.remove('headers-only');
+ }
+ else {
+ body.classList.add('show-thumbnails');
+
+ if(evt && (!evt.shiftKey || !evt.ctrlKey)) {
+ body.classList.add('headers-only');
+ }
+
+ body.addEventListener('click', function(evt) {
+ var slide = evt.target;
+
+ while(slide && !slide.classList.contains('slide')) {
+ slide = slide.parentNode;
+ }
+
+ if(slide) {
+ me.goto(slide.id);
+ //setTimeout(function() { me.adjustFontSize(); }, 1000); // for Opera
+ }
+
+ body.classList.remove('show-thumbnails');
+ body.classList.remove('headers-only');
+
+ body.removeEventListener('click', arguments.callee);
+ }, false);
+ }
+ }
+
+ // Process iframe slides
+ $$('.slide[data-src]:not([data-base]):empty').forEach(function(slide) {
+ var iframe = document.createElement('iframe');
+
+ iframe.setAttribute('data-src', slide.getAttribute('data-src'));
+ slide.removeAttribute('data-src');
+
+ slide.appendChild(iframe);
+ });
+
+ $$('.slide > iframe:only-child').forEach(function(iframe) {
+ var slide = iframe.parentNode,
+ src = iframe.src || iframe.getAttribute('data-src');
+
+ slide.classList.add('iframe');
+
+ if(!slide.classList.contains('notitle')) {
+ addTitle(slide, src, iframe.title);
+ }
+
+ slide.classList.add('onscreen-nav');
+ });
+
+ this.isIpad = navigator.userAgent.indexOf('iPad;') > -1;
+
+ // Order of the slides
+ this.order = [];
+
+ for (var i=0; i -1;
+
+ if (slides.length) {
+ var iframe = document.createElement('iframe');
+ var hash = slides[0].getAttribute('data-src');
+ iframe.className = 'csss-import';
+ iframe.src = url + hash;
+
+ document.body.insertBefore(iframe, document.body.firstChild);
+
+ // Process the rest of the slides, which should use the same iframe
+ slides.forEach(function (slide) {
+ var hash = slide.getAttribute('data-src');
+
+ slide.classList.add('dont-resize');
+
+ this.onSlide(slide.id, function () {
+ onscreen.style.display = '';
+
+ iframe.src = iframe.src.replace(/#.+$/, hash);
+ iframe.className = 'csss-import show';
+ });
+ }, this);
+ }
+ }, this);
+
+ function addTitle(slide, url, title) {
+ var h = document.createElement('h1'),
+ a = document.createElement('a');
+
+ title = title || slide.title || slide.getAttribute('data-title') ||
+ url.replace(/\/#?$/, '').replace(/^\w+:\/\/(www\.)?/, '');
+
+ a.href = url;
+ a.target = '_blank';
+ a.textContent = title;
+ h.appendChild(a);
+
+ slide.appendChild(h);
+ }
+};
+
+_.prototype = {
+ handleEvent: function(evt) {
+ var me = this;
+
+ // Prevent script from hijacking the user’s navigation
+ if (evt.metaKey && evt.keyCode) {
+ return true;
+ }
+
+ switch(evt.type) {
+ /**
+ Keyboard navigation
+ Ctrl+G : Go to slide...
+ Ctrl+H : Show thumbnails and go to slide
+ Ctrl+P : Presenter view
+ (Shift instead of Ctrl works too)
+ */
+ case 'keyup':
+ if((evt.ctrlKey || evt.shiftKey) && !evt.altKey && !/^(?:input|textarea)$/i.test(document.activeElement.nodeName)) {
+ switch(evt.keyCode) {
+ case 71: // G
+ var slide = prompt('Which slide?');
+ me.goto(+slide? slide - 1 : slide);
+ break;
+ case 72: // H
+ me.overview(evt);
+ break;
+ case 74: // J
+ if(body.classList.contains('hide-elements')) {
+ body.classList.remove('hide-elements');
+ }
+ else {
+ body.classList.add('hide-elements');
+ }
+ break;
+ case 80: // P
+ // Open new window for attendee view
+ this.projector = open(location, 'projector');
+
+ // Get the focus back
+ window.focus();
+
+ // Switch this one to presenter view
+ body.classList.add('presenter');
+ }
+ }
+ break;
+ case 'keydown':
+ /**
+ Keyboard navigation
+ Home : First slide
+ End : Last slide
+ Space/Up/Right arrow : Next item/slide
+ Ctrl + Space/Up/Right arrow : Next slide
+ Down/Left arrow : Previous item/slide
+ Ctrl + Down/Left arrow : Previous slide
+ (Shift instead of Ctrl works too)
+ */
+ if(evt.target === body || evt.target === body.parentNode || evt.metaKey && evt.altKey) {
+ if(evt.keyCode >= 32 && evt.keyCode <= 40) {
+ evt.preventDefault();
+ }
+
+ switch(evt.keyCode) {
+ case 33: //page up
+ this.previous();
+ break;
+ case 34: //page down
+ this.next();
+ break;
+ case 35: // end
+ this.end();
+ break;
+ case 36: // home
+ this.start();
+ break;
+ case 37: // <-
+ case 38: // up arrow
+ this.previous(evt.ctrlKey || evt.shiftKey);
+ break;
+ case 32: // space
+ case 39: // ->
+ case 40: // down arrow
+ this.next(evt.ctrlKey || evt.shiftKey);
+ break;
+ }
+ }
+ break;
+ case 'load':
+ // case 'resize':
+ // this.adjustFontSize();
+ // break;
+ case 'hashchange':
+ this.goto(location.hash.substr(1) || 0);
+ }
+ },
+
+ start: function() {
+ this.goto(0);
+ },
+
+ end: function() {
+ this.goto(this.slides.length - 1);
+ },
+
+ /**
+ @param hard {Boolean} Whether to advance to the next slide (true) or
+ just the next step (which could very well be showing a list item)
+ */
+ next: function(hard) {
+ if(!hard && this.items.length) {
+ this.nextItem();
+ }
+ else {
+ this.goto(this.index + 1);
+
+ this.item = 0;
+
+ // Mark all items as not displayed, if there are any
+ if(this.items.length) {
+ for (var i=0; i 0) {
+ this.previousItem();
+ }
+ else {
+ this.goto(this.index - 1);
+
+ this.item = this.items.length;
+
+ // Mark all items as displayed, if there are any
+ if(this.items.length) {
+ for (var i=0; i *', this.slides[this.slide]);
+ this.items.stableSort(function(a, b){
+ return (a.getAttribute('data-index') || 0) - (b.getAttribute('data-index') || 0)
+ });
+ this.item = 0;
+
+ this.projector && this.projector.goto(which);
+
+ // Update next/previous
+ var previousPrevious = this.slides.previous,
+ previousNext = this.slides.next;
+
+ this.slides.previous = this.slides[this.order[this.index - 1]];
+ this.slides.next = this.slides[this.order[this.index + 1]];
+
+ this.slides.previous && this.slides.previous.classList.add('previous');
+ this.slides.next && this.slides.next.classList.add('next');
+
+ if (previousPrevious && previousPrevious != this.slides.previous) {
+ previousPrevious.classList.remove('previous');
+ }
+
+ if (previousNext && previousNext != this.slides.next) {
+ previousNext.classList.remove('next');
+ }
+ }
+
+ // If you attach the listener immediately again then it will catch the event
+ // We have to do it asynchronously
+ var me = this;
+ setTimeout(function() {
+ addEventListener('hashchange', me, false);
+ }, 1000);
+ },
+
+ gotoItem: function(which) {
+ this.item = which;
+
+ var items = this.items, classes;
+
+ for(var i=items.length; i-- > 0;) {
+ classes = this.items[i].classList;
+
+ classes.remove('current');
+ classes.remove('displayed');
+
+ if (classes.contains('dummy') && items[i].dummyFor) {
+ items[i].dummyFor.removeAttribute('data-step');
+ }
+ }
+
+ for (var i=this.item - 1; i-- > 0;) {
+ items[i].classList.add('displayed');
+ }
+
+ if (this.item > 0) { // this.item can be zero, at which point no items are current
+ var item = items[this.item - 1];
+
+ item.classList.add('current');
+
+ // support for nested lists
+ for (var i = this.item - 1, cur = items[i], j; i > 0; i--) {
+ j = items[i - 1];
+ if (j.contains(cur)) {
+ j.classList.remove('displayed');
+ j.classList.add('current');
+ }
+ }
+
+ if (item.classList.contains('dummy') && item.dummyFor) {
+ item.dummyFor.setAttribute('data-step', item.dummyIndex);
+ }
+ }
+
+ this.projector && this.projector.gotoItem(which);
+ },
+
+ adjustFontSize: function() {
+ // Cache long lookup chains, for performance
+ var htmlStyle = html.style,
+ scrollRoot = html.scrollHeight? html : body,
+ innerHeight = window.innerHeight,
+ innerWidth = window.innerWidth,
+ slide = this.slides[this.slide];
+
+ // Clear previous styles
+ htmlStyle.fontSize = '';
+
+ if(body.classList.contains('show-thumbnails')
+ || slide.classList.contains('dont-resize')) {
+ return;
+ }
+
+ for(
+ var percent = 100;
+ (scrollRoot.scrollHeight > innerHeight || scrollRoot.scrollWidth > innerWidth) && percent >= 35;
+ percent-=5
+ ) {
+ htmlStyle.fontSize = percent + '%';
+ }
+
+ // Individual slide
+
+ if(slide.clientHeight && slide.clientWidth) {
+ // Strange FF bug: scrollHeight doesn't work properly with overflow:hidden
+ var previousStyle = slide.getAttribute('style');
+ slide.style.overflow = 'auto';
+
+ for(
+ ;
+ (slide.scrollHeight > slide.clientHeight || slide.scrollWidth > slide.clientWidth) && percent >= 35;
+ percent--
+ ) {
+ htmlStyle.fontSize = percent + '%';
+ }
+
+ slide.setAttribute('style', previousStyle);
+ }
+
+ if(percent <= 35) {
+ // Something probably went wrong, so just give up altogether
+ htmlStyle.fontSize = '';
+ }
+ },
+
+ // Is the element on the current slide?
+ onCurrent: function(element) {
+ var slide = _.getSlide(element);
+
+ if (slide) {
+ return '#' + slide.id === location.hash;
+ }
+
+ return false;
+ },
+
+ onSlide: function(id, callback, once) {
+ var me = this;
+
+ id = (id.indexOf('#') !== 0? '#' : '') + id;
+
+ var fired = false;
+
+ if (id == location.hash) {
+ callback.call(this.slides[this.slide]);
+ fired = true;
+ }
+
+ if (!fired || !once) {
+ addEventListener('hashchange', function() {
+ if (id == location.hash) {
+ callback.call(me.slides[me.slide]);
+ fired = true;
+
+ if (once) {
+ removeEventListener('hashchange', arguments.callee);
+ }
+ }
+
+ });
+ }
+ }
+};
+
+/**********************************************
+ * Static methods
+ **********************************************/
+
+// Helper method for plugins
+_.getSlide = function(element) {
+ var slide = element;
+
+ while (slide && slide.classList && !slide.classList.contains('slide')) {
+ slide = slide.parentNode;
+ }
+
+ return slide;
+}
+
+})(document.head || document.getElementsByTagName('head')[0], document.body, document.documentElement);
+
+// Rudimentary style[scoped] polyfill
+if (!('scoped' in document.createElement('style'))) {
+ addEventListener('load', function(){ // no idea why the timeout is needed
+ $$('style[scoped]').forEach(function(style) {
+ var rulez = style.sheet.cssRules,
+ parentid = style.parentNode.id || SlideShow.getSlide(style).id || style.parentNode.parentNode.id;
+
+ for(var j=rulez.length; j--;) {
+ var selector = rulez[j].selectorText.replace(/^|,/g, function($0) {
+ return '#' + parentid + ' ' + $0
+ });
+
+ var cssText = rulez[j].cssText.replace(/^.+?{/, selector + '{');
+
+ style.sheet.deleteRule(j);
+ style.sheet.insertRule(cssText, j);
+ }
+
+ style.removeAttribute('scoped');
+ style.setAttribute('data-scoped', '');
+ });
+ });
+}
diff --git a/index.html b/index.html
deleted file mode 100755
index 0a01172..0000000
--- a/index.html
+++ /dev/null
@@ -1,510 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Welcome to Ladies Learning Code!
-
- In partnership with:
- 
-
-
-
-
- Introduction to JavaScript
-
-
-
- (Interactive code slides thanks to CoderDeck!)
-
-
-
-
-
- Course Outline
- The morning
-
- - Development Environment: tools you need to get started
- - Technology Overview: Programming and JavaScript
- - Part 1: Getting started with variables and operators
- - Part 2: Functions
-
- Afternoon
-
- - Part 3: Making decisions with conditionals
- - Part 4: Objects
- - Part 5: The DOM and manipulating objects on a HTML page
-
-
- Homestretch
-
-
-
-
-
-
-
-
-
- Development Environment
- 3 2 tools you need to get started
-
-
-
-
- 1. Web Browser
-
- Choose a modern web browser that has good, built-in development tools to help make building web pages easier.
-
-
-
-
-
-
-
- (If you are unable to install Chrome:
-
- install
- Firefox and
- Firebug
- .)
-
-
-
-
-
- 2. Code Editor
-
- There are many, many free and paid options* but let's keep it simple for our mentors today and just use the same editor.
-
-
-
-
-
-
-
- *Others include: TextMate, Notepad++, and Text Wrangler.
-
- Ask a group of developers what they use and arguments will ensue -- it's a very personal choice! ;)
-
-
-
-
-
- 3. File Transfer Program (FTP)
-
- Do you already have your own hosted website? FTP software will let you copy the files you work on today to somewhere where the rest of the world can see them!
-
-
-
-
-
-
-
- Again, there are many, many free and paid options.
-
- FileZilla
- is good when you're more advanced.
-
-
-
-
-
- Technology Overview
- Programming and JavaScript
-
-
-
-
- What is JavaScript?
-
- It's a
- programming language
-
- designed to run in your web browser to
-
- manipulate content on web pages.
-
-
-
-
-
- What is JavaScript?
-
- It's a
- programming language
-
- designed to run in your web browser to
-
- manipulate content on web pages.
-
-
-
-
-
- What is Programming?
-
- A
- program
- is a set of instructions
- meant for a computer to execute.
-
- Computers are fast but blind.
- 
-
-
-
-
- Better Code = Clearer Instructions
-
- Think about a tourist that stops you to ask for directions:
-
- The clearer the instructions, the more likely they will get to their destination.
-
-
-
-
-
-
- Break it down
-Suppose I want a computer to say hello to using my name.
-Break down the steps as much as possible:
-
- - Allow me to type in my name.
- - Remember my name.
- - Say "Hello" and repeat back my name.
-
-
-
-
-
-
-
-
- What is a Programming Language?
-
- Programming is about having a conversation with your computer.
-
- Computers only understand things when you speak to them in a certain way. Much like English or any other natural language, programming is about sticking to grammar rules -- this is called
- syntax
- .
-
-
Computers have come a long way since their binary days (0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1) so meet them half-way.
-
-
-
-
-
- Example Programming Syntaxes
- Different programming languages have different syntax.
- Here are two ways a computer could say hi to me:
-
- Java
- Scanner userInput = new Scanner(System.in);
-String name;
-System.out.print("What's your name? ");
-name = userInput.next();
-System.out.println("Hello, " + name);
-
-
- JavaScript ( Try it out now!
- )
-
- var name;
-name = window.prompt("What's your name?",'');
-document.write("Hello, " + name);
-
-
-
-
-
- JavaScript versus Java
-
- They might vaguely look the same (as a lot of programming languages do) but they are not related at all.
-
-
-
- (Java was really popular at the time so Netscape just hijacked the name.)
-
-
-
-
-
- What is JavaScript?
-
- It's a
- programming language
-
- designed to run in your web browser to
-
- manipulate content on web pages.
-
-
-
-
-
- JavaScript in the Browser
-
- C++, Java, and .NET are also programming languages but they can be run directly by the operating system
- (e.g. Windows, Mac, Linux).
-
-
- JavaScript is typically meant to be run in a
- web browser
- (e.g. Safari, Firefox, Chrome, Internet Explorer).
-
-
-
-
-
-
-
-
- Web Programming Languages: Server-side vs Client-side
- 
-
- Java, .NET, PHP or Ruby can be considered server-side or "back-end" web technology because the code is typically compiled and executed by the operating system of a computer serving up web pages.
-
- JavaScript is referred to as a client-side or "front-end" web technology because it's interpreted by the web browser.
-
-
-
-
-
- Simple Client-Side Code Check
-
-
-
-
-
-At any time, someone can right-click and "view source" on a web page to see all the JavaScript that went into it.
-(I suggest that you do this yourself every time you see something you like!)
-
-
-
- Whereas for server-side code, it's sometimes a mystery what technology is running on a server.
-
-
-
-
-
-
- What is JavaScript?
-
- It's a
- programming language
-
- designed to run in your web browser to
-
- manipulate content on web pages.
-
-
-
-
-
- The Web Triad
-
- JavaScript was meant to manipulate webpages written in HTML and works in tandem with CSS.
-
-
-
- HTML (Hypertext Markup Language)
- is the markup language.
- CSS (Cascading Style Sheets)
- is the style sheet language.
- JavaScript
- is the programming language.
-
-
- 
- 
- 
-
-
- It should define the content.
- It should define the presentation
- It should define behaviour.
-
-
-
-
-
-
- JavaScript in Different Browsers
-
- For the most part, JavaScript will run the same in various web browsers but sometimes they say "hi" with different accents.
Imagine a British accent versus a Texas accent -- it's still English underneath but there's some variations and unique slang.
- This is especially noticeable with newer "HTML5" features.
- Insert Internet Explorer joke here. ;)
-
-
-
-
-
- A JavaScript Experiment
-
- JavaScript is essential for "AJAX", "Web 2.0", and "HTML5" websites.
-
-
- Try this experiment: Turn off JavaScript in your web browser. Go to the JavaScript settings for Chrome (
- chrome://settings/content
- ) and select "Do not allow any site to run JavaScript"
-
- Then visit your daily sites.
-
- e.g.
- Google
- ,
- Facebook
- ,
- Twitter
-
- (Remember to turn JavaScript back on to see this presentation!)
-
-
-
-
-
- A JavaScript Experiment: Results
- Note the sometimes subtle and sometimes major differences:
-
- -
- No search auto-completion and instant page refreshes on google.com
-
- -
- No inline video content or lightboxed photo viewers on facebook.com -- not to mention broken "Like" buttons and inability to comment on posts!
-
- -
- On twitter.com - the "more" link doesn't work, can't expand tweets inline, the media gallery doesn't show.
-
- -
- And you can't see it but most analytics tracking won't work either.
-
-
- The modern web just sort of gives up without JavaScript!
-
-
-
-
-
- JavaScript helps make very nice websites!
-
- Especially "one-page apps" where the experience is very seamless.
-
-
-
-
-
- Like
- this one
-
-
-
-
-
-
-
-
-
-
-
- (Use the left and right keyboard arrow keys to navigate within sections. Click the "next" arrow to move to the next section.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/instructor-notes.html b/instructor-notes.html
new file mode 100644
index 0000000..e26e95c
--- /dev/null
+++ b/instructor-notes.html
@@ -0,0 +1,132 @@
+
+
+
+
+
+ Canada Learning Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jquery-indepth.html b/jquery-indepth.html
deleted file mode 100755
index a80c4cc..0000000
--- a/jquery-indepth.html
+++ /dev/null
@@ -1,482 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- jQuery Hands-on
- Intro to jQuery and External JavaScript Files
-
-
-
-
-
-
- 
- The Write Less, Do More, JavaScript Library
-
-
-
-
- jQuery: A brief introduction
-
- jQuery is a cross-browser JavaScript library designed to simplify client-side scripting, manipulating HTML pages, animating and handling events.
-
- jQuery is still JavaScript. It is a library of functions built on top of JavaScript to simplify your program. It does, however, have it's own syntax as well.
-
- The library contains many, many built-in functions and methods. It's not an easy task to remember them all. Never fear, jQuery has documented their API here: http://api.jquery.com.
-
- Let dive in and see how jQuery methods compare to using just JavaScript alone.
-
-
-
-
-
- jQuery vs JavaScript
- Including inline JavaScript into your web page only requires the code to be written between the <script></script> tags.
- In jQuery, the document needs to be "ready". This bit of code needs to wrap all of your jQuery: $(document).ready(function(){});. Your code goes between the curly braces {}, and will only run once the DOM is ready.
-
-
-<script>
- // JavaScript code here
-</script>
-
-<script>
- $(document).ready(function(){
- //jQuery code here
- });
-</script>
-
-
-
-
-
- More on $(document).ready
- Remember document.write()? The functionality is similar. document is the object, write() is the method we use to pass in parameters. (see slide)
-
- In jQuery syntax, the $ is simply a shorcut for a function called jQuery. It is how you access all of the functionality in the library. To select the document jQuery style, it looks like this:
-
-$(document)
-
- .ready() specifies a function to execute when the DOM is loaded.
-
-$(document).ready();
-
- An "anonymous function" needs to be passed into the above code to execute the jQuery code.
-
-//syntax for anonymous function
-function(){
- code goes here
-}
-
-// pass the anonymous function in the ready() method
-$(document).ready(function(){
- jQuery code here
-});
-
-
-
-
-
-
- jQuery vs JavaScript (cont)
-
- Remember document.getElementById?
- jQuery makes it easier to reference objects in the DOM.
-
-
-<div id="status">
- <p>Loading...</p>
- <p><img src="assets/loading.gif"></p>
-</div>
-
-
-
-// JavaScript
-document.getElementById("status")
-
-// jQuery
-$("#status")
-
-
- Your HTML tag must have an id attribute in order to do this!
- Use #name to reference and ID and .name to reference a class
-
-
-
-
-
-
- jQuery vs JavaScript (cont)
- Let's see how the JavaScript innerHTML example can be done with jQuery
- to replace what's already in an element.
-
-
-
-
-
- jQuery vs JavaScript (cont)
- You can also use "dot notation" to write the statement in one line instead of declaring a variable.
-
-
-
-
-
-
- External JavaScript
- Keeping it organized, working with others
and adding libraries
-
-
-
-
- <script src="">
- As you write bigger pieces of JavaScript, you will want to start putting your code into their own files so they are easier to manage. Or you might want to enlist the help of others to write JavaScript for your website so you can work on different sections separately. A big site could have thousands of lines of code written by many different people!
- To link to an external JavaScript file:
-
-<html>
- <head>
- <title>JavaScript example!</title>
- <script src="scripts.js"></script>
- </head>
- <body>
- <div id="example">This is an example.</div>
- </body>
-</html>
-
-
- You might see script tags with the type attribute, type="text/javascript", when looking at older code. We used to have to specify this, but it's no longer required in HTML5.
-
-
-
-
-
- In the external file
- In the external JavaScript file (scripts.js) you don't include script tags; just JavaScript code.
- View this example: exercises/external-javascript.html
-
-
-
-
- script tag gotchas
- Even though you're not writing JavaScript between the script tags, you must use a closing </script> tag. A self-closing tag such as <script src="scripts.js" /> will not work. The correct way is highlighted below:
-
-
-<script src="scripts.js"></script>
-
-
-
-
-
-
- jQuery: Getting started
- To make use of the jQuery library, it needs to be included on the web page using an external file. There are two ways to include the file.
-
- 1. Download the jQuery library and include it with your files.
-
-<script src="jquery.js"></script>
-
- 2. Link directly to the CDN (Content Delivery Network) hosted copies.
-
-<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
-
-
- Download instructions: http://jquery.com/download
-
-
-
-
-
- Gotchas!
- When adding your own custom-written jQuery/JavaScript files, make sure to include it after the jQuery file to ensure that the library loads first.
-
-
-<script src="jquery.js"></script>
-<script src="custom.js"></script>
-
-
-
-
-
- jQuery Selectors: Syntax Review
- Selectors are always surrounded by single or double quotes, except when referencing a variable.
-
- <div class="name">Class selector<div>
- <div id="name">ID selector<div>
-
- $(".name") - referencing a class
- $("#name") - referencing an ID
- $("div") - referencing an HTML element
-
- var selector = $("name");
- $(selector) - referencing a variable
-
-
-
-
-
-
- jQuery Events
- Just like Javascript functions, we can execute the code on an event. A very common event is the click event.
-
-
-$(selector).click(function(){
- //code to execute
-});
-
- click() triggers a click event, the selector is the element to be clicked and function goes between the parenthesis to run a function, containing one more commands.
-
-
-
-
-
-
- jQuery AND JavaScript
- jQuery may have its own syntax and methods but it's still JavaScript at its core. Let's look at a previous example and see how jQuery and JavaScript work together.
-
- In the exercises folder, open jquery-javascript.html and jquery-javascript.js.
- While it works using pure JavaScript, the functions are currently being called "inline" by adding an onclick directly in the element. It's best practice to avoid inline event handlers.
-
- Let's use the jQuery click() method instead and use it to select the element and pass the related function.
-
-
-
-
-
- jQuery Effects
-
- There are many handy built in methods that make it simpler to add effects. The full list is available here. It's searchable and provides explanations and examples.
- Here's an example of how to use the .hide() and .show() methods.
-
-
-
-
-
-
- Mini-exercise (20 mins)
jQuery Effects
- Let's practice adding some more jQuery effects and using external javascript files.
-
- - In the exercises folder, open the jquery-effects.html into your text editor. HTML and CSS is already provided.
- - Include the jQuery library using one of the CDN hosted links listed here.
- - Create your own external file called 'jquery-effects.js' to write your own jQuery and included it in the HTML page.
- - Reference the previous example and add click events using the classes supplied in the
<a> links, to add the following effects:
-
- show()
- hide()
- slideDown()
- slideToggle()
- fadeOut()
- fadeIn()
-
-
-
-
- jQuery effects documentation: http://api.jquery.com/category/effects/
- jQuery click event documentation: http://api.jquery.com/click/
- Solutions posted in the solutions folder.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_arrays_loops.html b/js_arrays_loops.html
deleted file mode 100755
index 44909b8..0000000
--- a/js_arrays_loops.html
+++ /dev/null
@@ -1,503 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part ??
- Arrays and Loops
-
-
-
-
- Arrays
-
-
- Arrays are similar to objects; they both hold a collection of values. However, arrays hold its values in a numerical index rather than labels.
-
-
- Think of arrays as egg cartons. All the eggs are in one carton but each egg has its own slot.
-
-
-
- Just like variables and objects, declare an array with the keyword var.
-
-
- var eggspressions = [];
-
-
- Unlike objects, arrays are declared with square brackets [ ].
-
-
-
-
-
- Arrays How-to
-
-//declaring an empty array
-var eggspressions = [];
-
- Set values using a square bracket [ ] notation.
-
-//assigning values
-eggspressions[0] = "skeptical";
-eggspressions[1] = "frazzled";
-eggspressions[2] = "silly";
-eggspressions[3] = "giggling";
-
-
- The numbers inside the square brackets [ ] are referred to as the
-
- index number. Array indexes always start at zero.
-
-
-
-
- Arrays can be declared in different ways.
-
- The above example can also be declared like this:
-
- var eggspressions = ["skeptical","frazzled","silly", "giggling"];
-
- To read up more on Arrays, go here:
- https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array
-
-
-
-
-
-
- Arrays and Indexes
-
- Index numbers are used to assign values.
-
-
- Index numbers are also used to access values.
-
-
- To access the value of the second egg in the eggspressions array, use index 1 since it's the second item in the list.
-
-
-
-
-
-
- Arrays and Properties
-
- Since Arrays are also objects, there are many properties associated with the Array object.
-
-
- The length property is also associated with array objects.
-
- As mentioned previously, the length property returns the number of characters when associated with a string. When used with an Array, the length property returns the number of elements.
-
-
-
-
-
-
- Arrays & Length: Why?
-
- It is common to use JavaScript to run through a list of values and apply some code to it. In order to do this, we need to know how many elements there are in total.
-
-
- Let's look at this photo gallery from
- theglobeandmail.com
- and figure out how length can be used here.
-
- 
- *
-
-
-
-
- Arrays & Length and the 0 Index
- How do we access a particular value?
- By using the index number.
-
- So how do we access the
- last
- value?
-
-
-var eggspressions = [];
-eggspressions[0] = "skeptical";
-eggspressions[1] = "frazzled";
-eggspressions[2] = "silly";
-eggspressions[3] = "giggling";
-
-
- To access the last index value, you can use
- eggspressions[3].
-
- BUT...
-
- You can also use
- eggspressions[eggspressions.length-1].
-
-
-
-
-
- Huh?
-
-
-
-
-
- REWIND: Arrays & Length
-
- and the 0 Index
-
-
-var eggspressions = [];
-eggspressions[0] = "skeptical";
-eggspressions[1] = "frazzled";
-eggspressions[2] = "silly";
-eggspressions[3] = "giggling";
-
- Let's break it down.
- › eggspressions.length returns 4
- › index of last element is 3
- › eggspressions.length-1 is the same as 4 - 1 and will return 3
- › eggspressions[3] returns the last value
- › eggspressions[eggspressions.length-1] is the same as eggspressions[3]
-
- Clear as mud?
-
-
-
-
- How is this useful?
-
- Since the index always begins at 0, the last index value is always length-1.
- This is useful if you want to always access the last index, despite new additions, and apply some code to it.
-
-
- *
-
-
-
-
- Loopty-Loops
-
-
- Why use loops? Because sometimes we need to execute repetitive code for a specified number of times or through a list of values.
-
-
- Loops will execute the same code continuously, using conditional statements to determine when to begin and stop.
-
- It's like creating a playlist on your favorite music player.
-
- You create a list of songs, press play and then each song is played automatically in the set order of the playlist.
-When it reaches the end of the playlist, it stops.
-
-
- We will be discussing
- while loops
- and
- for loops.
-
-
-
-
-
- While Loop
-
- The
- while loop
- executes the code contained in curly braces { }
- while
- the condition is true.
-
-
- An index variable is required to keep track of its place in the loop.
-
-
- The
- while loop
- stops executing the code once the condition becomes false.
-
-
- If you had 10 songs in your playlist, the player won't stop until it reaches the end of song 10.
-
-
-//declare index variable
-var i = 0;
-
-while ( i < playlist.length ) {
- playCurrentSong();
- i = i + 1; // adds 1 to the current index so it moves to the next song
-}
-
-
-
-
- If the condition is always true, the loop will run infinitely and will never exit the while loop.
-This can cause your browser to crash!
-
-
-
-
-
-
- While Loop in Action!
-
-
- Let's use the while loop to output the mathematical formula for converting Celsius to Fahrenheit.
-
- (The formula is: Temperature = Temperature * 9 / 5 + 32)
-
- This next example uses a while loop to output the results of the temperature formula into HTML table rows that are also added dynamically.
-
-
- It will stop when we reach 30 degrees Celsius (or whatever number is declared in the condition).
-
- See next slide for the example.
-
-
-
-
- While Loop Temperature Conversion
-
- Let's look at the temperature conversion table with and without JavaScript and compare the difference in the amount of repetitive code required to create a table like this manually.
-
-
- Conversion table using a while loop.
-
-
- Conversion table without JavaScript.
-
-
- View source and compare the difference between the amount of code.
-
-
-
-
-
-
-
-
-
- For Loops
-
- A for loop also loops through the code a specified number of times until the condition is false.
-
- The index, conditional test and incrementer are all declared in one line. Basically, it's the while loop condensed.
-
-/* While Loop */
-var i = 0; //index
-while ( i < playlist.length ) { //condition
- playCurrentSong();
- i = i + 1; // incrementer
-}
-
-
-/* For Loop */
-// index, condition, incrementer
-for ( var i = 0; i < playlist.length; i++ ) {
- playCurrentSong();
-}
-
-
- Incrementer (i++) and decrementer (i--) operators add or subtract one.
- i++ is the same as i = i + 1
- i-- is the same as i = i - 1
-
-
-
-
-
- For Loops and Arrays
-
- For loops are useful when used it conjunction with arrays because it can be used to execute specific actions while going through the list of values.
-
-
- Back to our robot store. It wouldn't be much of a store if there was only one product!
-We can create a list of different products with various prices by creating an array.
-
-
-var productPrices = [];
-productPrices[0] = 17.99;
-productPrices[1] = 25;
-productPrices[2] = 13.99;
-productPrices[3] = 9.99;
-productPrices[4] = 24.99;
-productPrices[5] = 8.99;
-
-
-
-
-
- For Loops, Arrays, Robots and Sales
- Suppose we wanted to put all the items over $15 on sale? Let's use the for loop to determine which items are eligible for the sale and output the product number.
-
-
-
-
-
- Mini-exercise #6 (10-15 minutes)
-
- As owner of Planet Robot, you decide to have a special members-only sale: 50% off all items with a secret password! (p.s. the password is "llc"!)
-
-
- Sounds like a great deal for the customer but all you have is a static HTML page right now. Are you going to go through every single product, calculate the discounted price, and then update every entry manually? No, you're going to use loops and arrays!
-
-
- Download the HTML exercise file:
- exercises/shopping_cart_products_start.html
-
- TODO: Check within the code for your THREE tasks.
-
-
- If you're stuck, here's the solution file:
-
- exercises/shopping_cart_products_final.html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_conditionals.html b/js_conditionals.html
deleted file mode 100755
index 1251180..0000000
--- a/js_conditionals.html
+++ /dev/null
@@ -1,778 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part 3
- Making decisions with conditionals
-
-
-
-
- Conditional Statements
- Let's pretend to be your wise but nagging grandmother right now:
-
- - I hear it's cold out: bring a sweater!
- - The weather network says it's going to rain: take your umbrella!
- - It's cold and snowing: wearing your warm boots!
-
- All these things make logical sense to us as grown up humans but computers are a blank slate.
- As a programmer, you try to give the computer the smarts to act on its own based on possible circumstances or events by using CONDITIONALS.
-
-
-
-
-
- If Conditionals
- ...
-
-
-
- A basic conditional test looks like this:
- IF the weather is raining
-
- THEN bring an umbrella
-
-
-
- In JavaScript,
- it might look like this:
-
-if ( weather == rain ) {
- bringUmbrella();
-}
-
-
-
-
-
-
-
- The round brackets ()
- group together a condition to test.
- The curly braces {}
- group together a set of statements to execute.
-
-
-
-
-
- Important!
-Assignment is not the same as equality
-
- Drill this into your head. Tattoo it to your arm! So many errors happen because of this key difference:
-
-
-
- =
- assignment
-
- Store a value to a variable:
-
- var kitten = "Fluffy";
-
-
- ==
- equality
-
- Compare a value to another value:
-
- if ( kitten == cat )
-
-
-
-
-
-
-
- Using Several If Conditionals
- Sometimes it can be rainy but warm, or rainy and cold. You react to each thing individually.
- Use several if statements when you're testing mutually inclusive scenarios.
-
-
-
- IF the weather is raining
- THEN bring an umbrella
-
-IF the temperature is below 10°C
- THEN wear a sweater
-
-
-
- In JavaScript...
-
-if ( weather == rain ) {
- bringUmbrella();
-}
-
-if ( temperature < 10 ) {
- wearSweater();
-}
-
-
-
-
-
-
-
-
-
- if/else Conditionals
- Sometimes there's a catch-all state that you want to happen if your previous tests don't happen.
-
-
-
- IF the weather is raining
- THEN bring an umbrella
- OTHERWISE
- dress normally
-
-
-
- In JavaScript...
-
-if ( weather == rain ) {
- bringUmbrella();
-} else {
- dressNormally();
-}
-
-
-
-
-
-
-
-
- if/else else if Conditionals
- It shouldn't snow and rain at the same time so sometimes these conditions are mutually exclusive.
-
-
-
-
- IF the weather is raining
- THEN bring an umbrella
- BUT IF the weather is snowing
- THEN wear warm boots
- OTHERWISE
- dress normally
-
-
-
- In JavaScript...
-
-if ( weather == rain ) {
- bringUmbrella();
-} else if ( weather == snow ) {
- wearWarmBoots();
-} else {
- dressNormally();
-}
-
-
-
-
-
-
-
-
-
- Conditionals used for UI elements
- A basic conditional that your browser does internally is to react to mouse clicks on a HTML element.
- 
-
-
-<button onclick="animate()">Pull</button>
- IF a user has clicked on a button
- THEN call the animate() function.
-
-
-
-
-
-
-
-
-
-
-
-
- ...And Interactivity
- Notice how the brush acts when you speed up / slow down, or get close to other lines. You can even change brushes.
- 
-
-
-
-
-
-
-
- ...And Games!
- (Notice how the birds fly differently based on how far you pull them back in the slingshot, and in what direction.)
- 
-
-
-
-
-
-
- Conditional Statements Summary
-
-
-
- If Statement
- If...else statement
- If...else if...else statement
-
-
-
-
-
-
-
-
-if (condition) {
- // do something
-}
-
-
-
-
-if (condition) {
- // do something
-} else {
- // otherwise do this
-}
-
-
-
-
-if (condition) {
- // do something
-} else if (condition2) {
- // do something else
-} else {
- // otherwise do this
-}
-
-
-
-
-
-
-
-
-
-
-
- Testing Conditions
- What does a condition actually look like?
- if ( condition ) { ... }
- Let's try also comparing Booleans using variables, Numbers, and Strings.
-
-
-
-
-
-
-
- Cheat Sheet: Comparison and Logical Operators
-
-
- Here's a cheat sheet of different operators that can be used in conditional statements.
- Using these two variables, var two = 2 and var ten = 10 , the examples below show how the statements would return true using the various operators.
-
-
-
- Comparison operators
-
-
- ==
- is equal to
- ten == two * 5
-
-
- ===
-
- is exactly equal to
-
- (value and type)
-
-
- ten === 10
-
- ten === "10" (false)
-
-
-
- !=
- is not equal to
- ten !== two
-
-
- >
- greater than
- ten > two
-
-
- <
- less than
-
- two
- < ten
-
-
-
- >=
- greater than or equal to
-
- ten >= two * 5
-
- ten >= two * 5 + 1
-
-
-
- <=
- less than for equal to
-
- two
- <= ten
-
- two
- <= 2
-
-
-
-
-
- Logical operators
-
-
- &&
- and
-
- (ten
- < 11 && ten > 9)
-
-
-
- ||
- or
- (ten == 10 || two == 2)
-
-
- !
- not
- !(ten == two)
-
-
-
-
-
-
-
-
- More Conditional Examples
-
- Let's look at some examples. What do you think the output will be? Uncomment the code to be executed for each condition to see if the result is what you expected. Try changing the variable values too!
-
-
-
-
-
-
- Variables, Operators, Concatenation and Conditionals
- Now that we know what variables, operators and conditionals are, let's put them all into action using dynamic content.
-
-
-
-
-
-
- Mini-exercise (10 minutes)
- Quantity Check
- Uh-oh! Someone can attempt to put a negative number of products in their shopping cart! (This is based on the previous Quantity mini-exercise so it should look very familiar!)
-
-
- 1. Use a conditional test to avoid a negative quantity. Typically this involves comparing against the number 0 and you can go about it in a few ways with the same result.
- 2. Similarly, warn the user that they are attempting to check out with an empty basket.
- 3. Bonus: Practice your concatention and display the price using a dollar sign.
-
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
- Mini-exercise (5-10 minutes)
- Form validation
-
-
- Let's revisit the shipping information form again -- however you don't want someone to be able to submit their order if they haven't filled out their address!
-
-
- You have been supplied with 1 variable (address). After you press the "Check out now!" button, address which will automagically update to what is typed into the text field.
-
-
- 1. Use a conditional test so someone cannot supply a blank address.
Hint: If you don't type anything into the address field, you get an empty string. Remember that an empty string is simply two quotes with nothing inbetween them. e.g. var emptyString = "";)
-
-
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
- Mini-exercise (15-20 minutes)
- Complex form validation
-
- Now here's a more complex shopping form that you require all fields to be filled in. You have been supplied with 3 additional variables which will automagically update: name, city, and postal.
-
-
-
- 1. Use a conditional to verify that ALL the fields have been filled in. (Hint: How do you test for something AND something else OR another thing at one time? Try looking at the cheatsheet on Slide #12 of this section.)
-
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
-
-
-
-
-
-
-
- (Use the left and right keyboard arrow keys to navigate within sections. Click the "next" arrow to move to the next section.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_debugging.html b/js_debugging.html
deleted file mode 100755
index a394659..0000000
--- a/js_debugging.html
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Going Beyond JavaScript Basics
- You're getting to be quite the pro!
-
-
-
-
- Debugging!
- Squash those crawly things in your code.
-
-
-
-
- What's a Bug?
- As the story goes, the term "software bug" got its name because a real moth flew into a computer system causing strange, unexpected behaviours to happen in a computer program.
- Nowadays, bugs are mostly due to human error in one of two areas:
-
- -
- Syntax - missing semi-colons, typos, case-sensitivity
- -
- Logic - trying to access a variable that doesn't exist yet, writing an incorrect conditional test
- Luckily there's a few things to help us hunt them down quicker...
-
-
-
-
- Chrome Developer Console
- Use the built in developer tools in Chrome to debug your code. (Firefox+Firebug is similar but not exactly the same.)
- [Settings Icon] > Tools > Developer Tools ( Cmd+Opt+I for Mac, Ctrl+Shift+I for Windows) Click on the Console tab.
- 
-
-
-
-
- Right click > Inspect Element
- Easiest way to remember is to right-click on any web page and select "Inspect Element". In the new panel, select the "Console" tab to see JavaScript errors or to play in the console sandbox.
- 
-
-
-
-
- Inspecting the DOM
- You can inspect any webpage with the debugger.
- Let's open up the Ladies Learning Code Events page: http://ladieslearningcode.com/events/.
- How can we use the console to find out how many events are listed on this page?
-
-
-
-
- More info
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_dom.html b/js_dom.html
deleted file mode 100755
index 8789409..0000000
--- a/js_dom.html
+++ /dev/null
@@ -1,519 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part 5
- The DOM and manipulating objects on a HTML page
-
-
-
-
- The Components of a Web Page
- Think about your HTML web page (your "browser document") as being made up of many blocks.
- 
-
-
-
-
-
- Pre-defined Blocks
- Some blocks are defined by the browser, such as the browser window.
- 
-
-
-
-
-
- User-defined Blocks
- And some blocks we make ourselves via HTML
- (e.g. <fieldset>, <div>, and <img> HTML tags).
- 
-
-
-
-
- Document Objects
- All of these blocks are objects -- just like the ones we covered earlier! And all these objects have pre-written functions/methods you can use.
- Does the line of code below make more sense now? document is one of the main objects of a web page and it has a method named write that accepts a string as a parameter. document has lots of other properties and methods too: check out this list.
-
-
-
-
-
-
- HTML Element Objects
- The most common thing you'll do with JavaScript is get references to your HTML tags ("elements") via document.getElementById().
- Important! Your HTML tag must have an id attribute in order to do this!
-
-<div id="status">
- <p>Loading...>/p>
- <p><img src="assets/loading.gif"</p>
-</div>
-
-
-
-
-
- HTML Element Objects
- For example, let's get a reference to the "status" div element by using document.getElementById(). Then confirm this by dynamically reading all the HTML in it using the innerHTML property.
- (You can find all the things you can do with elements here.)
-
-
-
-
-
-
- HTML Element Objects (cont'd)
- You can also use innerHTML to replace what's already in an element.
-
-
-
-
-
-
-
- HTML Element Objects (cont'd)
- Or let's dynamically swap out one image for another by updating the src attribute of an image tag.
-
-
-
-
-
-
-
-
- However there is an easier way!
- Typing document.getElementById() gets tedious after a while so many people will use a JavaScript library to make repetive tasks easier.
- With the jQuery library:
-
- document.getElementById("status")
-
- document.getElementById("robot")
-
-
➞
-
-$("#status")
-
-$("#robot")
-
-
- Just remember that it is still JavaScript under the hood!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_functions.html b/js_functions.html
deleted file mode 100755
index 43767a7..0000000
--- a/js_functions.html
+++ /dev/null
@@ -1,720 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part 2
- Functions
-
-
-
-
- Functions in JavaScript
-
- Remember, functions are used to make the code "do things." It is especially useful for repetitive tasks.
-
- prompt()
- and
- alert()
- are two functions that are pre-written into JavaScript.
-
- But sometimes you need to group tasks that aren't covered by one of the pre-written functions.
- That's when we create our own!
-
-
-
-
- Defining a Function
-
- To create a function, it needs to be defined
- first.
-
-
- There are different ways to define a function, but the most common way is using the
- function keyword.
-
-
- The keyword is followed by the function name, of your choosing, and round brackets (). And finally, the code to be executed are enclosed within curly braces { }.
-
-
-function nameOfFunction() {
- //code to execute
-}
-
-
-
-
-
- Calling a Function
- Let's define a function called sayMyName and use alert() to get the computer to "say" our names. The code within a function doesn't execute until it's called.
- Functions can also be used inside other functions too.
-
- We've seen functions being called already!
-
-
-
-
-
-
- //Here's the syntax again
- function nameOfFunction() {
- code to execute
- }
-
-
-
-
-
- Functions & Events
-
- The browser executes the JavaScript as soon as the page loads.
-
-
- But sometimes you need to control when it executes, like when someone rolls over a navigation item or presses a submit button. These are referred to as an events.
-
- In other words, functions can be used to execute events.
-
-
-
-Note: You can use onclick() on any HTML element
-
- <div onclick="sayMyName();">
- Click here to call the function!
- </div>
-
-
-
-
-
-
- Who loves Ladies Learning Code?
- Run it and see what happens!
-
-
-
-
-
- Mini-exercise (5-10 minutes):
- Quantities
- Let's create a one-product shopping page where you can update the
- quantity by adding or removing it from the shopping cart.
- Here's what it should look like:
- 
-
-
-
-
- Mini-exercise (5-10 minutes):
- Quantities
- Use the quantity variable to keep track of additions and subtractions to the running total.
-
- 1. The "Add" and "Remove" buttons haven't been clicked yet so quantity needs to be initialized to a default value first. Replace the asterix with your answer.
- 2. Use your knowledge of arithemetic operators and variable assignment to re-calculate the value of quantity.
- 3. Same as step 2 above.
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
- Functions in Functions
-
- Let's take a closer look at our functions.
-
-
-<script>
- var quantity = 0;
-
- function addItem() {
- quantity = quantity + 1;
- refreshTotal();
- }
- function removeItem(){
- quantity = quantity - 1;
- refreshTotal();
- }
-
- function refreshTotal() {
- document.getElementById('updateQuantity').value = quantity;
- }
-</script>
-
-<!-- HTML and CSS -->
-<link rel="stylesheet" href="exercises/slides.css" type="text/css" media="screen" />
-<div class="item">
- <img src="assets/plush-android.jpg" width="195" height="195" />
- <br />
- <button onclick="addItem();">Add</button>
- <button onclick="removeItem();">Remove</button>
- <br />
- Quantity
- <input type="text" id="updateQuantity" value="0" readonly />
- <br />
- <br />
- Total Cost:
- <input type="text" id="updateTotal" value="0" readonly />
-</div>
-
-
-
-
-
- Mini-exercise (5-10 minutes):
- Quantities and Total Cost
- Let's re-visit the Quantities exercise and add a text field to show the total cost. If the Android plushie cost $20 each, how do we calculate the total cost?
-
-
-
-
-
-
-
- Review: What do we know about Functions so far?
-
- › Created & defined by using the function keyword
- › Used to group together related lines of code and store them into descriptive names
- › Can be reused just by calling the function name
- › Define the function first but it will not run until you call the function
- › Can be used inside another function
-
-
-
-
- Functions and Pizza
-
- Let's order a pizza! The orderPizza() function below represents all the steps it takes to place an order (find the pizza place's phone number, call them, give them your address, etc).
-
-
- Inside the function is where the pizza restaurant will hold our options choices (toppings, crust type and size of pizza). Now they can use this stored information to make our order.
-
-
-
-
-
-
- More Pizza!
-
- What if we want to order another pizza but with different options?
-
- Let's order another pizza by creating another function.
-
-
-
-
-
-
-
-
- Global vs Local Variables
-
- Let's say the pizza place always want to include cheese as a basic topping in all of the pizzas. We can declare a
- baseTopping
- variable outside of the function so it can be accessible from anywhere in the program.
-
-
-
-
-
-
-
- Functions, Pizza and Parameters
-
- This could get cumbersome if we wanted to make a lot of pizzas. How can we re-use the makePizza() function instead of creating multiple functions? We use parameters.
-
-
- Functions can be used with one parameter, more than one parameter or none at all.
-
-
-
-
-
-
-
-
- Review: Functions and Parameters
- Functions are more flexible when used with parameters because variables can be passed into the function.
- In the makePizza() function, the variables from inside the function were removed and added as parameters. Now when we call the function we can pass the values right into the function.
-
-
-
-
- Inline JavaScript
-
- JavaScript can appear
- inline
- in a webpage in several spots. Either in the
- <head>
- section or anywhere in the
- <body>
- section.
-
-
- <html>
- <head>
- <title>JavaScript example!</title>
-
- <script type="text/javascript">
- alert("I'm in the head tag!");
- </script>
-
- </head>
- <body>
- <div id="example">This is an example.</div>
-
- <script type="text/javascript">
- alert("I'm in the body tag!");
- </script>
-
- </body>
-</html>
-
-
- Need to manipulate an html tag or have a quick loading page? Put the JavaScript just before the
- closing
- <body>
- tag.
-
-
-
-
-
- Using a Code Editor
- Go to the exercises folder and open up pizzaMaking.html
-(Psst: It's also in the ZIP folder that you downloaded earlier today.)
-
-
- Most computers are set to open .html files in the default web browser so right-click (Command+click or 2-finger click on Mac) and select the "open with..." option.
-
-
-
-
- Using a Code Editor
- Uh oh!
- This is almost the same code as previous. Why isn't it making pizza? :(
-
Spoiler! Click here to show answer if you really can't find it...
- On line 16, there is a double quote missing before thin crust.
-
-
-
- Take note of how your code is being coloured. It's the first sign of a possible syntax error and will save you headaches later.
-
- Some editors do a better job than others -- that's what you pay for sometimes.
-
-
-
-
- Mini-exercise (now until lunch)
- Wing machine
- 1. Using pizzaMaking.html as an example, create a new .html file named wingMaking.html.
-
2. Use inline JavaScript and write a new function that makes wings with these 3 variations:
-
- - Style e.g. crispy or regular
- - Spice Level e.g. mild, medium, hot
- - Sauce e.g. BBQ, honey mustard, buffalo, Thai
-
- 3. Use parameters in a single function to create multiple types and flavours of wings easier -- versus writing multiple wing making functions.
- If you're really stuck, go to the solutions folder and open up wingMaking.html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_objects.html b/js_objects.html
deleted file mode 100755
index 1309a72..0000000
--- a/js_objects.html
+++ /dev/null
@@ -1,372 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part 4
- Objects
-
-
-
-
- Objects
- If variables are boxes, OBJECTS can be thought of as bento boxes -- "advanced variables" if you will.
- 
-
-
-
-
- How Bento Boxes are like Objects
-
-
-
-
-
-
-
-
- A basic variable only holds one value.
- var takeout = "Fried Rice";
-
-
-
-
-
-
-
- An object holds a collection of values.
- // create a new object
-var bentobox = {};
-
-// fill it with stuff
-bentobox.main = "Teriyaki";
-bentobox.side = "Tempura";
-bentobox.salad = "Seaweed Salad";
-bentobox.soup = "Miso";
-bentobox.sauce = "Soya";
-bentobox.dessert = "Fruit";
-
-
-
-
-
-
- Creating an Object
- Creating an object is easy. Just like any other variable, use the var keyword and give it a descriptive name.
- But instead of assigning a single value right away, use these curly braces to make an empty object.
- var bentobox = {};
- Yes, it's weird but think about the {} as a sort of funky container.
-
-
-
- Object Properties
- The "compartments" of objects are called PROPERTIES.
- If you already have an existing object, there are a few ways to access and set a value to a property. Since these two are very commonly used, they will both be discussed.
-
-
-
-
- Dot notation:
-myObject.property = value;
-
-
-bentobox.main = "Teriyaki";
-bentobox.side = "Tempura";
-
-
-
-
- Key-Value Lookup:
- myObject[key] = value;
-
-
-
-bentobox["main"] = "Teriyaki";
-bentobox["side"] = "Tempura";
-
-
-This will be most useful after you understand arrays. Advantage:
-You can use concatenation with the key string in order to do look up something that's partially dynamic:
-
-
-
-
-
-bentobox.soup0 = "Miso";
-bentobox.soup1 = "Udon";
-
-
-
-
-bentobox["soup"+1] = "Miso";
-bentobox["soup"+2] = "Udon";
-
-
-
-
- Advanced sidenote:
-Alternatively, you can both declare an object and set it's values at the same time:
-var bentobox = { soup:"Miso", main:"Teriyaki" };
-
-
-
- Why use Objects?
- Advanced topic: Objects are useful because you group all these properties together and you can reuse the object over again.
- There's an expectation of what you'll get in a bento box.
-
-Some items are fixed (a fruit dessert, a miso soup) but some compartments can be edited (a gyoza side versus tempura).
-
-
- 
- 
-
-
-
-
-
-
- Think of Everything as an Object*
- When I said that objects were "advanced variables", here's another way of looking at it:
- All JavaScript variables can be treated like objects too.
-
- If curly braces are a container for a generic object, quotes are containers for characters. When we get to arrays next, you'll see that it uses square brackets. (The only "uncontainered" object we've introduced today was a number.)
-
-
- var stringObject = “ ”;
-var arrayObject = [ ];
-
- Some objects are simpler than others but almost everything in JavaScript has properties available to us.
- *Again, I need to oversimplify. The concept called DATA TYPE is a hairy topic. For more info: http://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/ and http://www.2ality.com/2011/03/javascript-values-not-everything-is.html
-
-
-
-
- Built-in JavaScript Properties
- In this workshop we won't be creating any of our own objects but JavaScript already has many objects built into the language.
- Let's look at a string object and the length property which returns the number of characters in a string. Try putting your own name in here.
-
-
-
-
-
- Functions in Objects
- Previously, we talked about functions as blocks of re-usable code. This might sound crazy but you can store functions in variables too!
-
-
-
- This function...
-
-function sayHello(){
- document.write("hello");
-}
-
-sayHello();
-
-
-
-
- ➞
-
-
- is the same as:
-
-sayHello = function() {
- document.write("hello");
-}
-
-sayHello();
-
-
-
-
-
-
-
-
- ↆ
-
-
-
-
-
-
-
- But now look at this!
-
-var welcomeTeam = {};
-welcomeTeam.sayHello = function() {
- document.write("hello");
-}
-welcomeTeam.sayHello();
-
-
-
-
-
-
-
-
- Object Methods
- When a function is associated with an object we call it a METHOD.
- Let's say you're having a robot sale! Everything is 50% off. But, after doing the math, you notice that the sale price is a bit off.. Let's declare a sale price and manipulate it using toFixed(). When you use a method, it gives you access to all the hard work that someone else did and it only takes you one line to use it!
-
-
-
-
-
-
-
-
- Object Methods
- Here's another METHOD associated with strings.
- Have you ever created an email newsletter? You usually have a template but you want to replace [First Name] with someone's actual name. Use .replace() for that!
-
-
-
-
-
-
-
- Looking up properties and references
- length and toFixed() are only two of many (many!) more built-in properties and methods of objects in JavaScript.
- Check out this list: http://www.scribd.com/doc/19457597/Javascript-Methods.
- Or this cheatsheet: http://www.cheatography.com/davechild/cheat-sheets/javascript/.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/js_quick_start.html b/js_quick_start.html
deleted file mode 100755
index f11a569..0000000
--- a/js_quick_start.html
+++ /dev/null
@@ -1,782 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JavaScript Part 1
- Getting started with an intro to functions,
- variables and operators
-
-
-
-
- As the owner of the thriving store, Planet Robots, you have to make sure you have a top notch website.
-
-
-
-
-
-
-
- JavaScript Exercise Overview
-
- You'll want your site to be capable of offering online shopping and to collect customer information to print shipping labels.
- You'll also want to make sure that everything works properly as well. That means customers can't submit empty forms and product totals are calculated properly in their shopping carts.
- In order to create a website that can handle these requirements, we will need to learn how to use functions, variables, and conditionals.
-
-
-
-
- Intro to Functions
-
- What is something that you do that's very repetitive or a hassle? Wouldn't it be great if it was automated?
-
-
-
- Paying for parking:
-
-
-
- The old way
-
-
-
- The improved way
-
-
-
-
-
-
- - Find bank machine
- - Pull out bank card
- - Get money out from ATM
- - Buy chips so you can make change
- - Put change into machine
- - Take receipt
-
-
-
-
- - Pull the PayPass credit card from your wallet
- - Tap
- - Take receipt
-
-
-
-
-
-
-
-
- Intro to Functions
- We can think of step 2 as a function. We can't see all the steps that happen but we know that performing the action of tapping the card will execute some instructions that will allow us to pay automatically.
-
-
-
- The improved way
-
-
-
-
-
-
- - Pull the PayPass credit card from your wallet
- - Tap
- - Take receipt
-
-
-
-
-
-
-
-
- Intro to Functions
-
- Functions are used to make the code "do things."
- To get the function to execute, you have to call the function by using the function name followed by round brackets.
- If the credit card tap was a function in JavaScript, it could look something like this:
- tapCard()
-
-
-
- Intro to Functions
- We can create our own functions but there are already some handy ones built into JavaScript. There are three functions that are useful for testing and writing code.
-
- prompt(); and alert(); show popups in the browser.
- document.write(); outputs text onto the page, aka the document.
-
-
-
-
- document.write(); is a quick and easy way to output text onto the page but is not best practice for use in "the real world." console.log(); is better. Here's some more info.
-
-
-
-
-
- Comments
-
- Sometimes you want to write notes to yourself (and others) to organize blocks of code or leave explanations. Use comments! JavaScript will ignore comments and not execute them.
-
-
-// This is how you leave a single line comment.
-
-// You can write many single line comments.
-// Just make sure to add the double slash
-// for every new line.
-
- Here's another way to comment larger blocks of text.
-
-/* This is how you leave
-multi-line comments for when you
-want to write a longer message */
-
- Multi-line comments are great for "hiding" large blocks of code so you can try something new without erasing your old code.
-
-
-
-
- Variables
-
- Variables are like containers or a box. They are used to store values so you can use them later on, when you need them.
- 
-
-
-
-
- Variables How-to
- Declare variables with the keyword var.
- var email;
- Assign a value to the variable using the equals (=) sign.
- email = "hi@youremail.com";
- Now the computer will remember my email address!
-
- Take note that the value of the variable is written between quotes.
- More on this soon.
-
-
-
-
-
- Variables (cont'd)
-
- Variables are also like the computer's short-term memory. It doesn't remember anything unless instructed. In this example, the computer can't remember anybody's name!
- But it can remember it if we use a variable.
-
-
-
-
-
-
- Variables (cont'd)
-
-
- In a web checkout form that asks for your name and address, variables can be used to store this information.
- The stored information can then be used to create things like shipping labels.
-
-
-
-
-
-
-
-
-
- Aside: Statements
-
- Statements are commands that tell the computer what to do.
- End a statement with a semicolon (;) to tell the computer that the statement is done.
- Ending a statement with a semicolon is like ending a sentence with a period.
- You can also declare a variable with one or two statements.
-var email;
-email = "hi@youremail.com";
-
-is the same as
-var email = "hi@youremail.com";
-
-
-
-
-
- Say My Name, Say My Name
-
- Let's try creating some variables.
- Below is an example of a variable for your name. Try creating another variable for your email address. Output the values using document.write().
-
-
-
-
-
-
- Assigning Variables
-
- IMPORTANT!
-
- Using the equals (=) symbol in Javascript is NOT the same as in math.
-
- var total = 1 + 1
- is not the same as
- 1 + 1 = 2
-
- var total = 1 + 1 means:
- evaluate everything to the right of the equals sign (e.g. 1 + 1),
-
then assign this value (e.g. the number 2) to the variable on the left side.
-
- You will see later that we can re-assign new values to an existing variable.
-
-
-
-
- Various Variables
- Variables can hold different kinds of values. We've been using strings so far but variables can also hold other kinds of values.
- 1. Numeric variable (integers & decimals)
-
-var someIntegerNumber = 10;
-var someDecimalNumber = 10.5;
-
- 2. Boolean variable (true/false)
-
-var isSaturday = true;
-var isSunday = false;
-
- 3. String variable (letters, words & sentences)
-
-var singleWordString = "hello";
-var sentenceString = "Hello, good day to you!";
-var numberString = "10";
-
-
- Only string values are written inside single or double quotes ('string' or "string").
-
-
-
-
-
-
- Variables: Tips & Best Practices
- Variables can't contain spaces. Use a convention called camel case.
-
Every new word is capitalized and the result looks likeCamelHumps.
-
- JavaScript is case sensitive (uppercase and lowercase letters are treated differently) so variable names are also case sensitive.
- Another convention is to use underscores to_separate_words. This is common in other programming languages (like PHP).
-
-
-
-
-
-
- Variables: Tips & Best Practices
-
- When naming a variable, it's best to give it a descriptive name.
-
-
- It makes it easier to see, at a glance, what kind of value that variable is going to hold.
-
-
- This is especially useful when sharing code with others who may not use the same kinds of abbreviations.
-
-
- var firstName; ← Clear that first name will go here.
-
- var fn; ← Not as obvious as firstName.
-
- var x; ← Not clear at all.
-
-
-
-
-
- Variables: Tips & Best Practices
-
- Variables cannot start with a number or any special characters except for underscores (_) and dollar signs ($).
-
-
- Although it's valid to use underscore or a dollar sign, they should only be used in special circumstances.
-
-
-
-
-
-
-
-
-
- Whitespace in JavaScript
-
- Whitespace refers to blank characters and includes spaces, tabs and line breaks.
- JavaScript ignores whitespace except when used in a string.
-
-// both statements are the same to JavaScript
-var name="Your Name";
-var name = "Your Name";
-
-
-
-
-
-
- Getting user input
-
- So far we've been assigning the values to our variables. But what if we don't know what that value is going to be?
-
-
- Remember prompt()? This function triggers a popup box that allows user input. We can assign the prompt to a variable, thus saving the value of the user input.
-
-
-
-
-
-
-
- Mini-exercise (5-10 minutes):
- Simple Shipping Label
-
- Here's a simple shipping information request form via popup prompts. Right now, after you press Run, the confirmation shipping label is blank. How do we fix this?
-
-
- 1. Use variables to store your name and address.
- 2a. & 2b. To verify that your variables are working, uncomment out the document.write() lines and replace ********** with the actual name of your variables.
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
- JavaScript Arithmetic Operators
- We can also use JavaScript to do math using arithmetic operators.
- Arithmetic operators in JavaScript are (+) for addition, (-) for subtraction, (*) for multiplication and (/) for division.
-
-
-
-
-
- Arithmetic Operators and Variables
- Getting JavaScript to do math can be very useful.
- For example, we can use it to calculate totals in a shopping cart form.
- Instead of using just numbers, JavaScript can do math using variables with numerical values.
-
-
-
-
-
-
- Mini-exercise (5-10 minutes):
- Totals and Discounts
- Let's pretend that someone has checked out of our online store intending to buy 1 t-shirt and 1 Android plushie. Apply some arithmetic operations to get the final total after applying a discount.
-
- 1. Calculate the sub-total given tshirtPrice and androidPrice.
-
- 2. Calcuate the discount amount given the sub-total and discountPercentage.
-
- 3. Calcuate the final total given the sub-total and discount amount.
-
-
-
- addition (+), subtraction (-), multiplication (*), division (/)
-
-
-
- If you get stuck, click here for the full solution.
Or if you want to reset, click here for the original code.
-
-
-
-
-
- Operators: Numbers vs. Strings
- Remember that there are different variable types? Arithmetic operators can only be performed on numerical values.
- But numbers can be disguised as strings too!
- When the addition (+) operator is used with string values, it doesn't "add" the values, it concatenates them.
-
-
-
-
-
-
- Concatenation
- Unlike the other arithmetic operators, the (+) symbol has another purpose other than adding numbers. It is used to join strings together, also known as concatenation.
- You can concatenate variables, strings or a combination of both.
-
-
-
-
-
-
- Concatenation and Strings
- If you use the (+) operator with only numerical values, it will add the values. Otherwise, it will combine the outputs as a string.
-
-
-
-
-
-
- Concatenation Practice
- Let's practice concatenating using variables and strings.
-
-
-
-
-
-
- Re-assigning Variables
- Even after a variable has been assigned a value, we can still override it and
- re-assign a new value.
- For example, we may want to increase or decrease values.
-
-
-
-
-
-
-
-
-
-
-
-
-
- (Use the left and right keyboard arrow keys to navigate within sections. Click the "next" arrow to move to the next section.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/learner-prep-email.md b/learner-prep-email.md
new file mode 100644
index 0000000..58e56b2
--- /dev/null
+++ b/learner-prep-email.md
@@ -0,0 +1,14 @@
+Thanks for registering for the upcoming Ladies Learning Code workshop! There is no need to print a ticket or confirmation - we'll check you in electronically the day of the workshop.
+
+We want to be able to dive right in and start learning at the workshop so there are a few things you need to prepare in advance below. Reminder, this workshop is BYOL so be sure to bring a laptop, power cord and computer mouse (if you're more comfortable using one than a trackpad).
+
+HOW TO PREPARE:
+
+1. Download Google Chrome: To download Chrome, go here: http://www.google.com/chrome
+2. Download Atom Editor: http://atom.io (Sublime Text or Text Wrangler work okay, too!)
+3. Download the Learner Materials here: https://github.com/ladieslearningcode/JavaScript/archive/master.zip
+
+That's it! If you have any questions or comments there will be mentors available to help you on the day of the workshop.
+Looking forward to seeing you at the workshop!
+
+The Ladies Learning Code Team
diff --git a/lunch_break.html b/lunch_break.html
deleted file mode 100755
index 71a5fe2..0000000
--- a/lunch_break.html
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Regroup Before Lunch
- Learn from our mistakes!
- Name something that you did while writing code that caused an error. What were you attempting to do and what were your assumptions when doing it? How did you fix it?
-
- What are some questions or issues you are having with the material covered so far?
-
-
-
-
-
-
- Lunch time!
- Come back in an hour.
- While you're resting your brain, check out the next couple of slides for great examples of JavaScript.
- (Even try turning off your JavaScript to see how boring the web gets.)
-
-
-
-
- Some JavaScript Inspiration...
- (Note: Requires use of your laptop camera for head tracking!)
-
-
- 
-
-
-
-
- Some JavaScript Inspiration...
- And check out 30 top examples of JavaScript compiled by Creative Bloq.
-
-
- 
-
-
-
-
- The Ladies Learning Code Mentors
- (Aren't they awesome?)
-
-
-
-
- Now Back To Your Regularly Programmed Workshop...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/resources.html b/resources.html
deleted file mode 100755
index 921f35f..0000000
--- a/resources.html
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
- Ladies Learning Code - Intro to JavaScript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Resources
- Where to go from here?
-
-
-
- Cheatsheets and references
- From today's slides:
-
- - Javascript methods cheatsheet
- - another JavaScript cheatsheet
- - JavaScript on the Mozilla Developer Network
- (or same content but searchable via Dochub.io)
- - DOM on the Mozilla Developer Network
- (or same content but searchable via Dochub.io)
- - Stack Overflow discussion re: function order
-
- And in alpha: Adobe, Apple, Facebook, Google, HP, Microsoft, Mozilla, Nokia, Opera, and the W3C combining forces to make webplatform.org.
-
-
-
-
-
- Books
- JavaScript: The Good Parts by Douglas Crockford
- Watch this 1-hour video for a sampler, then pick up the book.
- 
-
-
-
- Books
- jQuery: Novice to Ninja by Earle Castledine and Craig Sharkie
- Make sure to get the 2nd edition book.
- 
-
-
-
- Books
- ...and lots more (free ones) at jsbooks.revolunet.com.
-
-
-
- Online tutorials or courses
-
-
-
-
- Debugging
- Become more effiecent with your dev tools. Learn how to debug using the Chrome Developer Tools.
-
-
-
-
- Thank you!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/slides.html b/slides.html
new file mode 100755
index 0000000..f8be5ab
--- /dev/null
+++ b/slides.html
@@ -0,0 +1,2168 @@
+
+
+
+
+
+ Ladies Learning Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/codemirror/LICENSE b/src/codemirror/LICENSE
deleted file mode 100755
index 3f7c0bb..0000000
--- a/src/codemirror/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2011 by Marijn Haverbeke
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/src/codemirror/README.md b/src/codemirror/README.md
deleted file mode 100755
index 3f1b1cc..0000000
--- a/src/codemirror/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# CodeMirror 2
-
-CodeMirror 2 is a rewrite of [CodeMirror
-1](http://github.com/marijnh/CodeMirror). The docs live
-[here](http://codemirror.net/manual.html), and the project page is
-[http://codemirror.net/](http://codemirror.net/).
diff --git a/src/codemirror/compress.html b/src/codemirror/compress.html
deleted file mode 100755
index a0637a0..0000000
--- a/src/codemirror/compress.html
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
- CodeMirror: Compression Helper
-
-
-
-
-
-
-{ } CodeMirror
-
-
-
/* Script compression
- helper */
-
-
- To optimize loading CodeMirror, especially when including a
- bunch of different modes, it is recommended that you combine and
- minify (and preferably also gzip) the scripts. This page makes
- those first two steps very easy. Simply select the version and
- scripts you need in the form below, and
- click Compress to download the minified script
- file.
-
-
-
-
-
-
-
-
diff --git a/src/codemirror/css/baboon.png b/src/codemirror/css/baboon.png
deleted file mode 100755
index 55d97f7..0000000
Binary files a/src/codemirror/css/baboon.png and /dev/null differ
diff --git a/src/codemirror/css/baboon_vector.svg b/src/codemirror/css/baboon_vector.svg
deleted file mode 100755
index dc1667a..0000000
--- a/src/codemirror/css/baboon_vector.svg
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/src/codemirror/css/docs.css b/src/codemirror/css/docs.css
deleted file mode 100755
index 9ea1866..0000000
--- a/src/codemirror/css/docs.css
+++ /dev/null
@@ -1,154 +0,0 @@
-body {
- font-family: Droid Sans, Arial, sans-serif;
- line-height: 1.5;
- max-width: 64.3em;
- margin: 3em auto;
- padding: 0 1em;
-}
-
-h1 {
- letter-spacing: -3px;
- font-size: 3.23em;
- font-weight: bold;
- margin: 0;
-}
-
-h2 {
- font-size: 1.23em;
- font-weight: bold;
- margin: .5em 0;
- letter-spacing: -1px;
-}
-
-h3 {
- font-size: 1em;
- font-weight: bold;
- margin: .4em 0;
-}
-
-pre {
- background-color: #eee;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- border-radius: 6px;
- padding: 1em;
-}
-
-pre.code {
- margin: 0 1em;
-}
-
-.grey {
- font-size: 2.2em;
- padding: .5em 1em;
- line-height: 1.2em;
- margin-top: .5em;
- position: relative;
-}
-
-img.logo {
- position: absolute;
- right: -25px;
- bottom: 4px;
-}
-
-a:link, a:visited, .quasilink {
- color: #df0019;
- cursor: pointer;
- text-decoration: none;
-}
-
-a:hover, .quasilink:hover {
- color: #800004;
-}
-
-h1 a:link, h1 a:visited, h1 a:hover {
- color: black;
-}
-
-ul {
- margin: 0;
- padding-left: 1.2em;
-}
-
-a.download {
- color: white;
- background-color: #df0019;
- width: 100%;
- display: block;
- text-align: center;
- font-size: 1.23em;
- font-weight: bold;
- text-decoration: none;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- border-radius: 6px;
- padding: .5em 0;
- margin-bottom: 1em;
-}
-
-a.download:hover {
- background-color: #bb0010;
-}
-
-.rel {
- margin-bottom: 0;
-}
-
-.rel-note {
- color: #777;
- font-size: .9em;
- margin-top: .1em;
-}
-
-.logo-braces {
- color: #df0019;
- position: relative;
- top: -4px;
-}
-
-.blk {
- float: left;
-}
-
-.left {
- width: 37em;
- padding-right: 6.53em;
- padding-bottom: 1em;
-}
-
-.left1 {
- width: 15.24em;
- padding-right: 6.45em;
-}
-
-.left2 {
- width: 15.24em;
-}
-
-.right {
- width: 20.68em;
-}
-
-.leftbig {
- width: 42.44em;
- padding-right: 6.53em;
-}
-
-.rightsmall {
- width: 15.24em;
-}
-
-.clear:after {
- visibility: hidden;
- display: block;
- font-size: 0;
- content: " ";
- clear: both;
- height: 0;
-}
-.clear { display: inline-block; }
-/* start commented backslash hack \*/
-* html .clear { height: 1%; }
-.clear { display: block; }
-/* close commented backslash hack */
diff --git a/src/codemirror/demo/activeline.html b/src/codemirror/demo/activeline.html
deleted file mode 100755
index 0455e8b..0000000
--- a/src/codemirror/demo/activeline.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
- CodeMirror 2: Active Line Demo
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Active Line Demo
-
-
-
-
-
- Styling the current cursor line.
-
-
-
diff --git a/src/codemirror/demo/changemode.html b/src/codemirror/demo/changemode.html
deleted file mode 100755
index 166e190..0000000
--- a/src/codemirror/demo/changemode.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
- CodeMirror 2: Mode-Changing Demo
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Mode-Changing demo
-
-
-
-On changes to the content of the above editor, a (crude) script
-tries to auto-detect the language used, and switches the editor to
-either JavaScript or Scheme mode based on that.
-
-
-
-
diff --git a/src/codemirror/demo/complete.html b/src/codemirror/demo/complete.html
deleted file mode 100755
index a38efdc..0000000
--- a/src/codemirror/demo/complete.html
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
- CodeMirror 2: Autocomplete Demo
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Autocomplete demo
-
-
-
-Press ctrl-space to activate autocompletion. See
-the code to figure out how it works.
-
-
-
-
diff --git a/src/codemirror/demo/complete.js b/src/codemirror/demo/complete.js
deleted file mode 100755
index bcaf2dd..0000000
--- a/src/codemirror/demo/complete.js
+++ /dev/null
@@ -1,151 +0,0 @@
-(function () {
- // Minimal event-handling wrapper.
- function stopEvent() {
- if (this.preventDefault) {this.preventDefault(); this.stopPropagation();}
- else {this.returnValue = false; this.cancelBubble = true;}
- }
- function addStop(event) {
- if (!event.stop) event.stop = stopEvent;
- return event;
- }
- function connect(node, type, handler) {
- function wrapHandler(event) {handler(addStop(event || window.event));}
- if (typeof node.addEventListener == "function")
- node.addEventListener(type, wrapHandler, false);
- else
- node.attachEvent("on" + type, wrapHandler);
- }
-
- function forEach(arr, f) {
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
- }
-
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- lineNumbers: true,
- theme: "night",
- onKeyEvent: function(i, e) {
- // Hook into ctrl-space
- if (e.keyCode == 32 && (e.ctrlKey || e.metaKey) && !e.altKey) {
- e.stop();
- return startComplete();
- }
- }
- });
-
- function startComplete() {
- // We want a single cursor position.
- if (editor.somethingSelected()) return;
- // Find the token at the cursor
- var cur = editor.getCursor(false), token = editor.getTokenAt(cur), tprop = token;
- // If it's not a 'word-style' token, ignore the token.
- if (!/^[\w$_]*$/.test(token.string)) {
- token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
- className: token.string == "." ? "property" : null};
- }
- // If it is a property, find out what it is a property of.
- while (tprop.className == "property") {
- tprop = editor.getTokenAt({line: cur.line, ch: tprop.start});
- if (tprop.string != ".") return;
- tprop = editor.getTokenAt({line: cur.line, ch: tprop.start});
- if (!context) var context = [];
- context.push(tprop);
- }
- var completions = getCompletions(token, context);
- if (!completions.length) return;
- function insert(str) {
- editor.replaceRange(str, {line: cur.line, ch: token.start}, {line: cur.line, ch: token.end});
- }
- // When there is only one completion, use it directly.
- if (completions.length == 1) {insert(completions[0]); return true;}
-
- // Build the select widget
- var complete = document.createElement("div");
- complete.className = "completions";
- var sel = complete.appendChild(document.createElement("select"));
- sel.multiple = true;
- for (var i = 0; i < completions.length; ++i) {
- var opt = sel.appendChild(document.createElement("option"));
- opt.appendChild(document.createTextNode(completions[i]));
- }
- sel.firstChild.selected = true;
- sel.size = Math.min(10, completions.length);
- var pos = editor.cursorCoords();
- complete.style.left = pos.x + "px";
- complete.style.top = pos.yBot + "px";
- document.body.appendChild(complete);
- // Hack to hide the scrollbar.
- if (completions.length <= 10)
- complete.style.width = (sel.clientWidth - 1) + "px";
-
- var done = false;
- function close() {
- if (done) return;
- done = true;
- complete.parentNode.removeChild(complete);
- }
- function pick() {
- insert(sel.options[sel.selectedIndex].text);
- close();
- setTimeout(function(){editor.focus();}, 50);
- }
- connect(sel, "blur", close);
- connect(sel, "keydown", function(event) {
- var code = event.keyCode;
- // Enter and space
- if (code == 13 || code == 32) {event.stop(); pick();}
- // Escape
- else if (code == 27) {event.stop(); close(); editor.focus();}
- else if (code != 38 && code != 40) {close(); editor.focus(); setTimeout(startComplete, 50);}
- });
- connect(sel, "dblclick", pick);
-
- sel.focus();
- // Opera sometimes ignores focusing a freshly created node
- if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
- return true;
- }
-
- var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
- "toUpperCase toLowerCase split concat match replace search").split(" ");
- var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
- "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
- var funcProps = "prototype apply call bind".split(" ");
- var keywords = ("break case catch continue debugger default delete do else false finally for function " +
- "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
-
- function getCompletions(token, context) {
- var found = [], start = token.string;
- function maybeAdd(str) {
- if (str.indexOf(start) == 0) found.push(str);
- }
- function gatherCompletions(obj) {
- if (typeof obj == "string") forEach(stringProps, maybeAdd);
- else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
- else if (obj instanceof Function) forEach(funcProps, maybeAdd);
- for (var name in obj) maybeAdd(name);
- }
-
- if (context) {
- // If this is a property, see if it belongs to some object we can
- // find in the current environment.
- var obj = context.pop(), base;
- if (obj.className == "variable")
- base = window[obj.string];
- else if (obj.className == "string")
- base = "";
- else if (obj.className == "atom")
- base = 1;
- while (base != null && context.length)
- base = base[context.pop().string];
- if (base != null) gatherCompletions(base);
- }
- else {
- // If not, just look in the window object and any local scope
- // (reading into JS mode internals to get at the local variables)
- for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
- gatherCompletions(window);
- forEach(keywords, maybeAdd);
- }
- return found;
- }
-})();
diff --git a/src/codemirror/demo/fullscreen.html b/src/codemirror/demo/fullscreen.html
deleted file mode 100755
index c52cafc..0000000
--- a/src/codemirror/demo/fullscreen.html
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
-
- CodeMirror 2: Full Screen Editing
-
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Full Screen Editing
-
-
-
-
- Press F11 (or ESC in Safari on Mac OS X) when cursor is in the editor to toggle full screen editing.
-
- Note: Does not currently work correctly in IE
- 6 and 7, where setting the height of something
- to 100% doesn't make it full-screen.
-
-
-
diff --git a/src/codemirror/demo/marker.html b/src/codemirror/demo/marker.html
deleted file mode 100755
index 5d05bd8..0000000
--- a/src/codemirror/demo/marker.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
- CodeMirror 2: Breakpoint Demo
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Breakpoint demo
-
-
-
-Click the line-number gutter to add or remove 'breakpoints'.
-
-
-
-
-
diff --git a/src/codemirror/demo/mustache.html b/src/codemirror/demo/mustache.html
deleted file mode 100755
index 44ce7c0..0000000
--- a/src/codemirror/demo/mustache.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
- CodeMirror 2: Overlay Parser Demo
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Overlay Parser Demo
-
-
-
-
-
- Demonstration of a mode that parses HTML, highlighting
- the Mustache templating
- directives inside of it by using the code
- in overlay.js. View
- source to see the 15 lines of code needed to accomplish this.
-
-
-
diff --git a/src/codemirror/demo/preview.html b/src/codemirror/demo/preview.html
deleted file mode 100755
index 9caf070..0000000
--- a/src/codemirror/demo/preview.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- CodeMirror 2: HTML5 preview
-
-
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: HTML5 preview
-
-
-
-
-
diff --git a/src/codemirror/demo/resize.html b/src/codemirror/demo/resize.html
deleted file mode 100755
index a21ece6..0000000
--- a/src/codemirror/demo/resize.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- CodeMirror 2: Autoresize Demo
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Autoresize demo
-
-
-
-By setting a few CSS properties, CodeMirror can be made to
-automatically resize to fit its content.
-
-
-
-
-
diff --git a/src/codemirror/demo/runmode.html b/src/codemirror/demo/runmode.html
deleted file mode 100755
index 3ae7331..0000000
--- a/src/codemirror/demo/runmode.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- CodeMirror 2: Mode Runner Demo
-
-
-
-
-
-
-
-
- CodeMirror 2: Mode Runner Demo
-
-
-
-
-
-
-
- Running a CodeMirror mode outside of the editor.
- The CodeMirror.runMode function, defined
- in lib/runmode.js takes the following arguments:
-
-
- text (string)
- - The document to run through the highlighter.
- mode (mode spec)
- - The mode to use (must be loaded as normal).
- output (function or DOM node)
- - If this is a function, it will be called for each token with
- two arguments, the token's text and the token's style class (may
- be
null for unstyled tokens). If it is a DOM node,
- the tokens will be converted to span elements as in
- an editor, and inserted into the node
- (through innerHTML).
-
-
-
-
diff --git a/src/codemirror/demo/search.html b/src/codemirror/demo/search.html
deleted file mode 100755
index 2a3bbee..0000000
--- a/src/codemirror/demo/search.html
+++ /dev/null
@@ -1,106 +0,0 @@
-
-
-
- CodeMirror 2: Search/Replace Demo
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Search/Replace Demo
-
-
-
- or
- it by
-
-
-
-
- Demonstration of search/replace functionality and marking
- text.
-
-
-
diff --git a/src/codemirror/demo/theme.html b/src/codemirror/demo/theme.html
deleted file mode 100755
index 183daf1..0000000
--- a/src/codemirror/demo/theme.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
- CodeMirror 2: Theme Demo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Theme demo
-
-
-
-Select a theme:
-
-
-
-
-
diff --git a/src/codemirror/index.html b/src/codemirror/index.html
deleted file mode 100755
index 394b0b6..0000000
--- a/src/codemirror/index.html
+++ /dev/null
@@ -1,272 +0,0 @@
-
-
-
- CodeMirror
-
-
-
-
-
-
-
-{ } CodeMirror
-
-
-
/* In-browser code editing
- made bearable */
-
-
-
-
- CodeMirror is a JavaScript library that can
- be used to create a relatively pleasant editor interface for
- code-like content ― computer programs, HTML markup, and
- similar. If a mode has been written for the language you are
- editing, the code will be coloured, and the editor will optionally
- help you with indentation.
-
- This is the project page for CodeMirror 2, the currently more
- actively developed, and recommended
- version. CodeMirror 1 is still available
- from here.
-
-
-
- Supported modes:
-
-
- - C, Java, C#, and similar
- - Clojure
- - CoffeeScript
- - CSS
- - diff
- - JavaScript
- - Haskell
- - HTML mixed-mode
- - Jinja2
- - Lua
- - Markdown
- - NTriples
- - Pascal
- - PHP
- - PL/SQL
- - Python
- - R
- - reStructuredText
- - Ruby
- - Scheme
- - Smalltalk
- - SPARQL
- - sTeX, LaTeX
- - Velocity
- - XML/HTML (alternative XML)
- - YAML
-
-
-
-
- Usage demos:
-
-
-
-
-
- Getting the code
-
- All of CodeMirror is released under a MIT-style license. To get it, you can download
- the latest
- release or the current development
- snapshot as zip files. To create a custom minified script file,
- you can use the compression API.
-
- We use git for version control.
- The main repository can be fetched in this way:
-
- git clone http://marijnhaverbeke.nl/git/codemirror2
-
- CodeMirror can also be found on GitHub at marijnh/CodeMirror2.
- If you plan to hack on the code and contribute patches, the best way
- to do it is to create a GitHub fork, and send pull requests.
-
- Documentation
-
- The manual is your first stop for
- learning how to use this library. It starts with a quick explanation
- of how to use the editor, and then describes all of the (many)
- options and methods that CodeMirror exposes.
-
- For those who want to learn more about the code, there is
- an overview of the internals available.
- The source code
- itself is, for the most part, also well commented.
-
- Support and bug reports
-
- There is
- a Google
- group (a sort of mailing list/newsgroup thing) for discussion
- and news related to CodeMirror. Reporting bugs is best done
- on github.
- You can also e-mail me
- directly: Marijn
- Haverbeke.
-
- Supported browsers
-
- The following browsers are able to run CodeMirror:
-
-
- - Firefox 2 or higher
- - Chrome, any version
- - Safari 3 or higher
- - Internet Explorer 6 or higher
- - Opera 9 or higher (with some key-handling problems on OS X)
-
-
- I am not actively testing against every new browser release, and
- vendors have a habit of introducing bugs all the time, so I am
- relying on the community to tell me when something breaks.
- See here for information on how to contact
- me.
-
-
-
-
-
- Download the latest release
-
- Make a donation
-
-
- - Paypal
- - Bank
-
-
-
-
- Releases:
-
- 26-09-2011: Version 2.15:
- Fix bug that snuck into 2.14: Clicking the
- character that currently has the cursor didn't re-focus the
- editor.
-
- 26-09-2011: Version 2.14:
-
- - Add Clojure, Pascal, NTriples, Jinja2, and Markdown modes.
- - Add Cobalt and Eclipse themes.
- - Add a
fixedGutter option.
- - Fix bug with
setValue breaking cursor movement.
- - Make gutter updates much more efficient.
- - Allow dragging of text out of the editor (on modern browsers).
-
-
- 23-08-2011: Version 2.13:
-
- - Add Ruby, R, CoffeeScript, and Velocity modes.
- - Add
getGutterElement to API.
- - Several fixes to scrolling and positioning.
- - Add
smartHome option.
- - Add an experimental pure XML mode.
-
-
- 25-07-2011: Version 2.12:
-
- - Add a SPARQL mode.
- - Fix bug with cursor jumping around in an unfocused editor in IE.
- - Allow key and mouse events to bubble out of the editor. Ignore widget clicks.
- - Solve cursor flakiness after undo/redo.
- - Fix block-reindent ignoring the last few lines.
- - Fix parsing of multi-line attrs in XML mode.
- - Use
innerHTML for HTML-escaping.
- - Some fixes to indentation in C-like mode.
- - Shrink horiz scrollbars when long lines removed.
- - Fix width feedback loop bug that caused the width of an inner DIV to shrink.
-
-
- 04-07-2011: Version 2.11:
-
- - Add a Scheme mode.
- - Add a
replace method to search cursors, for cursor-preserving replacements.
- - Make the C-like mode mode more customizeable.
- - Update XML mode to spot mismatched tags.
- - Add
getStateAfter API and compareState mode API methods for finer-grained mode magic.
- - Add a
getScrollerElement API method to manipulate the scrolling DIV.
- - Fix drag-and-drop for Firefox.
- - Add a C# configuration for the C-like mode.
- - Add full-screen editing and mode-changing demos.
-
-
- 07-06-2011: Version 2.1:
- Add
- a theme system
- (demo). Note that this is not
- backwards-compatible—you'll have to update your styles and
- modes!
-
- 07-06-2011: Version 2.02:
-
- - Add a Lua mode.
- - Fix reverse-searching for a regexp.
- - Empty lines can no longer break highlighting.
- - Rework scrolling model (the outer wrapper no longer does the scrolling).
- - Solve horizontal jittering on long lines.
- - Add runmode.js.
- - Immediately re-highlight text when typing.
- - Fix problem with 'sticking' horizontal scrollbar.
-
-
- 26-05-2011: Version 2.01:
-
- - Add a Smalltalk mode.
- - Add a reStructuredText mode.
- - Add a Python mode.
- - Add a PL/SQL mode.
- coordsChar now works
- - Fix a problem where
onCursorActivity interfered with onChange.
- - Fix a number of scrolling and mouse-click-position glitches.
- - Pass information about the changed lines to
onChange.
- - Support cmd-up/down on OS X.
- - Add triple-click line selection.
- - Don't handle shift when changing the selection through the API.
- - Support
"nocursor" mode for readOnly option.
- - Add an
onHighlightComplete option.
- - Fix the context menu for Firefox.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/codemirror/internals.html b/src/codemirror/internals.html
deleted file mode 100755
index 89e6aeb..0000000
--- a/src/codemirror/internals.html
+++ /dev/null
@@ -1,389 +0,0 @@
-
-
-
- CodeMirror: Internals
-
-
-
-
-
-
-
-{ } CodeMirror
-
-
-
/* (Re-) Implementing A Syntax-
- Highlighting Editor in JavaScript */
-
-
-
-
-
- Topic: JavaScript, code editor implementation
- Author: Marijn Haverbeke
- Date: March 2nd 2011
-
-
-This is a followup to
-my Brutal Odyssey to the
-Dark Side of the DOM Tree story. That one describes the
-mind-bending process of implementing (what would become) CodeMirror 1.
-This one describes the internals of CodeMirror 2, a complete rewrite
-and rethink of the old code base. I wanted to give this piece another
-Hunter Thompson copycat subtitle, but somehow that would be out of
-place—the process this time around was one of straightforward
-engineering, requiring no serious mind-bending whatsoever.
-
-So, what is wrong with CodeMirror 1? I'd estimate, by mailing list
-activity and general search-engine presence, that it has been
-integrated into about a thousand systems by now. The most prominent
-one, since a few weeks,
-being Google
-code's project hosting. It works, and it's being used widely.
-
-
Still, I did not start replacing it because I was bored. CodeMirror
-1 was heavily reliant on designMode
-or contentEditable (depending on the browser). Neither of
-these are well specified (HTML5 tries
-to specify
-their basics), and, more importantly, they tend to be one of the more
-obscure and buggy areas of browser functionality—CodeMirror, by using
-this functionality in a non-typical way, was constantly running up
-against browser bugs. WebKit wouldn't show an empty line at the end of
-the document, and in some releases would suddenly get unbearably slow.
-Firefox would show the cursor in the wrong place. Internet Explorer
-would insist on linkifying everything that looked like a URL or email
-address, a behaviour that can't be turned off. Some bugs I managed to
-work around (which was often a frustrating, painful process), others,
-such as the Firefox cursor placement, I gave up on, and had to tell
-user after user that they were known problems, but not something I
-could help.
-
-Also, there is the fact that designMode (which seemed
-to be less buggy than contentEditable in Webkit and
-Firefox, and was thus used by CodeMirror 1 in those browsers) requires
-a frame. Frames are another tricky area. It takes some effort to
-prevent getting tripped up by domain restrictions, they don't
-initialize synchronously, behave strangely in response to the back
-button, and, on several browsers, can't be moved around the DOM
-without having them re-initialize. They did provide a very nice way to
-namespace the library, though—CodeMirror 1 could freely pollute the
-namespace inside the frame.
-
-Finally, working with an editable document means working with
-selection in arbitrary DOM structures. Internet Explorer (8 and
-before) has an utterly different (and awkward) selection API than all
-of the other browsers, and even among the different implementations of
-document.selection, details about how exactly a selection
-is represented vary quite a bit. Add to that the fact that Opera's
-selection support tended to be very buggy until recently, and you can
-imagine why CodeMirror 1 contains 700 lines of selection-handling
-code.
-
-And that brings us to the main issue with the CodeMirror 1
-code base: The proportion of browser-bug-workarounds to real
-application code was getting dangerously high. By building on top of a
-few dodgy features, I put the system in a vulnerable position—any
-incompatibility and bugginess in these features, I had to paper over
-with my own code. Not only did I have to do some serious stunt-work to
-get it to work on older browsers (as detailed in the
-previous story), things
-also kept breaking in newly released versions, requiring me to come up
-with new scary hacks in order to keep up. This was starting
-to lose its appeal.
-
-General Approach
-
-What CodeMirror 2 does is try to sidestep most of the hairy hacks
-that came up in version 1. I owe a lot to the
-ACE editor for inspiration on how to
-approach this.
-
-I absolutely did not want to be completely reliant on key events to
-generate my input. Every JavaScript programmer knows that key event
-information is horrible and incomplete. Some people (most awesomely
-Mihai Bazon with Ymacs) have been able
-to build more or less functioning editors by directly reading key
-events, but it takes a lot of work (the kind of never-ending, fragile
-work I described earlier), and will never be able to properly support
-things like multi-keystoke international character input.
-
-So what I do is focus a hidden textarea, and let the browser
-believe that the user is typing into that. What we show to the user is
-a DOM structure we built to represent his document. If this is updated
-quickly enough, and shows some kind of believable cursor, it feels
-like a real text-input control.
-
-Another big win is that this DOM representation does not have to
-span the whole document. Some CodeMirror 1 users insisted that they
-needed to put a 30 thousand line XML document into CodeMirror. Putting
-all that into the DOM takes a while, especially since, for some
-reason, an editable DOM tree is slower than a normal one on most
-browsers. If we have full control over what we show, we must only
-ensure that the visible part of the document has been added, and can
-do the rest only when needed. (Fortunately, the onscroll
-event works almost the same on all browsers, and lends itself well to
-displaying things only as they are scrolled into view.)
-
-Input
-
-ACE uses its hidden textarea only as a text input shim, and does
-all cursor movement and things like text deletion itself by directly
-handling key events. CodeMirror's way is to let the browser do its
-thing as much as possible, and not, for example, define its own set of
-key bindings. One way to do this would have been to have the whole
-document inside the hidden textarea, and after each key event update
-the display DOM to reflect what's in that textarea.
-
-That'd be simple, but it is not realistic. For even medium-sized
-document the editor would be constantly munging huge strings, and get
-terribly slow. What CodeMirror 2 does is put the current selection,
-along with an extra line on the top and on the bottom, into the
-textarea.
-
-This means that the arrow keys (and their ctrl-variations), home,
-end, etcetera, do not have to be handled specially. We just read the
-cursor position in the textarea, and update our cursor to match it.
-Also, copy and paste work pretty much for free, and people get their
-native key bindings, without any special work on my part. For example,
-I have emacs key bindings configured for Chrome and Firefox. There is
-no way for a script to detect this.
-
-Of course, since only a small part of the document sits in the
-textarea, keys like page up and ctrl-end won't do the right thing.
-CodeMirror is catching those events and handling them itself.
-
-Selection
-
-Getting and setting the selection range of a textarea in modern
-browsers is trivial—you just use the selectionStart
-and selectionEnd properties. On IE you have to do some
-insane stuff with temporary ranges and compensating for the fact that
-moving the selection by a 'character' will treat \r\n as a single
-character, but even there it is possible to build functions that
-reliably set and get the selection range.
-
-But consider this typical case: When I'm somewhere in my document,
-press shift, and press the up arrow, something gets selected. Then, if
-I, still holding shift, press the up arrow again, the top of my
-selection is adjusted. The selection remembers where its head
-and its anchor are, and moves the head when we shift-move.
-This is a generally accepted property of selections, and done right by
-every editing component built in the past twenty years.
-
-But not something that the browser selection APIs expose.
-
-Great. So when someone creates an 'upside-down' selection, the next
-time CodeMirror has to update the textarea, it'll re-create the
-selection as an 'upside-up' selection, with the anchor at the top, and
-the next cursor motion will behave in an unexpected way—our second
-up-arrow press in the example above will not do anything, since it is
-interpreted in exactly the same way as the first.
-
-No problem. We'll just, ehm, detect that the selection is
-upside-down (you can tell by the way it was created), and then, when
-an upside-down selection is present, and a cursor-moving key is
-pressed in combination with shift, we quickly collapse the selection
-in the textarea to its start, allow the key to take effect, and then
-combine its new head with its old anchor to get the real
-selection.
-
-In short, scary hacks could not be avoided entirely in CodeMirror
-2.
-
-And, the observant reader might ask, how do you even know that a
-key combo is a cursor-moving combo, if you claim you support any
-native key bindings? Well, we don't, but we can learn. The editor
-keeps a set known cursor-movement combos (initialized to the
-predictable defaults), and updates this set when it observes that
-pressing a certain key had (only) the effect of moving the cursor.
-This, of course, doesn't work if the first time the key is used was
-for extending an inverted selection, but it works most of the
-time.
-
-Intelligent Updating
-
-One thing that always comes up when you have a complicated internal
-state that's reflected in some user-visible external representation
-(in this case, the displayed code and the textarea's content) is
-keeping the two in sync. The naive way is to just update the display
-every time you change your state, but this is not only error prone
-(you'll forget), it also easily leads to duplicate work on big,
-composite operations. Then you start passing around flags indicating
-whether the display should be updated in an attempt to be efficient
-again and, well, at that point you might as well give up completely.
-
-I did go down that road, but then switched to a much simpler model:
-simply keep track of all the things that have been changed during an
-action, and then, only at the end, use this information to update the
-user-visible display.
-
-CodeMirror uses a concept of operations, which start by
-calling a specific set-up function that clears the state and end by
-calling another function that reads this state and does the required
-updating. Most event handlers, and all the user-visible methods that
-change state are wrapped like this. There's a method
-called operation that accepts a function, and returns
-another function that wraps the given function as an operation.
-
-It's trivial to extend this (as CodeMirror does) to detect nesting,
-and, when an operation is started inside an operation, simply
-increment the nesting count, and only do the updating when this count
-reaches zero again.
-
-If we have a set of changed ranges and know the currently shown
-range, we can (with some awkward code to deal with the fact that
-changes can add and remove lines, so we're dealing with a changing
-coordinate system) construct a map of the ranges that were left
-intact. We can then compare this map with the part of the document
-that's currently visible (based on scroll offset and editor height) to
-determine whether something needs to be updated.
-
-CodeMirror uses two update algorithms—a full refresh, where it just
-discards the whole part of the DOM that contains the edited text and
-rebuilds it, and a patch algorithm, where it uses the information
-about changed and intact ranges to update only the out-of-date parts
-of the DOM. When more than 30 percent (which is the current heuristic,
-might change) of the lines need to be updated, the full refresh is
-chosen (since it's faster to do than painstakingly finding and
-updating all the changed lines), in the other case it does the
-patching (so that, if you scroll a line or select another character,
-the whole screen doesn't have to be re-rendered).
-
-All updating uses innerHTML rather than direct DOM
-manipulation, since that still seems to be by far the fastest way to
-build documents. There's a per-line function that combines the
-highlighting, marking, and
-selection info for that line into a snippet of HTML. The patch updater
-uses this to reset individual lines, the refresh updater builds an
-HTML chunk for the whole visible document at once, and then uses a
-single innerHTML update to do the refresh.
-
-Parsers can be Simple
-
-When I wrote CodeMirror 1, I
-thought interruptable
-parsers were a hugely scary and complicated thing, and I used a
-bunch of heavyweight abstractions to keep this supposed complexity
-under control: parsers
-were iterators
-that consumed input from another iterator, and used funny
-closure-resetting tricks to copy and resume themselves.
-
-This made for a rather nice system, in that parsers formed strictly
-separate modules, and could be composed in predictable ways.
-Unfortunately, it was quite slow (stacking three or four iterators on
-top of each other), and extremely intimidating to people not used to a
-functional programming style.
-
-With a few small changes, however, we can keep all those
-advantages, but simplify the API and make the whole thing less
-indirect and inefficient. CodeMirror
-2's mode API uses explicit state
-objects, and makes the parser/tokenizer a function that simply takes a
-state and a character stream abstraction, advances the stream one
-token, and returns the way the token should be styled. This state may
-be copied, optionally in a mode-defined way, in order to be able to
-continue a parse at a given point. Even someone who's never touched a
-lambda in his life can understand this approach. Additionally, far
-fewer objects are allocated in the course of parsing now.
-
-The biggest speedup comes from the fact that the parsing no longer
-has to touch the DOM though. In CodeMirror 1, on an older browser, you
-could see the parser work its way through the document,
-managing some twenty lines in each 50-millisecond time slice it got. It
-was reading its input from the DOM, and updating the DOM as it went
-along, which any experienced JavaScript programmer will immediately
-spot as a recipe for slowness. In CodeMirror 2, the parser usually
-finishes the whole document in a single 100-millisecond time slice—it
-manages some 1500 lines during that time on Chrome. All it has to do
-is munge strings, so there is no real reason for it to be slow
-anymore.
-
-What Gives?
-
-Given all this, what can you expect from CodeMirror 2? First, the
-good:
-
-
-
-- Small. the base library is some 32k when minified
-now, 12k when gzipped. It's smaller than its own logo.
-
-- Lightweight. CodeMirror 2 initializes very
-quickly, and does almost no work when it is not focused. This means
-you can treat it almost like a textarea, have multiple instances on a
-page without trouble.
-
-- Huge document support. Since highlighting is
-really fast, and no DOM structure is being built for non-visible
-content, you don't have to worry about locking up your browser when a
-user enters a megabyte-sized document.
-
-- Extended API. Some things kept coming up in the
-mailing list, such as marking pieces of text or lines, which were
-extremely hard to do with CodeMirror 1. The new version has proper
-support for these built in.
-
-- Tab support. Tabs inside editable documents were,
-for some reason, a no-go. At least six different people announced they
-were going to add tab support to CodeMirror 1, none survived (I mean,
-none delivered a working version). CodeMirror 2 no longer removes tabs
-from your document.
-
-- Sane styling.
iframe nodes aren't
-really known for respecting document flow. Now that an editor instance
-is a plain div element, it is much easier to size it to
-fit the surrounding elements. You don't even have to make it scroll if
-you do not want to.
-
-
-
-Then, the bad:
-
-
-
-- No line-wrapping. I'd have liked to get
-line-wrapping to work, but it doesn't match the model I'm using very
-well. It is important that cursor movement in the textarea matches
-what you see on the screen, and it seems to be impossible to have the
-lines wrapped the same in the textarea and the normal DOM.
-
-- Some cursor flakiness. The textarea hack does not
-really do justice to the complexity of cursor handling—a selection is
-typically more than just an offset into a string. For example, if you
-use the up and down arrow keys to move to a shorter line and then
-back, you'll end up in your old position in most editor controls, but
-CodeMirror 2 currently doesn't remember the 'real' cursor column in
-this case. These can be worked around on a case-by-case basis, but
-I haven't put much energy into that yet.
-
-- Limited interaction with the editable panel.
-Since the element you're looking at is not a real editable panel,
-native browser behaviour for editable controls doesn't work
-automatically. Through a lot of event glue code, I've managed to make
-drag and drop work pretty well, have context menus work on most
-browsers (except Opera). Middle-click paste on Firefox in Linux is
-broken until someone finds a way to intercept it.
-
-
-
-
-
- Contents
-
-
- - Introduction
- - General Approach
- - Input
- - Selection
- - Intelligent Updating
- - Parsing
- - What Gives?
-
-
-
-
-
-
-
diff --git a/src/codemirror/lib/codemirror.css b/src/codemirror/lib/codemirror.css
deleted file mode 100755
index aea1574..0000000
--- a/src/codemirror/lib/codemirror.css
+++ /dev/null
@@ -1,68 +0,0 @@
-.CodeMirror {
- line-height: 1em;
- font-family: monospace;
-}
-
-.CodeMirror-scroll {
- overflow: auto;
- height: 300px;
- /* This is needed to prevent an IE[67] bug where the scrolled content
- is visible outside of the scrolling box. */
- position: relative;
-}
-
-.CodeMirror-gutter {
- position: absolute; left: 0; top: 0;
- z-index: 10;
- background-color: #f7f7f7;
- border-right: 1px solid #eee;
- min-width: 2em;
- height: 100%;
-}
-.CodeMirror-gutter-text {
- color: #aaa;
- text-align: right;
- padding: .4em .2em .4em .4em;
-}
-.CodeMirror-lines {
- padding: .4em;
-}
-
-.CodeMirror pre {
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- -o-border-radius: 0;
- border-radius: 0;
- border-width: 0; margin: 0; padding: 0; background: transparent;
- font-family: inherit;
- font-size: inherit;
- padding: 0; margin: 0;
- white-space: pre;
- word-wrap: normal;
-}
-
-.CodeMirror textarea {
- font-family: inherit !important;
- font-size: inherit !important;
-}
-
-.CodeMirror-cursor {
- z-index: 10;
- position: absolute;
- visibility: hidden;
- border-left: 1px solid black !important;
-}
-.CodeMirror-focused .CodeMirror-cursor {
- visibility: visible;
-}
-
-span.CodeMirror-selected {
- background: #ccc !important;
- color: HighlightText !important;
-}
-.CodeMirror-focused span.CodeMirror-selected {
- background: Highlight !important;
-}
-
-.CodeMirror-matchingbracket {color: #0f0 !important;}
-.CodeMirror-nonmatchingbracket {color: #f22 !important;}
diff --git a/src/codemirror/lib/codemirror.js b/src/codemirror/lib/codemirror.js
deleted file mode 100755
index d6fd586..0000000
--- a/src/codemirror/lib/codemirror.js
+++ /dev/null
@@ -1,2197 +0,0 @@
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-
-// CodeMirror is the only global var we claim
-var CodeMirror = (function() {
- // This is the function that produces an editor instance. It's
- // closure is used to store the editor state.
- function CodeMirror(place, givenOptions) {
- // Determine effective options based on given values and defaults.
- var options = {}, defaults = CodeMirror.defaults;
- for (var opt in defaults)
- if (defaults.hasOwnProperty(opt))
- options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
-
- var targetDocument = options["document"];
- // The element in which the editor lives.
- var wrapper = targetDocument.createElement("div");
- wrapper.className = "CodeMirror";
- // This mess creates the base DOM structure for the editor.
- wrapper.innerHTML =
- '' +
- '';
- if (place.appendChild) place.appendChild(wrapper); else place(wrapper);
- // I've never seen more elegant code in my life.
- var inputDiv = wrapper.firstChild, input = inputDiv.firstChild,
- scroller = wrapper.lastChild, code = scroller.firstChild,
- measure = code.firstChild, mover = measure.nextSibling,
- gutter = mover.firstChild, gutterText = gutter.firstChild,
- lineSpace = gutter.nextSibling.firstChild,
- cursor = lineSpace.firstChild, lineDiv = cursor.nextSibling;
- if (options.tabindex != null) input.tabindex = options.tabindex;
- if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
-
- // Delayed object wrap timeouts, making sure only one is active. blinker holds an interval.
- var poll = new Delayed(), highlight = new Delayed(), blinker;
-
- // mode holds a mode API object. lines an array of Line objects
- // (see Line constructor), work an array of lines that should be
- // parsed, and history the undo history (instance of History
- // constructor).
- var mode, lines = [new Line("")], work, history = new History(), focused;
- loadMode();
- // The selection. These are always maintained to point at valid
- // positions. Inverted is used to remember that the user is
- // selecting bottom-to-top.
- var sel = {from: {line: 0, ch: 0}, to: {line: 0, ch: 0}, inverted: false};
- // Selection-related flags. shiftSelecting obviously tracks
- // whether the user is holding shift. reducedSelection is a hack
- // to get around the fact that we can't create inverted
- // selections. See below.
- var shiftSelecting, reducedSelection, lastClick, lastDoubleClick;
- // Variables used by startOperation/endOperation to track what
- // happened during the operation.
- var updateInput, changes, textChanged, selectionChanged, leaveInputAlone, gutterDirty;
- // Current visible range (may be bigger than the view window).
- var showingFrom = 0, showingTo = 0, lastHeight = 0, curKeyId = null;
- // editing will hold an object describing the things we put in the
- // textarea, to help figure out whether something changed.
- // bracketHighlighted is used to remember that a backet has been
- // marked.
- var editing, bracketHighlighted;
- // Tracks the maximum line length so that the horizontal scrollbar
- // can be kept static when scrolling.
- var maxLine = "", maxWidth;
-
- // Initialize the content.
- operation(function(){setValue(options.value || ""); updateInput = false;})();
-
- // Register our event handlers.
- connect(scroller, "mousedown", operation(onMouseDown));
- connect(lineSpace, "dragstart", onDragStart);
- // Gecko browsers fire contextmenu *after* opening the menu, at
- // which point we can't mess with it anymore. Context menu is
- // handled in onMouseDown for Gecko.
- if (!gecko) connect(scroller, "contextmenu", onContextMenu);
- connect(scroller, "scroll", function() {
- updateDisplay([]);
- if (options.fixedGutter) gutter.style.left = scroller.scrollLeft + "px";
- if (options.onScroll) options.onScroll(instance);
- });
- connect(window, "resize", function() {updateDisplay(true);});
- connect(input, "keyup", operation(onKeyUp));
- connect(input, "keydown", operation(onKeyDown));
- connect(input, "keypress", operation(onKeyPress));
- connect(input, "focus", onFocus);
- connect(input, "blur", onBlur);
-
- connect(scroller, "dragenter", e_stop);
- connect(scroller, "dragover", e_stop);
- connect(scroller, "drop", operation(onDrop));
- connect(scroller, "paste", function(){focusInput(); fastPoll();});
- connect(input, "paste", function(){fastPoll();});
- connect(input, "cut", function(){fastPoll();});
-
- // IE throws unspecified error in certain cases, when
- // trying to access activeElement before onload
- var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }
- if (hasFocus) setTimeout(onFocus, 20);
- else onBlur();
-
- function isLine(l) {return l >= 0 && l < lines.length;}
- // The instance object that we'll return. Mostly calls out to
- // local functions in the CodeMirror function. Some do some extra
- // range checking and/or clipping. operation is used to wrap the
- // call so that changes it makes are tracked, and the display is
- // updated afterwards.
- var instance = wrapper.CodeMirror = {
- getValue: getValue,
- setValue: operation(setValue),
- getSelection: getSelection,
- replaceSelection: operation(replaceSelection),
- focus: function(){focusInput(); onFocus(); fastPoll();},
- setOption: function(option, value) {
- options[option] = value;
- if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber")
- operation(gutterChanged)();
- else if (option == "mode" || option == "indentUnit") loadMode();
- else if (option == "readOnly" && value == "nocursor") input.blur();
- else if (option == "theme") scroller.className = scroller.className.replace(/cm-s-\w+/, "cm-s-" + value);
- },
- getOption: function(option) {return options[option];},
- undo: operation(undo),
- redo: operation(redo),
- indentLine: operation(function(n, dir) {
- if (isLine(n)) indentLine(n, dir == null ? "smart" : dir ? "add" : "subtract");
- }),
- historySize: function() {return {undo: history.done.length, redo: history.undone.length};},
- matchBrackets: operation(function(){matchBrackets(true);}),
- getTokenAt: function(pos) {
- pos = clipPos(pos);
- return lines[pos.line].getTokenAt(mode, getStateBefore(pos.line), pos.ch);
- },
- getStateAfter: function(line) {
- line = clipLine(line == null ? lines.length - 1: line);
- return getStateBefore(line + 1);
- },
- cursorCoords: function(start){
- if (start == null) start = sel.inverted;
- return pageCoords(start ? sel.from : sel.to);
- },
- charCoords: function(pos){return pageCoords(clipPos(pos));},
- coordsChar: function(coords) {
- var off = eltOffset(lineSpace);
- var line = clipLine(Math.min(lines.length - 1, showingFrom + Math.floor((coords.y - off.top) / lineHeight())));
- return clipPos({line: line, ch: charFromX(clipLine(line), coords.x - off.left)});
- },
- getSearchCursor: function(query, pos, caseFold) {return new SearchCursor(query, pos, caseFold);},
- markText: operation(function(a, b, c){return operation(markText(a, b, c));}),
- setMarker: operation(addGutterMarker),
- clearMarker: operation(removeGutterMarker),
- setLineClass: operation(setLineClass),
- lineInfo: lineInfo,
- addWidget: function(pos, node, scroll, vert, horiz) {
- pos = localCoords(clipPos(pos));
- var top = pos.yBot, left = pos.x;
- node.style.position = "absolute";
- code.appendChild(node);
- if (vert == "over") top = pos.y;
- else if (vert == "near") {
- var vspace = Math.max(scroller.offsetHeight, lines.length * lineHeight()),
- hspace = Math.max(code.clientWidth, lineSpace.clientWidth) - paddingLeft();
- if (pos.yBot + node.offsetHeight > vspace && pos.y > node.offsetHeight)
- top = pos.y - node.offsetHeight;
- if (left + node.offsetWidth > hspace)
- left = hspace - node.offsetWidth;
- }
- node.style.top = (top + paddingTop()) + "px";
- node.style.left = node.style.right = "";
- if (horiz == "right") {
- left = code.clientWidth - node.offsetWidth;
- node.style.right = "0px";
- } else {
- if (horiz == "left") left = 0;
- else if (horiz == "middle") left = (code.clientWidth - node.offsetWidth) / 2;
- node.style.left = (left + paddingLeft()) + "px";
- }
- if (scroll)
- scrollIntoView(left, top, left + node.offsetWidth, top + node.offsetHeight);
- },
-
- lineCount: function() {return lines.length;},
- getCursor: function(start) {
- if (start == null) start = sel.inverted;
- return copyPos(start ? sel.from : sel.to);
- },
- somethingSelected: function() {return !posEq(sel.from, sel.to);},
- setCursor: operation(function(line, ch) {
- if (ch == null && typeof line.line == "number") setCursor(line.line, line.ch);
- else setCursor(line, ch);
- }),
- setSelection: operation(function(from, to) {setSelection(clipPos(from), clipPos(to || from));}),
- getLine: function(line) {if (isLine(line)) return lines[line].text;},
- setLine: operation(function(line, text) {
- if (isLine(line)) replaceRange(text, {line: line, ch: 0}, {line: line, ch: lines[line].text.length});
- }),
- removeLine: operation(function(line) {
- if (isLine(line)) replaceRange("", {line: line, ch: 0}, clipPos({line: line+1, ch: 0}));
- }),
- replaceRange: operation(replaceRange),
- getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
-
- operation: function(f){return operation(f)();},
- refresh: function(){updateDisplay(true);},
- getInputField: function(){return input;},
- getWrapperElement: function(){return wrapper;},
- getScrollerElement: function(){return scroller;},
- getGutterElement: function(){return gutter;}
- };
-
- function setValue(code) {
- history = null;
- var top = {line: 0, ch: 0};
- updateLines(top, {line: lines.length - 1, ch: lines[lines.length-1].text.length},
- splitLines(code), top, top);
- history = new History();
- updateInput = true;
- }
- function getValue(code) {
- var text = [];
- for (var i = 0, l = lines.length; i < l; ++i)
- text.push(lines[i].text);
- return text.join("\n");
- }
-
- function onMouseDown(e) {
- // Check whether this is a click in a widget
- for (var n = e_target(e); n != wrapper; n = n.parentNode)
- if (n.parentNode == code && n != mover) return;
-
- // First, see if this is a click in the gutter
- for (var n = e_target(e); n != wrapper; n = n.parentNode)
- if (n.parentNode == gutterText) {
- if (options.onGutterClick)
- options.onGutterClick(instance, indexOf(gutterText.childNodes, n) + showingFrom, e);
- return e_preventDefault(e);
- }
-
- var start = posFromMouse(e);
-
- switch (e_button(e)) {
- case 3:
- if (gecko && !mac) onContextMenu(e);
- return;
- case 2:
- if (start) setCursor(start.line, start.ch, true);
- return;
- }
- // For button 1, if it was clicked inside the editor
- // (posFromMouse returning non-null), we have to adjust the
- // selection.
- if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
-
- if (!focused) onFocus();
-
- var now = +new Date;
- if (lastDoubleClick > now - 400) {
- e_preventDefault(e);
- return selectLine(start.line);
- } else if (lastClick > now - 400) {
- lastDoubleClick = now;
- e_preventDefault(e);
- return selectWordAt(start);
- } else { lastClick = now; }
-
- var last = start, going;
- if (dragAndDrop && !posEq(sel.from, sel.to) &&
- !posLess(start, sel.from) && !posLess(sel.to, start)) {
- // Let the drag handler handle this.
- return;
- }
- e_preventDefault(e);
- setCursor(start.line, start.ch, true);
-
- function extend(e) {
- var cur = posFromMouse(e, true);
- if (cur && !posEq(cur, last)) {
- if (!focused) onFocus();
- last = cur;
- setSelectionUser(start, cur);
- updateInput = false;
- var visible = visibleLines();
- if (cur.line >= visible.to || cur.line < visible.from)
- going = setTimeout(operation(function(){extend(e);}), 150);
- }
- }
-
- var move = connect(targetDocument, "mousemove", operation(function(e) {
- clearTimeout(going);
- e_preventDefault(e);
- extend(e);
- }), true);
- var up = connect(targetDocument, "mouseup", operation(function(e) {
- clearTimeout(going);
- var cur = posFromMouse(e);
- if (cur) setSelectionUser(start, cur);
- e_preventDefault(e);
- focusInput();
- updateInput = true;
- move(); up();
- }), true);
- }
- function onDrop(e) {
- e.preventDefault();
- var pos = posFromMouse(e, true), files = e.dataTransfer.files;
- if (!pos || options.readOnly) return;
- if (files && files.length && window.FileReader && window.File) {
- function loadFile(file, i) {
- var reader = new FileReader;
- reader.onload = function() {
- text[i] = reader.result;
- if (++read == n) replaceRange(text.join(""), clipPos(pos), clipPos(pos));
- };
- reader.readAsText(file);
- }
- var n = files.length, text = Array(n), read = 0;
- for (var i = 0; i < n; ++i) loadFile(files[i], i);
- }
- else {
- try {
- var text = e.dataTransfer.getData("Text");
- if (text) replaceRange(text, pos, pos);
- }
- catch(e){}
- }
- }
- function onDragStart(e) {
- var txt = getSelection();
- // This will reset escapeElement
- htmlEscape(txt);
- e.dataTransfer.setDragImage(escapeElement, 0, 0);
- e.dataTransfer.setData("Text", txt);
- }
- function onKeyDown(e) {
- if (!focused) onFocus();
-
- var code = e.keyCode;
- // IE does strange things with escape.
- if (ie && code == 27) { e.returnValue = false; }
- // Tries to detect ctrl on non-mac, cmd on mac.
- var mod = (mac ? e.metaKey : e.ctrlKey) && !e.altKey, anyMod = e.ctrlKey || e.altKey || e.metaKey;
- if (code == 16 || e.shiftKey) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
- else shiftSelecting = null;
- // First give onKeyEvent option a chance to handle this.
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
-
- if (code == 33 || code == 34) {scrollPage(code == 34); return e_preventDefault(e);} // page up/down
- if (mod && ((code == 36 || code == 35) || // ctrl-home/end
- mac && (code == 38 || code == 40))) { // cmd-up/down
- scrollEnd(code == 36 || code == 38); return e_preventDefault(e);
- }
- if (mod && code == 65) {selectAll(); return e_preventDefault(e);} // ctrl-a
- if (!options.readOnly) {
- if (!anyMod && code == 13) {return;} // enter
- if (!anyMod && code == 9 && handleTab(e.shiftKey)) return e_preventDefault(e); // tab
- if (mod && code == 90) {undo(); return e_preventDefault(e);} // ctrl-z
- if (mod && ((e.shiftKey && code == 90) || code == 89)) {redo(); return e_preventDefault(e);} // ctrl-shift-z, ctrl-y
- }
- if (code == 36) { if (options.smartHome) { smartHome(); return e_preventDefault(e); } }
-
- // Key id to use in the movementKeys map. We also pass it to
- // fastPoll in order to 'self learn'. We need this because
- // reducedSelection, the hack where we collapse the selection to
- // its start when it is inverted and a movement key is pressed
- // (and later restore it again), shouldn't be used for
- // non-movement keys.
- curKeyId = (mod ? "c" : "") + (e.altKey ? "a" : "") + code;
- if (sel.inverted && movementKeys[curKeyId] === true) {
- var range = selRange(input);
- if (range) {
- reducedSelection = {anchor: range.start};
- setSelRange(input, range.start, range.start);
- }
- }
- // Don't save the key as a movementkey unless it had a modifier
- if (!mod && !e.altKey) curKeyId = null;
- fastPoll(curKeyId);
- }
- function onKeyUp(e) {
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
- if (reducedSelection) {
- reducedSelection = null;
- updateInput = true;
- }
- if (e.keyCode == 16) shiftSelecting = null;
- }
- function onKeyPress(e) {
- if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
- if (options.electricChars && mode.electricChars) {
- var ch = String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode);
- if (mode.electricChars.indexOf(ch) > -1)
- setTimeout(operation(function() {indentLine(sel.to.line, "smart");}), 50);
- }
- var code = e.keyCode;
- // Re-stop tab and enter. Necessary on some browsers.
- if (code == 13) {if (!options.readOnly) handleEnter(); e_preventDefault(e);}
- else if (!e.ctrlKey && !e.altKey && !e.metaKey && code == 9 && options.tabMode != "default") e_preventDefault(e);
- else fastPoll(curKeyId);
- }
-
- function onFocus() {
- if (options.readOnly == "nocursor") return;
- if (!focused) {
- if (options.onFocus) options.onFocus(instance);
- focused = true;
- if (wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
- wrapper.className += " CodeMirror-focused";
- if (!leaveInputAlone) prepareInput();
- }
- slowPoll();
- restartBlink();
- }
- function onBlur() {
- if (focused) {
- if (options.onBlur) options.onBlur(instance);
- focused = false;
- wrapper.className = wrapper.className.replace(" CodeMirror-focused", "");
- }
- clearInterval(blinker);
- setTimeout(function() {if (!focused) shiftSelecting = null;}, 150);
- }
-
- // Replace the range from from to to by the strings in newText.
- // Afterwards, set the selection to selFrom, selTo.
- function updateLines(from, to, newText, selFrom, selTo) {
- if (history) {
- var old = [];
- for (var i = from.line, e = to.line + 1; i < e; ++i) old.push(lines[i].text);
- history.addChange(from.line, newText.length, old);
- while (history.done.length > options.undoDepth) history.done.shift();
- }
- updateLinesNoUndo(from, to, newText, selFrom, selTo);
- }
- function unredoHelper(from, to) {
- var change = from.pop();
- if (change) {
- var replaced = [], end = change.start + change.added;
- for (var i = change.start; i < end; ++i) replaced.push(lines[i].text);
- to.push({start: change.start, added: change.old.length, old: replaced});
- var pos = clipPos({line: change.start + change.old.length - 1,
- ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
- updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: lines[end-1].text.length}, change.old, pos, pos);
- updateInput = true;
- }
- }
- function undo() {unredoHelper(history.done, history.undone);}
- function redo() {unredoHelper(history.undone, history.done);}
-
- function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
- var recomputeMaxLength = false, maxLineLength = maxLine.length;
- for (var i = from.line; i <= to.line; ++i) {
- if (lines[i].text.length == maxLineLength) {recomputeMaxLength = true; break;}
- }
-
- var nlines = to.line - from.line, firstLine = lines[from.line], lastLine = lines[to.line];
- // First adjust the line structure, taking some care to leave highlighting intact.
- if (firstLine == lastLine) {
- if (newText.length == 1)
- firstLine.replace(from.ch, to.ch, newText[0]);
- else {
- lastLine = firstLine.split(to.ch, newText[newText.length-1]);
- var spliceargs = [from.line + 1, nlines];
- firstLine.replace(from.ch, firstLine.text.length, newText[0]);
- for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
- spliceargs.push(lastLine);
- lines.splice.apply(lines, spliceargs);
- }
- }
- else if (newText.length == 1) {
- firstLine.replace(from.ch, firstLine.text.length, newText[0] + lastLine.text.slice(to.ch));
- lines.splice(from.line + 1, nlines);
- }
- else {
- var spliceargs = [from.line + 1, nlines - 1];
- firstLine.replace(from.ch, firstLine.text.length, newText[0]);
- lastLine.replace(0, to.ch, newText[newText.length-1]);
- for (var i = 1, e = newText.length - 1; i < e; ++i) spliceargs.push(new Line(newText[i]));
- lines.splice.apply(lines, spliceargs);
- }
-
-
- for (var i = from.line, e = i + newText.length; i < e; ++i) {
- var l = lines[i].text;
- if (l.length > maxLineLength) {
- maxLine = l; maxLineLength = l.length; maxWidth = null;
- recomputeMaxLength = false;
- }
- }
- if (recomputeMaxLength) {
- maxLineLength = 0; maxLine = ""; maxWidth = null;
- for (var i = 0, e = lines.length; i < e; ++i) {
- var l = lines[i].text;
- if (l.length > maxLineLength) {
- maxLineLength = l.length; maxLine = l;
- }
- }
- }
-
- // Add these lines to the work array, so that they will be
- // highlighted. Adjust work lines if lines were added/removed.
- var newWork = [], lendiff = newText.length - nlines - 1;
- for (var i = 0, l = work.length; i < l; ++i) {
- var task = work[i];
- if (task < from.line) newWork.push(task);
- else if (task > to.line) newWork.push(task + lendiff);
- }
- if (newText.length < 5) {
- highlightLines(from.line, from.line + newText.length);
- newWork.push(from.line + newText.length);
- } else {
- newWork.push(from.line);
- }
- work = newWork;
- startWorker(100);
- // Remember that these lines changed, for updating the display
- changes.push({from: from.line, to: to.line + 1, diff: lendiff});
- textChanged = {from: from, to: to, text: newText};
-
- // Update the selection
- function updateLine(n) {return n <= Math.min(to.line, to.line + lendiff) ? n : n + lendiff;}
- setSelection(selFrom, selTo, updateLine(sel.from.line), updateLine(sel.to.line));
-
- // Make sure the scroll-size div has the correct height.
- code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
- }
-
- function replaceRange(code, from, to) {
- from = clipPos(from);
- if (!to) to = from; else to = clipPos(to);
- code = splitLines(code);
- function adjustPos(pos) {
- if (posLess(pos, from)) return pos;
- if (!posLess(to, pos)) return end;
- var line = pos.line + code.length - (to.line - from.line) - 1;
- var ch = pos.ch;
- if (pos.line == to.line)
- ch += code[code.length-1].length - (to.ch - (to.line == from.line ? from.ch : 0));
- return {line: line, ch: ch};
- }
- var end;
- replaceRange1(code, from, to, function(end1) {
- end = end1;
- return {from: adjustPos(sel.from), to: adjustPos(sel.to)};
- });
- return end;
- }
- function replaceSelection(code, collapse) {
- replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
- if (collapse == "end") return {from: end, to: end};
- else if (collapse == "start") return {from: sel.from, to: sel.from};
- else return {from: sel.from, to: end};
- });
- }
- function replaceRange1(code, from, to, computeSel) {
- var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
- var newSel = computeSel({line: from.line + code.length - 1, ch: endch});
- updateLines(from, to, code, newSel.from, newSel.to);
- }
-
- function getRange(from, to) {
- var l1 = from.line, l2 = to.line;
- if (l1 == l2) return lines[l1].text.slice(from.ch, to.ch);
- var code = [lines[l1].text.slice(from.ch)];
- for (var i = l1 + 1; i < l2; ++i) code.push(lines[i].text);
- code.push(lines[l2].text.slice(0, to.ch));
- return code.join("\n");
- }
- function getSelection() {
- return getRange(sel.from, sel.to);
- }
-
- var pollingFast = false; // Ensures slowPoll doesn't cancel fastPoll
- function slowPoll() {
- if (pollingFast) return;
- poll.set(2000, function() {
- startOperation();
- readInput();
- if (focused) slowPoll();
- endOperation();
- });
- }
- function fastPoll(keyId) {
- var missed = false;
- pollingFast = true;
- function p() {
- startOperation();
- var changed = readInput();
- if (changed && keyId) {
- if (changed == "moved" && movementKeys[keyId] == null) movementKeys[keyId] = true;
- if (changed == "changed") movementKeys[keyId] = false;
- }
- if (!changed && !missed) {missed = true; poll.set(80, p);}
- else {pollingFast = false; slowPoll();}
- endOperation();
- }
- poll.set(20, p);
- }
-
- // Inspects the textarea, compares its state (content, selection)
- // to the data in the editing variable, and updates the editor
- // content or cursor if something changed.
- function readInput() {
- if (leaveInputAlone || !focused) return;
- var changed = false, text = input.value, sr = selRange(input);
- if (!sr) return false;
- var changed = editing.text != text, rs = reducedSelection;
- var moved = changed || sr.start != editing.start || sr.end != (rs ? editing.start : editing.end);
- if (!moved && !rs) return false;
- if (changed) {
- shiftSelecting = reducedSelection = null;
- if (options.readOnly) {updateInput = true; return "changed";}
- }
-
- // Compute selection start and end based on start/end offsets in textarea
- function computeOffset(n, startLine) {
- var pos = 0;
- for (;;) {
- var found = text.indexOf("\n", pos);
- if (found == -1 || (text.charAt(found-1) == "\r" ? found - 1 : found) >= n)
- return {line: startLine, ch: n - pos};
- ++startLine;
- pos = found + 1;
- }
- }
- var from = computeOffset(sr.start, editing.from),
- to = computeOffset(sr.end, editing.from);
- // Here we have to take the reducedSelection hack into account,
- // so that you can, for example, press shift-up at the start of
- // your selection and have the right thing happen.
- if (rs) {
- var head = sr.start == rs.anchor ? to : from;
- var tail = shiftSelecting ? sel.to : sr.start == rs.anchor ? from : to;
- if (sel.inverted = posLess(head, tail)) { from = head; to = tail; }
- else { reducedSelection = null; from = tail; to = head; }
- }
-
- // In some cases (cursor on same line as before), we don't have
- // to update the textarea content at all.
- if (from.line == to.line && from.line == sel.from.line && from.line == sel.to.line && !shiftSelecting)
- updateInput = false;
-
- // Magic mess to extract precise edited range from the changed
- // string.
- if (changed) {
- var start = 0, end = text.length, len = Math.min(end, editing.text.length);
- var c, line = editing.from, nl = -1;
- while (start < len && (c = text.charAt(start)) == editing.text.charAt(start)) {
- ++start;
- if (c == "\n") {line++; nl = start;}
- }
- var ch = nl > -1 ? start - nl : start, endline = editing.to - 1, edend = editing.text.length;
- for (;;) {
- c = editing.text.charAt(edend);
- if (text.charAt(end) != c) {++end; ++edend; break;}
- if (c == "\n") endline--;
- if (edend <= start || end <= start) break;
- --end; --edend;
- }
- var nl = editing.text.lastIndexOf("\n", edend - 1), endch = nl == -1 ? edend : edend - nl - 1;
- updateLines({line: line, ch: ch}, {line: endline, ch: endch}, splitLines(text.slice(start, end)), from, to);
- if (line != endline || from.line != line) updateInput = true;
- }
- else setSelection(from, to);
-
- editing.text = text; editing.start = sr.start; editing.end = sr.end;
- return changed ? "changed" : moved ? "moved" : false;
- }
-
- // Set the textarea content and selection range to match the
- // editor state.
- function prepareInput() {
- var text = [];
- var from = Math.max(0, sel.from.line - 1), to = Math.min(lines.length, sel.to.line + 2);
- for (var i = from; i < to; ++i) text.push(lines[i].text);
- text = input.value = text.join(lineSep);
- var startch = sel.from.ch, endch = sel.to.ch;
- for (var i = from; i < sel.from.line; ++i)
- startch += lineSep.length + lines[i].text.length;
- for (var i = from; i < sel.to.line; ++i)
- endch += lineSep.length + lines[i].text.length;
- editing = {text: text, from: from, to: to, start: startch, end: endch};
- setSelRange(input, startch, reducedSelection ? startch : endch);
- }
- function focusInput() {
- if (options.readOnly != "nocursor") input.focus();
- }
-
- function scrollEditorIntoView() {
- if (!cursor.getBoundingClientRect) return;
- var rect = cursor.getBoundingClientRect();
- var winH = window.innerHeight || document.body.offsetHeight || document.documentElement.offsetHeight;
- if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
- }
- function scrollCursorIntoView() {
- var cursor = localCoords(sel.inverted ? sel.from : sel.to);
- return scrollIntoView(cursor.x, cursor.y, cursor.x, cursor.yBot);
- }
- function scrollIntoView(x1, y1, x2, y2) {
- var pl = paddingLeft(), pt = paddingTop(), lh = lineHeight();
- y1 += pt; y2 += pt; x1 += pl; x2 += pl;
- var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
- if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
- else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
-
- var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
- var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
- if (x1 < screenleft + gutterw) {
- if (x1 < 50) x1 = 0;
- scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
- scrolled = true;
- }
- else if (x2 > screenw + screenleft) {
- scroller.scrollLeft = x2 + 10 - screenw;
- scrolled = true;
- if (x2 > code.clientWidth) result = false;
- }
- if (scrolled && options.onScroll) options.onScroll(instance);
- return result;
- }
-
- function visibleLines() {
- var lh = lineHeight(), top = scroller.scrollTop - paddingTop();
- return {from: Math.min(lines.length, Math.max(0, Math.floor(top / lh))),
- to: Math.min(lines.length, Math.ceil((top + scroller.clientHeight) / lh))};
- }
- // Uses a set of changes plus the current scroll position to
- // determine which DOM updates have to be made, and makes the
- // updates.
- function updateDisplay(changes) {
- if (!scroller.clientWidth) {
- showingFrom = showingTo = 0;
- return;
- }
- // First create a range of theoretically intact lines, and punch
- // holes in that using the change info.
- var intact = changes === true ? [] : [{from: showingFrom, to: showingTo, domStart: 0}];
- for (var i = 0, l = changes.length || 0; i < l; ++i) {
- var change = changes[i], intact2 = [], diff = change.diff || 0;
- for (var j = 0, l2 = intact.length; j < l2; ++j) {
- var range = intact[j];
- if (change.to <= range.from)
- intact2.push({from: range.from + diff, to: range.to + diff, domStart: range.domStart});
- else if (range.to <= change.from)
- intact2.push(range);
- else {
- if (change.from > range.from)
- intact2.push({from: range.from, to: change.from, domStart: range.domStart});
- if (change.to < range.to)
- intact2.push({from: change.to + diff, to: range.to + diff,
- domStart: range.domStart + (change.to - range.from)});
- }
- }
- intact = intact2;
- }
-
- // Then, determine which lines we'd want to see, and which
- // updates have to be made to get there.
- var visible = visibleLines();
- var from = Math.min(showingFrom, Math.max(visible.from - 3, 0)),
- to = Math.min(lines.length, Math.max(showingTo, visible.to + 3)),
- updates = [], domPos = 0, domEnd = showingTo - showingFrom, pos = from, changedLines = 0;
-
- for (var i = 0, l = intact.length; i < l; ++i) {
- var range = intact[i];
- if (range.to <= from) continue;
- if (range.from >= to) break;
- if (range.domStart > domPos || range.from > pos) {
- updates.push({from: pos, to: range.from, domSize: range.domStart - domPos, domStart: domPos});
- changedLines += range.from - pos;
- }
- pos = range.to;
- domPos = range.domStart + (range.to - range.from);
- }
- if (domPos != domEnd || pos != to) {
- changedLines += Math.abs(to - pos);
- updates.push({from: pos, to: to, domSize: domEnd - domPos, domStart: domPos});
- if (to - pos != domEnd - domPos) gutterDirty = true;
- }
-
- if (!updates.length) return;
- lineDiv.style.display = "none";
- // If more than 30% of the screen needs update, just do a full
- // redraw (which is quicker than patching)
- if (changedLines > (visible.to - visible.from) * .3)
- refreshDisplay(from = Math.max(visible.from - 10, 0), to = Math.min(visible.to + 7, lines.length));
- // Otherwise, only update the stuff that needs updating.
- else
- patchDisplay(updates);
- lineDiv.style.display = "";
-
- // Position the mover div to align with the lines it's supposed
- // to be showing (which will cover the visible display)
- var different = from != showingFrom || to != showingTo || lastHeight != scroller.clientHeight;
- showingFrom = from; showingTo = to;
- mover.style.top = (from * lineHeight()) + "px";
- if (different) {
- lastHeight = scroller.clientHeight;
- code.style.height = (lines.length * lineHeight() + 2 * paddingTop()) + "px";
- }
- if (different || gutterDirty) updateGutter();
-
- if (maxWidth == null) maxWidth = stringWidth(maxLine);
- if (maxWidth > scroller.clientWidth) {
- lineSpace.style.width = maxWidth + "px";
- // Needed to prevent odd wrapping/hiding of widgets placed in here.
- code.style.width = "";
- code.style.width = scroller.scrollWidth + "px";
- } else {
- lineSpace.style.width = code.style.width = "";
- }
-
- // Since this is all rather error prone, it is honoured with the
- // only assertion in the whole file.
- if (lineDiv.childNodes.length != showingTo - showingFrom)
- throw new Error("BAD PATCH! " + JSON.stringify(updates) + " size=" + (showingTo - showingFrom) +
- " nodes=" + lineDiv.childNodes.length);
- updateCursor();
- }
-
- function refreshDisplay(from, to) {
- var html = [], start = {line: from, ch: 0}, inSel = posLess(sel.from, start) && !posLess(sel.to, start);
- for (var i = from; i < to; ++i) {
- var ch1 = null, ch2 = null;
- if (inSel) {
- ch1 = 0;
- if (sel.to.line == i) {inSel = false; ch2 = sel.to.ch;}
- }
- else if (sel.from.line == i) {
- if (sel.to.line == i) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
- else {inSel = true; ch1 = sel.from.ch;}
- }
- html.push(lines[i].getHTML(ch1, ch2, true));
- }
- lineDiv.innerHTML = html.join("");
- }
- function patchDisplay(updates) {
- // Slightly different algorithm for IE (badInnerHTML), since
- // there .innerHTML on PRE nodes is dumb, and discards
- // whitespace.
- var sfrom = sel.from.line, sto = sel.to.line, off = 0,
- scratch = badInnerHTML && targetDocument.createElement("div");
- for (var i = 0, e = updates.length; i < e; ++i) {
- var rec = updates[i];
- var extra = (rec.to - rec.from) - rec.domSize;
- var nodeAfter = lineDiv.childNodes[rec.domStart + rec.domSize + off] || null;
- if (badInnerHTML)
- for (var j = Math.max(-extra, rec.domSize); j > 0; --j)
- lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
- else if (extra) {
- for (var j = Math.max(0, extra); j > 0; --j)
- lineDiv.insertBefore(targetDocument.createElement("pre"), nodeAfter);
- for (var j = Math.max(0, -extra); j > 0; --j)
- lineDiv.removeChild(nodeAfter ? nodeAfter.previousSibling : lineDiv.lastChild);
- }
- var node = lineDiv.childNodes[rec.domStart + off], inSel = sfrom < rec.from && sto >= rec.from;
- for (var j = rec.from; j < rec.to; ++j) {
- var ch1 = null, ch2 = null;
- if (inSel) {
- ch1 = 0;
- if (sto == j) {inSel = false; ch2 = sel.to.ch;}
- }
- else if (sfrom == j) {
- if (sto == j) {ch1 = sel.from.ch; ch2 = sel.to.ch;}
- else {inSel = true; ch1 = sel.from.ch;}
- }
- if (badInnerHTML) {
- scratch.innerHTML = lines[j].getHTML(ch1, ch2, true);
- lineDiv.insertBefore(scratch.firstChild, nodeAfter);
- }
- else {
- node.innerHTML = lines[j].getHTML(ch1, ch2, false);
- node.className = lines[j].className || "";
- node = node.nextSibling;
- }
- }
- off += extra;
- }
- }
-
- function updateGutter() {
- if (!options.gutter && !options.lineNumbers) return;
- var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
- gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
- var html = [];
- for (var i = showingFrom; i < Math.max(showingTo, showingFrom + 1); ++i) {
- var marker = lines[i].gutterMarker;
- var text = options.lineNumbers ? i + options.firstLineNumber : null;
- if (marker && marker.text)
- text = marker.text.replace("%N%", text != null ? text : "");
- else if (text == null)
- text = "\u00a0";
- html.push((marker && marker.style ? '' : ""), text, "
");
- }
- gutter.style.display = "none";
- gutterText.innerHTML = html.join("");
- var minwidth = String(lines.length).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
- while (val.length + pad.length < minwidth) pad += "\u00a0";
- if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
- gutter.style.display = "";
- lineSpace.style.marginLeft = gutter.offsetWidth + "px";
- gutterDirty = false;
- }
- function updateCursor() {
- var head = sel.inverted ? sel.from : sel.to, lh = lineHeight();
- var x = charX(head.line, head.ch);
- var top = head.line * lh - scroller.scrollTop;
- inputDiv.style.top = Math.max(Math.min(top, scroller.offsetHeight), 0) + "px";
- inputDiv.style.left = (x - scroller.scrollLeft) + "px";
- if (posEq(sel.from, sel.to)) {
- cursor.style.top = (head.line - showingFrom) * lh + "px";
- cursor.style.left = x + "px";
- cursor.style.display = "";
- }
- else cursor.style.display = "none";
- }
-
- function setSelectionUser(from, to) {
- var sh = shiftSelecting && clipPos(shiftSelecting);
- if (sh) {
- if (posLess(sh, from)) from = sh;
- else if (posLess(to, sh)) to = sh;
- }
- setSelection(from, to);
- }
- // Update the selection. Last two args are only used by
- // updateLines, since they have to be expressed in the line
- // numbers before the update.
- function setSelection(from, to, oldFrom, oldTo) {
- if (posEq(sel.from, from) && posEq(sel.to, to)) return;
- if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
-
- if (posEq(from, to)) sel.inverted = false;
- else if (posEq(from, sel.to)) sel.inverted = false;
- else if (posEq(to, sel.from)) sel.inverted = true;
-
- // Some ugly logic used to only mark the lines that actually did
- // see a change in selection as changed, rather than the whole
- // selected range.
- if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
- if (posEq(from, to)) {
- if (!posEq(sel.from, sel.to))
- changes.push({from: oldFrom, to: oldTo + 1});
- }
- else if (posEq(sel.from, sel.to)) {
- changes.push({from: from.line, to: to.line + 1});
- }
- else {
- if (!posEq(from, sel.from)) {
- if (from.line < oldFrom)
- changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
- else
- changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
- }
- if (!posEq(to, sel.to)) {
- if (to.line < oldTo)
- changes.push({from: Math.max(oldFrom, from.line), to: oldTo + 1});
- else
- changes.push({from: Math.max(from.line, oldTo), to: to.line + 1});
- }
- }
- sel.from = from; sel.to = to;
- selectionChanged = true;
- }
- function setCursor(line, ch, user) {
- var pos = clipPos({line: line, ch: ch || 0});
- (user ? setSelectionUser : setSelection)(pos, pos);
- }
-
- function clipLine(n) {return Math.max(0, Math.min(n, lines.length-1));}
- function clipPos(pos) {
- if (pos.line < 0) return {line: 0, ch: 0};
- if (pos.line >= lines.length) return {line: lines.length-1, ch: lines[lines.length-1].text.length};
- var ch = pos.ch, linelen = lines[pos.line].text.length;
- if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
- else if (ch < 0) return {line: pos.line, ch: 0};
- else return pos;
- }
-
- function scrollPage(down) {
- var linesPerPage = Math.floor(scroller.clientHeight / lineHeight()), head = sel.inverted ? sel.from : sel.to;
- setCursor(head.line + (Math.max(linesPerPage - 1, 1) * (down ? 1 : -1)), head.ch, true);
- }
- function scrollEnd(top) {
- var pos = top ? {line: 0, ch: 0} : {line: lines.length - 1, ch: lines[lines.length-1].text.length};
- setSelectionUser(pos, pos);
- }
- function selectAll() {
- var endLine = lines.length - 1;
- setSelection({line: 0, ch: 0}, {line: endLine, ch: lines[endLine].text.length});
- }
- function selectWordAt(pos) {
- var line = lines[pos.line].text;
- var start = pos.ch, end = pos.ch;
- while (start > 0 && /\w/.test(line.charAt(start - 1))) --start;
- while (end < line.length && /\w/.test(line.charAt(end))) ++end;
- setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
- }
- function selectLine(line) {
- setSelectionUser({line: line, ch: 0}, {line: line, ch: lines[line].text.length});
- }
- function handleEnter() {
- replaceSelection("\n", "end");
- if (options.enterMode != "flat")
- indentLine(sel.from.line, options.enterMode == "keep" ? "prev" : "smart");
- }
- function handleTab(shift) {
- function indentSelected(mode) {
- if (posEq(sel.from, sel.to)) return indentLine(sel.from.line, mode);
- var e = sel.to.line - (sel.to.ch ? 0 : 1);
- for (var i = sel.from.line; i <= e; ++i) indentLine(i, mode);
- }
- shiftSelecting = null;
- switch (options.tabMode) {
- case "default":
- return false;
- case "indent":
- indentSelected("smart");
- break;
- case "classic":
- if (posEq(sel.from, sel.to)) {
- if (shift) indentLine(sel.from.line, "smart");
- else replaceSelection("\t", "end");
- break;
- }
- case "shift":
- indentSelected(shift ? "subtract" : "add");
- break;
- }
- return true;
- }
- function smartHome() {
- var firstNonWS = Math.max(0, lines[sel.from.line].text.search(/\S/));
- setCursor(sel.from.line, sel.from.ch <= firstNonWS && sel.from.ch ? 0 : firstNonWS, true);
- }
-
- function indentLine(n, how) {
- if (how == "smart") {
- if (!mode.indent) how = "prev";
- else var state = getStateBefore(n);
- }
-
- var line = lines[n], curSpace = line.indentation(), curSpaceString = line.text.match(/^\s*/)[0], indentation;
- if (how == "prev") {
- if (n) indentation = lines[n-1].indentation();
- else indentation = 0;
- }
- else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
- else if (how == "add") indentation = curSpace + options.indentUnit;
- else if (how == "subtract") indentation = curSpace - options.indentUnit;
- indentation = Math.max(0, indentation);
- var diff = indentation - curSpace;
-
- if (!diff) {
- if (sel.from.line != n && sel.to.line != n) return;
- var indentString = curSpaceString;
- }
- else {
- var indentString = "", pos = 0;
- if (options.indentWithTabs)
- for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
- while (pos < indentation) {++pos; indentString += " ";}
- }
-
- replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
- }
-
- function loadMode() {
- mode = CodeMirror.getMode(options, options.mode);
- for (var i = 0, l = lines.length; i < l; ++i)
- lines[i].stateAfter = null;
- work = [0];
- startWorker();
- }
- function gutterChanged() {
- var visible = options.gutter || options.lineNumbers;
- gutter.style.display = visible ? "" : "none";
- if (visible) gutterDirty = true;
- else lineDiv.parentNode.style.marginLeft = 0;
- }
-
- function markText(from, to, className) {
- from = clipPos(from); to = clipPos(to);
- var accum = [];
- function add(line, from, to, className) {
- var line = lines[line], mark = line.addMark(from, to, className);
- mark.line = line;
- accum.push(mark);
- }
- if (from.line == to.line) add(from.line, from.ch, to.ch, className);
- else {
- add(from.line, from.ch, null, className);
- for (var i = from.line + 1, e = to.line; i < e; ++i)
- add(i, 0, null, className);
- add(to.line, 0, to.ch, className);
- }
- changes.push({from: from.line, to: to.line + 1});
- return function() {
- var start, end;
- for (var i = 0; i < accum.length; ++i) {
- var mark = accum[i], found = indexOf(lines, mark.line);
- mark.line.removeMark(mark);
- if (found > -1) {
- if (start == null) start = found;
- end = found;
- }
- }
- if (start != null) changes.push({from: start, to: end + 1});
- };
- }
-
- function addGutterMarker(line, text, className) {
- if (typeof line == "number") line = lines[clipLine(line)];
- line.gutterMarker = {text: text, style: className};
- gutterDirty = true;
- return line;
- }
- function removeGutterMarker(line) {
- if (typeof line == "number") line = lines[clipLine(line)];
- line.gutterMarker = null;
- gutterDirty = true;
- }
- function setLineClass(line, className) {
- if (typeof line == "number") {
- var no = line;
- line = lines[clipLine(line)];
- }
- else {
- var no = indexOf(lines, line);
- if (no == -1) return null;
- }
- if (line.className != className) {
- line.className = className;
- changes.push({from: no, to: no + 1});
- }
- return line;
- }
-
- function lineInfo(line) {
- if (typeof line == "number") {
- var n = line;
- line = lines[line];
- if (!line) return null;
- }
- else {
- var n = indexOf(lines, line);
- if (n == -1) return null;
- }
- var marker = line.gutterMarker;
- return {line: n, text: line.text, markerText: marker && marker.text, markerClass: marker && marker.style};
- }
-
- function stringWidth(str) {
- measure.innerHTML = "x";
- measure.firstChild.firstChild.firstChild.nodeValue = str;
- return measure.firstChild.firstChild.offsetWidth || 10;
- }
- // These are used to go from pixel positions to character
- // positions, taking varying character widths into account.
- function charX(line, pos) {
- if (pos == 0) return 0;
- measure.innerHTML = "" + lines[line].getHTML(null, null, false, pos) + "";
- return measure.firstChild.firstChild.offsetWidth;
- }
- function charFromX(line, x) {
- if (x <= 0) return 0;
- var lineObj = lines[line], text = lineObj.text;
- function getX(len) {
- measure.innerHTML = "" + lineObj.getHTML(null, null, false, len) + "";
- return measure.firstChild.firstChild.offsetWidth;
- }
- var from = 0, fromX = 0, to = text.length, toX;
- // Guess a suitable upper bound for our search.
- var estimated = Math.min(to, Math.ceil(x / stringWidth("x")));
- for (;;) {
- var estX = getX(estimated);
- if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
- else {toX = estX; to = estimated; break;}
- }
- if (x > toX) return to;
- // Try to guess a suitable lower bound as well.
- estimated = Math.floor(to * 0.8); estX = getX(estimated);
- if (estX < x) {from = estimated; fromX = estX;}
- // Do a binary search between these bounds.
- for (;;) {
- if (to - from <= 1) return (toX - x > x - fromX) ? from : to;
- var middle = Math.ceil((from + to) / 2), middleX = getX(middle);
- if (middleX > x) {to = middle; toX = middleX;}
- else {from = middle; fromX = middleX;}
- }
- }
-
- function localCoords(pos, inLineWrap) {
- var lh = lineHeight(), line = pos.line - (inLineWrap ? showingFrom : 0);
- return {x: charX(pos.line, pos.ch), y: line * lh, yBot: (line + 1) * lh};
- }
- function pageCoords(pos) {
- var local = localCoords(pos, true), off = eltOffset(lineSpace);
- return {x: off.left + local.x, y: off.top + local.y, yBot: off.top + local.yBot};
- }
-
- function lineHeight() {
- var nlines = lineDiv.childNodes.length;
- if (nlines) return (lineDiv.offsetHeight / nlines) || 1;
- measure.innerHTML = "x
";
- return measure.firstChild.offsetHeight || 1;
- }
- function paddingTop() {return lineSpace.offsetTop;}
- function paddingLeft() {return lineSpace.offsetLeft;}
-
- function posFromMouse(e, liberal) {
- var offW = eltOffset(scroller, true), x, y;
- // Fails unpredictably on IE[67] when mouse is dragged around quickly.
- try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
- // This is a mess of a heuristic to try and determine whether a
- // scroll-bar was clicked or not, and to return null if one was
- // (and !liberal).
- if (!liberal && (x - offW.left > scroller.clientWidth || y - offW.top > scroller.clientHeight))
- return null;
- var offL = eltOffset(lineSpace, true);
- var line = showingFrom + Math.floor((y - offL.top) / lineHeight());
- return clipPos({line: line, ch: charFromX(clipLine(line), x - offL.left)});
- }
- function onContextMenu(e) {
- var pos = posFromMouse(e);
- if (!pos || window.opera) return; // Opera is difficult.
- if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
- operation(setCursor)(pos.line, pos.ch);
-
- var oldCSS = input.style.cssText;
- inputDiv.style.position = "absolute";
- input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
- "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; " +
- "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
- leaveInputAlone = true;
- var val = input.value = getSelection();
- focusInput();
- setSelRange(input, 0, input.value.length);
- function rehide() {
- var newVal = splitLines(input.value).join("\n");
- if (newVal != val) operation(replaceSelection)(newVal, "end");
- inputDiv.style.position = "relative";
- input.style.cssText = oldCSS;
- leaveInputAlone = false;
- prepareInput();
- slowPoll();
- }
-
- if (gecko) {
- e_stop(e);
- var mouseup = connect(window, "mouseup", function() {
- mouseup();
- setTimeout(rehide, 20);
- }, true);
- }
- else {
- setTimeout(rehide, 50);
- }
- }
-
- // Cursor-blinking
- function restartBlink() {
- clearInterval(blinker);
- var on = true;
- cursor.style.visibility = "";
- blinker = setInterval(function() {
- cursor.style.visibility = (on = !on) ? "" : "hidden";
- }, 650);
- }
-
- var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
- function matchBrackets(autoclear) {
- var head = sel.inverted ? sel.from : sel.to, line = lines[head.line], pos = head.ch - 1;
- var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
- if (!match) return;
- var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
- for (var off = pos + 1, i = 0, e = st.length; i < e; i+=2)
- if ((off -= st[i].length) <= 0) {var style = st[i+1]; break;}
-
- var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
- function scan(line, from, to) {
- if (!line.text) return;
- var st = line.styles, pos = forward ? 0 : line.text.length - 1, cur;
- for (var i = forward ? 0 : st.length - 2, e = forward ? st.length : -2; i != e; i += 2*d) {
- var text = st[i];
- if (st[i+1] != null && st[i+1] != style) {pos += d * text.length; continue;}
- for (var j = forward ? 0 : text.length - 1, te = forward ? text.length : -1; j != te; j += d, pos+=d) {
- if (pos >= from && pos < to && re.test(cur = text.charAt(j))) {
- var match = matching[cur];
- if (match.charAt(1) == ">" == forward) stack.push(cur);
- else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
- else if (!stack.length) return {pos: pos, match: true};
- }
- }
- }
- }
- for (var i = head.line, e = forward ? Math.min(i + 100, lines.length) : Math.max(-1, i - 100); i != e; i+=d) {
- var line = lines[i], first = i == head.line;
- var found = scan(line, first && forward ? pos + 1 : 0, first && !forward ? pos : line.text.length);
- if (found) break;
- }
- if (!found) found = {pos: null, match: false};
- var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
- var one = markText({line: head.line, ch: pos}, {line: head.line, ch: pos+1}, style),
- two = found.pos != null
- ? markText({line: i, ch: found.pos}, {line: i, ch: found.pos + 1}, style)
- : function() {};
- var clear = operation(function(){one(); two();});
- if (autoclear) setTimeout(clear, 800);
- else bracketHighlighted = clear;
- }
-
- // Finds the line to start with when starting a parse. Tries to
- // find a line with a stateAfter, so that it can start with a
- // valid state. If that fails, it returns the line with the
- // smallest indentation, which tends to need the least context to
- // parse correctly.
- function findStartLine(n) {
- var minindent, minline;
- for (var search = n, lim = n - 40; search > lim; --search) {
- if (search == 0) return 0;
- var line = lines[search-1];
- if (line.stateAfter) return search;
- var indented = line.indentation();
- if (minline == null || minindent > indented) {
- minline = search - 1;
- minindent = indented;
- }
- }
- return minline;
- }
- function getStateBefore(n) {
- var start = findStartLine(n), state = start && lines[start-1].stateAfter;
- if (!state) state = startState(mode);
- else state = copyState(mode, state);
- for (var i = start; i < n; ++i) {
- var line = lines[i];
- line.highlight(mode, state);
- line.stateAfter = copyState(mode, state);
- }
- if (n < lines.length && !lines[n].stateAfter) work.push(n);
- return state;
- }
- function highlightLines(start, end) {
- var state = getStateBefore(start);
- for (var i = start; i < end; ++i) {
- var line = lines[i];
- line.highlight(mode, state);
- line.stateAfter = copyState(mode, state);
- }
- }
- function highlightWorker() {
- var end = +new Date + options.workTime;
- var foundWork = work.length;
- while (work.length) {
- if (!lines[showingFrom].stateAfter) var task = showingFrom;
- else var task = work.pop();
- if (task >= lines.length) continue;
- var start = findStartLine(task), state = start && lines[start-1].stateAfter;
- if (state) state = copyState(mode, state);
- else state = startState(mode);
-
- var unchanged = 0, compare = mode.compareStates, realChange = false;
- for (var i = start, l = lines.length; i < l; ++i) {
- var line = lines[i], hadState = line.stateAfter;
- if (+new Date > end) {
- work.push(i);
- startWorker(options.workDelay);
- if (realChange) changes.push({from: task, to: i + 1});
- return;
- }
- var changed = line.highlight(mode, state);
- if (changed) realChange = true;
- line.stateAfter = copyState(mode, state);
- if (compare) {
- if (hadState && compare(hadState, state)) break;
- } else {
- if (changed !== false || !hadState) unchanged = 0;
- else if (++unchanged > 3) break;
- }
- }
- if (realChange) changes.push({from: task, to: i + 1});
- }
- if (foundWork && options.onHighlightComplete)
- options.onHighlightComplete(instance);
- }
- function startWorker(time) {
- if (!work.length) return;
- highlight.set(time, operation(highlightWorker));
- }
-
- // Operations are used to wrap changes in such a way that each
- // change won't have to update the cursor and display (which would
- // be awkward, slow, and error-prone), but instead updates are
- // batched and then all combined and executed at once.
- function startOperation() {
- updateInput = null; changes = []; textChanged = selectionChanged = false;
- }
- function endOperation() {
- var reScroll = false;
- if (selectionChanged) reScroll = !scrollCursorIntoView();
- if (changes.length) updateDisplay(changes);
- else {
- if (selectionChanged) updateCursor();
- if (gutterDirty) updateGutter();
- }
- if (reScroll) scrollCursorIntoView();
- if (selectionChanged) {scrollEditorIntoView(); restartBlink();}
-
- // updateInput can be set to a boolean value to force/prevent an
- // update.
- if (focused && !leaveInputAlone &&
- (updateInput === true || (updateInput !== false && selectionChanged)))
- prepareInput();
-
- if (selectionChanged && options.matchBrackets)
- setTimeout(operation(function() {
- if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;}
- matchBrackets(false);
- }), 20);
- var tc = textChanged; // textChanged can be reset by cursoractivity callback
- if (selectionChanged && options.onCursorActivity)
- options.onCursorActivity(instance);
- if (tc && options.onChange && instance)
- options.onChange(instance, tc);
- }
- var nestedOperation = 0;
- function operation(f) {
- return function() {
- if (!nestedOperation++) startOperation();
- try {var result = f.apply(this, arguments);}
- finally {if (!--nestedOperation) endOperation();}
- return result;
- };
- }
-
- function SearchCursor(query, pos, caseFold) {
- this.atOccurrence = false;
- if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
-
- if (pos && typeof pos == "object") pos = clipPos(pos);
- else pos = {line: 0, ch: 0};
- this.pos = {from: pos, to: pos};
-
- // The matches method is filled in based on the type of query.
- // It takes a position and a direction, and returns an object
- // describing the next occurrence of the query, or null if no
- // more matches were found.
- if (typeof query != "string") // Regexp match
- this.matches = function(reverse, pos) {
- if (reverse) {
- var line = lines[pos.line].text.slice(0, pos.ch), match = line.match(query), start = 0;
- while (match) {
- var ind = line.indexOf(match[0]);
- start += ind;
- line = line.slice(ind + 1);
- var newmatch = line.match(query);
- if (newmatch) match = newmatch;
- else break;
- start++;
- }
- }
- else {
- var line = lines[pos.line].text.slice(pos.ch), match = line.match(query),
- start = match && pos.ch + line.indexOf(match[0]);
- }
- if (match)
- return {from: {line: pos.line, ch: start},
- to: {line: pos.line, ch: start + match[0].length},
- match: match};
- };
- else { // String query
- if (caseFold) query = query.toLowerCase();
- var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
- var target = query.split("\n");
- // Different methods for single-line and multi-line queries
- if (target.length == 1)
- this.matches = function(reverse, pos) {
- var line = fold(lines[pos.line].text), len = query.length, match;
- if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
- : (match = line.indexOf(query, pos.ch)) != -1)
- return {from: {line: pos.line, ch: match},
- to: {line: pos.line, ch: match + len}};
- };
- else
- this.matches = function(reverse, pos) {
- var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(lines[ln].text);
- var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
- if (reverse ? offsetA >= pos.ch || offsetA != match.length
- : offsetA <= pos.ch || offsetA != line.length - match.length)
- return;
- for (;;) {
- if (reverse ? !ln : ln == lines.length - 1) return;
- line = fold(lines[ln += reverse ? -1 : 1].text);
- match = target[reverse ? --idx : ++idx];
- if (idx > 0 && idx < target.length - 1) {
- if (line != match) return;
- else continue;
- }
- var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
- if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
- return;
- var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
- return {from: reverse ? end : start, to: reverse ? start : end};
- }
- };
- }
- }
-
- SearchCursor.prototype = {
- findNext: function() {return this.find(false);},
- findPrevious: function() {return this.find(true);},
-
- find: function(reverse) {
- var self = this, pos = clipPos(reverse ? this.pos.from : this.pos.to);
- function savePosAndFail(line) {
- var pos = {line: line, ch: 0};
- self.pos = {from: pos, to: pos};
- self.atOccurrence = false;
- return false;
- }
-
- for (;;) {
- if (this.pos = this.matches(reverse, pos)) {
- this.atOccurrence = true;
- return this.pos.match || true;
- }
- if (reverse) {
- if (!pos.line) return savePosAndFail(0);
- pos = {line: pos.line-1, ch: lines[pos.line-1].text.length};
- }
- else {
- if (pos.line == lines.length - 1) return savePosAndFail(lines.length);
- pos = {line: pos.line+1, ch: 0};
- }
- }
- },
-
- from: function() {if (this.atOccurrence) return copyPos(this.pos.from);},
- to: function() {if (this.atOccurrence) return copyPos(this.pos.to);},
-
- replace: function(newText) {
- var self = this;
- if (this.atOccurrence)
- operation(function() {
- self.pos.to = replaceRange(newText, self.pos.from, self.pos.to);
- })();
- }
- };
-
- for (var ext in extensions)
- if (extensions.propertyIsEnumerable(ext) &&
- !instance.propertyIsEnumerable(ext))
- instance[ext] = extensions[ext];
- return instance;
- } // (end of function CodeMirror)
-
- // The default configuration options.
- CodeMirror.defaults = {
- value: "",
- mode: null,
- theme: "default",
- indentUnit: 2,
- indentWithTabs: false,
- tabMode: "classic",
- enterMode: "indent",
- electricChars: true,
- onKeyEvent: null,
- lineNumbers: false,
- gutter: false,
- fixedGutter: false,
- firstLineNumber: 1,
- readOnly: false,
- smartHome: true,
- onChange: null,
- onCursorActivity: null,
- onGutterClick: null,
- onHighlightComplete: null,
- onFocus: null, onBlur: null, onScroll: null,
- matchBrackets: false,
- workTime: 100,
- workDelay: 200,
- undoDepth: 40,
- tabindex: null,
- document: window.document
- };
-
- // Known modes, by name and by MIME
- var modes = {}, mimeModes = {};
- CodeMirror.defineMode = function(name, mode) {
- if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
- modes[name] = mode;
- };
- CodeMirror.defineMIME = function(mime, spec) {
- mimeModes[mime] = spec;
- };
- CodeMirror.getMode = function(options, spec) {
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
- spec = mimeModes[spec];
- if (typeof spec == "string")
- var mname = spec, config = {};
- else if (spec != null)
- var mname = spec.name, config = spec;
- var mfactory = modes[mname];
- if (!mfactory) {
- if (window.console) console.warn("No mode " + mname + " found, falling back to plain text.");
- return CodeMirror.getMode(options, "text/plain");
- }
- return mfactory(options, config || {});
- };
- CodeMirror.listModes = function() {
- var list = [];
- for (var m in modes)
- if (modes.propertyIsEnumerable(m)) list.push(m);
- return list;
- };
- CodeMirror.listMIMEs = function() {
- var list = [];
- for (var m in mimeModes)
- if (mimeModes.propertyIsEnumerable(m)) list.push({mime: m, mode: mimeModes[m]});
- return list;
- };
-
- var extensions = {};
- CodeMirror.defineExtension = function(name, func) {
- extensions[name] = func;
- };
-
- CodeMirror.fromTextArea = function(textarea, options) {
- if (!options) options = {};
- options.value = textarea.value;
- if (!options.tabindex && textarea.tabindex)
- options.tabindex = textarea.tabindex;
-
- function save() {textarea.value = instance.getValue();}
- if (textarea.form) {
- // Deplorable hack to make the submit method do the right thing.
- var rmSubmit = connect(textarea.form, "submit", save, true);
- if (typeof textarea.form.submit == "function") {
- var realSubmit = textarea.form.submit;
- function wrappedSubmit() {
- save();
- textarea.form.submit = realSubmit;
- textarea.form.submit();
- textarea.form.submit = wrappedSubmit;
- }
- textarea.form.submit = wrappedSubmit;
- }
- }
-
- textarea.style.display = "none";
- var instance = CodeMirror(function(node) {
- textarea.parentNode.insertBefore(node, textarea.nextSibling);
- }, options);
- instance.save = save;
- instance.toTextArea = function() {
- save();
- textarea.parentNode.removeChild(instance.getWrapperElement());
- textarea.style.display = "";
- if (textarea.form) {
- rmSubmit();
- if (typeof textarea.form.submit == "function")
- textarea.form.submit = realSubmit;
- }
- };
- return instance;
- };
-
- // Utility functions for working with state. Exported because modes
- // sometimes need to do this.
- function copyState(mode, state) {
- if (state === true) return state;
- if (mode.copyState) return mode.copyState(state);
- var nstate = {};
- for (var n in state) {
- var val = state[n];
- if (val instanceof Array) val = val.concat([]);
- nstate[n] = val;
- }
- return nstate;
- }
- CodeMirror.startState = startState;
- function startState(mode, a1, a2) {
- return mode.startState ? mode.startState(a1, a2) : true;
- }
- CodeMirror.copyState = copyState;
-
- // The character stream used by a mode's parser.
- function StringStream(string) {
- this.pos = this.start = 0;
- this.string = string;
- }
- StringStream.prototype = {
- eol: function() {return this.pos >= this.string.length;},
- sol: function() {return this.pos == 0;},
- peek: function() {return this.string.charAt(this.pos);},
- next: function() {
- if (this.pos < this.string.length)
- return this.string.charAt(this.pos++);
- },
- eat: function(match) {
- var ch = this.string.charAt(this.pos);
- if (typeof match == "string") var ok = ch == match;
- else var ok = ch && (match.test ? match.test(ch) : match(ch));
- if (ok) {++this.pos; return ch;}
- },
- eatWhile: function(match) {
- var start = this.pos;
- while (this.eat(match)){}
- return this.pos > start;
- },
- eatSpace: function() {
- var start = this.pos;
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
- return this.pos > start;
- },
- skipToEnd: function() {this.pos = this.string.length;},
- skipTo: function(ch) {
- var found = this.string.indexOf(ch, this.pos);
- if (found > -1) {this.pos = found; return true;}
- },
- backUp: function(n) {this.pos -= n;},
- column: function() {return countColumn(this.string, this.start);},
- indentation: function() {return countColumn(this.string);},
- match: function(pattern, consume, caseInsensitive) {
- if (typeof pattern == "string") {
- function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
- if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
- if (consume !== false) this.pos += pattern.length;
- return true;
- }
- }
- else {
- var match = this.string.slice(this.pos).match(pattern);
- if (match && consume !== false) this.pos += match[0].length;
- return match;
- }
- },
- current: function(){return this.string.slice(this.start, this.pos);}
- };
- CodeMirror.StringStream = StringStream;
-
- // Line objects. These hold state related to a line, including
- // highlighting info (the styles array).
- function Line(text, styles) {
- this.styles = styles || [text, null];
- this.stateAfter = null;
- this.text = text;
- this.marked = this.gutterMarker = this.className = null;
- }
- Line.prototype = {
- // Replace a piece of a line, keeping the styles around it intact.
- replace: function(from, to, text) {
- var st = [], mk = this.marked;
- copyStyles(0, from, this.styles, st);
- if (text) st.push(text, null);
- copyStyles(to, this.text.length, this.styles, st);
- this.styles = st;
- this.text = this.text.slice(0, from) + text + this.text.slice(to);
- this.stateAfter = null;
- if (mk) {
- var diff = text.length - (to - from), end = this.text.length;
- function fix(n) {return n <= Math.min(to, to + diff) ? n : n + diff;}
- for (var i = 0; i < mk.length; ++i) {
- var mark = mk[i], del = false;
- if (mark.from >= end) del = true;
- else {mark.from = fix(mark.from); if (mark.to != null) mark.to = fix(mark.to);}
- if (del || mark.from >= mark.to) {mk.splice(i, 1); i--;}
- }
- }
- },
- // Split a line in two, again keeping styles intact.
- split: function(pos, textBefore) {
- var st = [textBefore, null];
- copyStyles(pos, this.text.length, this.styles, st);
- return new Line(textBefore + this.text.slice(pos), st);
- },
- addMark: function(from, to, style) {
- var mk = this.marked, mark = {from: from, to: to, style: style};
- if (this.marked == null) this.marked = [];
- this.marked.push(mark);
- this.marked.sort(function(a, b){return a.from - b.from;});
- return mark;
- },
- removeMark: function(mark) {
- var mk = this.marked;
- if (!mk) return;
- for (var i = 0; i < mk.length; ++i)
- if (mk[i] == mark) {mk.splice(i, 1); break;}
- },
- // Run the given mode's parser over a line, update the styles
- // array, which contains alternating fragments of text and CSS
- // classes.
- highlight: function(mode, state) {
- var stream = new StringStream(this.text), st = this.styles, pos = 0;
- var changed = false, curWord = st[0], prevWord;
- if (this.text == "" && mode.blankLine) mode.blankLine(state);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- var substr = this.text.slice(stream.start, stream.pos);
- stream.start = stream.pos;
- if (pos && st[pos-1] == style)
- st[pos-2] += substr;
- else if (substr) {
- if (!changed && (st[pos+1] != style || (pos && st[pos-2] != prevWord))) changed = true;
- st[pos++] = substr; st[pos++] = style;
- prevWord = curWord; curWord = st[pos];
- }
- // Give up when line is ridiculously long
- if (stream.pos > 5000) {
- st[pos++] = this.text.slice(stream.pos); st[pos++] = null;
- break;
- }
- }
- if (st.length != pos) {st.length = pos; changed = true;}
- if (pos && st[pos-2] != prevWord) changed = true;
- // Short lines with simple highlights return null, and are
- // counted as changed by the driver because they are likely to
- // highlight the same way in various contexts.
- return changed || (st.length < 5 && this.text.length < 10 ? null : false);
- },
- // Fetch the parser token for a given character. Useful for hacks
- // that want to inspect the mode state (say, for completion).
- getTokenAt: function(mode, state, ch) {
- var txt = this.text, stream = new StringStream(txt);
- while (stream.pos < ch && !stream.eol()) {
- stream.start = stream.pos;
- var style = mode.token(stream, state);
- }
- return {start: stream.start,
- end: stream.pos,
- string: stream.current(),
- className: style || null,
- state: state};
- },
- indentation: function() {return countColumn(this.text);},
- // Produces an HTML fragment for the line, taking selection,
- // marking, and highlighting into account.
- getHTML: function(sfrom, sto, includePre, endAt) {
- var html = [];
- if (includePre)
- html.push(this.className ? '': "");
- function span(text, style) {
- if (!text) return;
- if (style) html.push('', htmlEscape(text), "");
- else html.push(htmlEscape(text));
- }
- var st = this.styles, allText = this.text, marked = this.marked;
- if (sfrom == sto) sfrom = null;
- var len = allText.length;
- if (endAt != null) len = Math.min(endAt, len);
-
- if (!allText && endAt == null)
- span(" ", sfrom != null && sto == null ? "CodeMirror-selected" : null);
- else if (!marked && sfrom == null)
- for (var i = 0, ch = 0; ch < len; i+=2) {
- var str = st[i], style = st[i+1], l = str.length;
- if (ch + l > len) str = str.slice(0, len - ch);
- ch += l;
- span(str, style && "cm-" + style);
- }
- else {
- var pos = 0, i = 0, text = "", style, sg = 0;
- var markpos = -1, mark = null;
- function nextMark() {
- if (marked) {
- markpos += 1;
- mark = (markpos < marked.length) ? marked[markpos] : null;
- }
- }
- nextMark();
- while (pos < len) {
- var upto = len;
- var extraStyle = "";
- if (sfrom != null) {
- if (sfrom > pos) upto = sfrom;
- else if (sto == null || sto > pos) {
- extraStyle = " CodeMirror-selected";
- if (sto != null) upto = Math.min(upto, sto);
- }
- }
- while (mark && mark.to != null && mark.to <= pos) nextMark();
- if (mark) {
- if (mark.from > pos) upto = Math.min(upto, mark.from);
- else {
- extraStyle += " " + mark.style;
- if (mark.to != null) upto = Math.min(upto, mark.to);
- }
- }
- for (;;) {
- var end = pos + text.length;
- var appliedStyle = style;
- if (extraStyle) appliedStyle = style ? style + extraStyle : extraStyle;
- span(end > upto ? text.slice(0, upto - pos) : text, appliedStyle);
- if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
- pos = end;
- text = st[i++]; style = "cm-" + st[i++];
- }
- }
- if (sfrom != null && sto == null) span(" ", "CodeMirror-selected");
- }
- if (includePre) html.push("");
- return html.join("");
- }
- };
- // Utility used by replace and split above
- function copyStyles(from, to, source, dest) {
- for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
- var part = source[i], end = pos + part.length;
- if (state == 0) {
- if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
- if (end >= from) state = 1;
- }
- else if (state == 1) {
- if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
- else dest.push(part, source[i+1]);
- }
- pos = end;
- }
- }
-
- // The history object 'chunks' changes that are made close together
- // and at almost the same time into bigger undoable units.
- function History() {
- this.time = 0;
- this.done = []; this.undone = [];
- }
- History.prototype = {
- addChange: function(start, added, old) {
- this.undone.length = 0;
- var time = +new Date, last = this.done[this.done.length - 1];
- if (time - this.time > 400 || !last ||
- last.start > start + added || last.start + last.added < start - last.added + last.old.length)
- this.done.push({start: start, added: added, old: old});
- else {
- var oldoff = 0;
- if (start < last.start) {
- for (var i = last.start - start - 1; i >= 0; --i)
- last.old.unshift(old[i]);
- last.added += last.start - start;
- last.start = start;
- }
- else if (last.start < start) {
- oldoff = start - last.start;
- added += oldoff;
- }
- for (var i = last.added - oldoff, e = old.length; i < e; ++i)
- last.old.push(old[i]);
- if (last.added < added) last.added = added;
- }
- this.time = time;
- }
- };
-
- function stopMethod() {e_stop(this);}
- // Ensure an event has a stop method.
- function addStop(event) {
- if (!event.stop) event.stop = stopMethod;
- return event;
- }
-
- function e_preventDefault(e) {
- if (e.preventDefault) e.preventDefault();
- else e.returnValue = false;
- }
- function e_stopPropagation(e) {
- if (e.stopPropagation) e.stopPropagation();
- else e.cancelBubble = true;
- }
- function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
- function e_target(e) {return e.target || e.srcElement;}
- function e_button(e) {
- if (e.which) return e.which;
- else if (e.button & 1) return 1;
- else if (e.button & 2) return 3;
- else if (e.button & 4) return 2;
- }
-
- // Event handler registration. If disconnect is true, it'll return a
- // function that unregisters the handler.
- function connect(node, type, handler, disconnect) {
- function wrapHandler(event) {handler(event || window.event);}
- if (typeof node.addEventListener == "function") {
- node.addEventListener(type, wrapHandler, false);
- if (disconnect) return function() {node.removeEventListener(type, wrapHandler, false);};
- }
- else {
- node.attachEvent("on" + type, wrapHandler);
- if (disconnect) return function() {node.detachEvent("on" + type, wrapHandler);};
- }
- }
-
- function Delayed() {this.id = null;}
- Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
-
- // Some IE versions don't preserve whitespace when setting the
- // innerHTML of a PRE tag.
- var badInnerHTML = (function() {
- var pre = document.createElement("pre");
- pre.innerHTML = " "; return !pre.innerHTML;
- })();
-
- // Detect drag-and-drop
- var dragAndDrop = (function() {
- // IE8 has ondragstart and ondrop properties, but doesn't seem to
- // actually support ondragstart the way it's supposed to work.
- if (/MSIE [1-8]\b/.test(navigator.userAgent)) return false;
- var div = document.createElement('div');
- return "ondragstart" in div && "ondrop" in div;
- })();
-
- var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
- var ie = /MSIE \d/.test(navigator.userAgent);
- var safari = /Apple Computer/.test(navigator.vendor);
-
- var lineSep = "\n";
- // Feature-detect whether newlines in textareas are converted to \r\n
- (function () {
- var te = document.createElement("textarea");
- te.value = "foo\nbar";
- if (te.value.indexOf("\r") > -1) lineSep = "\r\n";
- }());
-
- var tabSize = 8;
- var mac = /Mac/.test(navigator.platform);
- var movementKeys = {};
- for (var i = 35; i <= 40; ++i)
- movementKeys[i] = movementKeys["c" + i] = true;
-
- // Counts the column offset in a string, taking tabs into account.
- // Used mostly to find indentation.
- function countColumn(string, end) {
- if (end == null) {
- end = string.search(/[^\s\u00a0]/);
- if (end == -1) end = string.length;
- }
- for (var i = 0, n = 0; i < end; ++i) {
- if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
- else ++n;
- }
- return n;
- }
-
- function computedStyle(elt) {
- if (elt.currentStyle) return elt.currentStyle;
- return window.getComputedStyle(elt, null);
- }
- // Find the position of an element by following the offsetParent chain.
- // If screen==true, it returns screen (rather than page) coordinates.
- function eltOffset(node, screen) {
- var doc = node.ownerDocument.body;
- var x = 0, y = 0, skipDoc = false;
- for (var n = node; n; n = n.offsetParent) {
- x += n.offsetLeft; y += n.offsetTop;
- if (screen && computedStyle(n).position == "fixed")
- skipDoc = true;
- }
- var e = screen && !skipDoc ? null : doc;
- for (var n = node.parentNode; n != e; n = n.parentNode)
- if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;}
- return {left: x, top: y};
- }
- // Get a node's text content.
- function eltText(node) {
- return node.textContent || node.innerText || node.nodeValue || "";
- }
-
- // Operations on {line, ch} objects.
- function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
- function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
- function copyPos(x) {return {line: x.line, ch: x.ch};}
-
- var escapeElement = document.createElement("div");
- function htmlEscape(str) {
- escapeElement.innerText = escapeElement.textContent = str;
- return escapeElement.innerHTML;
- }
- CodeMirror.htmlEscape = htmlEscape;
-
- // Used to position the cursor after an undo/redo by finding the
- // last edited character.
- function editEnd(from, to) {
- if (!to) return from ? from.length : 0;
- if (!from) return to.length;
- for (var i = from.length, j = to.length; i >= 0 && j >= 0; --i, --j)
- if (from.charAt(i) != to.charAt(j)) break;
- return j + 1;
- }
-
- function indexOf(collection, elt) {
- if (collection.indexOf) return collection.indexOf(elt);
- for (var i = 0, e = collection.length; i < e; ++i)
- if (collection[i] == elt) return i;
- return -1;
- }
-
- // See if "".split is the broken IE version, if so, provide an
- // alternative way to split lines.
- var splitLines, selRange, setSelRange;
- if ("\n\nb".split(/\n/).length != 3)
- splitLines = function(string) {
- var pos = 0, nl, result = [];
- while ((nl = string.indexOf("\n", pos)) > -1) {
- result.push(string.slice(pos, string.charAt(nl-1) == "\r" ? nl - 1 : nl));
- pos = nl + 1;
- }
- result.push(string.slice(pos));
- return result;
- };
- else
- splitLines = function(string){return string.split(/\r?\n/);};
- CodeMirror.splitLines = splitLines;
-
- // Sane model of finding and setting the selection in a textarea
- if (window.getSelection) {
- selRange = function(te) {
- try {return {start: te.selectionStart, end: te.selectionEnd};}
- catch(e) {return null;}
- };
- if (safari)
- // On Safari, selection set with setSelectionRange are in a sort
- // of limbo wrt their anchor. If you press shift-left in them,
- // the anchor is put at the end, and the selection expanded to
- // the left. If you press shift-right, the anchor ends up at the
- // front. This is not what CodeMirror wants, so it does a
- // spurious modify() call to get out of limbo.
- setSelRange = function(te, start, end) {
- if (start == end)
- te.setSelectionRange(start, end);
- else {
- te.setSelectionRange(start, end - 1);
- window.getSelection().modify("extend", "forward", "character");
- }
- };
- else
- setSelRange = function(te, start, end) {
- try {te.setSelectionRange(start, end);}
- catch(e) {} // Fails on Firefox when textarea isn't part of the document
- };
- }
- // IE model. Don't ask.
- else {
- selRange = function(te) {
- try {var range = te.ownerDocument.selection.createRange();}
- catch(e) {return null;}
- if (!range || range.parentElement() != te) return null;
- var val = te.value, len = val.length, localRange = te.createTextRange();
- localRange.moveToBookmark(range.getBookmark());
- var endRange = te.createTextRange();
- endRange.collapse(false);
-
- if (localRange.compareEndPoints("StartToEnd", endRange) > -1)
- return {start: len, end: len};
-
- var start = -localRange.moveStart("character", -len);
- for (var i = val.indexOf("\r"); i > -1 && i < start; i = val.indexOf("\r", i+1), start++) {}
-
- if (localRange.compareEndPoints("EndToEnd", endRange) > -1)
- return {start: start, end: len};
-
- var end = -localRange.moveEnd("character", -len);
- for (var i = val.indexOf("\r"); i > -1 && i < end; i = val.indexOf("\r", i+1), end++) {}
- return {start: start, end: end};
- };
- setSelRange = function(te, start, end) {
- var range = te.createTextRange();
- range.collapse(true);
- var endrange = range.duplicate();
- var newlines = 0, txt = te.value;
- for (var pos = txt.indexOf("\n"); pos > -1 && pos < start; pos = txt.indexOf("\n", pos + 1))
- ++newlines;
- range.move("character", start - newlines);
- for (; pos > -1 && pos < end; pos = txt.indexOf("\n", pos + 1))
- ++newlines;
- endrange.move("character", end - newlines);
- range.setEndPoint("EndToEnd", endrange);
- range.select();
- };
- }
-
- CodeMirror.defineMode("null", function() {
- return {token: function(stream) {stream.skipToEnd();}};
- });
- CodeMirror.defineMIME("text/plain", "null");
-
- return CodeMirror;
-})();
diff --git a/src/codemirror/lib/overlay.js b/src/codemirror/lib/overlay.js
deleted file mode 100755
index c4cdf9f..0000000
--- a/src/codemirror/lib/overlay.js
+++ /dev/null
@@ -1,51 +0,0 @@
-// Utility function that allows modes to be combined. The mode given
-// as the base argument takes care of most of the normal mode
-// functionality, but a second (typically simple) mode is used, which
-// can override the style of text. Both modes get to parse all of the
-// text, but when both assign a non-null style to a piece of code, the
-// overlay wins, unless the combine argument was true, in which case
-// the styles are combined.
-
-CodeMirror.overlayParser = function(base, overlay, combine) {
- return {
- startState: function() {
- return {
- base: CodeMirror.startState(base),
- overlay: CodeMirror.startState(overlay),
- basePos: 0, baseCur: null,
- overlayPos: 0, overlayCur: null
- };
- },
- copyState: function(state) {
- return {
- base: CodeMirror.copyState(base, state.base),
- overlay: CodeMirror.copyState(overlay, state.overlay),
- basePos: state.basePos, baseCur: null,
- overlayPos: state.overlayPos, overlayCur: null
- };
- },
-
- token: function(stream, state) {
- if (stream.start == state.basePos) {
- state.baseCur = base.token(stream, state.base);
- state.basePos = stream.pos;
- }
- if (stream.start == state.overlayPos) {
- stream.pos = stream.start;
- state.overlayCur = overlay.token(stream, state.overlay);
- state.overlayPos = stream.pos;
- }
- stream.pos = Math.min(state.basePos, state.overlayPos);
- if (stream.eol()) state.basePos = state.overlayPos = 0;
-
- if (state.overlayCur == null) return state.baseCur;
- if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
- else return state.overlayCur;
- },
-
- indent: function(state, textAfter) {
- return base.indent(state.base, textAfter);
- },
- electricChars: base.electricChars
- };
-};
diff --git a/src/codemirror/lib/runmode.js b/src/codemirror/lib/runmode.js
deleted file mode 100755
index 163e720..0000000
--- a/src/codemirror/lib/runmode.js
+++ /dev/null
@@ -1,27 +0,0 @@
-CodeMirror.runMode = function(string, modespec, callback) {
- var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
- var isNode = callback.nodeType == 1;
- if (isNode) {
- var node = callback, accum = [];
- callback = function(string, style) {
- if (string == "\n")
- accum.push("
");
- else if (style)
- accum.push("" + CodeMirror.htmlEscape(string) + "");
- else
- accum.push(CodeMirror.htmlEscape(string));
- }
- }
- var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
- for (var i = 0, e = lines.length; i < e; ++i) {
- if (i) callback("\n");
- var stream = new CodeMirror.StringStream(lines[i]);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- callback(stream.current(), style);
- stream.start = stream.pos;
- }
- }
- if (isNode)
- node.innerHTML = accum.join("");
-};
diff --git a/src/codemirror/manual.html b/src/codemirror/manual.html
deleted file mode 100755
index 2d9f0f1..0000000
--- a/src/codemirror/manual.html
+++ /dev/null
@@ -1,869 +0,0 @@
-
-
-
- CodeMirror: User Manual
-
-
-
-
-
-
-
-{ } CodeMirror
-
-
-
/* User manual and
- reference guide */
-
-
-
-
- Overview
-
- CodeMirror is a code-editor component that can be embedded in
- Web pages. It provides only the editor component, no
- accompanying buttons
- (see CodeMirror
- UI for a drop-in button bar), auto-completion, or other IDE
- functionality. It does provide a rich API on top of which such
- functionality can be straightforwardly implemented.
-
- CodeMirror works with language-specific modes. Modes are
- JavaScript programs that help color (and optionally indent) text
- written in a given language. The distribution comes with a few
- modes (see the mode/ directory), and it isn't hard
- to write new ones for other languages.
-
- Basic Usage
-
- The easiest way to use CodeMirror is to simply load the script
- and style sheet found under lib/ in the distribution,
- plus a mode script from one of the mode/ directories
- and a theme stylesheet from theme/. (See
- also the compression helper.) For
- example:
-
- <script src="lib/codemirror.js"></script>
-<link rel="stylesheet" href="lib/codemirror.css">
-<script src="mode/javascript/javascript.js"></script>
-<link rel="stylesheet" href="theme/default.css">
-
- (If you use a theme other than default.css, you
- also have to specify the
- theme option.) Having
- done this, an editor instance can be created like this:
-
- var myCodeMirror = CodeMirror(document.body);
-
- The editor will be appended to the document body, will start
- empty, and will use the mode that we loaded. To have more control
- over the new editor, a configuration object can be passed
- to CodeMirror as a second argument:
-
- var myCodeMirror = CodeMirror(document.body, {
- value: "function myScript(){return 100;}\n",
- mode: "javascript"
-});
-
- This will initialize the editor with a piece of code already in
- it, and explicitly tell it to use the JavaScript mode (which is
- useful when multiple modes are loaded).
- See below for a full discussion of the
- configuration options that CodeMirror accepts.
-
- In cases where you don't want to append the editor to an
- element, and need more control over the way it is inserted, the
- first argument to the CodeMirror function can also
- be a function that, when given a DOM element, inserts it into the
- document somewhere. This could be used to, for example, replace a
- textarea with a real editor:
-
- var myCodeMirror = CodeMirror(function(elt) {
- myTextArea.parentNode.replaceChild(elt, myTextArea);
-}, {value: myTextArea.value});
-
- However, for this use case, which is a common way to use
- CodeMirror, the library provides a much more powerful
- shortcut:
-
- var myCodeMirror = CodeMirror.fromTextArea(myTextArea);
-
- This will, among other things, ensure that the textarea's value
- is updated when the form (if it is part of a form) is submitted.
- See the API reference for a full
- description of this method.
-
- Configuration
-
- Both the CodeMirror function and
- its fromTextArea method take as second (optional)
- argument an object containing configuration options. Any option
- not supplied like this will be taken
- from CodeMirror.defaults, an object containing the
- default options. You can update this object to change the defaults
- on your page.
-
- Options are not checked in any way, so setting bogus option
- values is bound to lead to odd errors.
-
- Note: CodeMirror
- 2 does not support
- line-wrapping. I would have very much liked to support it, but it
- combines extremely poorly with the way the editor is
- implemented.
-
- These are the supported options:
-
-
- value (string)
- - The starting value of the editor.
-
- mode (string or object)
- - The mode to use. When not given, this will default to the
- first mode that was loaded. It may be a string, which either
- simply names the mode or is
- a MIME type
- associated with the mode. Alternatively, it may be an object
- containing configuration options for the mode, with
- a
name property that names the mode (for
- example {name: "javascript", json: true}). The demo
- pages for each mode contain information about what configuration
- parameters the mode supports. You can ask CodeMirror which modes
- and MIME types are loaded with
- the CodeMirror.listModes
- and CodeMirror.listMIMEs functions.
-
- theme (string)
- - The theme to style the editor with. You must make sure the
- CSS file defining the corresponding
.cm-s-[name]
- styles is loaded (see
- the theme directory in the
- distribution).
-
- indentUnit (integer)
- - How many spaces a block (whatever that means in the edited
- language) should be indented. The default is 2.
-
- indentWithTabs (boolean)
- - Whether, when indenting, the first N*8 spaces should be
- replaced by N tabs. Default is false.
-
- tabMode (string)
- - Determines what happens when the user presses the tab key.
- Must be one of the following:
-
- "classic" (the default)
- - When nothing is selected, insert a tab. Otherwise,
- behave like the
"shift" mode. (When shift is
- held, this behaves like the "indent" mode.)
- "shift"
- - Indent all selected lines by
- one
indentUnit.
- If shift was held while pressing tab, un-indent all selected
- lines one unit.
- "indent"
- - Indent the line the 'correctly', based on its syntactic
- context. Only works if the
- mode supports it.
- "default"
- - Do not capture tab presses, let the browser apply its
- default behaviour (which usually means it skips to the next
- control).
-
-
- enterMode (string)
- - Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
-
- "indent" (the default)
- - Use the mode's indentation rules to give the new line
- the correct indentation.
- "keep"
- - Indent the line the same as the previous line.
- "flat"
- - Do not indent the new line.
-
-
- electricChars (boolean)
- - Configures whether the editor should re-indent the current
- line when a character is typed that might change its proper
- indentation (only works if the mode supports indentation).
- Default is true.
-
- smartHome (boolean)
- - Configures whether the home key takes you to the first
- non-whitespace character (unless already there) or to the start
- of the line. On by default.
-
- lineNumbers (boolean)
- - Whether to show line numbers to the left of the editor.
-
- firstLineNumber (integer)
- - At which number to start counting lines. Default is 1.
-
- gutter (boolean)
- - Can be used to force a 'gutter' (empty space on the left of
- the editor) to be shown even when no line numbers are active.
- This is useful for setting markers.
-
- fixedGutter (boolean)
- - When enabled (off by default), this will make the gutter
- stay visible when the document is scrolled horizontally.
-
- readOnly (boolean)
- - This disables editing of the editor content by the user.
- (Changes through API functions will still be possible.) If you
- also want to disable the cursor, use
"nocursor" as
- a value for this option, instead of true.
-
- onChange (function)
- - When given, this function will be called every time the
- content of the editor is changed. It will be given the editor
- instance as only argument.
-
- onCursorActivity (function)
- - Like
onChange, but will also be called when the
- cursor moves without any changes being made.
-
- onGutterClick (function)
- - When given, will be called whenever the editor gutter (the
- line-number area) is clicked. Will be given the editor instance
- as first argument, the (zero-based) number of the line that was
- clicked as second argument, and the raw
mousedown
- event object as third argument.
-
- onFocus, onBlur (function)
- - The given functions will be called whenever the editor is
- focused or unfocused.
-
- onScroll (function)
- - When given, will be called whenever the editor is
- scrolled.
-
- onHighlightComplete (function)
- - Whenever the editor's content has been fully highlighted,
- this function (if given) will be called. It'll be given a single
- argument, the editor instance.
-
- matchBrackets (boolean)
- - Determines whether brackets are matched whenever the cursor
- is moved next to a bracket.
-
- workTime, workDelay (number)
- - Highlighting is done by a pseudo background-thread that will
- work for
workTime milliseconds, and then use
- timeout to sleep for workDelay milliseconds. The
- defaults are 200 and 300, you can change these options to make
- the highlighting more or less aggressive.
-
- undoDepth (integer)
- - The maximum number of undo levels that the editor stores.
- Defaults to 40.
-
- tabindex (integer)
- - The tab
- index to assign to the editor. If not given, no tab index
- will be assigned.
-
- document (DOM document)
- - Use this if you want to display the editor in another DOM.
- By default it will use the global
document
- object.
-
- onKeyEvent (function)
- - This provides a rather low-level hook into CodeMirror's key
- handling. If provided, this function will be called on
- every
keydown, keyup,
- and keypress event that CodeMirror captures. It
- will be passed two arguments, the editor instance and the key
- event. This key event is pretty much the raw key event, except
- that a stop() method is always added to it. You
- could feed it to, for example, jQuery.Event to
- further normalize it.
This function can inspect the key
- event, and handle it if it wants to. It may return true to tell
- CodeMirror to ignore the event. Be wary that, on some browsers,
- stopping a keydown does not stop
- the keypress from firing, whereas on others it
- does. If you respond to an event, you should probably inspect
- its type property and only do something when it
- is keydown (or keypress for actions
- that need character data).
-
-
- Customized Styling
-
- Up to a certain extent, CodeMirror's look can be changed by
- modifying style sheet files. The style sheets supplied by modes
- simply provide the colors for that mode, and can be adapted in a
- very straightforward way. To style the editor itself, it is
- possible to alter or override the styles defined
- in codemirror.css.
-
- Some care must be taken there, since a lot of the rules in this
- file are necessary to have CodeMirror function properly. Adjusting
- colors should be safe, of course, and with some care a lot of
- other things can be changed as well. The CSS classes defined in
- this file serve the following roles:
-
-
- CodeMirror
- - The outer element of the editor. This should be used for
- borders and positioning. Can also be used to set styles that
- should hold for everything inside the editor (such as font
- and font size), or to set a background.
-
- CodeMirror-scroll
- - This determines whether the editor scrolls (
overflow:
- auto + fixed height). By default, it does. Giving
- this height: auto; overflow: visible; will cause
- the editor to resize to fit its content.
-
- CodeMirror-focused
- - Whenever the editor is focused, the top element gets this
- class. This is used to hide the cursor and give the selection a
- different color when the editor is not focused.
-
- CodeMirror-gutter
- - Use this for giving a background or a border to the editor
- gutter. Don't set any padding here,
- use
CodeMirror-gutter-text for that. By default,
- the gutter is 'fluid', meaning it will adjust its width to the
- maximum line number or line marker width. You can also set a
- fixed width if you want.
-
- CodeMirror-gutter-text
- - Used to style the actual line numbers. For the numbers to
- line up, you must make sure that the font in the gutter is the
- same as the one in the rest of the editor, so you should
- probably only set font style and size in
- the
CodeMirror class.
-
- CodeMirror-lines
- - The visible lines. If this has vertical
- padding,
CodeMirror-gutter should have the same
- padding.
-
- CodeMirror-cursor
- - The cursor is a block element that is absolutely positioned.
- You can make it look whichever way you want.
-
- CodeMirror-selected
- - The selection is represented by
span elements
- with this class.
-
- CodeMirror-matchingbracket,
- CodeMirror-nonmatchingbracket
- - These are used to style matched (or unmatched) brackets.
-
-
- The actual lines, as well as the cursor, are represented
- by pre elements. By default no text styling (such as
- bold) that might change line height is applied. If you do want
- such effects, you'll have to give CodeMirror pre a
- fixed height. Also, you must still take care that character width
- is constant.
-
- If your page's style sheets do funky things to
- all div or pre elements (you probably
- shouldn't do that), you'll have to define rules to cancel these
- effects out again for elements under the CodeMirror
- class.
-
- Programming API
-
- A lot of CodeMirror features are only available through its API.
- This has the disadvantage that you need to do work to enable them,
- and the advantage that CodeMirror will fit seamlessly into your
- application.
-
- Whenever points in the document are represented, the API uses
- objects with line and ch properties.
- Both are zero-based. CodeMirror makes sure to 'clip' any positions
- passed by client code so that they fit inside the document, so you
- shouldn't worry too much about sanitizing your coordinates. If you
- give ch a value of null, or don't
- specify it, it will be replaced with the length of the specified
- line.
-
-
- getValue() → string
- - Get the current editor content.
- setValue(string)
- - Set the editor content.
-
- getSelection() → string
- - Get the currently selected code.
- replaceSelection(string)
- - Replace the selection with the given string.
-
- focus()
- - Give the editor focus.
-
- setOption(option, value)
- - Change the configuration of the editor.
option
- should the name of an option,
- and value should be a valid value for that
- option.
- getOption(option) → value
- - Retrieves the current value of the given option for this
- editor instance.
-
- cursorCoords(start) → object
- - Returns an
{x, y, yBot} object containing the
- coordinates of the cursor relative to the top-left corner of the
- page. yBot is the coordinate of the bottom of the
- cursor. start is a boolean indicating whether you
- want the start or the end of the selection.
- charCoords(pos) → object
- - Like
cursorCoords, but returns the position of
- an arbitrary characters. pos should be
- a {line, ch} object.
- coordsChar(object) → pos
- - Given an
{x, y} object (in page coordinates),
- returns the {line, ch} position that corresponds to
- it.
-
- undo()
- - Undo one edit (if any undo events are stored).
- redo()
- - Redo one undone edit.
- historySize() → object
- - Returns an object with
{undo, redo} properties,
- both of which hold integers, indicating the amount of stored
- undo and redo operations.
-
- indentLine(line, dir)
- - Reset the given line's indentation to the indentation
- prescribed by the mode. If the second argument is given,
- indentation will be increased (if
dir is true) or
- decreased (if false) by an indent
- unit instead.
-
- getSearchCursor(query, start, caseFold) → cursor
- - Used to implement search/replace
- functionality.
query can be a regular expression or
- a string (only strings will match across lines—if they contain
- newlines). start provides the starting position of
- the search. It can be a {line, ch} object, or can
- be left off to default to the start of the
- document. caseFold is only relevant when matching a
- string. It will cause the search to be case-insensitive. A
- search cursor has the following methods:
-
- findNext(), findPrevious() → boolean
- - Search forward or backward from the current position.
- The return value indicates whether a match was found. If
- matching a regular expression, the return value will be the
- array returned by the
match method, in case you
- want to extract matched groups.
- from(), to() → object
- - These are only valid when the last call
- to
findNext or findPrevious did
- not return false. They will return {line, ch}
- objects pointing at the start and end of the match.
- replace(text)
- - Replaces the currently found match with the given text
- and adjusts the cursor position to reflect the
- replacement.
-
-
- getTokenAt(pos) → object
- - Retrieves information about the token the current mode found
- at the given position (a
{line, ch} object). The
- returned object has the following properties:
-
- start- The character (on the given line) at which the token starts.
- end- The character at which the token ends.
- string- The token's string.
- className- The class the mode assigned
- to the token. (Can be null when no class was assigned.)
- state- The mode's state at the end of this token.
-
-
- markText(from, to, className) → function
- - Can be used to mark a range of text with a specific CSS
- class name.
from and to should
- be {line, ch} objects. The method will return a
- function that can be called to remove the marking.
-
- setMarker(line, text, className) → lineHandle
- - Add a gutter marker for the given line. Gutter markers are
- shown in the line-number area (instead of the number for this
- line). Both
text and className are
- optional. Setting text to a Unicode character like
- ● tends to give a nice effect. To put a picture in the gutter,
- set text to a space and className to
- something that sets a background image. If you
- specify text, the given text (which may contain
- HTML) will, by default, replace the line number for that line.
- If this is not what you want, you can include the
- string %N% in the text, which will be replaced by
- the line number.
- clearMarker(line)
- - Clears a marker created
- with
setMarker. line can be either a
- number or a handle returned by setMarker (since a
- number may now refer to a different line if something was added
- or deleted).
- setLineClass(line, className) → lineHandle
- - Set a CSS class name for the given line.
line
- can be a number or a line handle (as returned
- by setMarker or this function).
- Pass null to clear the class for a line.
-
- lineInfo(line) → object
- - Returns the line number, text content, and marker status of
- the given line, which can be either a number or a handle
- returned by
setMarker. The returned object has the
- structure {line, text, markerText, markerClass}.
-
- addWidget(pos, node, scrollIntoView)
- - Puts
node, which should be an absolutely
- positioned DOM node, into the editor, positioned right below the
- given {line, ch} position.
- When scrollIntoView is true, the editor will ensure
- that the entire node is visible (if possible). To remove the
- widget again, simply use DOM methods (move it somewhere else, or
- call removeChild on its parent).
-
- matchBrackets()
- - Force matching-bracket-highlighting to happen.
-
- lineCount() → number
- - Get the number of lines in the editor.
-
- getCursor(start) → object
- start is a boolean indicating whether the start
- or the end of the selection must be retrieved. If it is not
- given, the current cursor pos, i.e. the side of the selection
- that would move if you pressed an arrow key, is chosen.
- A {line, ch} object will be returned.
- somethingSelected() → boolean
- - Return true if any text is selected.
- setCursor(pos)
- - Set the cursor position. You can either pass a
- single
{line, ch} object, or the line and the
- character as two separate parameters.
- setSelection(start, end)
- - Set the selection range.
start
- and end should be {line, ch} objects.
-
- getLine(n) → string
- - Get the content of line
n.
- setLine(n, text)
- - Set the content of line
n.
- removeLine(n)
- - Remove the given line from the document.
-
- getRange(from, to) → string
- - Get the text between the given points in the editor, which
- should be
{line, ch} objects.
- replaceRange(string, from, to)
- - Replace the part of the document between
from
- and to with the given string. from
- and to must be {line, ch}
- objects. to can be left off to simply insert the
- string at position from.
-
-
- The following are more low-level methods:
-
-
- operation(func) → result
- - CodeMirror internally buffers changes and only updates its
- DOM structure after it has finished performing some operation.
- If you need to perform a lot of operations on a CodeMirror
- instance, you can call this method with a function argument. It
- will call the function, buffering up all changes, and only doing
- the expensive update after the function returns. This can be a
- lot faster. The return value from this method will be the return
- value of your function.
-
- refresh()
- - If your code does something to change the size of the editor
- element (window resizes are already listened for), or unhides
- it, you should probably follow up by calling this method to
- ensure CodeMirror is still looking as intended.
-
- getInputField() → textarea
- - Returns the hiden textarea used to read input.
- getWrapperElement() → node
- - Returns the DOM node that represents the editor. Remove this
- from your tree to delete an editor instance.
- getScrollerElement() → node
- - Returns the DOM node that is responsible for the sizing and
- the scrolling of the editor. You can change
- the
height and width styles of this
- element to resize an editor. (You might have to call
- the refresh method
- afterwards.)
- getGutterElement() → node
- - Fetches the DOM node that represents the editor gutter.
-
- getStateAfter(line) → state
- - Returns the mode's parser state, if any, at the end of the
- given line number. If no line number is given, the state at the
- end of the document is returned. This can be useful for storing
- parsing errors in the state, or getting other kinds of
- contextual information for a line.
-
-
- Finally, the CodeMirror object
- itself has a method fromTextArea. This takes a
- textarea DOM node as first argument and an optional configuration
- object as second. It will replace the textarea with a CodeMirror
- instance, and wire up the form of that textarea (if any) to make
- sure the editor contents are put into the textarea when the form
- is submitted. A CodeMirror instance created this way has two
- additional methods:
-
-
- save()
- - Copy the content of the editor into the textarea.
-
- toTextArea()
- - Remove the editor, and restore the original textarea (with
- the editor's current content).
-
-
- If you want define extra methods in terms
- of the CodeMirror API, is it possible to
- use CodeMirror.defineExtension(name, value). This
- will cause the given value (usually a method) to be added to all
- CodeMirror instances created from then on.
-
- Writing CodeMirror Modes
-
- Modes typically consist of a JavaScript file and a CSS file.
- The CSS file (see, for
- example javascript.css)
- defines the classes that will be used to style the syntactic
- elements of the code, and the script contains the logic to
- actually assign these classes to the right pieces of text.
-
- You'll usually want to use some kind of prefix for your CSS
- classes, so that they are unlikely to clash with other classes,
- both those used by other modes and those defined by the page in
- which CodeMirror is embedded.
-
- The mode script should
- call CodeMirror.defineMode to register itself with
- CodeMirror. This function takes two arguments. The first should be
- the name of the mode, for which you should use a lowercase string,
- preferably one that is also the name of the files that define the
- mode (i.e. "xml" is defined xml.js). The
- second argument should be a function that, given a CodeMirror
- configuration object (the thing passed to
- the CodeMirror function) and a mode configuration
- object (as in the mode
- option), returns a mode object.
-
- Typically, you should use this second argument
- to defineMode as your module scope function (modes
- should not leak anything into the global scope!), i.e. write your
- whole mode inside this function.
-
- The main responsibility of a mode script is parsing
- the content of the editor. Depending on the language and the
- amount of functionality desired, this can be done in really easy
- or extremely complicated ways. Some parsers can be stateless,
- meaning that they look at one element (token) of the code
- at a time, with no memory of what came before. Most, however, will
- need to remember something. This is done by using a state
- object, which is an object that can be mutated every time a
- new token is read.
-
- Modes that use a state must define
- a startState method on their mode object. This is a
- function of no arguments that produces a state object to be used
- at the start of a document.
-
- The most important part of a mode object is
- its token(stream, state) method. All modes must
- define this method. It should read one token from the stream it is
- given as an argument, optionally update its state, and return a
- style string, or null for tokens that do not have to
- be styled. For your styles, you can either use the 'standard' ones
- defined in the themes (without the cm- prefix), or
- define your own (as the diff
- mode does) and have people include a custom theme for your
- mode.
-
-
The stream object encapsulates a line of code
- (tokens may never span lines) and our current position in that
- line. It has the following API:
-
-
- eol() → boolean
- - Returns true only if the stream is at the end of the
- line.
- sol() → boolean
- - Returns true only if the stream is at the start of the
- line.
-
- peek() → character
- - Returns the next character in the stream without advancing
- it. Will return
undefined at the end of the
- line.
- next() → character
- - Returns the next character in the stream and advances it.
- Also returns
undefined when no more characters are
- available.
-
- eat(match) → character
- match can be a character, a regular expression,
- or a function that takes a character and returns a boolean. If
- the next character in the stream 'matches' the given argument,
- it is consumed and returned. Otherwise, undefined
- is returned.
- eatWhile(match) → boolean
- - Repeatedly calls
eat with the given argument,
- until it fails. Returns true if any characters were eaten.
- eatSpace() → boolean
- - Shortcut for
eatWhile when matching
- white-space.
- skipToEnd()
- - Moves the position to the end of the line.
- skipTo(ch) → boolean
- - Skips to the next occurrence of the given character, if
- found. Returns true if the character was found.
- match(pattern, consume, caseFold) → boolean
- - Act like a
- multi-character
eat—if consume is true
- or not given—or a look-ahead that doesn't update the stream
- position—if it is false. pattern can be either a
- string or a regular expression starting with ^.
- When it is a string, caseFold can be set to true to
- make the match case-insensitive. When successfully matching a
- regular expression, the returned value will be the array
- returned by match, in case you need to extract
- matched groups.
-
- backUp(n)
- - Backs up the stream
n characters. Backing it up
- further than the start of the current token will cause things to
- break, so be careful.
- column() → integer
- - Returns the column (taking into account tabs) at which the
- current token starts. Can be used to find out whether a token
- starts a new line.
- indentation() → integer
- - Tells you how far the current line has been indented, in
- spaces. Corrects for tab characters.
-
- current() → string
- - Get the string between the start of the current token and
- the current stream position.
-
-
- By default, blank lines are simply skipped when
- tokenizing a document. For languages that have significant blank
- lines, you can define a blankLine(state) method on
- your mode that will get called whenever a blank line is passed
- over, so that it can update the parser state.
-
- Because state object are mutated, and CodeMirror
- needs to keep valid versions of a state around so that it can
- restart a parse at any line, copies must be made of state objects.
- The default algorithm used is that a new state object is created,
- which gets all the properties of the old object. Any properties
- which hold arrays get a copy of these arrays (since arrays tend to
- be used as mutable stacks). When this is not correct, for example
- because a mode mutates non-array properties of its state object, a
- mode object should define a copyState method,
- which is given a state and should return a safe copy of that
- state.
-
- By default, CodeMirror will stop re-parsing
- a document as soon as it encounters a few lines that were
- highlighted the same in the old parse as in the new one. It is
- possible to provide an explicit way to test whether a state is
- equivalent to another one, which CodeMirror will use (instead of
- the unchanged-lines heuristic) to decide when to stop
- highlighting. You do this by providing
- a compareStates method on your mode object, which
- takes two state arguments and returns a boolean indicating whether
- they are equivalent. See the XML mode, which uses this to provide
- reliable highlighting of bad closing tags, as an example.
-
- If you want your mode to provide smart indentation
- (see entermode
- and tabMode when they
- have a value of "indent"), you must define
- an indent(state, textAfter) method on your mode
- object.
-
- The indentation method should inspect the given state object,
- and optionally the textAfter string, which contains
- the text on the line that is being indented, and return an
- integer, the amount of spaces to indent. It should usually take
- the indentUnit
- option into account.
-
- Finally, a mode may define
- an electricChars property, which should hold a string
- containing all the characters that should trigger the behaviour
- described for
- the electricChars
- option.
-
- So, to summarize, a mode must provide
- a token method, and it may
- provide startState, copyState,
- and indent methods. For an example of a trivial mode,
- see the diff mode, for a more
- involved example, see
- the JavaScript
- mode.
-
- Sometimes, it is useful for modes to nest—to have one
- mode delegate work to another mode. An example of this kind of
- mode is the mixed-mode HTML
- mode. To implement such nesting, it is usually necessary to
- create mode objects and copy states yourself. To create a mode
- object, there are CodeMirror.getMode(options,
- parserConfig), where the first argument is a configuration
- object as passed to the mode constructor function, and the second
- argument is a mode specification as in
- the mode option. To copy a
- state object, call CodeMirror.copyState(mode, state),
- where mode is the mode that created the given
- state.
-
- To make indentation work properly in a nested parser, it is
- advisable to give the startState method of modes that
- are intended to be nested an optional argument that provides the
- base indentation for the block of code. The JavaScript and CSS
- parser do this, for example, to allow JavaScript and CSS code
- inside the mixed-mode HTML mode to be properly indented.
-
- Finally, it is possible to associate your mode, or a certain
- configuration of your mode, with
- a MIME type. For
- example, the JavaScript mode associates itself
- with text/javascript, and its JSON variant
- with application/json. To do this,
- call CodeMirror.defineMIME(mime, modeSpec),
- where modeSpec can be a string or object specifying a
- mode, as in the mode
- option.
-
-
-
- Contents
-
-
-
-
-
-
-
-
-
diff --git a/src/codemirror/mode/clike/clike.js b/src/codemirror/mode/clike/clike.js
deleted file mode 100755
index 08b443a..0000000
--- a/src/codemirror/mode/clike/clike.js
+++ /dev/null
@@ -1,247 +0,0 @@
-CodeMirror.defineMode("clike", function(config, parserConfig) {
- var indentUnit = config.indentUnit,
- keywords = parserConfig.keywords || {},
- blockKeywords = parserConfig.blockKeywords || {},
- atoms = parserConfig.atoms || {},
- hooks = parserConfig.hooks || {},
- multiLineStrings = parserConfig.multiLineStrings;
- var isOperatorChar = /[+\-*&%=<>!?|\/]/;
-
- var curPunc;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- if (hooks[ch]) {
- var result = hooks[ch](stream, state);
- if (result !== false) return result;
- }
- if (ch == '"' || ch == "'") {
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
- curPunc = ch;
- return null
- }
- if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/);
- return "number";
- }
- if (ch == "/") {
- if (stream.eat("*")) {
- state.tokenize = tokenComment;
- return tokenComment(stream, state);
- }
- if (stream.eat("/")) {
- stream.skipToEnd();
- return "comment";
- }
- }
- if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return "operator";
- }
- stream.eatWhile(/[\w\$_]/);
- var cur = stream.current();
- if (keywords.propertyIsEnumerable(cur)) {
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
- return "keyword";
- }
- if (atoms.propertyIsEnumerable(cur)) return "atom";
- return "word";
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {end = true; break;}
- escaped = !escaped && next == "\\";
- }
- if (end || !(escaped || multiLineStrings))
- state.tokenize = tokenBase;
- return "string";
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function Context(indented, column, type, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.align = align;
- this.prev = prev;
- }
- function pushContext(state, col, type) {
- return state.context = new Context(state.indented, col, type, null, state.context);
- }
- function popContext(state) {
- var t = state.context.type;
- if (t == ")" || t == "]" || t == "}")
- state.indented = state.context.indented;
- return state.context = state.context.prev;
- }
-
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: null,
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
- indented: 0,
- startOfLine: true
- };
- },
-
- token: function(stream, state) {
- var ctx = state.context;
- if (stream.sol()) {
- if (ctx.align == null) ctx.align = false;
- state.indented = stream.indentation();
- state.startOfLine = true;
- }
- if (stream.eatSpace()) return null;
- curPunc = null;
- var style = (state.tokenize || tokenBase)(stream, state);
- if (style == "comment" || style == "meta") return style;
- if (ctx.align == null) ctx.align = true;
-
- if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
- else if (curPunc == "{") pushContext(state, stream.column(), "}");
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
- else if (curPunc == "}") {
- while (ctx.type == "statement") ctx = popContext(state);
- if (ctx.type == "}") ctx = popContext(state);
- while (ctx.type == "statement") ctx = popContext(state);
- }
- else if (curPunc == ctx.type) popContext(state);
- else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
- pushContext(state, stream.column(), "statement");
- state.startOfLine = false;
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase && state.tokenize != null) return 0;
- var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
- else return ctx.indented + (closing ? 0 : indentUnit);
- },
-
- electricChars: "{}"
- };
-});
-
-(function() {
- function words(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
- var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
- "double static else struct entry switch extern typedef float union for unsigned " +
- "goto while enum void const signed volatile";
-
- function cppHook(stream, state) {
- if (!state.startOfLine) return false;
- stream.skipToEnd();
- return "meta";
- }
-
- // C#-style strings where "" escapes a quote.
- function tokenAtString(stream, state) {
- var next;
- while ((next = stream.next()) != null) {
- if (next == '"' && !stream.eat('"')) {
- state.tokenize = null;
- break;
- }
- }
- return "string";
- }
-
- CodeMirror.defineMIME("text/x-csrc", {
- name: "clike",
- keywords: words(cKeywords),
- blockKeywords: words("case do else for if switch while struct"),
- atoms: words("null"),
- hooks: {"#": cppHook}
- });
- CodeMirror.defineMIME("text/x-c++src", {
- name: "clike",
- keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
- "static_cast typeid catch operator template typename class friend private " +
- "this using const_cast inline public throw virtual delete mutable protected " +
- "wchar_t"),
- blockKeywords: words("catch class do else finally for if struct switch try while"),
- atoms: words("true false null"),
- hooks: {"#": cppHook}
- });
- CodeMirror.defineMIME("text/x-java", {
- name: "clike",
- keywords: words("abstract assert boolean break byte case catch char class const continue default " +
- "do double else enum extends final finally float for goto if implements import " +
- "instanceof int interface long native new package private protected public " +
- "return short static strictfp super switch synchronized this throw throws transient " +
- "try void volatile while"),
- blockKeywords: words("catch class do else finally for if switch try while"),
- atoms: words("true false null"),
- hooks: {
- "@": function(stream, state) {
- stream.eatWhile(/[\w\$_]/);
- return "meta";
- }
- }
- });
- CodeMirror.defineMIME("text/x-csharp", {
- name: "clike",
- keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
- " default delegate do double else enum event explicit extern finally fixed float for" +
- " foreach goto if implicit in int interface internal is lock long namespace new object" +
- " operator out override params private protected public readonly ref return sbyte sealed short" +
- " sizeof stackalloc static string struct switch this throw try typeof uint ulong unchecked" +
- " unsafe ushort using virtual void volatile while add alias ascending descending dynamic from get" +
- " global group into join let orderby partial remove select set value var yield"),
- blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
- atoms: words("true false null"),
- hooks: {
- "@": function(stream, state) {
- if (stream.eat('"')) {
- state.tokenize = tokenAtString;
- return tokenAtString(stream, state);
- }
- stream.eatWhile(/[\w\$_]/);
- return "meta";
- }
- }
- });
- CodeMirror.defineMIME("text/x-groovy", {
- name: "clike",
- keywords: words("abstract as assert boolean break byte case catch char class const continue def default " +
- "do double else enum extends final finally float for goto if implements import " +
- "in instanceof int interface long native new package property private protected public " +
- "return short static strictfp super switch synchronized this throw throws transient " +
- "try void volatile while"),
- atoms: words("true false null"),
- hooks: {
- "@": function(stream, state) {
- stream.eatWhile(/[\w\$_]/);
- return "meta";
- }
- }
- });
-}());
diff --git a/src/codemirror/mode/clike/index.html b/src/codemirror/mode/clike/index.html
deleted file mode 100755
index 89241c0..0000000
--- a/src/codemirror/mode/clike/index.html
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
- CodeMirror 2: C-like mode
-
-
-
-
-
-
-
-
- CodeMirror 2: C-like mode
-
-
-
-
-
- Simple mode that tries to handle C-like languages as well as it
- can. Takes two configuration parameters: keywords, an
- object whose property names are the keywords in the language,
- and useCPP, which determines whether C preprocessor
- directives are recognized.
-
- MIME types defined: text/x-csrc
- (C code), text/x-c++src (C++
- code), text/x-java (Java
- code), text/x-groovy (Groovy code).
-
-
diff --git a/src/codemirror/mode/clojure/clojure.js b/src/codemirror/mode/clojure/clojure.js
deleted file mode 100755
index a951589..0000000
--- a/src/codemirror/mode/clojure/clojure.js
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
- * Author: Hans Engel
- * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
- */
-CodeMirror.defineMode("clojure", function (config, mode) {
- var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag",
- ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
- var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
-
- function makeKeywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var atoms = makeKeywords("true false nil");
-
- var keywords = makeKeywords(
- // Control structures
- "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord deftest slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle" +
-
- // Built-ins
- "* *1 *2 *3 *agent* *allow-unresolved-vars* *assert *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - / < <= = == > >= accessor aclone agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? extend extend-protocol extend-type extends? extenders false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reify reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq");
-
- var indentKeys = makeKeywords(
- // Built-ins
- "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch" +
-
- // Binding forms
- "let letfn binding loop for doseq dotimes when-let if-let" +
-
- // Data structures
- "defstruct struct-map assoc" +
-
- // clojure.test
- "testing deftest" +
-
- // contrib
- "handler-case handle dotrace deftrace");
-
- var tests = {
- digit: /\d/,
- digit_or_colon: /[\d:]/,
- hex: /[0-9a-fA-F]/,
- sign: /[+-]/,
- exponent: /[eE]/,
- keyword_char: /[^\s\(\[\;\)\]]/,
- basic: /[\w\$_\-]/,
- lang_keyword: /[\w*+!\-_?:\/]/
- };
-
- function stateStack(indent, type, prev) { // represents a state stack object
- this.indent = indent;
- this.type = type;
- this.prev = prev;
- }
-
- function pushStack(state, indent, type) {
- state.indentStack = new stateStack(indent, type, state.indentStack);
- }
-
- function popStack(state) {
- state.indentStack = state.indentStack.prev;
- }
-
- function isNumber(ch, stream){
- // hex
- if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) {
- stream.eat('x');
- stream.eatWhile(tests.hex);
- return true;
- }
-
- // leading sign
- if ( ch == '+' || ch == '-' ) {
- stream.eat(tests.sign);
- ch = stream.next();
- }
-
- if ( tests.digit.test(ch) ) {
- stream.eat(ch);
- stream.eatWhile(tests.digit);
-
- if ( '.' == stream.peek() ) {
- stream.eat('.');
- stream.eatWhile(tests.digit);
- }
-
- if ( 'e' == stream.peek().toLowerCase() ) {
- stream.eat(tests.exponent);
- stream.eat(tests.sign);
- stream.eatWhile(tests.digit);
- }
-
- return true;
- }
-
- return false;
- }
-
- return {
- startState: function () {
- return {
- indentStack: null,
- indentation: 0,
- mode: false,
- };
- },
-
- token: function (stream, state) {
- if (state.indentStack == null && stream.sol()) {
- // update indentation, but only if indentStack is empty
- state.indentation = stream.indentation();
- }
-
- // skip spaces
- if (stream.eatSpace()) {
- return null;
- }
- var returnType = null;
-
- switch(state.mode){
- case "string": // multi-line string parsing mode
- var next, escaped = false;
- while ((next = stream.next()) != null) {
- if (next == "\"" && !escaped) {
-
- state.mode = false;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- returnType = STRING; // continue on in string mode
- break;
- default: // default parsing mode
- var ch = stream.next();
-
- if (ch == "\"") {
- state.mode = "string";
- returnType = STRING;
- } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
- returnType = ATOM;
- } else if (ch == ";") { // comment
- stream.skipToEnd(); // rest of the line is a comment
- returnType = COMMENT;
- } else if (isNumber(ch,stream)){
- returnType = NUMBER;
- } else if (ch == "(" || ch == "[") {
- var keyWord = ''; var indentTemp = stream.column();
- /**
- Either
- (indent-word ..
- (non-indent-word ..
- (;something else, bracket, etc.
- */
-
- while ((letter = stream.eat(tests.keyword_char)) != null) {
- keyWord += letter;
- }
-
- if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
-
- pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
- } else { // non-indent word
- // we continue eating the spaces
- stream.eatSpace();
- if (stream.eol() || stream.peek() == ";") {
- // nothing significant after
- // we restart indentation 1 space after
- pushStack(state, indentTemp + 1, ch);
- } else {
- pushStack(state, indentTemp + stream.current().length, ch); // else we match
- }
- }
- stream.backUp(stream.current().length - 1); // undo all the eating
-
- returnType = BRACKET;
- } else if (ch == ")" || ch == "]") {
- returnType = BRACKET;
- if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
- popStack(state);
- }
- } else if ( ch == ":" ) {
- stream.eatWhile(tests.lang_keyword);
- return TAG;
- } else {
- stream.eatWhile(tests.basic);
-
- if (keywords && keywords.propertyIsEnumerable(stream.current())) {
- returnType = BUILTIN;
- } else if ( atoms && atoms.propertyIsEnumerable(stream.current()) ) {
- returnType = ATOM;
- } else returnType = null;
- }
- }
-
- return returnType;
- },
-
- indent: function (state, textAfter) {
- if (state.indentStack == null) return state.indentation;
- return state.indentStack.indent;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-clojure", "clojure");
diff --git a/src/codemirror/mode/clojure/index.html b/src/codemirror/mode/clojure/index.html
deleted file mode 100755
index e9cc3e7..0000000
--- a/src/codemirror/mode/clojure/index.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
- CodeMirror 2: Clojure mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Clojure mode
-
-
-
- MIME types defined: text/x-clojure.
-
-
-
diff --git a/src/codemirror/mode/coffeescript/LICENSE b/src/codemirror/mode/coffeescript/LICENSE
deleted file mode 100755
index 977e284..0000000
--- a/src/codemirror/mode/coffeescript/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License
-
-Copyright (c) 2011 Jeff Pickhardt
-Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
diff --git a/src/codemirror/mode/coffeescript/coffeescript.js b/src/codemirror/mode/coffeescript/coffeescript.js
deleted file mode 100755
index d4d5723..0000000
--- a/src/codemirror/mode/coffeescript/coffeescript.js
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- * Link to the project's GitHub page:
- * https://github.com/pickhardt/coffeescript-codemirror-mode
- */
-CodeMirror.defineMode('coffeescript', function(conf) {
- var ERRORCLASS = 'error';
-
- function wordRegexp(words) {
- return new RegExp("^((" + words.join(")|(") + "))\\b");
- }
-
- var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]");
- var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
- var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))");
- var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
- var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))");
- var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
-
- var wordOperators = wordRegexp(['and', 'or', 'not',
- 'is', 'isnt', 'in',
- 'instanceof', 'typeof']);
- var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else',
- 'switch', 'try', 'catch', 'finally', 'class'];
- var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete',
- 'do', 'in', 'of', 'new', 'return', 'then',
- 'this', 'throw', 'when', 'until'];
-
- var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
-
- indentKeywords = wordRegexp(indentKeywords);
-
-
- var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])");
- var regexPrefixes = new RegExp("^(/{3}|/)");
- var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no'];
- var constants = wordRegexp(commonConstants);
-
- // Tokenizers
- function tokenBase(stream, state) {
- // Handle scope changes
- if (stream.sol()) {
- var scopeOffset = state.scopes[0].offset;
- if (stream.eatSpace()) {
- var lineOffset = stream.indentation();
- if (lineOffset > scopeOffset) {
- return 'indent';
- } else if (lineOffset < scopeOffset) {
- return 'dedent';
- }
- return null;
- } else {
- if (scopeOffset > 0) {
- dedent(stream, state);
- }
- }
- }
- if (stream.eatSpace()) {
- return null;
- }
-
- var ch = stream.peek();
-
- // Handle comments
- if (ch === '#') {
- stream.skipToEnd();
- return 'comment';
- }
-
- // Handle number literals
- if (stream.match(/^-?[0-9\.]/, false)) {
- var floatLiteral = false;
- // Floats
- if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
- floatLiteral = true;
- }
- if (stream.match(/^-?\d+\.\d*/)) {
- floatLiteral = true;
- }
- if (stream.match(/^-?\.\d+/)) {
- floatLiteral = true;
- }
- if (floatLiteral) {
- return 'number';
- }
- // Integers
- var intLiteral = false;
- // Hex
- if (stream.match(/^-?0x[0-9a-f]+/i)) {
- intLiteral = true;
- }
- // Decimal
- if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
- intLiteral = true;
- }
- // Zero by itself with no other piece of number.
- if (stream.match(/^-?0(?![\dx])/i)) {
- intLiteral = true;
- }
- if (intLiteral) {
- return 'number';
- }
- }
-
- // Handle strings
- if (stream.match(stringPrefixes)) {
- state.tokenize = tokenFactory(stream.current(), 'string');
- return state.tokenize(stream, state);
- }
- // Handle regex literals
- if (stream.match(regexPrefixes)) {
- if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division
- state.tokenize = tokenFactory(stream.current(), 'string-2');
- return state.tokenize(stream, state);
- } else {
- stream.backUp(1);
- }
- }
-
- // Handle operators and delimiters
- if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
- return 'punctuation';
- }
- if (stream.match(doubleOperators)
- || stream.match(singleOperators)
- || stream.match(wordOperators)) {
- return 'operator';
- }
- if (stream.match(singleDelimiters)) {
- return 'punctuation';
- }
-
- if (stream.match(constants)) {
- return 'atom';
- }
-
- if (stream.match(keywords)) {
- return 'keyword';
- }
-
- if (stream.match(identifiers)) {
- return 'variable';
- }
-
- // Handle non-detected items
- stream.next();
- return ERRORCLASS;
- }
-
- function tokenFactory(delimiter, outclass) {
- var delim_re = new RegExp(delimiter);
- var singleline = delimiter.length == 1;
-
- return function tokenString(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"\/\\]/);
- if (stream.eat('\\')) {
- stream.next();
- if (singleline && stream.eol()) {
- return outclass;
- }
- } else if (stream.match(delim_re)) {
- state.tokenize = tokenBase;
- return outclass;
- } else {
- stream.eat(/['"\/]/);
- }
- }
- if (singleline) {
- if (conf.mode.singleLineStringErrors) {
- outclass = ERRORCLASS
- } else {
- state.tokenize = tokenBase;
- }
- }
- return outclass;
- };
- }
-
- function indent(stream, state, type) {
- type = type || 'coffee';
- var indentUnit = 0;
- if (type === 'coffee') {
- for (var i = 0; i < state.scopes.length; i++) {
- if (state.scopes[i].type === 'coffee') {
- indentUnit = state.scopes[i].offset + conf.indentUnit;
- break;
- }
- }
- } else {
- indentUnit = stream.column() + stream.current().length;
- }
- state.scopes.unshift({
- offset: indentUnit,
- type: type
- });
- }
-
- function dedent(stream, state) {
- if (state.scopes.length == 1) return;
- if (state.scopes[0].type === 'coffee') {
- var _indent = stream.indentation();
- var _indent_index = -1;
- for (var i = 0; i < state.scopes.length; ++i) {
- if (_indent === state.scopes[i].offset) {
- _indent_index = i;
- break;
- }
- }
- if (_indent_index === -1) {
- return true;
- }
- while (state.scopes[0].offset !== _indent) {
- state.scopes.shift();
- }
- return false
- } else {
- state.scopes.shift();
- return false;
- }
- }
-
- function tokenLexer(stream, state) {
- var style = state.tokenize(stream, state);
- var current = stream.current();
-
- // Handle '.' connected identifiers
- if (current === '.') {
- style = state.tokenize(stream, state);
- current = stream.current();
- if (style === 'variable') {
- return 'variable';
- } else {
- return ERRORCLASS;
- }
- }
-
- // Handle properties
- if (current === '@') {
- style = state.tokenize(stream, state);
- current = stream.current();
- if (style === 'variable') {
- return 'variable-2';
- } else {
- return ERRORCLASS;
- }
- }
-
- // Handle scope changes.
- if (current === 'return') {
- state.dedent += 1;
- }
- if (((current === '->' || current === '=>') &&
- !state.lambda &&
- state.scopes[0].type == 'coffee' &&
- stream.peek() === '')
- || style === 'indent') {
- indent(stream, state);
- }
- var delimiter_index = '[({'.indexOf(current);
- if (delimiter_index !== -1) {
- indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
- }
- if (indentKeywords.exec(current)){
- indent(stream, state);
- }
- if (current == 'then'){
- dedent(stream, state);
- }
-
-
- if (style === 'dedent') {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
- delimiter_index = '])}'.indexOf(current);
- if (delimiter_index !== -1) {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
- if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') {
- if (state.scopes.length > 1) state.scopes.shift();
- state.dedent -= 1;
- }
-
- return style;
- }
-
- var external = {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- scopes: [{offset:basecolumn || 0, type:'coffee'}],
- lastToken: null,
- lambda: false,
- dedent: 0
- };
- },
-
- token: function(stream, state) {
- var style = tokenLexer(stream, state);
-
- state.lastToken = {style:style, content: stream.current()};
-
- if (stream.eol() && stream.lambda) {
- state.lambda = false;
- }
-
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase) {
- return 0;
- }
-
- return state.scopes[0].offset;
- }
-
- };
- return external;
-});
-
-CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');
diff --git a/src/codemirror/mode/coffeescript/index.html b/src/codemirror/mode/coffeescript/index.html
deleted file mode 100755
index c1984df..0000000
--- a/src/codemirror/mode/coffeescript/index.html
+++ /dev/null
@@ -1,722 +0,0 @@
-
-
-
- CodeMirror 2: CoffeeScript mode
-
-
-
-
-
-
-
-
- CodeMirror 2: CoffeeScript mode
-
-
-
- MIME types defined: text/x-coffeescript.
-
- The CoffeeScript mode was written by Jeff Pickhardt (license).
-
-
-
diff --git a/src/codemirror/mode/css/css.js b/src/codemirror/mode/css/css.js
deleted file mode 100755
index 45170a3..0000000
--- a/src/codemirror/mode/css/css.js
+++ /dev/null
@@ -1,124 +0,0 @@
-CodeMirror.defineMode("css", function(config) {
- var indentUnit = config.indentUnit, type;
- function ret(style, tp) {type = tp; return style;}
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
- else if (ch == "/" && stream.eat("*")) {
- state.tokenize = tokenCComment;
- return tokenCComment(stream, state);
- }
- else if (ch == "<" && stream.eat("!")) {
- state.tokenize = tokenSGMLComment;
- return tokenSGMLComment(stream, state);
- }
- else if (ch == "=") ret(null, "compare");
- else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
- else if (ch == "\"" || ch == "'") {
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- else if (ch == "#") {
- stream.eatWhile(/[\w\\\-]/);
- return ret("atom", "hash");
- }
- else if (ch == "!") {
- stream.match(/^\s*\w*/);
- return ret("keyword", "important");
- }
- else if (/\d/.test(ch)) {
- stream.eatWhile(/[\w.%]/);
- return ret("number", "unit");
- }
- else if (/[,.+>*\/]/.test(ch)) {
- return ret(null, "select-op");
- }
- else if (/[;{}:\[\]]/.test(ch)) {
- return ret(null, ch);
- }
- else {
- stream.eatWhile(/[\w\\\-]/);
- return ret("variable", "variable");
- }
- }
-
- function tokenCComment(stream, state) {
- var maybeEnd = false, ch;
- while ((ch = stream.next()) != null) {
- if (maybeEnd && ch == "/") {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return ret("comment", "comment");
- }
-
- function tokenSGMLComment(stream, state) {
- var dashes = 0, ch;
- while ((ch = stream.next()) != null) {
- if (dashes >= 2 && ch == ">") {
- state.tokenize = tokenBase;
- break;
- }
- dashes = (ch == "-") ? dashes + 1 : 0;
- }
- return ret("comment", "comment");
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped)
- break;
- escaped = !escaped && ch == "\\";
- }
- if (!escaped) state.tokenize = tokenBase;
- return ret("string", "string");
- };
- }
-
- return {
- startState: function(base) {
- return {tokenize: tokenBase,
- baseIndent: base || 0,
- stack: []};
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
-
- var context = state.stack[state.stack.length-1];
- if (type == "hash" && context == "rule") style = "atom";
- else if (style == "variable") {
- if (context == "rule") style = "number";
- else if (!context || context == "@media{") style = "tag";
- }
-
- if (context == "rule" && /^[\{\};]$/.test(type))
- state.stack.pop();
- if (type == "{") {
- if (context == "@media") state.stack[state.stack.length-1] = "@media{";
- else state.stack.push("{");
- }
- else if (type == "}") state.stack.pop();
- else if (type == "@media") state.stack.push("@media");
- else if (context == "{" && type != "comment") state.stack.push("rule");
- return style;
- },
-
- indent: function(state, textAfter) {
- var n = state.stack.length;
- if (/^\}/.test(textAfter))
- n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
- return state.baseIndent + n * indentUnit;
- },
-
- electricChars: "}"
- };
-});
-
-CodeMirror.defineMIME("text/css", "css");
diff --git a/src/codemirror/mode/css/index.html b/src/codemirror/mode/css/index.html
deleted file mode 100755
index 7d01e36..0000000
--- a/src/codemirror/mode/css/index.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- CodeMirror 2: CSS mode
-
-
-
-
-
-
-
-
- CodeMirror 2: CSS mode
-
-
-
- MIME types defined: text/css.
-
-
-
diff --git a/src/codemirror/mode/diff/diff.css b/src/codemirror/mode/diff/diff.css
deleted file mode 100755
index 16f8d33..0000000
--- a/src/codemirror/mode/diff/diff.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.cm-s-default span.cm-rangeinfo {color: #a0b;}
-.cm-s-default span.cm-minus {color: #a22;}
-.cm-s-default span.cm-plus {color: #2b2;}
diff --git a/src/codemirror/mode/diff/diff.js b/src/codemirror/mode/diff/diff.js
deleted file mode 100755
index 725bb2c..0000000
--- a/src/codemirror/mode/diff/diff.js
+++ /dev/null
@@ -1,13 +0,0 @@
-CodeMirror.defineMode("diff", function() {
- return {
- token: function(stream) {
- var ch = stream.next();
- stream.skipToEnd();
- if (ch == "+") return "plus";
- if (ch == "-") return "minus";
- if (ch == "@") return "rangeinfo";
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-diff", "diff");
diff --git a/src/codemirror/mode/diff/index.html b/src/codemirror/mode/diff/index.html
deleted file mode 100755
index 2748f2f..0000000
--- a/src/codemirror/mode/diff/index.html
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
- CodeMirror 2: Diff mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Diff mode
-
-
-
- MIME types defined: text/x-diff.
-
-
-
diff --git a/src/codemirror/mode/haskell/haskell.js b/src/codemirror/mode/haskell/haskell.js
deleted file mode 100755
index aac5041..0000000
--- a/src/codemirror/mode/haskell/haskell.js
+++ /dev/null
@@ -1,242 +0,0 @@
-CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
-
- function switchState(source, setState, f) {
- setState(f);
- return f(source, setState);
- }
-
- // These should all be Unicode extended, as per the Haskell 2010 report
- var smallRE = /[a-z_]/;
- var largeRE = /[A-Z]/;
- var digitRE = /[0-9]/;
- var hexitRE = /[0-9A-Fa-f]/;
- var octitRE = /[0-7]/;
- var idRE = /[a-z_A-Z0-9']/;
- var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
- var specialRE = /[(),;[\]`{}]/;
- var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
-
- function normal(source, setState) {
- if (source.eatWhile(whiteCharRE)) {
- return null;
- }
-
- var ch = source.next();
- if (specialRE.test(ch)) {
- if (ch == '{' && source.eat('-')) {
- var t = "comment";
- if (source.eat('#')) {
- t = "meta";
- }
- return switchState(source, setState, ncomment(t, 1));
- }
- return null;
- }
-
- if (ch == '\'') {
- if (source.eat('\\')) {
- source.next(); // should handle other escapes here
- }
- else {
- source.next();
- }
- if (source.eat('\'')) {
- return "string";
- }
- return "error";
- }
-
- if (ch == '"') {
- return switchState(source, setState, stringLiteral);
- }
-
- if (largeRE.test(ch)) {
- source.eatWhile(idRE);
- if (source.eat('.')) {
- return "qualifier";
- }
- return "variable-2";
- }
-
- if (smallRE.test(ch)) {
- source.eatWhile(idRE);
- return "variable";
- }
-
- if (digitRE.test(ch)) {
- if (ch == '0') {
- if (source.eat(/[xX]/)) {
- source.eatWhile(hexitRE); // should require at least 1
- return "integer";
- }
- if (source.eat(/[oO]/)) {
- source.eatWhile(octitRE); // should require at least 1
- return "number";
- }
- }
- source.eatWhile(digitRE);
- var t = "number";
- if (source.eat('.')) {
- t = "number";
- source.eatWhile(digitRE); // should require at least 1
- }
- if (source.eat(/[eE]/)) {
- t = "number";
- source.eat(/[-+]/);
- source.eatWhile(digitRE); // should require at least 1
- }
- return t;
- }
-
- if (symbolRE.test(ch)) {
- if (ch == '-' && source.eat(/-/)) {
- source.eatWhile(/-/);
- if (!source.eat(symbolRE)) {
- source.skipToEnd();
- return "comment";
- }
- }
- var t = "variable";
- if (ch == ':') {
- t = "variable-2";
- }
- source.eatWhile(symbolRE);
- return t;
- }
-
- return "error";
- }
-
- function ncomment(type, nest) {
- if (nest == 0) {
- return normal;
- }
- return function(source, setState) {
- var currNest = nest;
- while (!source.eol()) {
- var ch = source.next();
- if (ch == '{' && source.eat('-')) {
- ++currNest;
- }
- else if (ch == '-' && source.eat('}')) {
- --currNest;
- if (currNest == 0) {
- setState(normal);
- return type;
- }
- }
- }
- setState(ncomment(type, currNest));
- return type;
- }
- }
-
- function stringLiteral(source, setState) {
- while (!source.eol()) {
- var ch = source.next();
- if (ch == '"') {
- setState(normal);
- return "string";
- }
- if (ch == '\\') {
- if (source.eol() || source.eat(whiteCharRE)) {
- setState(stringGap);
- return "string";
- }
- if (source.eat('&')) {
- }
- else {
- source.next(); // should handle other escapes here
- }
- }
- }
- setState(normal);
- return "error";
- }
-
- function stringGap(source, setState) {
- if (source.eat('\\')) {
- return switchState(source, setState, stringLiteral);
- }
- source.next();
- setState(normal);
- return "error";
- }
-
-
- var wellKnownWords = (function() {
- var wkw = {};
- function setType(t) {
- return function () {
- for (var i = 0; i < arguments.length; i++)
- wkw[arguments[i]] = t;
- }
- }
-
- setType("keyword")(
- "case", "class", "data", "default", "deriving", "do", "else", "foreign",
- "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
- "module", "newtype", "of", "then", "type", "where", "_");
-
- setType("keyword")(
- "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
-
- setType("builtin")(
- "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
- "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
-
- setType("builtin")(
- "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
- "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
- "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
- "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
- "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
- "String", "True");
-
- setType("builtin")(
- "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
- "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
- "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
- "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
- "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
- "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
- "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
- "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
- "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
- "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
- "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
- "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
- "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
- "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
- "otherwise", "pi", "pred", "print", "product", "properFraction",
- "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
- "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
- "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
- "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
- "sequence", "sequence_", "show", "showChar", "showList", "showParen",
- "showString", "shows", "showsPrec", "significand", "signum", "sin",
- "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
- "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
- "toRational", "truncate", "uncurry", "undefined", "unlines", "until",
- "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
- "zip3", "zipWith", "zipWith3");
-
- return wkw;
- })();
-
-
-
- return {
- startState: function () { return { f: normal }; },
- copyState: function (s) { return { f: s.f }; },
-
- token: function(stream, state) {
- var t = state.f(stream, function(s) { state.f = s; });
- var w = stream.current();
- return (w in wellKnownWords) ? wellKnownWords[w] : t;
- }
- };
-
-});
-
-CodeMirror.defineMIME("text/x-haskell", "haskell");
diff --git a/src/codemirror/mode/haskell/index.html b/src/codemirror/mode/haskell/index.html
deleted file mode 100755
index 6ea7f5e..0000000
--- a/src/codemirror/mode/haskell/index.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
- CodeMirror 2: Haskell mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Haskell mode
-
-
-
-
-
- MIME types defined: text/x-haskell.
-
-
diff --git a/src/codemirror/mode/htmlmixed/htmlmixed.js b/src/codemirror/mode/htmlmixed/htmlmixed.js
deleted file mode 100755
index fa30a13..0000000
--- a/src/codemirror/mode/htmlmixed/htmlmixed.js
+++ /dev/null
@@ -1,79 +0,0 @@
-CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
- var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
- var jsMode = CodeMirror.getMode(config, "javascript");
- var cssMode = CodeMirror.getMode(config, "css");
-
- function html(stream, state) {
- var style = htmlMode.token(stream, state.htmlState);
- if (style == "tag" && stream.current() == ">" && state.htmlState.context) {
- if (/^script$/i.test(state.htmlState.context.tagName)) {
- state.token = javascript;
- state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
- state.mode = "javascript";
- }
- else if (/^style$/i.test(state.htmlState.context.tagName)) {
- state.token = css;
- state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
- state.mode = "css";
- }
- }
- return style;
- }
- function maybeBackup(stream, pat, style) {
- var cur = stream.current();
- var close = cur.search(pat);
- if (close > -1) stream.backUp(cur.length - close);
- return style;
- }
- function javascript(stream, state) {
- if (stream.match(/^<\/\s*script\s*>/i, false)) {
- state.token = html;
- state.curState = null;
- state.mode = "html";
- return html(stream, state);
- }
- return maybeBackup(stream, /<\/\s*script\s*>/,
- jsMode.token(stream, state.localState));
- }
- function css(stream, state) {
- if (stream.match(/^<\/\s*style\s*>/i, false)) {
- state.token = html;
- state.localState = null;
- state.mode = "html";
- return html(stream, state);
- }
- return maybeBackup(stream, /<\/\s*style\s*>/,
- cssMode.token(stream, state.localState));
- }
-
- return {
- startState: function() {
- var state = htmlMode.startState();
- return {token: html, localState: null, mode: "html", htmlState: state};
- },
-
- copyState: function(state) {
- if (state.localState)
- var local = CodeMirror.copyState(state.token == css ? cssMode : jsMode, state.localState);
- return {token: state.token, localState: local, mode: state.mode,
- htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
- },
-
- token: function(stream, state) {
- return state.token(stream, state);
- },
-
- indent: function(state, textAfter) {
- if (state.token == html || /^\s*<\//.test(textAfter))
- return htmlMode.indent(state.htmlState, textAfter);
- else if (state.token == javascript)
- return jsMode.indent(state.localState, textAfter);
- else
- return cssMode.indent(state.localState, textAfter);
- },
-
- electricChars: "/{}:"
- }
-});
-
-CodeMirror.defineMIME("text/html", "htmlmixed");
diff --git a/src/codemirror/mode/htmlmixed/index.html b/src/codemirror/mode/htmlmixed/index.html
deleted file mode 100755
index 6d62b35..0000000
--- a/src/codemirror/mode/htmlmixed/index.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
- CodeMirror 2: HTML mixed mode
-
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: HTML mixed mode
-
-
-
- The HTML mixed mode depends on the XML, JavaScript, and CSS modes.
-
- MIME types defined: text/html
- (redefined, only takes effect if you load this parser after the
- XML parser).
-
-
-
diff --git a/src/codemirror/mode/javascript/index.html b/src/codemirror/mode/javascript/index.html
deleted file mode 100755
index 2454c81..0000000
--- a/src/codemirror/mode/javascript/index.html
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
- CodeMirror 2: JavaScript mode
-
-
-
-
-
-
-
-
- CodeMirror 2: JavaScript mode
-
-
-
-
-
- JavaScript mode supports a single configuration
- option, json, which will set the mode to expect JSON
- data rather than a JavaScript program.
-
- MIME types defined: text/javascript, application/json.
-
-
diff --git a/src/codemirror/mode/javascript/javascript.js b/src/codemirror/mode/javascript/javascript.js
deleted file mode 100755
index d3f9289..0000000
--- a/src/codemirror/mode/javascript/javascript.js
+++ /dev/null
@@ -1,352 +0,0 @@
-CodeMirror.defineMode("javascript", function(config, parserConfig) {
- var indentUnit = config.indentUnit;
- var jsonMode = parserConfig.json;
-
- // Tokenizer
-
- var keywords = function(){
- function kw(type) {return {type: type, style: "keyword"};}
- var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
- var operator = kw("operator"), atom = {type: "atom", style: "atom"};
- return {
- "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
- "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
- "var": kw("var"), "function": kw("function"), "catch": kw("catch"),
- "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
- "in": operator, "typeof": operator, "instanceof": operator,
- "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
- };
- }();
-
- var isOperatorChar = /[+\-*&%=<>!?|]/;
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
-
- function nextUntilUnescaped(stream, end) {
- var escaped = false, next;
- while ((next = stream.next()) != null) {
- if (next == end && !escaped)
- return false;
- escaped = !escaped && next == "\\";
- }
- return escaped;
- }
-
- // Used as scratch variables to communicate multiple values without
- // consing up tons of objects.
- var type, content;
- function ret(tp, style, cont) {
- type = tp; content = cont;
- return style;
- }
-
- function jsTokenBase(stream, state) {
- var ch = stream.next();
- if (ch == '"' || ch == "'")
- return chain(stream, state, jsTokenString(ch));
- else if (/[\[\]{}\(\),;\:\.]/.test(ch))
- return ret(ch);
- else if (ch == "0" && stream.eat(/x/i)) {
- stream.eatWhile(/[\da-f]/i);
- return ret("number", "number");
- }
- else if (/\d/.test(ch)) {
- stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
- return ret("number", "number");
- }
- else if (ch == "/") {
- if (stream.eat("*")) {
- return chain(stream, state, jsTokenComment);
- }
- else if (stream.eat("/")) {
- stream.skipToEnd();
- return ret("comment", "comment");
- }
- else if (state.reAllowed) {
- nextUntilUnescaped(stream, "/");
- stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
- return ret("regexp", "string");
- }
- else {
- stream.eatWhile(isOperatorChar);
- return ret("operator", null, stream.current());
- }
- }
- else if (ch == "#") {
- stream.skipToEnd();
- return ret("error", "error");
- }
- else if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return ret("operator", null, stream.current());
- }
- else {
- stream.eatWhile(/[\w\$_]/);
- var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
- return known ? ret(known.type, known.style, word) :
- ret("variable", "variable", word);
- }
- }
-
- function jsTokenString(quote) {
- return function(stream, state) {
- if (!nextUntilUnescaped(stream, quote))
- state.tokenize = jsTokenBase;
- return ret("string", "string");
- };
- }
-
- function jsTokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = jsTokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return ret("comment", "comment");
- }
-
- // Parser
-
- var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
-
- function JSLexical(indented, column, type, align, prev, info) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.prev = prev;
- this.info = info;
- if (align != null) this.align = align;
- }
-
- function inScope(state, varname) {
- for (var v = state.localVars; v; v = v.next)
- if (v.name == varname) return true;
- }
-
- function parseJS(state, style, type, content, stream) {
- var cc = state.cc;
- // Communicate our context to the combinators.
- // (Less wasteful than consing up a hundred closures on every call.)
- cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
-
- if (!state.lexical.hasOwnProperty("align"))
- state.lexical.align = true;
-
- while(true) {
- var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
- if (combinator(type, content)) {
- while(cc.length && cc[cc.length - 1].lex)
- cc.pop()();
- if (cx.marked) return cx.marked;
- if (type == "variable" && inScope(state, content)) return "variable-2";
- return style;
- }
- }
- }
-
- // Combinator utils
-
- var cx = {state: null, column: null, marked: null, cc: null};
- function pass() {
- for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
- }
- function cont() {
- pass.apply(null, arguments);
- return true;
- }
- function register(varname) {
- var state = cx.state;
- if (state.context) {
- cx.marked = "def";
- for (var v = state.localVars; v; v = v.next)
- if (v.name == varname) return;
- state.localVars = {name: varname, next: state.localVars};
- }
- }
-
- // Combinators
-
- var defaultVars = {name: "this", next: {name: "arguments"}};
- function pushcontext() {
- if (!cx.state.context) cx.state.localVars = defaultVars;
- cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
- }
- function popcontext() {
- cx.state.localVars = cx.state.context.vars;
- cx.state.context = cx.state.context.prev;
- }
- function pushlex(type, info) {
- var result = function() {
- var state = cx.state;
- state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
- };
- result.lex = true;
- return result;
- }
- function poplex() {
- var state = cx.state;
- if (state.lexical.prev) {
- if (state.lexical.type == ")")
- state.indented = state.lexical.indented;
- state.lexical = state.lexical.prev;
- }
- }
- poplex.lex = true;
-
- function expect(wanted) {
- return function expecting(type) {
- if (type == wanted) return cont();
- else if (wanted == ";") return pass();
- else return cont(arguments.callee);
- };
- }
-
- function statement(type) {
- if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
- if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
- if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
- if (type == "{") return cont(pushlex("}"), block, poplex);
- if (type == ";") return cont();
- if (type == "function") return cont(functiondef);
- if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
- poplex, statement, poplex);
- if (type == "variable") return cont(pushlex("stat"), maybelabel);
- if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
- block, poplex, poplex);
- if (type == "case") return cont(expression, expect(":"));
- if (type == "default") return cont(expect(":"));
- if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
- statement, poplex, popcontext);
- return pass(pushlex("stat"), expression, expect(";"), poplex);
- }
- function expression(type) {
- if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
- if (type == "function") return cont(functiondef);
- if (type == "keyword c") return cont(expression);
- if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
- if (type == "operator") return cont(expression);
- if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
- if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
- return cont();
- }
- function maybeoperator(type, value) {
- if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
- if (type == "operator") return cont(expression);
- if (type == ";") return;
- if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
- if (type == ".") return cont(property, maybeoperator);
- if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
- }
- function maybelabel(type) {
- if (type == ":") return cont(poplex, statement);
- return pass(maybeoperator, expect(";"), poplex);
- }
- function property(type) {
- if (type == "variable") {cx.marked = "property"; return cont();}
- }
- function objprop(type) {
- if (type == "variable") cx.marked = "property";
- if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
- }
- function commasep(what, end) {
- function proceed(type) {
- if (type == ",") return cont(what, proceed);
- if (type == end) return cont();
- return cont(expect(end));
- }
- return function commaSeparated(type) {
- if (type == end) return cont();
- else return pass(what, proceed);
- };
- }
- function block(type) {
- if (type == "}") return cont();
- return pass(statement, block);
- }
- function vardef1(type, value) {
- if (type == "variable"){register(value); return cont(vardef2);}
- return cont();
- }
- function vardef2(type, value) {
- if (value == "=") return cont(expression, vardef2);
- if (type == ",") return cont(vardef1);
- }
- function forspec1(type) {
- if (type == "var") return cont(vardef1, forspec2);
- if (type == ";") return pass(forspec2);
- if (type == "variable") return cont(formaybein);
- return pass(forspec2);
- }
- function formaybein(type, value) {
- if (value == "in") return cont(expression);
- return cont(maybeoperator, forspec2);
- }
- function forspec2(type, value) {
- if (type == ";") return cont(forspec3);
- if (value == "in") return cont(expression);
- return cont(expression, expect(";"), forspec3);
- }
- function forspec3(type) {
- if (type != ")") cont(expression);
- }
- function functiondef(type, value) {
- if (type == "variable") {register(value); return cont(functiondef);}
- if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
- }
- function funarg(type, value) {
- if (type == "variable") {register(value); return cont();}
- }
-
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: jsTokenBase,
- reAllowed: true,
- cc: [],
- lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
- localVars: null,
- context: null,
- indented: 0
- };
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (!state.lexical.hasOwnProperty("align"))
- state.lexical.align = false;
- state.indented = stream.indentation();
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- if (type == "comment") return style;
- state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
- return parseJS(state, style, type, content, stream);
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != jsTokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
- type = lexical.type, closing = firstChar == type;
- if (type == "vardef") return lexical.indented + 4;
- else if (type == "form" && firstChar == "{") return lexical.indented;
- else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
- else if (lexical.info == "switch" && !closing)
- return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
- else if (lexical.align) return lexical.column + (closing ? 0 : 1);
- else return lexical.indented + (closing ? 0 : indentUnit);
- },
-
- electricChars: ":{}"
- };
-});
-
-CodeMirror.defineMIME("text/javascript", "javascript");
-CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
diff --git a/src/codemirror/mode/jinja2/index.html b/src/codemirror/mode/jinja2/index.html
deleted file mode 100755
index ffb06e8..0000000
--- a/src/codemirror/mode/jinja2/index.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- CodeMirror 2: Jinja2 mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Jinja2 mode
-
-
-
-
diff --git a/src/codemirror/mode/jinja2/jinja2.js b/src/codemirror/mode/jinja2/jinja2.js
deleted file mode 100755
index 75419d8..0000000
--- a/src/codemirror/mode/jinja2/jinja2.js
+++ /dev/null
@@ -1,42 +0,0 @@
-CodeMirror.defineMode("jinja2", function(config, parserConf) {
- var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
- "loop", "none", "self", "super", "if", "as", "not", "and",
- "else", "import", "with", "without", "context"];
- keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
-
- function tokenBase (stream, state) {
- var ch = stream.next();
- if (ch == "{") {
- if (ch = stream.eat(/\{|%|#/)) {
- stream.eat("-");
- state.tokenize = inTag(ch);
- return "tag";
- }
- }
- }
- function inTag (close) {
- if (close == "{") {
- close = "}";
- }
- return function (stream, state) {
- var ch = stream.next();
- if ((ch == close || (ch == "-" && stream.eat(close)))
- && stream.eat("}")) {
- state.tokenize = tokenBase;
- return "tag";
- }
- if (stream.match(keywords)) {
- return "keyword";
- }
- return close == "#" ? "comment" : "string";
- };
- }
- return {
- startState: function () {
- return {tokenize: tokenBase};
- },
- token: function (stream, state) {
- return state.tokenize(stream, state);
- }
- };
-});
diff --git a/src/codemirror/mode/lua/index.html b/src/codemirror/mode/lua/index.html
deleted file mode 100755
index 532973a..0000000
--- a/src/codemirror/mode/lua/index.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
- CodeMirror 2: Lua mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Lua mode
-
-
-
- Loosely based on Franciszek
- Wawrzak's CodeMirror
- 1 mode. One configuration parameter is
- supported, specials, to which you can provide an
- array of strings to have those identifiers highlighted with
- the lua-special style.
- MIME types defined: text/x-lua.
-
-
-
diff --git a/src/codemirror/mode/lua/lua.js b/src/codemirror/mode/lua/lua.js
deleted file mode 100755
index f96737a..0000000
--- a/src/codemirror/mode/lua/lua.js
+++ /dev/null
@@ -1,140 +0,0 @@
-// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
-// CodeMirror 1 mode.
-// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
-
-CodeMirror.defineMode("lua", function(config, parserConfig) {
- var indentUnit = config.indentUnit;
-
- function prefixRE(words) {
- return new RegExp("^(?:" + words.join("|") + ")", "i");
- }
- function wordRE(words) {
- return new RegExp("^(?:" + words.join("|") + ")$", "i");
- }
- var specials = wordRE(parserConfig.specials || []);
-
- // long list of standard functions from lua manual
- var builtins = wordRE([
- "_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
- "loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
- "select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
-
- "coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
-
- "debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
- "debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
- "debug.setupvalue","debug.traceback",
-
- "close","flush","lines","read","seek","setvbuf","write",
-
- "io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
- "io.stdout","io.tmpfile","io.type","io.write",
-
- "math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
- "math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
- "math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
- "math.sqrt","math.tan","math.tanh",
-
- "os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
- "os.time","os.tmpname",
-
- "package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
- "package.seeall",
-
- "string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
- "string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
-
- "table.concat","table.insert","table.maxn","table.remove","table.sort"
- ]);
- var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
- "true","function", "end", "if", "then", "else", "do",
- "while", "repeat", "until", "for", "in", "local" ]);
-
- var indentTokens = wordRE(["function", "if","repeat","for","while", "\\(", "{"]);
- var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
- var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
-
- function readBracket(stream) {
- var level = 0;
- while (stream.eat("=")) ++level;
- stream.eat("[");
- return level;
- }
-
- function normal(stream, state) {
- var ch = stream.next();
- if (ch == "-" && stream.eat("-")) {
- if (stream.eat("["))
- return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
- stream.skipToEnd();
- return "comment";
- }
- if (ch == "\"" || ch == "'")
- return (state.cur = string(ch))(stream, state);
- if (ch == "[" && /[\[=]/.test(stream.peek()))
- return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
- if (/\d/.test(ch)) {
- stream.eatWhile(/[\w.%]/);
- return "number";
- }
- if (/[\w_]/.test(ch)) {
- stream.eatWhile(/[\w\\\-_.]/);
- return "variable";
- }
- return null;
- }
-
- function bracketed(level, style) {
- return function(stream, state) {
- var curlev = null, ch;
- while ((ch = stream.next()) != null) {
- if (curlev == null) {if (ch == "]") curlev = 0;}
- else if (ch == "=") ++curlev;
- else if (ch == "]" && curlev == level) { state.cur = normal; break; }
- else curlev = null;
- }
- return style;
- };
- }
-
- function string(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) break;
- escaped = !escaped && ch == "\\";
- }
- if (!escaped) state.cur = normal;
- return "string";
- };
- }
-
- return {
- startState: function(basecol) {
- return {basecol: basecol || 0, indentDepth: 0, cur: normal};
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- var style = state.cur(stream, state);
- var word = stream.current();
- if (style == "variable") {
- if (keywords.test(word)) style = "keyword";
- else if (builtins.test(word)) style = "builtin";
- else if (specials.test(word)) style = "variable-2";
- }
- if ((style != "lua-comment") && (style != "lua-string")){
- if (indentTokens.test(word)) ++state.indentDepth;
- else if (dedentTokens.test(word)) --state.indentDepth;
- }
- return style;
- },
-
- indent: function(state, textAfter) {
- var closing = dedentPartial.test(textAfter);
- return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-lua", "lua");
diff --git a/src/codemirror/mode/markdown/index.html b/src/codemirror/mode/markdown/index.html
deleted file mode 100755
index 106b545..0000000
--- a/src/codemirror/mode/markdown/index.html
+++ /dev/null
@@ -1,340 +0,0 @@
-
-
-
- CodeMirror 2: Markdown mode
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: Markdown mode
-
-
-
-
-
-
- MIME types defined: text/x-markdown.
-
-
-
diff --git a/src/codemirror/mode/markdown/markdown.css b/src/codemirror/mode/markdown/markdown.css
deleted file mode 100755
index c053e3f..0000000
--- a/src/codemirror/mode/markdown/markdown.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.cm-s-default span.cm-header {color: #2f2f4f; font-weight:bold;}
-.cm-s-default span.cm-code {color: #666;}
-.cm-s-default span.cm-quote {color: #090;}
-.cm-s-default span.cm-list {color: #a50;}
-.cm-s-default span.cm-hr {color: #999;}
-.cm-s-default span.cm-linktext {color: #00c; text-decoration: underline;}
-.cm-s-default span.cm-linkhref {color: #00c;}
-.cm-s-default span.cm-em {font-style: italic;}
-.cm-s-default span.cm-strong {font-weight: bold;}
-.cm-s-default span.cm-emstrong {font-style: italic; font-weight: bold;}
diff --git a/src/codemirror/mode/markdown/markdown.js b/src/codemirror/mode/markdown/markdown.js
deleted file mode 100755
index 75f0a63..0000000
--- a/src/codemirror/mode/markdown/markdown.js
+++ /dev/null
@@ -1,230 +0,0 @@
-CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
-
- var htmlMode = CodeMirror.getMode(cmCfg, { name: 'xml', htmlMode: true });
-
- var header = 'header'
- , code = 'code'
- , quote = 'quote'
- , list = 'list'
- , hr = 'hr'
- , linktext = 'linktext'
- , linkhref = 'linkhref'
- , em = 'em'
- , strong = 'strong'
- , emstrong = 'emstrong';
-
- var hrRE = /^[*-=_]/
- , ulRE = /^[*-+]\s+/
- , olRE = /^[0-9]\.\s+/
- , headerRE = /^(?:\={3,}|-{3,})$/
- , codeRE = /^(k:\t|\s{4,})/
- , textRE = /^[^\[*_\\<>`]+/;
-
- function switchInline(stream, state, f) {
- state.f = state.inline = f;
- return f(stream, state);
- }
-
- function switchBlock(stream, state, f) {
- state.f = state.block = f;
- return f(stream, state);
- }
-
-
- // Blocks
-
- function blockNormal(stream, state) {
- if (stream.match(codeRE)) {
- stream.skipToEnd();
- return code;
- }
-
- if (stream.eatSpace()) {
- return null;
- }
-
- if (stream.peek() === '#' || stream.match(headerRE)) {
- stream.skipToEnd();
- return header;
- }
- if (stream.eat('>')) {
- state.indentation++;
- return quote;
- }
- if (stream.peek() === '<') {
- return switchBlock(stream, state, htmlBlock);
- }
- if (stream.peek() === '[') {
- return switchInline(stream, state, footnoteLink);
- }
- if (hrRE.test(stream.peek())) {
- var re = new RegExp('(?:\s*['+stream.peek()+']){3,}$');
- if (stream.match(re, true)) {
- return hr;
- }
- }
-
- var match;
- if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
- state.indentation += match[0].length;
- return list;
- }
-
- return switchInline(stream, state, state.inline);
- }
-
- function htmlBlock(stream, state) {
- var type = htmlMode.token(stream, state.htmlState);
- if (stream.eol() && !state.htmlState.context) {
- state.block = blockNormal;
- }
- return type;
- }
-
-
- // Inline
-
- function inlineNormal(stream, state) {
- function getType() {
- return state.strong ? (state.em ? emstrong : strong)
- : (state.em ? em : null);
- }
-
- if (stream.match(textRE, true)) {
- return getType();
- }
-
- var ch = stream.next();
-
- if (ch === '\\') {
- stream.next();
- return getType();
- }
- if (ch === '`') {
- return switchInline(stream, state, inlineElement(code, '`'));
- }
- if (ch === '<') {
- return switchInline(stream, state, inlineElement(linktext, '>'));
- }
- if (ch === '[') {
- return switchInline(stream, state, linkText);
- }
-
- var t = getType();
- if (ch === '*' || ch === '_') {
- if (stream.eat(ch)) {
- return (state.strong = !state.strong) ? getType() : t;
- }
- return (state.em = !state.em) ? getType() : t;
- }
-
- return getType();
- }
-
- function linkText(stream, state) {
- while (!stream.eol()) {
- var ch = stream.next();
- if (ch === '\\') stream.next();
- if (ch === ']') {
- state.inline = state.f = linkHref;
- return linktext;
- }
- }
- return linktext;
- }
-
- function linkHref(stream, state) {
- stream.eatSpace();
- var ch = stream.next();
- if (ch === '(' || ch === '[') {
- return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
- }
- return 'error';
- }
-
- function footnoteLink(stream, state) {
- if (stream.match(/^[^\]]*\]:/, true)) {
- state.f = footnoteUrl;
- return linktext;
- }
- return switchInline(stream, state, inlineNormal);
- }
-
- function footnoteUrl(stream, state) {
- stream.eatSpace();
- stream.match(/^[^\s]+/, true);
- state.f = state.inline = inlineNormal;
- return linkhref;
- }
-
- function inlineElement(type, endChar, next) {
- next = next || inlineNormal;
- return function(stream, state) {
- while (!stream.eol()) {
- var ch = stream.next();
- if (ch === '\\') stream.next();
- if (ch === endChar) {
- state.inline = state.f = next;
- return type;
- }
- }
- return type;
- };
- }
-
- return {
- startState: function() {
- return {
- f: blockNormal,
-
- block: blockNormal,
- htmlState: htmlMode.startState(),
- indentation: 0,
-
- inline: inlineNormal,
- em: false,
- strong: false
- };
- },
-
- copyState: function(s) {
- return {
- f: s.f,
-
- block: s.block,
- htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
- indentation: s.indentation,
-
- inline: s.inline,
- em: s.em,
- strong: s.strong
- };
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- state.f = state.block;
- var previousIndentation = state.indentation
- , currentIndentation = 0;
- while (previousIndentation > 0) {
- if (stream.eat(' ')) {
- previousIndentation--;
- currentIndentation++;
- } else if (previousIndentation >= 4 && stream.eat('\t')) {
- previousIndentation -= 4;
- currentIndentation += 4;
- } else {
- break;
- }
- }
- state.indentation = currentIndentation;
-
- if (currentIndentation > 0) return null;
- }
- return state.f(stream, state);
- }
- };
-
-});
-
-CodeMirror.defineMIME("text/x-markdown", "markdown");
diff --git a/src/codemirror/mode/ntriples/index.html b/src/codemirror/mode/ntriples/index.html
deleted file mode 100755
index 128112c..0000000
--- a/src/codemirror/mode/ntriples/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- CodeMirror 2: NTriples mode
-
-
-
-
-
-
-
-
- CodeMirror 2: NTriples mode
-
-
-
- MIME types defined: text/n-triples.
-
-
diff --git a/src/codemirror/mode/ntriples/ntriples.js b/src/codemirror/mode/ntriples/ntriples.js
deleted file mode 100755
index 3b6cb41..0000000
--- a/src/codemirror/mode/ntriples/ntriples.js
+++ /dev/null
@@ -1,172 +0,0 @@
-/**********************************************************
-* This script provides syntax highlighting support for
-* the Ntriples format.
-* Ntriples format specification:
-* http://www.w3.org/TR/rdf-testcases/#ntriples
-***********************************************************/
-
-/*
- The following expression defines the defined ASF grammar transitions.
-
- pre_subject ->
- {
- ( writing_subject_uri | writing_bnode_uri )
- -> pre_predicate
- -> writing_predicate_uri
- -> pre_object
- -> writing_object_uri | writing_object_bnode |
- (
- writing_object_literal
- -> writing_literal_lang | writing_literal_type
- )
- -> post_object
- -> BEGIN
- } otherwise {
- -> ERROR
- }
-*/
-CodeMirror.defineMode("ntriples", function() {
-
- Location = {
- PRE_SUBJECT : 0,
- WRITING_SUB_URI : 1,
- WRITING_BNODE_URI : 2,
- PRE_PRED : 3,
- WRITING_PRED_URI : 4,
- PRE_OBJ : 5,
- WRITING_OBJ_URI : 6,
- WRITING_OBJ_BNODE : 7,
- WRITING_OBJ_LITERAL : 8,
- WRITING_LIT_LANG : 9,
- WRITING_LIT_TYPE : 10,
- POST_OBJ : 11,
- ERROR : 12
- };
- function transitState(currState, c) {
- var currLocation = currState.location;
- var ret;
-
- // Opening.
- if (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
- else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
- else if(currLocation == Location.PRE_PRED && c == '<') ret = Location.WRITING_PRED_URI;
- else if(currLocation == Location.PRE_OBJ && c == '<') ret = Location.WRITING_OBJ_URI;
- else if(currLocation == Location.PRE_OBJ && c == '_') ret = Location.WRITING_OBJ_BNODE;
- else if(currLocation == Location.PRE_OBJ && c == '"') ret = Location.WRITING_OBJ_LITERAL;
-
- // Closing.
- else if(currLocation == Location.WRITING_SUB_URI && c == '>') ret = Location.PRE_PRED;
- else if(currLocation == Location.WRITING_BNODE_URI && c == ' ') ret = Location.PRE_PRED;
- else if(currLocation == Location.WRITING_PRED_URI && c == '>') ret = Location.PRE_OBJ;
- else if(currLocation == Location.WRITING_OBJ_URI && c == '>') ret = Location.POST_OBJ;
- else if(currLocation == Location.WRITING_OBJ_BNODE && c == ' ') ret = Location.POST_OBJ;
- else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ;
- else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ;
- else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ;
-
- // Closing typed and language literal.
- else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG;
- else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE;
-
- // Spaces.
- else if( c == ' ' &&
- (
- currLocation == Location.PRE_SUBJECT ||
- currLocation == Location.PRE_PRED ||
- currLocation == Location.PRE_OBJ ||
- currLocation == Location.POST_OBJ
- )
- ) ret = currLocation;
-
- // Reset.
- else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT;
-
- // Error
- else ret = Location.ERROR;
-
- currState.location=ret;
- }
-
- untilSpace = function(c) { return c != ' '; };
- untilEndURI = function(c) { return c != '>'; };
- return {
- startState: function() {
- return {
- location : Location.PRE_SUBJECT,
- uris : [],
- anchors : [],
- bnodes : [],
- langs : [],
- types : []
- };
- },
- token: function(stream, state) {
- var ch = stream.next();
- if(ch == '<') {
- transitState(state, ch);
- var parsedURI = '';
- stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} );
- state.uris.push(parsedURI);
- if( stream.match('#', false) ) return 'variable';
- stream.next();
- transitState(state, '>');
- return 'variable';
- }
- if(ch == '#') {
- var parsedAnchor = '';
- stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false});
- state.anchors.push(parsedAnchor);
- return 'variable-2';
- }
- if(ch == '>') {
- transitState(state, '>');
- return 'variable';
- }
- if(ch == '_') {
- transitState(state, ch);
- var parsedBNode = '';
- stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;});
- state.bnodes.push(parsedBNode);
- stream.next();
- transitState(state, ' ');
- return 'builtin';
- }
- if(ch == '"') {
- transitState(state, ch);
- stream.eatWhile( function(c) { return c != '"'; } );
- stream.next();
- if( stream.peek() != '@' && stream.peek() != '^' ) {
- transitState(state, '"');
- }
- return 'string';
- }
- if( ch == '@' ) {
- transitState(state, '@');
- var parsedLang = '';
- stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;});
- state.langs.push(parsedLang);
- stream.next();
- transitState(state, ' ');
- return 'string-2';
- }
- if( ch == '^' ) {
- stream.next();
- transitState(state, '^');
- var parsedType = '';
- stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} );
- state.types.push(parsedType);
- stream.next();
- transitState(state, '>');
- return 'variable';
- }
- if( ch == ' ' ) {
- transitState(state, ch);
- }
- if( ch == '.' ) {
- transitState(state, ch);
- }
- }
- };
-});
-
-CodeMirror.defineMIME("text/n-triples", "ntriples");
diff --git a/src/codemirror/mode/pascal/LICENSE b/src/codemirror/mode/pascal/LICENSE
deleted file mode 100755
index 8e3747e..0000000
--- a/src/codemirror/mode/pascal/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (c) 2011 souceLair
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/codemirror/mode/pascal/index.html b/src/codemirror/mode/pascal/index.html
deleted file mode 100755
index f8f59e2..0000000
--- a/src/codemirror/mode/pascal/index.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
- CodeMirror 2: Pascal mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Pascal mode
-
-
-
-
-
- MIME types defined: text/x-pascal.
-
-
diff --git a/src/codemirror/mode/pascal/pascal.js b/src/codemirror/mode/pascal/pascal.js
deleted file mode 100755
index 86c6f71..0000000
--- a/src/codemirror/mode/pascal/pascal.js
+++ /dev/null
@@ -1,138 +0,0 @@
-CodeMirror.defineMode("pascal", function(config) {
- function words(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
- var keywords = words("and array begin case const div do downto else end file for forward integer " +
- "boolean char function goto if in label mod nil not of or packed procedure " +
- "program record repeat set string then to type until var while with");
- var blockKeywords = words("case do else for if switch while struct then of");
- var atoms = {"null": true};
-
- var isOperatorChar = /[+\-*&%=<>!?|\/]/;
- var curPunc;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- if (ch == "#" && state.startOfLine) {
- stream.skipToEnd();
- return "meta";
- }
- if (ch == '"' || ch == "'") {
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- if (ch == "(" && stream.eat("*")) {
- state.tokenize = tokenComment;
- return tokenComment(stream, state);
- }
- if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
- curPunc = ch;
- return null
- }
- if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/);
- return "number";
- }
- if (ch == "/") {
- if (stream.eat("/")) {
- stream.skipToEnd();
- return "comment";
- }
- }
- if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return "operator";
- }
- stream.eatWhile(/[\w\$_]/);
- var cur = stream.current();
- if (keywords.propertyIsEnumerable(cur)) {
- if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
- return "keyword";
- }
- if (atoms.propertyIsEnumerable(cur)) return "atom";
- return "word";
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {end = true; break;}
- escaped = !escaped && next == "\\";
- }
- if (end || !escaped) state.tokenize = null;
- return "string";
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == ")" && maybeEnd) {
- state.tokenize = null;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function Context(indented, column, type, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.align = align;
- this.prev = prev;
- }
- function pushContext(state, col, type) {
- return state.context = new Context(state.indented, col, type, null, state.context);
- }
- function popContext(state) {
- var t = state.context.type;
- if (t == ")" || t == "]" )
- state.indented = state.context.indented;
- return state.context = state.context.prev;
- }
-
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: null,
- context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
- indented: 0,
- startOfLine: true
- };
- },
-
- token: function(stream, state) {
- var ctx = state.context;
- if (stream.sol()) {
- if (ctx.align == null) ctx.align = false;
- state.indented = stream.indentation();
- state.startOfLine = true;
- }
- if (stream.eatSpace()) return null;
- curPunc = null;
- var style = (state.tokenize || tokenBase)(stream, state);
- if (style == "comment" || style == "meta") return style;
- if (ctx.align == null) ctx.align = true;
-
- if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
- else if (curPunc == ctx.type) popContext(state);
- else if ( ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
- pushContext(state, stream.column(), "statement");
- state.startOfLine = false;
- return style;
- },
-
- electricChars: "{}"
- };
-});
-
-CodeMirror.defineMIME("text/x-pascal", "pascal");
diff --git a/src/codemirror/mode/php/index.html b/src/codemirror/mode/php/index.html
deleted file mode 100755
index 9e545c9..0000000
--- a/src/codemirror/mode/php/index.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
- CodeMirror 2: PHP mode
-
-
-
-
-
-
-
-
-
-
-
-
- CodeMirror 2: PHP mode
-
-
-
-
-
- Simple HTML/PHP mode based on
- the C-like mode. Depends on XML,
- JavaScript, CSS, and C-like modes.
-
- MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).
-
-
diff --git a/src/codemirror/mode/php/php.js b/src/codemirror/mode/php/php.js
deleted file mode 100755
index 00655be..0000000
--- a/src/codemirror/mode/php/php.js
+++ /dev/null
@@ -1,116 +0,0 @@
-(function() {
- function keywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
- function heredoc(delim) {
- return function(stream, state) {
- if (stream.match(delim)) state.tokenize = null;
- else stream.skipToEnd();
- return "string";
- }
- }
- var phpConfig = {
- name: "clike",
- keywords: keywords("abstract and array as break case catch cfunction class clone const continue declare " +
- "default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends " +
- "final for foreach function global goto if implements interface instanceof namespace " +
- "new or private protected public static switch throw try use var while xor return" +
- "die echo empty exit eval include include_once isset list require require_once print unset"),
- blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
- atoms: keywords("true false null TRUE FALSE NULL"),
- multiLineStrings: true,
- hooks: {
- "$": function(stream, state) {
- stream.eatWhile(/[\w\$_]/);
- return "variable-2";
- },
- "<": function(stream, state) {
- if (stream.match(/<)) {
- stream.eatWhile(/[\w\.]/);
- state.tokenize = heredoc(stream.current().slice(3));
- return state.tokenize(stream, state);
- }
- return false;
- }
- }
- };
-
- CodeMirror.defineMode("php", function(config, parserConfig) {
- var htmlMode = CodeMirror.getMode(config, "text/html");
- var jsMode = CodeMirror.getMode(config, "text/javascript");
- var cssMode = CodeMirror.getMode(config, "text/css");
- var phpMode = CodeMirror.getMode(config, phpConfig);
-
- function dispatch(stream, state) { // TODO open PHP inside text/css
- if (state.curMode == htmlMode) {
- var style = htmlMode.token(stream, state.curState);
- if (style == "meta" && /^<\?/.test(stream.current())) {
- state.curMode = phpMode;
- state.curState = state.php;
- state.curClose = /^\?>/;
- state.mode = 'php';
- }
- else if (style == "tag" && stream.current() == ">" && state.curState.context) {
- if (/^script$/i.test(state.curState.context.tagName)) {
- state.curMode = jsMode;
- state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
- state.curClose = /^<\/\s*script\s*>/i;
- state.mode = 'javascript';
- }
- else if (/^style$/i.test(state.curState.context.tagName)) {
- state.curMode = cssMode;
- state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
- state.curClose = /^<\/\s*style\s*>/i;
- state.mode = 'css';
- }
- }
- return style;
- }
- else if (stream.match(state.curClose, false)) {
- state.curMode = htmlMode;
- state.curState = state.html;
- state.curClose = null;
- state.mode = 'html';
- return dispatch(stream, state);
- }
- else return state.curMode.token(stream, state.curState);
- }
-
- return {
- startState: function() {
- var html = htmlMode.startState();
- return {html: html,
- php: phpMode.startState(),
- curMode: parserConfig.startOpen ? phpMode : htmlMode,
- curState: parserConfig.startOpen ? phpMode.startState() : html,
- curClose: parserConfig.startOpen ? /^\?>/ : null,
- mode: parserConfig.startOpen ? 'php' : 'html'}
- },
-
- copyState: function(state) {
- var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
- php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
- if (state.curState == html) cur = htmlNew;
- else if (state.curState == php) cur = phpNew;
- else cur = CodeMirror.copyState(state.curMode, state.curState);
- return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur, curClose: state.curClose};
- },
-
- token: dispatch,
-
- indent: function(state, textAfter) {
- if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
- (state.curMode == phpMode && /^\?>/.test(textAfter)))
- return htmlMode.indent(state.html, textAfter);
- return state.curMode.indent(state.curState, textAfter);
- },
-
- electricChars: "/{}:"
- }
- });
- CodeMirror.defineMIME("application/x-httpd-php", "php");
- CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
- CodeMirror.defineMIME("text/x-php", phpConfig);
-})();
diff --git a/src/codemirror/mode/plsql/index.html b/src/codemirror/mode/plsql/index.html
deleted file mode 100755
index 8c7bf7c..0000000
--- a/src/codemirror/mode/plsql/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
- CodeMirror 2: Oracle PL/SQL mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Oracle PL/SQL mode
-
-
-
-
-
-
- Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
-
-
- MIME type defined: text/x-plsql
- (PLSQL code)
-
diff --git a/src/codemirror/mode/plsql/plsql.js b/src/codemirror/mode/plsql/plsql.js
deleted file mode 100755
index a2ac2e8..0000000
--- a/src/codemirror/mode/plsql/plsql.js
+++ /dev/null
@@ -1,217 +0,0 @@
-CodeMirror.defineMode("plsql", function(config, parserConfig) {
- var indentUnit = config.indentUnit,
- keywords = parserConfig.keywords,
- functions = parserConfig.functions,
- types = parserConfig.types,
- sqlplus = parserConfig.sqlplus,
- multiLineStrings = parserConfig.multiLineStrings;
- var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
-
- var type;
- function ret(tp, style) {
- type = tp;
- return style;
- }
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- // start of string?
- if (ch == '"' || ch == "'")
- return chain(stream, state, tokenString(ch));
- // is it one of the special signs []{}().,;? Seperator?
- else if (/[\[\]{}\(\),;\.]/.test(ch))
- return ret(ch);
- // start of a number value?
- else if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/);
- return ret("number", "number");
- }
- // multi line comment or simple operator?
- else if (ch == "/") {
- if (stream.eat("*")) {
- return chain(stream, state, tokenComment);
- }
- else {
- stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
- }
- }
- // single line comment or simple operator?
- else if (ch == "-") {
- if (stream.eat("-")) {
- stream.skipToEnd();
- return ret("comment", "comment");
- }
- else {
- stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
- }
- }
- // pl/sql variable?
- else if (ch == "@" || ch == "$") {
- stream.eatWhile(/[\w\d\$_]/);
- return ret("word", "variable");
- }
- // is it a operator?
- else if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
- }
- else {
- // get the whole word
- stream.eatWhile(/[\w\$_]/);
- // is it one of the listed keywords?
- if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword");
- // is it one of the listed functions?
- if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin");
- // is it one of the listed types?
- if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2");
- // is it one of the listed sqlplus keywords?
- if (sqlplus && sqlplus.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3");
- // default: just a "word"
- return ret("word", "plsql-word");
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {end = true; break;}
- escaped = !escaped && next == "\\";
- }
- if (end || !(escaped || multiLineStrings))
- state.tokenize = tokenBase;
- return ret("string", "plsql-string");
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return ret("comment", "plsql-comment");
- }
-
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- startOfLine: true
- };
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- return style;
- }
- };
-});
-
-(function() {
- function keywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
- var cKeywords = "abort accept access add all alter and any array arraylen as asc assert assign at attributes audit " +
- "authorization avg " +
- "base_table begin between binary_integer body boolean by " +
- "case cast char char_base check close cluster clusters colauth column comment commit compress connect " +
- "connected constant constraint crash create current currval cursor " +
- "data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete " +
- "desc digits dispose distinct do drop " +
- "else elsif enable end entry escape exception exception_init exchange exclusive exists exit external " +
- "fast fetch file for force form from function " +
- "generic goto grant group " +
- "having " +
- "identified if immediate in increment index indexes indicator initial initrans insert interface intersect " +
- "into is " +
- "key " +
- "level library like limited local lock log logging long loop " +
- "master maxextents maxtrans member minextents minus mislabel mode modify multiset " +
- "new next no noaudit nocompress nologging noparallel not nowait number_base " +
- "object of off offline on online only open option or order out " +
- "package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior " +
- "private privileges procedure public " +
- "raise range raw read rebuild record ref references refresh release rename replace resource restrict return " +
- "returning reverse revoke rollback row rowid rowlabel rownum rows run " +
- "savepoint schema segment select separate session set share snapshot some space split sql start statement " +
- "storage subtype successful synonym " +
- "tabauth table tables tablespace task terminate then to trigger truncate type " +
- "union unique unlimited unrecoverable unusable update use using " +
- "validate value values variable view views " +
- "when whenever where while with work";
-
- var cFunctions = "abs acos add_months ascii asin atan atan2 average " +
- "bfilename " +
- "ceil chartorowid chr concat convert cos cosh count " +
- "decode deref dual dump dup_val_on_index " +
- "empty error exp " +
- "false floor found " +
- "glb greatest " +
- "hextoraw " +
- "initcap instr instrb isopen " +
- "last_day least lenght lenghtb ln lower lpad ltrim lub " +
- "make_ref max min mod months_between " +
- "new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower " +
- "nls_sort nls_upper nlssort no_data_found notfound null nvl " +
- "others " +
- "power " +
- "rawtohex reftohex round rowcount rowidtochar rpad rtrim " +
- "sign sin sinh soundex sqlcode sqlerrm sqrt stddev substr substrb sum sysdate " +
- "tan tanh to_char to_date to_label to_multi_byte to_number to_single_byte translate true trunc " +
- "uid upper user userenv " +
- "variance vsize";
-
- var cTypes = "bfile blob " +
- "character clob " +
- "dec " +
- "float " +
- "int integer " +
- "mlslabel " +
- "natural naturaln nchar nclob number numeric nvarchar2 " +
- "real rowtype " +
- "signtype smallint string " +
- "varchar varchar2";
-
- var cSqlplus = "appinfo arraysize autocommit autoprint autorecovery autotrace " +
- "blockterminator break btitle " +
- "cmdsep colsep compatibility compute concat copycommit copytypecheck " +
- "define describe " +
- "echo editfile embedded escape exec execute " +
- "feedback flagger flush " +
- "heading headsep " +
- "instance " +
- "linesize lno loboffset logsource long longchunksize " +
- "markup " +
- "native newpage numformat numwidth " +
- "pagesize pause pno " +
- "recsep recsepchar release repfooter repheader " +
- "serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber " +
- "sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix " +
- "tab term termout time timing trimout trimspool ttitle " +
- "underline " +
- "verify version " +
- "wrap";
-
- CodeMirror.defineMIME("text/x-plsql", {
- name: "plsql",
- keywords: keywords(cKeywords),
- functions: keywords(cFunctions),
- types: keywords(cTypes),
- sqlplus: keywords(cSqlplus)
- });
-}());
diff --git a/src/codemirror/mode/python/index.html b/src/codemirror/mode/python/index.html
deleted file mode 100755
index 1c36643..0000000
--- a/src/codemirror/mode/python/index.html
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
- CodeMirror 2: Python mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Python mode
-
-
-
- Configuration Options:
-
- - version - 2/3 - The version of Python to recognize. Default is 2.
- - singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.
-
-
- MIME types defined: text/x-python.
-
-
diff --git a/src/codemirror/mode/python/python.js b/src/codemirror/mode/python/python.js
deleted file mode 100755
index 4f60d9e..0000000
--- a/src/codemirror/mode/python/python.js
+++ /dev/null
@@ -1,320 +0,0 @@
-CodeMirror.defineMode("python", function(conf, parserConf) {
- var ERRORCLASS = 'error';
-
- function wordRegexp(words) {
- return new RegExp("^((" + words.join(")|(") + "))\\b");
- }
-
- var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
- var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
- var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
- var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
- var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
- var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
-
- var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'in']);
- var commonkeywords = ['as', 'assert', 'break', 'class', 'continue',
- 'def', 'del', 'elif', 'else', 'except', 'finally',
- 'for', 'from', 'global', 'if', 'import',
- 'lambda', 'pass', 'raise', 'return',
- 'try', 'while', 'with', 'yield'];
- var commontypes = ['bool', 'classmethod', 'complex', 'dict', 'enumerate',
- 'float', 'frozenset', 'int', 'list', 'object',
- 'property', 'reversed', 'set', 'slice', 'staticmethod',
- 'str', 'super', 'tuple', 'type'];
- var py2 = {'types': ['basestring', 'buffer', 'file', 'long', 'unicode',
- 'xrange'],
- 'keywords': ['exec', 'print']};
- var py3 = {'types': ['bytearray', 'bytes', 'filter', 'map', 'memoryview',
- 'open', 'range', 'zip'],
- 'keywords': ['nonlocal']};
-
- if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
- commonkeywords = commonkeywords.concat(py3.keywords);
- commontypes = commontypes.concat(py3.types);
- var stringPrefixes = new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))", "i");
- } else {
- commonkeywords = commonkeywords.concat(py2.keywords);
- commontypes = commontypes.concat(py2.types);
- var stringPrefixes = new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
- }
- var keywords = wordRegexp(commonkeywords);
- var types = wordRegexp(commontypes);
-
- var indentInfo = null;
-
- // tokenizers
- function tokenBase(stream, state) {
- // Handle scope changes
- if (stream.sol()) {
- var scopeOffset = state.scopes[0].offset;
- if (stream.eatSpace()) {
- var lineOffset = stream.indentation();
- if (lineOffset > scopeOffset) {
- indentInfo = 'indent';
- } else if (lineOffset < scopeOffset) {
- indentInfo = 'dedent';
- }
- return null;
- } else {
- if (scopeOffset > 0) {
- dedent(stream, state);
- }
- }
- }
- if (stream.eatSpace()) {
- return null;
- }
-
- var ch = stream.peek();
-
- // Handle Comments
- if (ch === '#') {
- stream.skipToEnd();
- return 'comment';
- }
-
- // Handle Number Literals
- if (stream.match(/^[0-9\.]/, false)) {
- var floatLiteral = false;
- // Floats
- if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
- if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
- if (stream.match(/^\.\d+/)) { floatLiteral = true; }
- if (floatLiteral) {
- // Float literals may be "imaginary"
- stream.eat(/J/i);
- return 'number';
- }
- // Integers
- var intLiteral = false;
- // Hex
- if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
- // Binary
- if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
- // Octal
- if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
- // Decimal
- if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
- // Decimal literals may be "imaginary"
- stream.eat(/J/i);
- // TODO - Can you have imaginary longs?
- intLiteral = true;
- }
- // Zero by itself with no other piece of number.
- if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
- if (intLiteral) {
- // Integer literals may be "long"
- stream.eat(/L/i);
- return 'number';
- }
- }
-
- // Handle Strings
- if (stream.match(stringPrefixes)) {
- state.tokenize = tokenStringFactory(stream.current());
- return state.tokenize(stream, state);
- }
-
- // Handle operators and Delimiters
- if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
- return null;
- }
- if (stream.match(doubleOperators)
- || stream.match(singleOperators)
- || stream.match(wordOperators)) {
- return 'operator';
- }
- if (stream.match(singleDelimiters)) {
- return null;
- }
-
- if (stream.match(types)) {
- return 'builtin';
- }
-
- if (stream.match(keywords)) {
- return 'keyword';
- }
-
- if (stream.match(identifiers)) {
- return 'variable';
- }
-
- // Handle non-detected items
- stream.next();
- return ERRORCLASS;
- }
-
- function tokenStringFactory(delimiter) {
- while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
- delimiter = delimiter.substr(1);
- }
- var singleline = delimiter.length == 1;
- var OUTCLASS = 'string';
-
- return function tokenString(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"\\]/);
- if (stream.eat('\\')) {
- stream.next();
- if (singleline && stream.eol()) {
- return OUTCLASS;
- }
- } else if (stream.match(delimiter)) {
- state.tokenize = tokenBase;
- return OUTCLASS;
- } else {
- stream.eat(/['"]/);
- }
- }
- if (singleline) {
- if (parserConf.singleLineStringErrors) {
- return ERRORCLASS;
- } else {
- state.tokenize = tokenBase;
- }
- }
- return OUTCLASS;
- };
- }
-
- function indent(stream, state, type) {
- type = type || 'py';
- var indentUnit = 0;
- if (type === 'py') {
- for (var i = 0; i < state.scopes.length; ++i) {
- if (state.scopes[i].type === 'py') {
- indentUnit = state.scopes[i].offset + conf.indentUnit;
- break;
- }
- }
- } else {
- indentUnit = stream.column() + stream.current().length;
- }
- state.scopes.unshift({
- offset: indentUnit,
- type: type
- });
- }
-
- function dedent(stream, state) {
- if (state.scopes.length == 1) return;
- if (state.scopes[0].type === 'py') {
- var _indent = stream.indentation();
- var _indent_index = -1;
- for (var i = 0; i < state.scopes.length; ++i) {
- if (_indent === state.scopes[i].offset) {
- _indent_index = i;
- break;
- }
- }
- if (_indent_index === -1) {
- return true;
- }
- while (state.scopes[0].offset !== _indent) {
- state.scopes.shift();
- }
- return false
- } else {
- state.scopes.shift();
- return false;
- }
- }
-
- function tokenLexer(stream, state) {
- indentInfo = null;
- var style = state.tokenize(stream, state);
- var current = stream.current();
-
- // Handle '.' connected identifiers
- if (current === '.') {
- style = state.tokenize(stream, state);
- current = stream.current();
- if (style === 'variable') {
- return 'variable';
- } else {
- return ERRORCLASS;
- }
- }
-
- // Handle decorators
- if (current === '@') {
- style = state.tokenize(stream, state);
- current = stream.current();
- if (style === 'variable'
- || current === '@staticmethod'
- || current === '@classmethod') {
- return 'meta';
- } else {
- return ERRORCLASS;
- }
- }
-
- // Handle scope changes.
- if (current === 'pass' || current === 'return') {
- state.dedent += 1;
- }
- if ((current === ':' && !state.lambda && state.scopes[0].type == 'py')
- || indentInfo === 'indent') {
- indent(stream, state);
- }
- var delimiter_index = '[({'.indexOf(current);
- if (delimiter_index !== -1) {
- indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
- }
- if (indentInfo === 'dedent') {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
- delimiter_index = '])}'.indexOf(current);
- if (delimiter_index !== -1) {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
- if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'py') {
- if (state.scopes.length > 1) state.scopes.shift();
- state.dedent -= 1;
- }
-
- return style;
- }
-
- var external = {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- scopes: [{offset:basecolumn || 0, type:'py'}],
- lastToken: null,
- lambda: false,
- dedent: 0
- };
- },
-
- token: function(stream, state) {
- var style = tokenLexer(stream, state);
-
- state.lastToken = {style:style, content: stream.current()};
-
- if (stream.eol() && stream.lambda) {
- state.lambda = false;
- }
-
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase) {
- return 0;
- }
-
- return state.scopes[0].offset;
- }
-
- };
- return external;
-});
-
-CodeMirror.defineMIME("text/x-python", "python");
diff --git a/src/codemirror/mode/r/LICENSE b/src/codemirror/mode/r/LICENSE
deleted file mode 100755
index 2510ae1..0000000
--- a/src/codemirror/mode/r/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2011, Ubalo, Inc.
-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 the Ubalo, Inc 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 COPYRIGHT HOLDERS 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 UBALO, INC 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.
diff --git a/src/codemirror/mode/r/index.html b/src/codemirror/mode/r/index.html
deleted file mode 100755
index 8ba3ef1..0000000
--- a/src/codemirror/mode/r/index.html
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
- CodeMirror 2: R mode
-
-
-
-
-
-
-
-
- CodeMirror 2: R mode
-
-
-
- MIME types defined: text/x-rsrc.
-
- Development of the CodeMirror R mode was kindly sponsored
- by Ubalo, who hold
- the license.
-
-
-
diff --git a/src/codemirror/mode/r/r.js b/src/codemirror/mode/r/r.js
deleted file mode 100755
index 53647f2..0000000
--- a/src/codemirror/mode/r/r.js
+++ /dev/null
@@ -1,141 +0,0 @@
-CodeMirror.defineMode("r", function(config) {
- function wordObj(str) {
- var words = str.split(" "), res = {};
- for (var i = 0; i < words.length; ++i) res[words[i]] = true;
- return res;
- }
- var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
- var builtins = wordObj("list quote bquote eval return call parse deparse");
- var keywords = wordObj("if else repeat while function for in next break");
- var blockkeywords = wordObj("if else repeat while function for");
- var opChars = /[+\-*\/^<>=!&|~$:]/;
- var curPunc;
-
- function tokenBase(stream, state) {
- curPunc = null;
- var ch = stream.next();
- if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- } else if (ch == "0" && stream.eat("x")) {
- stream.eatWhile(/[\da-f]/i);
- return "number";
- } else if (ch == "." && stream.eat(/\d/)) {
- stream.match(/\d*(?:e[+\-]?\d+)?/);
- return "number";
- } else if (/\d/.test(ch)) {
- stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
- return "number";
- } else if (ch == "'" || ch == '"') {
- state.tokenize = tokenString(ch);
- return "string";
- } else if (ch == "." && stream.match(/.[.\d]+/)) {
- return "keyword";
- } else if (/[\w\.]/.test(ch) && ch != "_") {
- stream.eatWhile(/[\w\.]/);
- var word = stream.current();
- if (atoms.propertyIsEnumerable(word)) return "atom";
- if (keywords.propertyIsEnumerable(word)) {
- if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
- return "keyword";
- }
- if (builtins.propertyIsEnumerable(word)) return "builtin";
- return "variable";
- } else if (ch == "%") {
- if (stream.skipTo("%")) stream.next();
- return "variable-2";
- } else if (ch == "<" && stream.eat("-")) {
- return "arrow";
- } else if (ch == "=" && state.ctx.argList) {
- return "arg-is";
- } else if (opChars.test(ch)) {
- if (ch == "$") return "dollar";
- stream.eatWhile(opChars);
- return "operator";
- } else if (/[\(\){}\[\];]/.test(ch)) {
- curPunc = ch;
- if (ch == ";") return "semi";
- return null;
- } else {
- return null;
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- if (stream.eat("\\")) {
- var ch = stream.next();
- if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
- else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
- else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
- else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
- else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
- return "string-2";
- } else {
- var next;
- while ((next = stream.next()) != null) {
- if (next == quote) { state.tokenize = tokenBase; break; }
- if (next == "\\") { stream.backUp(1); break; }
- }
- return "string";
- }
- };
- }
-
- function push(state, type, stream) {
- state.ctx = {type: type,
- indent: state.indent,
- align: null,
- column: stream.column(),
- prev: state.ctx};
- }
- function pop(state) {
- state.indent = state.ctx.indent;
- state.ctx = state.ctx.prev;
- }
-
- return {
- startState: function(base) {
- return {tokenize: tokenBase,
- ctx: {type: "top",
- indent: -config.indentUnit,
- align: false},
- indent: 0,
- afterIdent: false};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (state.ctx.align == null) state.ctx.align = false;
- state.indent = stream.indentation();
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
-
- var ctype = state.ctx.type;
- if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
- if (curPunc == "{") push(state, "}", stream);
- else if (curPunc == "(") {
- push(state, ")", stream);
- if (state.afterIdent) state.ctx.argList = true;
- }
- else if (curPunc == "[") push(state, "]", stream);
- else if (curPunc == "block") push(state, "block", stream);
- else if (curPunc == ctype) pop(state);
- state.afterIdent = style == "variable" || style == "keyword";
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
- closing = firstChar == ctx.type;
- if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
- else return ctx.indent + (closing ? 0 : config.indentUnit);
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-rsrc", "r");
diff --git a/src/codemirror/mode/rst/index.html b/src/codemirror/mode/rst/index.html
deleted file mode 100755
index 0831dff..0000000
--- a/src/codemirror/mode/rst/index.html
+++ /dev/null
@@ -1,526 +0,0 @@
-
-
-
- CodeMirror 2: reStructuredText mode
-
-
-
-
-
-
-
-
- CodeMirror 2: reStructuredText mode
-
-
-
-
- The reStructuredText mode supports one configuration parameter:
-
- verbatim (string)
- - A name or MIME type of a mode that will be used for highlighting
- verbatim blocks. By default, reStructuredText mode uses uniform color
- for whole block of verbatim text if no mode is given.
-
- If python mode is available (not a part of CodeMirror 2 yet),
- it will be used for highlighting blocks containing Python/IPython terminal
- sessions (blocks starting with >>> (for Python) or
- In [num]: (for IPython).
-
-
MIME types defined: text/x-rst.
-
-
-
diff --git a/src/codemirror/mode/rst/rst.css b/src/codemirror/mode/rst/rst.css
deleted file mode 100755
index 235a5d8..0000000
--- a/src/codemirror/mode/rst/rst.css
+++ /dev/null
@@ -1,75 +0,0 @@
-.cm-s-default span.cm-emphasis {
- font-style: italic;
-}
-
-.cm-s-default span.cm-strong {
- font-weight: bold;
-}
-
-.cm-s-default span.cm-interpreted {
- color: #33cc66;
-}
-
-.cm-s-default span.cm-inline {
- color: #3399cc;
-}
-
-.cm-s-default span.cm-role {
- color: #666699;
-}
-
-.cm-s-default span.cm-list {
- color: #cc0099;
- font-weight: bold;
-}
-
-.cm-s-default span.cm-body {
- color: #6699cc;
-}
-
-.cm-s-default span.cm-verbatim {
- color: #3366ff;
-}
-
-.cm-s-default span.cm-comment {
- color: #aa7700;
-}
-
-.cm-s-default span.cm-directive {
- font-weight: bold;
- color: #3399ff;
-}
-
-.cm-s-default span.cm-hyperlink {
- font-weight: bold;
- color: #3366ff;
-}
-
-.cm-s-default span.cm-footnote {
- font-weight: bold;
- color: #3333ff;
-}
-
-.cm-s-default span.cm-citation {
- font-weight: bold;
- color: #3300ff;
-}
-
-.cm-s-default span.cm-replacement {
- color: #9933cc;
-}
-
-.cm-s-default span.cm-section {
- font-weight: bold;
- color: #cc0099;
-}
-
-.cm-s-default span.cm-directive-marker {
- font-weight: bold;
- color: #3399ff;
-}
-
-.cm-s-default span.cm-verbatim-marker {
- font-weight: bold;
- color: #9900ff;
-}
diff --git a/src/codemirror/mode/rst/rst.js b/src/codemirror/mode/rst/rst.js
deleted file mode 100755
index eecc5be..0000000
--- a/src/codemirror/mode/rst/rst.js
+++ /dev/null
@@ -1,333 +0,0 @@
-CodeMirror.defineMode('rst', function(config, options) {
- function setState(state, fn, ctx) {
- state.fn = fn;
- setCtx(state, ctx);
- }
-
- function setCtx(state, ctx) {
- state.ctx = ctx || {};
- }
-
- function setNormal(state, ch) {
- if (ch && (typeof ch !== 'string')) {
- var str = ch.current();
- ch = str[str.length-1];
- }
-
- setState(state, normal, {back: ch});
- }
-
- function hasMode(mode) {
- if (mode) {
- var modes = CodeMirror.listModes();
-
- for (var i in modes) {
- if (modes[i] == mode) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- function getMode(mode) {
- if (hasMode(mode)) {
- return CodeMirror.getMode(config, mode);
- } else {
- return null;
- }
- }
-
- var verbatimMode = getMode(options.verbatim);
- var pythonMode = getMode('python');
-
- var reSection = /^[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/;
- var reDirective = /^\s*\w([-:.\w]*\w)?::(\s|$)/;
- var reHyperlink = /^\s*_[\w-]+:(\s|$)/;
- var reFootnote = /^\s*\[(\d+|#)\](\s|$)/;
- var reCitation = /^\s*\[[A-Za-z][\w-]*\](\s|$)/;
- var reFootnoteRef = /^\[(\d+|#)\]_/;
- var reCitationRef = /^\[[A-Za-z][\w-]*\]_/;
- var reDirectiveMarker = /^\.\.(\s|$)/;
- var reVerbatimMarker = /^::\s*$/;
- var rePreInline = /^[-\s"([{/:.,;!?\\_]/;
- var reEnumeratedList = /^\s*((\d+|[A-Za-z#])[.)]|\((\d+|[A-Z-a-z#])\))\s/;
- var reBulletedList = /^\s*[-\+\*]\s/;
- var reExamples = /^\s+(>>>|In \[\d+\]:)\s/;
-
- function normal(stream, state) {
- var ch, sol, i;
-
- if (stream.eat(/\\/)) {
- ch = stream.next();
- setNormal(state, ch);
- return null;
- }
-
- sol = stream.sol();
-
- if (sol && (ch = stream.eat(reSection))) {
- for (i = 0; stream.eat(ch); i++);
-
- if (i >= 3 && stream.match(/^\s*$/)) {
- setNormal(state, null);
- return 'section';
- } else {
- stream.backUp(i + 1);
- }
- }
-
- if (sol && stream.match(reDirectiveMarker)) {
- if (!stream.eol()) {
- setState(state, directive);
- }
-
- return 'directive-marker';
- }
-
- if (stream.match(reVerbatimMarker)) {
- if (!verbatimMode) {
- setState(state, verbatim);
- } else {
- var mode = verbatimMode;
-
- setState(state, verbatim, {
- mode: mode,
- local: mode.startState()
- });
- }
-
- return 'verbatim-marker';
- }
-
- if (sol && stream.match(reExamples, false)) {
- if (!pythonMode) {
- setState(state, verbatim);
- return 'verbatim-marker';
- } else {
- var mode = pythonMode;
-
- setState(state, verbatim, {
- mode: mode,
- local: mode.startState()
- });
-
- return null;
- }
- }
-
- if (sol && (stream.match(reEnumeratedList) ||
- stream.match(reBulletedList))) {
- setNormal(state, stream);
- return 'list';
- }
-
- function testBackward(re) {
- return sol || !state.ctx.back || re.test(state.ctx.back);
- }
-
- function testForward(re) {
- return stream.eol() || stream.match(re, false);
- }
-
- function testInline(re) {
- return stream.match(re) && testBackward(/\W/) && testForward(/\W/);
- }
-
- if (testInline(reFootnoteRef)) {
- setNormal(state, stream);
- return 'footnote';
- }
-
- if (testInline(reCitationRef)) {
- setNormal(state, stream);
- return 'citation';
- }
-
- ch = stream.next();
-
- if (testBackward(rePreInline)) {
- if ((ch === ':' || ch === '|') && stream.eat(/\S/)) {
- var token;
-
- if (ch === ':') {
- token = 'role';
- } else {
- token = 'replacement';
- }
-
- setState(state, inline, {
- ch: ch,
- wide: false,
- prev: null,
- token: token
- });
-
- return token;
- }
-
- if (ch === '*' || ch === '`') {
- var orig = ch,
- wide = false;
-
- ch = stream.next();
-
- if (ch == orig) {
- wide = true;
- ch = stream.next();
- }
-
- if (ch && !/\s/.test(ch)) {
- var token;
-
- if (orig === '*') {
- token = wide ? 'strong' : 'emphasis';
- } else {
- token = wide ? 'inline' : 'interpreted';
- }
-
- setState(state, inline, {
- ch: orig, // inline() has to know what to search for
- wide: wide, // are we looking for `ch` or `chch`
- prev: null, // terminator must not be preceeded with whitespace
- token: token // I don't want to recompute this all the time
- });
-
- return token;
- }
- }
- }
-
- setNormal(state, ch);
- return null;
- }
-
- function inline(stream, state) {
- var ch = stream.next(),
- token = state.ctx.token;
-
- function finish(ch) {
- state.ctx.prev = ch;
- return token;
- }
-
- if (ch != state.ctx.ch) {
- return finish(ch);
- }
-
- if (/\s/.test(state.ctx.prev)) {
- return finish(ch);
- }
-
- if (state.ctx.wide) {
- ch = stream.next();
-
- if (ch != state.ctx.ch) {
- return finish(ch);
- }
- }
-
- if (!stream.eol() && !rePostInline.test(stream.peek())) {
- if (state.ctx.wide) {
- stream.backUp(1);
- }
-
- return finish(ch);
- }
-
- setState(state, normal);
- setNormal(state, ch);
-
- return token;
- }
-
- function directive(stream, state) {
- var token = null;
-
- if (stream.match(reDirective)) {
- token = 'directive';
- } else if (stream.match(reHyperlink)) {
- token = 'hyperlink';
- } else if (stream.match(reFootnote)) {
- token = 'footnote';
- } else if (stream.match(reCitation)) {
- token = 'citation';
- } else {
- stream.eatSpace();
-
- if (stream.eol()) {
- setNormal(state, stream);
- return null;
- } else {
- stream.skipToEnd();
- setState(state, comment);
- return 'comment';
- }
- }
-
- setState(state, body, {start: true});
- return token;
- }
-
- function body(stream, state) {
- var token = 'body';
-
- if (!state.ctx.start || stream.sol()) {
- return block(stream, state, token);
- }
-
- stream.skipToEnd();
- setCtx(state);
-
- return token;
- }
-
- function comment(stream, state) {
- return block(stream, state, 'comment');
- }
-
- function verbatim(stream, state) {
- if (!verbatimMode) {
- return block(stream, state, 'verbatim');
- } else {
- if (stream.sol()) {
- if (!stream.eatSpace()) {
- setNormal(state, stream);
- }
-
- return null;
- }
-
- return verbatimMode.token(stream, state.ctx.local);
- }
- }
-
- function block(stream, state, token) {
- if (stream.eol() || stream.eatSpace()) {
- stream.skipToEnd();
- return token;
- } else {
- setNormal(state, stream);
- return null;
- }
- }
-
- return {
- startState: function() {
- return {fn: normal, ctx: {}};
- },
-
- copyState: function(state) {
- return {fn: state.fn, ctx: state.ctx};
- },
-
- token: function(stream, state) {
- var token = state.fn(stream, state);
- return token;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-rst", "rst");
diff --git a/src/codemirror/mode/ruby/LICENSE b/src/codemirror/mode/ruby/LICENSE
deleted file mode 100755
index ac09fc4..0000000
--- a/src/codemirror/mode/ruby/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2011, Ubalo, Inc.
-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 the Ubalo, Inc. 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 COPYRIGHT HOLDERS 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 UBALO, INC 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.
diff --git a/src/codemirror/mode/ruby/index.html b/src/codemirror/mode/ruby/index.html
deleted file mode 100755
index babc37e..0000000
--- a/src/codemirror/mode/ruby/index.html
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
- CodeMirror 2: Ruby mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Ruby mode
-
-
-
- MIME types defined: text/x-ruby.
-
- Development of the CodeMirror Ruby mode was kindly sponsored
- by Ubalo, who hold
- the license.
-
-
-
diff --git a/src/codemirror/mode/ruby/ruby.js b/src/codemirror/mode/ruby/ruby.js
deleted file mode 100755
index ddc1a65..0000000
--- a/src/codemirror/mode/ruby/ruby.js
+++ /dev/null
@@ -1,195 +0,0 @@
-CodeMirror.defineMode("ruby", function(config, parserConfig) {
- function wordObj(words) {
- var o = {};
- for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
- return o;
- }
- var keywords = wordObj([
- "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
- "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
- "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
- "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
- "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
- "require_relative", "extend", "autoload"
- ]);
- var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
- "unless", "catch", "loop", "proc"]);
- var dedentWords = wordObj(["end", "until"]);
- var matching = {"[": "]", "{": "}", "(": ")"};
- var curPunc;
-
- function chain(newtok, stream, state) {
- state.tokenize.push(newtok);
- return newtok(stream, state);
- }
-
- function tokenBase(stream, state) {
- curPunc = null;
- if (stream.sol() && stream.match("=begin") && stream.eol()) {
- state.tokenize.push(readBlockComment);
- return "comment";
- }
- if (stream.eatSpace()) return null;
- var ch = stream.next();
- if (ch == "`" || ch == "'" || ch == '"' || ch == "/") {
- return chain(readQuoted(ch, "string", ch == '"'), stream, state);
- } else if (ch == "%") {
- var style, embed = false;
- if (stream.eat("s")) style = "atom";
- else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
- else if (stream.eat(/[wxqr]/)) style = "string";
- var delim = stream.eat(/[^\w\s]/);
- if (!delim) return "operator";
- if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
- return chain(readQuoted(delim, style, embed, true), stream, state);
- } else if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- } else if (ch == "<" && stream.eat("<")) {
- stream.eat("-");
- stream.eat(/[\'\"\`]/);
- var match = stream.match(/^\w+/);
- stream.eat(/[\'\"\`]/);
- if (match) return chain(readHereDoc(match[0]), stream, state);
- return null;
- } else if (ch == "0") {
- if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
- else if (stream.eat("b")) stream.eatWhile(/[01]/);
- else stream.eatWhile(/[0-7]/);
- return "number";
- } else if (/\d/.test(ch)) {
- stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
- return "number";
- } else if (ch == "?") {
- while (stream.match(/^\\[CM]-/)) {}
- if (stream.eat("\\")) stream.eatWhile(/\w/);
- else stream.next();
- return "string";
- } else if (ch == ":") {
- if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
- if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
- stream.eatWhile(/[\w\?]/);
- return "atom";
- } else if (ch == "@") {
- stream.eat("@");
- stream.eatWhile(/[\w\?]/);
- return "variable-2";
- } else if (ch == "$") {
- stream.next();
- stream.eatWhile(/[\w\?]/);
- return "variable-3";
- } else if (/\w/.test(ch)) {
- stream.eatWhile(/[\w\?]/);
- if (stream.eat(":")) return "atom";
- return "ident";
- } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
- curPunc = "|";
- return null;
- } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
- curPunc = ch;
- return null;
- } else if (ch == "-" && stream.eat(">")) {
- return "arrow";
- } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
- stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
- return "operator";
- } else {
- return null;
- }
- }
-
- function tokenBaseUntilBrace() {
- var depth = 1;
- return function(stream, state) {
- if (stream.peek() == "}") {
- depth--;
- if (depth == 0) {
- state.tokenize.pop();
- return state.tokenize[state.tokenize.length-1](stream, state);
- }
- } else if (stream.peek() == "{") {
- depth++;
- }
- return tokenBase(stream, state);
- };
- }
- function readQuoted(quote, style, embed, unescaped) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && (unescaped || !escaped)) {
- state.tokenize.pop();
- break;
- }
- if (embed && ch == "#" && !escaped && stream.eat("{")) {
- state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- return style;
- };
- }
- function readHereDoc(phrase) {
- return function(stream, state) {
- if (stream.match(phrase)) state.tokenize.pop();
- else stream.skipToEnd();
- return "string";
- };
- }
- function readBlockComment(stream, state) {
- if (stream.sol() && stream.match("=end") && stream.eol())
- state.tokenize.pop();
- stream.skipToEnd();
- return "comment";
- }
-
- return {
- startState: function() {
- return {tokenize: [tokenBase],
- indented: 0,
- context: {type: "top", indented: -config.indentUnit},
- continuedLine: false,
- lastTok: null,
- varList: false};
- },
-
- token: function(stream, state) {
- if (stream.sol()) state.indented = stream.indentation();
- var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
- if (style == "ident") {
- var word = stream.current();
- style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
- : /^[A-Z]/.test(word) ? "tag"
- : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
- : "variable";
- if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
- else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
- else if (word == "if" && stream.column() == stream.indentation()) kwtype = "indent";
- }
- if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
- if (curPunc == "|") state.varList = !state.varList;
-
- if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
- state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
- else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
- state.context = state.context.prev;
-
- if (stream.eol())
- state.continuedLine = (curPunc == "\\" || style == "operator");
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0);
- var ct = state.context;
- var closing = ct.type == matching[firstChar] ||
- ct.type == "keyword" && /^(?:end|until|else|elsif|when)\b/.test(textAfter);
- return ct.indented + (closing ? 0 : config.indentUnit) +
- (state.continuedLine ? config.indentUnit : 0);
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-ruby", "ruby");
diff --git a/src/codemirror/mode/scheme/index.html b/src/codemirror/mode/scheme/index.html
deleted file mode 100755
index 3240232..0000000
--- a/src/codemirror/mode/scheme/index.html
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
- CodeMirror 2: Scheme mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Scheme mode
-
-
-
- MIME types defined: text/x-scheme.
-
-
-
diff --git a/src/codemirror/mode/scheme/scheme.js b/src/codemirror/mode/scheme/scheme.js
deleted file mode 100755
index caf78db..0000000
--- a/src/codemirror/mode/scheme/scheme.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * Author: Koh Zi Han, based on implementation by Koh Zi Chun
- */
-CodeMirror.defineMode("scheme", function (config, mode) {
- var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
- ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
- var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
-
- function makeKeywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
- var indentKeys = makeKeywords("define let letrec let* lambda");
-
-
- function stateStack(indent, type, prev) { // represents a state stack object
- this.indent = indent;
- this.type = type;
- this.prev = prev;
- }
-
- function pushStack(state, indent, type) {
- state.indentStack = new stateStack(indent, type, state.indentStack);
- }
-
- function popStack(state) {
- state.indentStack = state.indentStack.prev;
- }
-
- /**
- * Scheme numbers are complicated unfortunately.
- * Checks if we're looking at a number, which might be possibly a fraction.
- * Also checks that it is not part of a longer identifier. Returns true/false accordingly.
- */
- function isNumber(ch, stream){
- if(/[0-9]/.exec(ch) != null){
- stream.eatWhile(/[0-9]/);
- stream.eat(/\//);
- stream.eatWhile(/[0-9]/);
- if (stream.eol() || !(/[a-zA-Z\-\_\/]/.exec(stream.peek()))) return true;
- stream.backUp(stream.current().length - 1); // undo all the eating
- }
- return false;
- }
-
- return {
- startState: function () {
- return {
- indentStack: null,
- indentation: 0,
- mode: false,
- sExprComment: false
- };
- },
-
- token: function (stream, state) {
- if (state.indentStack == null && stream.sol()) {
- // update indentation, but only if indentStack is empty
- state.indentation = stream.indentation();
- }
-
- // skip spaces
- if (stream.eatSpace()) {
- return null;
- }
- var returnType = null;
-
- switch(state.mode){
- case "string": // multi-line string parsing mode
- var next, escaped = false;
- while ((next = stream.next()) != null) {
- if (next == "\"" && !escaped) {
-
- state.mode = false;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- returnType = STRING; // continue on in scheme-string mode
- break;
- case "comment": // comment parsing mode
- var next, maybeEnd = false;
- while ((next = stream.next()) != null) {
- if (next == "#" && maybeEnd) {
-
- state.mode = false;
- break;
- }
- maybeEnd = (next == "|");
- }
- returnType = COMMENT;
- break;
- case "s-expr-comment": // s-expr commenting mode
- state.mode = false;
- if(stream.peek() == "(" || stream.peek() == "["){
- // actually start scheme s-expr commenting mode
- state.sExprComment = 0;
- }else{
- // if not we just comment the entire of the next token
- stream.eatWhile(/[^/s]/); // eat non spaces
- returnType = COMMENT;
- break;
- }
- default: // default parsing mode
- var ch = stream.next();
-
- if (ch == "\"") {
- state.mode = "string";
- returnType = STRING;
-
- } else if (ch == "'") {
- returnType = ATOM;
- } else if (ch == '#') {
- if (stream.eat("|")) { // Multi-line comment
- state.mode = "comment"; // toggle to comment mode
- returnType = COMMENT;
- } else if (stream.eat(/[tf]/)) { // #t/#f (atom)
- returnType = ATOM;
- } else if (stream.eat(';')) { // S-Expr comment
- state.mode = "s-expr-comment";
- returnType = COMMENT;
- }
-
- } else if (ch == ";") { // comment
- stream.skipToEnd(); // rest of the line is a comment
- returnType = COMMENT;
- } else if (ch == "-"){
-
- if(!isNaN(parseInt(stream.peek()))){
- stream.eatWhile(/[\/0-9]/);
- returnType = NUMBER;
- }else{
- returnType = null;
- }
- } else if (isNumber(ch,stream)){
- returnType = NUMBER;
- } else if (ch == "(" || ch == "[") {
- var keyWord = ''; var indentTemp = stream.column();
- /**
- Either
- (indent-word ..
- (non-indent-word ..
- (;something else, bracket, etc.
- */
-
- while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
- keyWord += letter;
- }
-
- if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
-
- pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
- } else { // non-indent word
- // we continue eating the spaces
- stream.eatSpace();
- if (stream.eol() || stream.peek() == ";") {
- // nothing significant after
- // we restart indentation 1 space after
- pushStack(state, indentTemp + 1, ch);
- } else {
- pushStack(state, indentTemp + stream.current().length, ch); // else we match
- }
- }
- stream.backUp(stream.current().length - 1); // undo all the eating
-
- if(typeof state.sExprComment == "number") state.sExprComment++;
-
- returnType = BRACKET;
- } else if (ch == ")" || ch == "]") {
- returnType = BRACKET;
- if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
- popStack(state);
-
- if(typeof state.sExprComment == "number"){
- if(--state.sExprComment == 0){
- returnType = COMMENT; // final closing bracket
- state.sExprComment = false; // turn off s-expr commenting mode
- }
- }
- }
- } else {
- stream.eatWhile(/[\w\$_\-]/);
-
- if (keywords && keywords.propertyIsEnumerable(stream.current())) {
- returnType = BUILTIN;
- }else returnType = null;
- }
- }
- return (typeof state.sExprComment == "number") ? COMMENT : returnType;
- },
-
- indent: function (state, textAfter) {
- if (state.indentStack == null) return state.indentation;
- return state.indentStack.indent;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-scheme", "scheme");
\ No newline at end of file
diff --git a/src/codemirror/mode/smalltalk/index.html b/src/codemirror/mode/smalltalk/index.html
deleted file mode 100755
index 67cb22b..0000000
--- a/src/codemirror/mode/smalltalk/index.html
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- CodeMirror 2: Smalltalk mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Smalltalk mode
-
-
-
-
-
- Simple Smalltalk mode.
-
- MIME types defined: text/x-stsrc.
-
-
diff --git a/src/codemirror/mode/smalltalk/smalltalk.js b/src/codemirror/mode/smalltalk/smalltalk.js
deleted file mode 100755
index a5b14e1..0000000
--- a/src/codemirror/mode/smalltalk/smalltalk.js
+++ /dev/null
@@ -1,122 +0,0 @@
-CodeMirror.defineMode("smalltalk", function(config, parserConfig) {
- var keywords = {"true": 1, "false": 1, nil: 1, self: 1, "super": 1, thisContext: 1};
- var indentUnit = config.indentUnit;
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
-
- var type;
- function ret(tp, style) {
- type = tp;
- return style;
- }
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- if (ch == '"')
- return chain(stream, state, tokenComment(ch));
- else if (ch == "'")
- return chain(stream, state, tokenString(ch));
- else if (ch == "#") {
- stream.eatWhile(/[\w\$_]/);
- return ret("string", "string");
- }
- else if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/)
- return ret("number", "number");
- }
- else if (/[\[\]()]/.test(ch)) {
- return ret(ch, null);
- }
- else {
- stream.eatWhile(/[\w\$_]/);
- if (keywords && keywords.propertyIsEnumerable(stream.current())) return ret("keyword", "keyword");
- return ret("word", "variable");
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {end = true; break;}
- escaped = !escaped && next == "\\";
- }
- if (end || !(escaped))
- state.tokenize = tokenBase;
- return ret("string", "string");
- };
- }
-
- function tokenComment(quote) {
- return function(stream, state) {
- var next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote) {end = true; break;}
- }
- if (end)
- state.tokenize = tokenBase;
- return ret("comment", "comment");
- };
- }
-
- function Context(indented, column, type, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.align = align;
- this.prev = prev;
- }
-
- function pushContext(state, col, type) {
- return state.context = new Context(state.indented, col, type, null, state.context);
- }
- function popContext(state) {
- return state.context = state.context.prev;
- }
-
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
- indented: 0,
- startOfLine: true
- };
- },
-
- token: function(stream, state) {
- var ctx = state.context;
- if (stream.sol()) {
- if (ctx.align == null) ctx.align = false;
- state.indented = stream.indentation();
- state.startOfLine = true;
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- if (type == "comment") return style;
- if (ctx.align == null) ctx.align = true;
-
- if (type == "[") pushContext(state, stream.column(), "]");
- else if (type == "(") pushContext(state, stream.column(), ")");
- else if (type == ctx.type) popContext(state);
- state.startOfLine = false;
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
- if (ctx.align) return ctx.column + (closing ? 0 : 1);
- else return ctx.indented + (closing ? 0 : indentUnit);
- },
-
- electricChars: "]"
- };
-});
-
-CodeMirror.defineMIME("text/x-stsrc", {name: "smalltalk"});
diff --git a/src/codemirror/mode/sparql/index.html b/src/codemirror/mode/sparql/index.html
deleted file mode 100755
index a0e2f4e..0000000
--- a/src/codemirror/mode/sparql/index.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- CodeMirror 2: SPARQL mode
-
-
-
-
-
-
-
-
- CodeMirror 2: SPARQL mode
-
-
-
- MIME types defined: application/x-sparql-query.
-
-
-
diff --git a/src/codemirror/mode/sparql/sparql.js b/src/codemirror/mode/sparql/sparql.js
deleted file mode 100755
index ceb5294..0000000
--- a/src/codemirror/mode/sparql/sparql.js
+++ /dev/null
@@ -1,143 +0,0 @@
-CodeMirror.defineMode("sparql", function(config) {
- var indentUnit = config.indentUnit;
- var curPunc;
-
- function wordRegexp(words) {
- return new RegExp("^(?:" + words.join("|") + ")$", "i");
- }
- var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
- "isblank", "isliteral", "union", "a"]);
- var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
- "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
- "graph", "by", "asc", "desc"]);
- var operatorChars = /[*+\-<>=&|]/;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- curPunc = null;
- if (ch == "$" || ch == "?") {
- stream.match(/^[\w\d]*/);
- return "variable-2";
- }
- else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
- stream.match(/^[^\s\u00a0>]*>?/);
- return "atom";
- }
- else if (ch == "\"" || ch == "'") {
- state.tokenize = tokenLiteral(ch);
- return state.tokenize(stream, state);
- }
- else if (/[{}\(\),\.;\[\]]/.test(ch)) {
- curPunc = ch;
- return null;
- }
- else if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- }
- else if (operatorChars.test(ch)) {
- stream.eatWhile(operatorChars);
- return null;
- }
- else if (ch == ":") {
- stream.eatWhile(/[\w\d\._\-]/);
- return "atom";
- }
- else {
- stream.eatWhile(/[_\w\d]/);
- if (stream.eat(":")) {
- stream.eatWhile(/[\w\d_\-]/);
- return "atom";
- }
- var word = stream.current(), type;
- if (ops.test(word))
- return null;
- else if (keywords.test(word))
- return "keyword";
- else
- return "variable";
- }
- }
-
- function tokenLiteral(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) {
- state.tokenize = tokenBase;
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- return "string";
- };
- }
-
- function pushContext(state, type, col) {
- state.context = {prev: state.context, indent: state.indent, col: col, type: type};
- }
- function popContext(state) {
- state.indent = state.context.indent;
- state.context = state.context.prev;
- }
-
- return {
- startState: function(base) {
- return {tokenize: tokenBase,
- context: null,
- indent: 0,
- col: 0};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (state.context && state.context.align == null) state.context.align = false;
- state.indent = stream.indentation();
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
-
- if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
- state.context.align = true;
- }
-
- if (curPunc == "(") pushContext(state, ")", stream.column());
- else if (curPunc == "[") pushContext(state, "]", stream.column());
- else if (curPunc == "{") pushContext(state, "}", stream.column());
- else if (/[\]\}\)]/.test(curPunc)) {
- while (state.context && state.context.type == "pattern") popContext(state);
- if (state.context && curPunc == state.context.type) popContext(state);
- }
- else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
- else if (/atom|string|variable/.test(style) && state.context) {
- if (/[\}\]]/.test(state.context.type))
- pushContext(state, "pattern", stream.column());
- else if (state.context.type == "pattern" && !state.context.align) {
- state.context.align = true;
- state.context.col = stream.column();
- }
- }
-
- return style;
- },
-
- indent: function(state, textAfter) {
- var firstChar = textAfter && textAfter.charAt(0);
- var context = state.context;
- if (/[\]\}]/.test(firstChar))
- while (context && context.type == "pattern") context = context.prev;
-
- var closing = context && firstChar == context.type;
- if (!context)
- return 0;
- else if (context.type == "pattern")
- return context.col;
- else if (context.align)
- return context.col + (closing ? 0 : 1);
- else
- return context.indent + (closing ? 0 : indentUnit);
- }
- };
-});
-
-CodeMirror.defineMIME("application/x-sparql-query", "sparql");
diff --git a/src/codemirror/mode/stex/index.html b/src/codemirror/mode/stex/index.html
deleted file mode 100755
index 7a27d11..0000000
--- a/src/codemirror/mode/stex/index.html
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
- CodeMirror 2: sTeX mode
-
-
-
-
-
-
-
-
- CodeMirror 2: sTeX mode
-
-
-
- MIME types defined: text/stex.
-
-
-
diff --git a/src/codemirror/mode/stex/stex.js b/src/codemirror/mode/stex/stex.js
deleted file mode 100755
index bb47fb4..0000000
--- a/src/codemirror/mode/stex/stex.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
- * Licence: MIT
- */
-
-CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
-{
- function pushCommand(state, command) {
- state.cmdState.push(command);
- }
-
- function peekCommand(state) {
- if (state.cmdState.length>0)
- return state.cmdState[state.cmdState.length-1];
- else
- return null;
- }
-
- function popCommand(state) {
- if (state.cmdState.length>0) {
- var plug = state.cmdState.pop();
- plug.closeBracket();
- }
- }
-
- function applyMostPowerful(state) {
- var context = state.cmdState;
- for (var i = context.length - 1; i >= 0; i--) {
- var plug = context[i];
- if (plug.name=="DEFAULT")
- continue;
- return plug.styleIdentifier();
- }
- return null;
- }
-
- function addPluginPattern(pluginName, cmdStyle, brackets, styles) {
- return function () {
- this.name=pluginName;
- this.bracketNo = 0;
- this.style=cmdStyle;
- this.styles = styles;
- this.brackets = brackets;
-
- this.styleIdentifier = function(content) {
- if (this.bracketNo<=this.styles.length)
- return this.styles[this.bracketNo-1];
- else
- return null;
- };
- this.openBracket = function(content) {
- this.bracketNo++;
- return "bracket";
- };
- this.closeBracket = function(content) {
- };
- }
- }
-
- var plugins = new Array();
-
- plugins["importmodule"] = addPluginPattern("importmodule", "tag", "{[", ["string", "builtin"]);
- plugins["documentclass"] = addPluginPattern("documentclass", "tag", "{[", ["", "atom"]);
- plugins["usepackage"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
- plugins["begin"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
- plugins["end"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
-
- plugins["DEFAULT"] = function () {
- this.name="DEFAULT";
- this.style="tag";
-
- this.styleIdentifier = function(content) {
- };
- this.openBracket = function(content) {
- };
- this.closeBracket = function(content) {
- };
- };
-
- function setState(state, f) {
- state.f = f;
- }
-
- function normal(source, state) {
- if (source.match(/^\\[a-z]+/)) {
- var cmdName = source.current();
- cmdName = cmdName.substr(1, cmdName.length-1);
- var plug = plugins[cmdName];
- if (typeof(plug) == 'undefined') {
- plug = plugins["DEFAULT"];
- }
- plug = new plug();
- pushCommand(state, plug);
- setState(state, beginParams);
- return plug.style;
- }
-
- var ch = source.next();
- if (ch == "%") {
- setState(state, inCComment);
- return "comment";
- }
- else if (ch=='}' || ch==']') {
- plug = peekCommand(state);
- if (plug) {
- plug.closeBracket(ch);
- setState(state, beginParams);
- } else
- return "error";
- return "bracket";
- } else if (ch=='{' || ch=='[') {
- plug = plugins["DEFAULT"];
- plug = new plug();
- pushCommand(state, plug);
- return "bracket";
- }
- else if (/\d/.test(ch)) {
- source.eatWhile(/[\w.%]/);
- return "atom";
- }
- else {
- source.eatWhile(/[\w-_]/);
- return applyMostPowerful(state);
- }
- }
-
- function inCComment(source, state) {
- source.skipToEnd();
- setState(state, normal);
- return "comment";
- }
-
- function beginParams(source, state) {
- var ch = source.peek();
- if (ch == '{' || ch == '[') {
- var lastPlug = peekCommand(state);
- var style = lastPlug.openBracket(ch);
- source.eat(ch);
- setState(state, normal);
- return "bracket";
- }
- if (/[ \t\r]/.test(ch)) {
- source.eat(ch);
- return null;
- }
- setState(state, normal);
- lastPlug = peekCommand(state);
- if (lastPlug) {
- popCommand(state);
- }
- return normal(source, state);
- }
-
- return {
- startState: function() { return { f:normal, cmdState:[] }; },
- copyState: function(s) { return { f: s.f, cmdState: s.cmdState.slice(0, s.cmdState.length) }; },
-
- token: function(stream, state) {
- var t = state.f(stream, state);
- var w = stream.current();
- return t;
- }
- };
-});
-
-
-CodeMirror.defineMIME("text/x-stex", "stex");
diff --git a/src/codemirror/mode/velocity/index.html b/src/codemirror/mode/velocity/index.html
deleted file mode 100755
index 7ab63ec..0000000
--- a/src/codemirror/mode/velocity/index.html
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
- CodeMirror 2: Velocity mode
-
-
-
-
-
-
-
-
- CodeMirror 2: Velocity mode
-
-
-
- MIME types defined: text/velocity.
-
-
-
diff --git a/src/codemirror/mode/velocity/velocity.js b/src/codemirror/mode/velocity/velocity.js
deleted file mode 100755
index 0b80c75..0000000
--- a/src/codemirror/mode/velocity/velocity.js
+++ /dev/null
@@ -1,146 +0,0 @@
-CodeMirror.defineMode("velocity", function(config) {
- function parseWords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var indentUnit = config.indentUnit
- var keywords = parseWords("#end #else #break #stop #[[ #]] " +
- "#{end} #{else} #{break} #{stop}");
- var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " +
- "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}");
- var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent $velocityCount");
- var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
- var multiLineStrings =true;
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
- function tokenBase(stream, state) {
- var beforeParams = state.beforeParams;
- state.beforeParams = false;
- var ch = stream.next();
- // start of string?
- if ((ch == '"' || ch == "'") && state.inParams)
- return chain(stream, state, tokenString(ch));
- // is it one of the special signs []{}().,;? Seperator?
- else if (/[\[\]{}\(\),;\.]/.test(ch)) {
- if (ch == "(" && beforeParams) state.inParams = true;
- else if (ch == ")") state.inParams = false;
- return null;
- }
- // start of a number value?
- else if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/);
- return "number";
- }
- // multi line comment?
- else if (ch == "#" && stream.eat("*")) {
- return chain(stream, state, tokenComment);
- }
- // unparsed content?
- else if (ch == "#" && stream.match(/ *\[ *\[/)) {
- return chain(stream, state, tokenUnparsed);
- }
- // single line comment?
- else if (ch == "#" && stream.eat("#")) {
- stream.skipToEnd();
- return "comment";
- }
- // variable?
- else if (ch == "$") {
- stream.eatWhile(/[\w\d\$_\.{}]/);
- // is it one of the specials?
- if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) {
- return "keyword";
- }
- else {
- state.beforeParams = true;
- return "builtin";
- }
- }
- // is it a operator?
- else if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return "operator";
- }
- else {
- // get the whole word
- stream.eatWhile(/[\w\$_{}]/);
- var word = stream.current().toLowerCase();
- // is it one of the listed keywords?
- if (keywords && keywords.propertyIsEnumerable(word))
- return "keyword";
- // is it one of the listed functions?
- if (functions && functions.propertyIsEnumerable(word) ||
- stream.current().match(/^#[a-z0-9_]+ *$/i) && stream.peek()=="(") {
- state.beforeParams = true;
- return "keyword";
- }
- // default: just a "word"
- return null;
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {
- end = true;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- if (end) state.tokenize = tokenBase;
- return "string";
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function tokenUnparsed(stream, state) {
- var maybeEnd = 0, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd == 2) {
- state.tokenize = tokenBase;
- break;
- }
- if (ch == "]")
- maybeEnd++;
- else if (ch != " ")
- maybeEnd = 0;
- }
- return "meta";
- }
- // Interface
-
- return {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- beforeParams: false,
- inParams: false
- };
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- return state.tokenize(stream, state);
- }
- };
-});
-
-CodeMirror.defineMIME("text/velocity", "velocity");
diff --git a/src/codemirror/mode/xml/index.html b/src/codemirror/mode/xml/index.html
deleted file mode 100755
index 122848a..0000000
--- a/src/codemirror/mode/xml/index.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- CodeMirror 2: XML mode
-
-
-
-
-
-
-
-
- CodeMirror 2: XML mode
-
-
- The XML mode supports two configuration parameters:
-
- htmlMode (boolean)
- - This switches the mode to parse HTML instead of XML. This
- means attributes do not have to be quoted, and some elements
- (such as
br) do not require a closing tag.
- alignCDATA (boolean)
- - Setting this to true will force the opening tag of CDATA
- blocks to not be indented.
-
-
- MIME types defined: application/xml, text/html.
-
-
diff --git a/src/codemirror/mode/xml/xml.js b/src/codemirror/mode/xml/xml.js
deleted file mode 100755
index cb7cf97..0000000
--- a/src/codemirror/mode/xml/xml.js
+++ /dev/null
@@ -1,231 +0,0 @@
-CodeMirror.defineMode("xml", function(config, parserConfig) {
- var indentUnit = config.indentUnit;
- var Kludges = parserConfig.htmlMode ? {
- autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
- "meta": true, "col": true, "frame": true, "base": true, "area": true},
- doNotIndent: {"pre": true, "!cdata": true},
- allowUnquoted: true
- } : {autoSelfClosers: {}, doNotIndent: {"!cdata": true}, allowUnquoted: false};
- var alignCDATA = parserConfig.alignCDATA;
-
- // Return variables for tokenizers
- var tagName, type;
-
- function inText(stream, state) {
- function chain(parser) {
- state.tokenize = parser;
- return parser(stream, state);
- }
-
- var ch = stream.next();
- if (ch == "<") {
- if (stream.eat("!")) {
- if (stream.eat("[")) {
- if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
- else return null;
- }
- else if (stream.match("--")) return chain(inBlock("comment", "-->"));
- else if (stream.match("DOCTYPE", true, true)) {
- stream.eatWhile(/[\w\._\-]/);
- return chain(inBlock("meta", ">"));
- }
- else return null;
- }
- else if (stream.eat("?")) {
- stream.eatWhile(/[\w\._\-]/);
- state.tokenize = inBlock("meta", "?>");
- return "meta";
- }
- else {
- type = stream.eat("/") ? "closeTag" : "openTag";
- stream.eatSpace();
- tagName = "";
- var c;
- while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
- state.tokenize = inTag;
- return "tag";
- }
- }
- else if (ch == "&") {
- stream.eatWhile(/[^;]/);
- stream.eat(";");
- return "atom";
- }
- else {
- stream.eatWhile(/[^&<]/);
- return null;
- }
- }
-
- function inTag(stream, state) {
- var ch = stream.next();
- if (ch == ">" || (ch == "/" && stream.eat(">"))) {
- state.tokenize = inText;
- type = ch == ">" ? "endTag" : "selfcloseTag";
- return "tag";
- }
- else if (ch == "=") {
- type = "equals";
- return null;
- }
- else if (/[\'\"]/.test(ch)) {
- state.tokenize = inAttribute(ch);
- return state.tokenize(stream, state);
- }
- else {
- stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
- return "word";
- }
- }
-
- function inAttribute(quote) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.next() == quote) {
- state.tokenize = inTag;
- break;
- }
- }
- return "string";
- };
- }
-
- function inBlock(style, terminator) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.match(terminator)) {
- state.tokenize = inText;
- break;
- }
- stream.next();
- }
- return style;
- };
- }
-
- var curState, setStyle;
- function pass() {
- for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
- }
- function cont() {
- pass.apply(null, arguments);
- return true;
- }
-
- function pushContext(tagName, startOfLine) {
- var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
- curState.context = {
- prev: curState.context,
- tagName: tagName,
- indent: curState.indented,
- startOfLine: startOfLine,
- noIndent: noIndent
- };
- }
- function popContext() {
- if (curState.context) curState.context = curState.context.prev;
- }
-
- function element(type) {
- if (type == "openTag") {curState.tagName = tagName; return cont(attributes, endtag(curState.startOfLine));}
- else if (type == "closeTag") {
- var err = false;
- if (curState.context) {
- err = curState.context.tagName != tagName;
- } else {
- err = true;
- }
- if (err) setStyle = "error";
- return cont(endclosetag(err));
- }
- else if (type == "string") {
- if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
- if (curState.tokenize == inText) popContext();
- return cont();
- }
- else return cont();
- }
- function endtag(startOfLine) {
- return function(type) {
- if (type == "selfcloseTag" ||
- (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
- return cont();
- if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
- return cont();
- };
- }
- function endclosetag(err) {
- return function(type) {
- if (err) setStyle = "error";
- if (type == "endTag") { popContext(); return cont(); }
- setStyle = "error";
- return cont(arguments.callee);
- }
- }
-
- function attributes(type) {
- if (type == "word") {setStyle = "attribute"; return cont(attributes);}
- if (type == "equals") return cont(attvalue, attributes);
- return pass();
- }
- function attvalue(type) {
- if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
- if (type == "string") return cont(attvaluemaybe);
- return pass();
- }
- function attvaluemaybe(type) {
- if (type == "string") return cont(attvaluemaybe);
- else return pass();
- }
-
- return {
- startState: function() {
- return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- state.startOfLine = true;
- state.indented = stream.indentation();
- }
- if (stream.eatSpace()) return null;
-
- setStyle = type = tagName = null;
- var style = state.tokenize(stream, state);
- if ((style || type) && style != "comment") {
- curState = state;
- while (true) {
- var comb = state.cc.pop() || element;
- if (comb(type || style)) break;
- }
- }
- state.startOfLine = false;
- return setStyle || style;
- },
-
- indent: function(state, textAfter) {
- var context = state.context;
- if (context && context.noIndent) return 0;
- if (alignCDATA && /
-
-
- CodeMirror 2: Pure XML mode
-
-
-
-
-
-
-
-
- CodeMirror 2: XML mode
-
-
-
- This is my XML parser, based on the original:
-
- - No html mode - this is pure xml
- - Illegal attributes and element names are errors
- - Attributes must have a value
- - XML declaration supported (e.g.: <?xml version="1.0" encoding="utf-8" standalone="no" ?>)
- - CDATA and comment blocks are not indented (except for their start-tag)
- - Better handling of errors per line with the state object - provides good infrastructure for extending it
-
-
- What's missing:
-
- - Make sure only a single root element exists at the document level
- - Multi-line attributes should NOT indent
- - Start tags are not painted red when they have no matching end tags (is this really wrong?)
-
-
- MIME types defined: application/xml, text/xml.
-
- @author: Dror BG (deebug dot dev at gmail dot com)
-
@date: August, 2011
-
@github: https://github.com/deebugger/CodeMirror2
-
- MIME types defined: application/xml, text/xml.
-
-
diff --git a/src/codemirror/mode/xmlpure/xmlpure.js b/src/codemirror/mode/xmlpure/xmlpure.js
deleted file mode 100755
index c55a717..0000000
--- a/src/codemirror/mode/xmlpure/xmlpure.js
+++ /dev/null
@@ -1,481 +0,0 @@
-/**
- * xmlpure.js
- *
- * Building upon and improving the CodeMirror 2 XML parser
- * @author: Dror BG (deebug.dev@gmail.com)
- * @date: August, 2011
- */
-
-CodeMirror.defineMode("xmlpure", function(config, parserConfig) {
- // constants
- var STYLE_ERROR = "error";
- var STYLE_INSTRUCTION = "comment";
- var STYLE_COMMENT = "comment";
- var STYLE_ELEMENT_NAME = "tag";
- var STYLE_ATTRIBUTE = "attribute";
- var STYLE_WORD = "string";
- var STYLE_TEXT = "atom";
-
- var TAG_INSTRUCTION = "!instruction";
- var TAG_CDATA = "!cdata";
- var TAG_COMMENT = "!comment";
- var TAG_TEXT = "!text";
-
- var doNotIndent = {
- "!cdata": true,
- "!comment": true,
- "!text": true,
- "!instruction": true
- };
-
- // options
- var indentUnit = config.indentUnit;
-
- ///////////////////////////////////////////////////////////////////////////
- // helper functions
-
- // chain a parser to another parser
- function chain(stream, state, parser) {
- state.tokenize = parser;
- return parser(stream, state);
- }
-
- // parse a block (comment, CDATA or text)
- function inBlock(style, terminator, nextTokenize) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.match(terminator)) {
- popContext(state);
- state.tokenize = nextTokenize;
- break;
- }
- stream.next();
- }
- return style;
- };
- }
-
- // go down a level in the document
- // (hint: look at who calls this function to know what the contexts are)
- function pushContext(state, tagName) {
- var noIndent = doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.doIndent);
- var newContext = {
- tagName: tagName,
- prev: state.context,
- indent: state.context ? state.context.indent + indentUnit : 0,
- lineNumber: state.lineNumber,
- indented: state.indented,
- noIndent: noIndent
- };
- state.context = newContext;
- }
-
- // go up a level in the document
- function popContext(state) {
- if (state.context) {
- var oldContext = state.context;
- state.context = oldContext.prev;
- return oldContext;
- }
-
- // we shouldn't be here - it means we didn't have a context to pop
- return null;
- }
-
- // return true if the current token is seperated from the tokens before it
- // which means either this is the start of the line, or there is at least
- // one space or tab character behind the token
- // otherwise returns false
- function isTokenSeparated(stream) {
- return stream.sol() ||
- stream.string.charAt(stream.start - 1) == " " ||
- stream.string.charAt(stream.start - 1) == "\t";
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // context: document
- //
- // an XML document can contain:
- // - a single declaration (if defined, it must be the very first line)
- // - exactly one root element
- // @todo try to actually limit the number of root elements to 1
- // - zero or more comments
- function parseDocument(stream, state) {
- if(stream.eat("<")) {
- if(stream.eat("?")) {
- // processing instruction
- pushContext(state, TAG_INSTRUCTION);
- state.tokenize = parseProcessingInstructionStartTag;
- return STYLE_INSTRUCTION;
- } else if(stream.match("!--")) {
- // new context: comment
- pushContext(state, TAG_COMMENT);
- return chain(stream, state, inBlock(STYLE_COMMENT, "-->", parseDocument));
- } else if(stream.eatSpace() || stream.eol() ) {
- stream.skipToEnd();
- return STYLE_ERROR;
- } else {
- // element
- state.tokenize = parseElementTagName;
- return STYLE_ELEMENT_NAME;
- }
- }
-
- // error on line
- stream.skipToEnd();
- return STYLE_ERROR;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // context: XML element start-tag or end-tag
- //
- // - element start-tag can contain attributes
- // - element start-tag may self-close (or start an element block if it doesn't)
- // - element end-tag can contain only the tag name
- function parseElementTagName(stream, state) {
- // get the name of the tag
- var startPos = stream.pos;
- if(stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*/)) {
- // element start-tag
- var tagName = stream.string.substring(startPos, stream.pos);
- pushContext(state, tagName);
- state.tokenize = parseElement;
- return STYLE_ELEMENT_NAME;
- } else if(stream.match(/^\/[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*>/)) {
- // element end-tag
- var endTagName = stream.string.substring(startPos + 1, stream.pos - 1).trim();
- var oldContext = popContext(state);
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
- if(oldContext == null || endTagName != oldContext.tagName) {
- // the start and end tag names should match - error
- return STYLE_ERROR;
- }
- return STYLE_ELEMENT_NAME;
- } else {
- // no tag name - error
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
- stream.eatWhile(/[^>]/);
- stream.eat(">");
- return STYLE_ERROR;
- }
-
- stream.skipToEnd();
- return null;
- }
-
- function parseElement(stream, state) {
- if(stream.match(/^\/>/)) {
- // self-closing tag
- popContext(state);
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
- return STYLE_ELEMENT_NAME;
- } else if(stream.eat(/^>/)) {
- state.tokenize = parseElementBlock;
- return STYLE_ELEMENT_NAME;
- } else if(isTokenSeparated(stream) && stream.match(/^[a-zA-Z_:][-a-zA-Z0-9_:.]*( )*=/)) {
- // attribute
- state.tokenize = parseAttribute;
- return STYLE_ATTRIBUTE;
- }
-
- // no other options - this is an error
- state.tokenize = state.context == null ? parseDocument : parseDocument;
- stream.eatWhile(/[^>]/);
- stream.eat(">");
- return STYLE_ERROR;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // context: attribute
- //
- // attribute values may contain everything, except:
- // - the ending quote (with ' or ") - this marks the end of the value
- // - the character "<" - should never appear
- // - ampersand ("&") - unless it starts a reference: a string that ends with a semi-colon (";")
- // ---> note: this parser is lax in what may be put into a reference string,
- // ---> consult http://www.w3.org/TR/REC-xml/#NT-Reference if you want to make it tighter
- function parseAttribute(stream, state) {
- var quote = stream.next();
- if(quote != "\"" && quote != "'") {
- // attribute must be quoted
- stream.skipToEnd();
- state.tokenize = parseElement;
- return STYLE_ERROR;
- }
-
- state.tokParams.quote = quote;
- state.tokenize = parseAttributeValue;
- return STYLE_WORD;
- }
-
- // @todo: find out whether this attribute value spans multiple lines,
- // and if so, push a context for it in order not to indent it
- // (or something of the sort..)
- function parseAttributeValue(stream, state) {
- var ch = "";
- while(!stream.eol()) {
- ch = stream.next();
- if(ch == state.tokParams.quote) {
- // end quote found
- state.tokenize = parseElement;
- return STYLE_WORD;
- } else if(ch == "<") {
- // can't have less-than signs in an attribute value, ever
- stream.skipToEnd()
- state.tokenize = parseElement;
- return STYLE_ERROR;
- } else if(ch == "&") {
- // reference - look for a semi-colon, or return error if none found
- ch = stream.next();
-
- // make sure that semi-colon isn't right after the ampersand
- if(ch == ';') {
- stream.skipToEnd()
- state.tokenize = parseElement;
- return STYLE_ERROR;
- }
-
- // make sure no less-than characters slipped in
- while(!stream.eol() && ch != ";") {
- if(ch == "<") {
- // can't have less-than signs in an attribute value, ever
- stream.skipToEnd()
- state.tokenize = parseElement;
- return STYLE_ERROR;
- }
- ch = stream.next();
- }
- if(stream.eol() && ch != ";") {
- // no ampersand found - error
- stream.skipToEnd();
- state.tokenize = parseElement;
- return STYLE_ERROR;
- }
- }
- }
-
- // attribute value continues to next line
- return STYLE_WORD;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // context: element block
- //
- // a block can contain:
- // - elements
- // - text
- // - CDATA sections
- // - comments
- function parseElementBlock(stream, state) {
- if(stream.eat("<")) {
- if(stream.match("?")) {
- pushContext(state, TAG_INSTRUCTION);
- state.tokenize = parseProcessingInstructionStartTag;
- return STYLE_INSTRUCTION;
- } else if(stream.match("!--")) {
- // new context: comment
- pushContext(state, TAG_COMMENT);
- return chain(stream, state, inBlock(STYLE_COMMENT, "-->",
- state.context == null ? parseDocument : parseElementBlock));
- } else if(stream.match("![CDATA[")) {
- // new context: CDATA section
- pushContext(state, TAG_CDATA);
- return chain(stream, state, inBlock(STYLE_TEXT, "]]>",
- state.context == null ? parseDocument : parseElementBlock));
- } else if(stream.eatSpace() || stream.eol() ) {
- stream.skipToEnd();
- return STYLE_ERROR;
- } else {
- // element
- state.tokenize = parseElementTagName;
- return STYLE_ELEMENT_NAME;
- }
- } else {
- // new context: text
- pushContext(state, TAG_TEXT);
- state.tokenize = parseText;
- return null;
- }
-
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
- stream.skipToEnd();
- return null;
- }
-
- function parseText(stream, state) {
- stream.eatWhile(/[^<]/);
- if(!stream.eol()) {
- // we cannot possibly be in the document context,
- // just inside an element block
- popContext(state);
- state.tokenize = parseElementBlock;
- }
- return STYLE_TEXT;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // context: XML processing instructions
- //
- // XML processing instructions (PIs) allow documents to contain instructions for applications.
- // PI format:
- // - 'name' can be anything other than 'xml' (case-insensitive)
- // - 'data' can be anything which doesn't contain '?>'
- // XML declaration is a special PI (see XML declaration context below)
- function parseProcessingInstructionStartTag(stream, state) {
- if(stream.match("xml", true, true)) {
- // xml declaration
- if(state.lineNumber > 1 || stream.pos > 5) {
- state.tokenize = parseDocument;
- stream.skipToEnd();
- return STYLE_ERROR;
- } else {
- state.tokenize = parseDeclarationVersion;
- return STYLE_INSTRUCTION;
- }
- }
-
- // regular processing instruction
- if(isTokenSeparated(stream) || stream.match("?>")) {
- // we have a space after the start-tag, or nothing but the end-tag
- // either way - error!
- state.tokenize = parseDocument;
- stream.skipToEnd();
- return STYLE_ERROR;
- }
-
- state.tokenize = parseProcessingInstructionBody;
- return STYLE_INSTRUCTION;
- }
-
- function parseProcessingInstructionBody(stream, state) {
- stream.eatWhile(/[^?]/);
- if(stream.eat("?")) {
- if(stream.eat(">")) {
- popContext(state);
- state.tokenize = state.context == null ? parseDocument : parseElementBlock;
- }
- }
- return STYLE_INSTRUCTION;
- }
-
-
- ///////////////////////////////////////////////////////////////////////////
- // context: XML declaration
- //
- // XML declaration is of the following format:
- //
- // - must start at the first character of the first line
- // - may span multiple lines
- // - must include 'version'
- // - may include 'encoding' and 'standalone' (in that order after 'version')
- // - attribute names must be lowercase
- // - cannot contain anything else on the line
- function parseDeclarationVersion(stream, state) {
- state.tokenize = parseDeclarationEncoding;
-
- if(isTokenSeparated(stream) && stream.match(/^version( )*=( )*"([a-zA-Z0-9_.:]|\-)+"/)) {
- return STYLE_INSTRUCTION;
- }
- stream.skipToEnd();
- return STYLE_ERROR;
- }
-
- function parseDeclarationEncoding(stream, state) {
- state.tokenize = parseDeclarationStandalone;
-
- if(isTokenSeparated(stream) && stream.match(/^encoding( )*=( )*"[A-Za-z]([A-Za-z0-9._]|\-)*"/)) {
- return STYLE_INSTRUCTION;
- }
- return null;
- }
-
- function parseDeclarationStandalone(stream, state) {
- state.tokenize = parseDeclarationEndTag;
-
- if(isTokenSeparated(stream) && stream.match(/^standalone( )*=( )*"(yes|no)"/)) {
- return STYLE_INSTRUCTION;
- }
- return null;
- }
-
- function parseDeclarationEndTag(stream, state) {
- state.tokenize = parseDocument;
-
- if(stream.match("?>") && stream.eol()) {
- popContext(state);
- return STYLE_INSTRUCTION;
- }
- stream.skipToEnd();
- return STYLE_ERROR;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // returned object
- return {
- electricChars: "/",
-
- startState: function() {
- return {
- tokenize: parseDocument,
- tokParams: {},
- lineNumber: 0,
- lineError: false,
- context: null,
- indented: 0
- };
- },
-
- token: function(stream, state) {
- if(stream.sol()) {
- // initialize a new line
- state.lineNumber++;
- state.lineError = false;
- state.indented = stream.indentation();
- }
-
- // eat all (the spaces) you can
- if(stream.eatSpace()) return null;
-
- // run the current tokenize function, according to the state
- var style = state.tokenize(stream, state);
-
- // is there an error somewhere in the line?
- state.lineError = (state.lineError || style == "error");
-
- return style;
- },
-
- blankLine: function(state) {
- // blank lines are lines too!
- state.lineNumber++;
- state.lineError = false;
- },
-
- indent: function(state, textAfter) {
- if(state.context) {
- if(state.context.noIndent == true) {
- // do not indent - no return value at all
- return;
- }
- if(textAfter.match(/^<\/.*/)) {
- // eng-tag - indent back to last context
- return state.context.indent;
- }
- // indent to last context + regular indent unit
- return state.context.indent + indentUnit;
- }
- return 0;
- },
-
- compareStates: function(a, b) {
- if (a.indented != b.indented) return false;
- for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
- if (!ca || !cb) return ca == cb;
- if (ca.tagName != cb.tagName) return false;
- }
- }
- };
-});
-
-CodeMirror.defineMIME("application/xml", "purexml");
-CodeMirror.defineMIME("text/xml", "purexml");
diff --git a/src/codemirror/mode/yaml/index.html b/src/codemirror/mode/yaml/index.html
deleted file mode 100755
index e8d04d1..0000000
--- a/src/codemirror/mode/yaml/index.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
- CodeMirror 2: YAML mode
-
-
-
-
-
-
-
-
- CodeMirror 2: YAML mode
-
-
-
- MIME types defined: text/x-yaml.
-
-
-
diff --git a/src/codemirror/mode/yaml/yaml.js b/src/codemirror/mode/yaml/yaml.js
deleted file mode 100755
index 59e2641..0000000
--- a/src/codemirror/mode/yaml/yaml.js
+++ /dev/null
@@ -1,95 +0,0 @@
-CodeMirror.defineMode("yaml", function() {
-
- var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
- var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
-
- return {
- token: function(stream, state) {
- var ch = stream.peek();
- var esc = state.escaped;
- state.escaped = false;
- /* comments */
- if (ch == "#") { stream.skipToEnd(); return "comment"; }
- if (state.literal && stream.indentation() > state.keyCol) {
- stream.skipToEnd(); return "string";
- } else if (state.literal) { state.literal = false; }
- if (stream.sol()) {
- state.keyCol = 0;
- state.pair = false;
- state.pairStart = false;
- /* document start */
- if(stream.match(/---/)) { return "def"; }
- /* document end */
- if (stream.match(/\.\.\./)) { return "def"; }
- /* array list item */
- if (stream.match(/\s*-\s+/)) { return 'meta'; }
- }
- /* pairs (associative arrays) -> key */
- if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) {
- state.pair = true;
- state.keyCol = stream.indentation();
- return "atom";
- }
- if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
-
- /* inline pairs/lists */
- if (stream.match(/^(\{|\}|\[|\])/)) {
- if (ch == '{')
- state.inlinePairs++;
- else if (ch == '}')
- state.inlinePairs--;
- else if (ch == '[')
- state.inlineList++;
- else
- state.inlineList--;
- return 'meta';
- }
-
- /* list seperator */
- if (state.inlineList > 0 && !esc && ch == ',') {
- stream.next();
- return 'meta';
- }
- /* pairs seperator */
- if (state.inlinePairs > 0 && !esc && ch == ',') {
- state.keyCol = 0;
- state.pair = false;
- state.pairStart = false;
- stream.next();
- return 'meta';
- }
-
- /* start of value of a pair */
- if (state.pairStart) {
- /* block literals */
- if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
- /* references */
- if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
- /* numbers */
- if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
- if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
- /* keywords */
- if (stream.match(keywordRegex)) { return 'keyword'; }
- }
-
- /* nothing found, continue */
- state.pairStart = false;
- state.escaped = (ch == '\\');
- stream.next();
- return null;
- },
- startState: function() {
- return {
- pair: false,
- pairStart: false,
- keyCol: 0,
- inlinePairs: 0,
- inlineList: 0,
- literal: false,
- escaped: false
- };
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-yaml", "yaml");
diff --git a/src/codemirror/oldrelease.html b/src/codemirror/oldrelease.html
deleted file mode 100755
index 8607a4d..0000000
--- a/src/codemirror/oldrelease.html
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
- CodeMirror
-
-
-
-
-
-
-
-{ } CodeMirror
-
-
-
/* Old release history */
-
-
-
- 28-03-2011: Version 2.0:
- CodeMirror 2 is a complete rewrite that's
- faster, smaller, simpler to use, and less dependent on browser
- quirks. See this
- and this
- for more information.
-
-
28-03-2011: Version 1.0:
-
- - Fix error when debug history overflows.
- - Refine handling of C# verbatim strings.
- - Fix some issues with JavaScript indentation.
-
-
- 22-02-2011: Version 2.0 beta 2:
- Somewhate more mature API, lots of bugs shaken out.
-
-
17-02-2011: Version 0.94:
-
- tabMode: "spaces" was modified slightly (now indents when something is selected).
- - Fixes a bug that would cause the selection code to break on some IE versions.
- - Disabling spell-check on WebKit browsers now works.
-
-
- 08-02-2011: Version 2.0 beta 1:
- CodeMirror 2 is a complete rewrite of
- CodeMirror, no longer depending on an editable frame.
-
- 19-01-2011: Version 0.93:
-
- - Added a Regular Expression parser.
- - Fixes to the PHP parser.
- - Support for regular expression in search/replace.
- - Add
save method to instances created with fromTextArea.
- - Add support for MS T-SQL in the SQL parser.
- - Support use of CSS classes for highlighting brackets.
- - Fix yet another hang with line-numbering in hidden editors.
-
-
- 17-12-2010: Version 0.92:
-
- - Make CodeMirror work in XHTML documents.
- - Fix bug in handling of backslashes in Python strings.
- - The
styleNumbers option is now officially
- supported and documented.
- onLineNumberClick option added.
- - More consistent names
onLoad and
- onCursorActivity callbacks. Old names still work, but
- are deprecated.
- - Add a Freemarker mode.
-
-
- 11-11-2010: Version 0.91:
-
- - Adds support for Java.
- - Small additions to the PHP and SQL parsers.
- - Work around various Webkit issues.
- - Fix
toTextArea to update the code in the textarea.
- - Add a
noScriptCaching option (hack to ease development).
- - Make sub-modes of HTML mixed mode configurable.
-
-
- 02-10-2010: Version 0.9:
-
- - Add support for searching backwards.
- - There are now parsers for Scheme, XQuery, and OmetaJS.
- - Makes
height: "dynamic" more robust.
- - Fixes bug where paste did not work on OS X.
- - Add a
enterMode and electricChars options to make indentation even more customizable.
- - Add
firstLineNumber option.
- - Fix bad handling of
@media rules by the CSS parser.
- - Take a new, more robust approach to working around the invisible-last-line bug in WebKit.
-
-
- 22-07-2010: Version 0.8:
-
- - Add a
cursorCoords method to find the screen
- coordinates of the cursor.
- - A number of fixes and support for more syntax in the PHP parser.
- - Fix indentation problem with JSON-mode JS parser in Webkit.
- - Add a minification UI.
- - Support a
height: dynamic mode, where the editor's
- height will adjust to the size of its content.
- - Better support for IME input mode.
- - Fix JavaScript parser getting confused when seeing a no-argument
- function call.
- - Have CSS parser see the difference between selectors and other
- identifiers.
- - Fix scrolling bug when pasting in a horizontally-scrolled
- editor.
- - Support
toTextArea method in instances created with
- fromTextArea.
- - Work around new Opera cursor bug that causes the cursor to jump
- when pressing backspace at the end of a line.
-
-
- 27-04-2010: Version
- 0.67:
- More consistent page-up/page-down behaviour
- across browsers. Fix some issues with hidden editors looping forever
- when line-numbers were enabled. Make PHP parser parse
- "\\" correctly. Have jumpToLine work on
- line handles, and add cursorLine function to fetch the
- line handle where the cursor currently is. Add new
- setStylesheet function to switch style-sheets in a
- running editor.
-
- 01-03-2010: Version
- 0.66:
- Adds removeLine method to API.
- Introduces the PLSQL parser.
- Marks XML errors by adding (rather than replacing) a CSS class, so
- that they can be disabled by modifying their style. Fixes several
- selection bugs, and a number of small glitches.
-
- 12-11-2009: Version
- 0.65:
- Add support for having both line-wrapping and
- line-numbers turned on, make paren-highlighting style customisable
- (markParen and unmarkParen config
- options), work around a selection bug that Opera
- reintroduced in version 10.
-
- 23-10-2009: Version
- 0.64:
- Solves some issues introduced by the
- paste-handling changes from the previous release. Adds
- setSpellcheck, setTextWrapping,
- setIndentUnit, setUndoDepth,
- setTabMode, and setLineNumbers to
- customise a running editor. Introduces an SQL parser. Fixes a few small
- problems in the Python
- parser. And, as usual, add workarounds for various newly discovered
- browser incompatibilities.
-
-31-08-2009: Version
-0.63:
- Overhaul of paste-handling (less fragile), fixes for several
-serious IE8 issues (cursor jumping, end-of-document bugs) and a number
-of small problems.
-
-30-05-2009: Version
-0.62:
-Introduces Python
-and Lua parsers. Add
-setParser (on-the-fly mode changing) and
-clearHistory methods. Make parsing passes time-based
-instead of lines-based (see the passTime option).
-
-
diff --git a/src/codemirror/test/index.html b/src/codemirror/test/index.html
deleted file mode 100755
index ce40a7d..0000000
--- a/src/codemirror/test/index.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- CodeMirror 2: Test Suite
-
-
-
-
-
-
-
-
- CodeMirror 2: Test Suite
-
- A limited set of programmatic sanity tests for CodeMirror.
-
-
-
-
-
-
-
-
diff --git a/src/codemirror/test/test.js b/src/codemirror/test/test.js
deleted file mode 100755
index f3d5441..0000000
--- a/src/codemirror/test/test.js
+++ /dev/null
@@ -1,249 +0,0 @@
-var tests = [];
-
-test("fromTextArea", function() {
- var te = document.getElementById("code");
- te.value = "CONTENT";
- var cm = CodeMirror.fromTextArea(te);
- is(!te.offsetHeight);
- eq(cm.getValue(), "CONTENT");
- cm.setValue("foo\nbar");
- eq(cm.getValue(), "foo\nbar");
- cm.save();
- is(/^foo\r?\nbar$/.test(te.value));
- cm.setValue("xxx");
- cm.toTextArea();
- is(te.offsetHeight);
- eq(te.value, "xxx");
-});
-
-testCM("getRange", function(cm) {
- eq(cm.getLine(0), "1234");
- eq(cm.getLine(1), "5678");
- eq(cm.getLine(2), null);
- eq(cm.getLine(-1), null);
- eq(cm.getRange({line: 0, ch: 0}, {line: 0, ch: 3}), "123");
- eq(cm.getRange({line: 0, ch: -1}, {line: 0, ch: 200}), "1234");
- eq(cm.getRange({line: 0, ch: 2}, {line: 1, ch: 2}), "34\n56");
- eq(cm.getRange({line: 1, ch: 2}, {line: 100, ch: 0}), "78");
-}, {value: "1234\n5678"});
-
-testCM("replaceRange", function(cm) {
- eq(cm.getValue(), "");
- cm.replaceRange("foo\n", {line: 0, ch: 0});
- eq(cm.getValue(), "foo\n");
- cm.replaceRange("a\nb", {line: 0, ch: 1});
- eq(cm.getValue(), "fa\nboo\n");
- eq(cm.lineCount(), 3);
- cm.replaceRange("xyzzy", {line: 0, ch: 0}, {line: 1, ch: 1});
- eq(cm.getValue(), "xyzzyoo\n");
- cm.replaceRange("abc", {line: 0, ch: 0}, {line: 10, ch: 0});
- eq(cm.getValue(), "abc");
- eq(cm.lineCount(), 1);
-});
-
-testCM("selection", function(cm) {
- cm.setSelection({line: 0, ch: 4}, {line: 2, ch: 2});
- is(cm.somethingSelected());
- eq(cm.getSelection(), "11\n222222\n33");
- eqPos(cm.getCursor(false), {line: 2, ch: 2});
- eqPos(cm.getCursor(true), {line: 0, ch: 4});
- cm.setSelection({line: 1, ch: 0});
- is(!cm.somethingSelected());
- eq(cm.getSelection(), "");
- eqPos(cm.getCursor(true), {line: 1, ch: 0});
- cm.replaceSelection("abc");
- eq(cm.getSelection(), "abc");
- eq(cm.getValue(), "111111\nabc222222\n333333");
- cm.replaceSelection("def", "end");
- eq(cm.getSelection(), "");
- eqPos(cm.getCursor(true), {line: 1, ch: 3});
- cm.setCursor({line: 2, ch: 1});
- eqPos(cm.getCursor(true), {line: 2, ch: 1});
- cm.setCursor(1, 2);
- eqPos(cm.getCursor(true), {line: 1, ch: 2});
-}, {value: "111111\n222222\n333333"});
-
-testCM("lines", function(cm) {
- eq(cm.getLine(0), "111111");
- eq(cm.getLine(1), "222222");
- eq(cm.getLine(-1), null);
- cm.removeLine(1);
- cm.setLine(1, "abc");
- eq(cm.getValue(), "111111\nabc");
-}, {value: "111111\n222222\n333333"});
-
-testCM("indent", function(cm) {
- cm.indentLine(1);
- eq(cm.getLine(1), " blah();");
- cm.setOption("indentUnit", 8);
- cm.indentLine(1);
- eq(cm.getLine(1), "\tblah();");
-}, {value: "if (x) {\nblah();\n}", indentUnit: 3, indentWithTabs: true});
-
-test("defaults", function() {
- var olddefaults = CodeMirror.defaults, defs = CodeMirror.defaults = {};
- for (var opt in olddefaults) defs[opt] = olddefaults[opt];
- defs.indentUnit = 5;
- defs.value = "uu";
- defs.enterMode = "keep";
- defs.tabindex = 55;
- var place = document.getElementById("testground"), cm = CodeMirror(place);
- try {
- eq(cm.getOption("indentUnit"), 5);
- cm.setOption("indentUnit", 10);
- eq(defs.indentUnit, 5);
- eq(cm.getValue(), "uu");
- eq(cm.getOption("enterMode"), "keep");
- eq(cm.getInputField().tabindex, 55);
- }
- finally {
- CodeMirror.defaults = olddefaults;
- place.removeChild(cm.getWrapperElement());
- }
-});
-
-testCM("lineInfo", function(cm) {
- eq(cm.lineInfo(-1), null);
- var lh = cm.setMarker(1, "FOO", "bar");
- var info = cm.lineInfo(1);
- eq(info.text, "222222");
- eq(info.markerText, "FOO");
- eq(info.markerClass, "bar");
- eq(info.line, 1);
- eq(cm.lineInfo(2).markerText, null);
- cm.clearMarker(lh);
- eq(cm.lineInfo(1).markerText, null);
-}, {value: "111111\n222222\n333333"});
-
-testCM("coords", function(cm) {
- var scroller = cm.getWrapperElement().getElementsByClassName("CodeMirror-scroll")[0];
- scroller.style.height = "100px";
- var content = [];
- for (var i = 0; i < 200; ++i) content.push("------------------------------" + i);
- cm.setValue(content.join("\n"));
- var top = cm.charCoords({line: 0, ch: 0});
- var bot = cm.charCoords({line: 200, ch: 30});
- is(top.x < bot.x);
- is(top.y < bot.y);
- is(top.y < top.yBot);
- scroller.scrollTop = 100;
- cm.refresh();
- var top2 = cm.charCoords({line: 0, ch: 0});
- is(top.y > top2.y);
- eq(top.x, top2.x);
-});
-
-testCM("coordsChar", function(cm) {
- var content = [];
- for (var i = 0; i < 70; ++i) content.push("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
- cm.setValue(content.join("\n"));
- for (var x = 0; x < 35; x += 2) {
- for (var y = 0; y < 70; y += 5) {
- cm.setCursor(y, x);
- var pos = cm.coordsChar(cm.charCoords({line: y, ch: x}));
- eq(pos.line, y);
- eq(pos.ch, x);
- }
- }
-});
-
-testCM("undo", function(cm) {
- cm.setLine(0, "def");
- eq(cm.historySize().undo, 1);
- cm.undo();
- eq(cm.getValue(), "abc");
- eq(cm.historySize().undo, 0);
- eq(cm.historySize().redo, 1);
- cm.redo();
- eq(cm.getValue(), "def");
- eq(cm.historySize().undo, 1);
- eq(cm.historySize().redo, 0);
- cm.setValue("1\n\n\n2");
- eq(cm.historySize().undo, 0);
- for (var i = 0; i < 20; ++i) {
- cm.replaceRange("a", {line: 0, ch: 0});
- cm.replaceRange("b", {line: 3, ch: 0});
- }
- eq(cm.historySize().undo, 40);
- for (var i = 0; i < 38; ++i) cm.undo();
- eq(cm.historySize().undo, 2);
- eq(cm.historySize().redo, 38);
- eq(cm.getValue(), "a1\n\n\nb2");
- cm.setOption("undoDepth", 10);
- for (var i = 0; i < 20; ++i) {
- cm.replaceRange("a", {line: 0, ch: 0});
- cm.replaceRange("b", {line: 3, ch: 0});
- }
- eq(cm.historySize().undo, 10);
-}, {value: "abc"});
-
-testCM("undoMultiLine", function(cm) {
- cm.replaceRange("x", {line:0, ch: 0});
- cm.replaceRange("y", {line:1, ch: 0});
- cm.undo();
- eq(cm.getValue(), "abc\ndef\nghi");
- cm.replaceRange("y", {line:1, ch: 0});
- cm.replaceRange("x", {line:0, ch: 0});
- cm.undo();
- eq(cm.getValue(), "abc\ndef\nghi");
- cm.replaceRange("y", {line:2, ch: 0});
- cm.replaceRange("x", {line:1, ch: 0});
- cm.replaceRange("z", {line:2, ch: 0});
- cm.undo();
- eq(cm.getValue(), "abc\ndef\nghi");
-}, {value: "abc\ndef\nghi"});
-
-// Scaffolding
-
-function htmlEscape(str) {
- return str.replace(/[<&]/g, function(str) {return str == "&" ? "&" : "<";});
-}
-function forEach(arr, f) {
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
-}
-
-function Failure(why) {this.message = why;}
-
-function test(name, run) {tests.push({name: name, func: run});}
-function testCM(name, run, opts) {
- test(name, function() {
- var place = document.getElementById("testground"), cm = CodeMirror(place, opts);
- try {run(cm);}
- finally {place.removeChild(cm.getWrapperElement());}
- });
-}
-
-function runTests() {
- var failures = [], run = 0;
- for (var i = 0; i < tests.length; ++i) {
- var test = tests[i];
- try {test.func();}
- catch(e) {
- if (e instanceof Failure)
- failures.push({type: "failure", test: test.name, text: e.message});
- else
- failures.push({type: "error", test: test.name, text: e.toString()});
- }
- run++;
- }
- var html = [run + " tests run."];
- if (failures.length)
- forEach(failures, function(fail) {
- html.push(fail.test + ': ' + htmlEscape(fail.text) + "");
- });
- else html.push('All passed.');
- document.getElementById("output").innerHTML = html.join("\n");
-}
-
-function eq(a, b, msg) {
- if (a != b) throw new Failure(a + " != " + b + (msg ? " (" + msg + ")" : ""));
-}
-function eqPos(a, b, msg) {
- eq(a.line, b.line, msg);
- eq(a.ch, b.ch, msg);
-}
-function is(a, msg) {
- if (!a) throw new Failure("assertion failed" + (msg ? " (" + msg + ")" : ""));
-}
-
-window.onload = runTests;
diff --git a/src/codemirror/theme/cobalt.css b/src/codemirror/theme/cobalt.css
deleted file mode 100755
index ba47da8..0000000
--- a/src/codemirror/theme/cobalt.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.cm-s-cobalt { background: #002240; color: white; }
-.cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; }
-.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
-.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
-.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
-
-.cm-s-cobalt span.cm-comment { color: #08f; }
-.cm-s-cobalt span.cm-atom { color: #845dc4; }
-.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
-.cm-s-cobalt span.cm-keyword { color: #ffee80; }
-.cm-s-cobalt span.cm-string { color: #3ad900; }
-.cm-s-cobalt span.cm-meta { color: #ff9d00; }
-.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
-.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
-.cm-s-cobalt span.cm-error { color: #9d1e15; }
-.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
-.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
diff --git a/src/codemirror/theme/default.css b/src/codemirror/theme/default.css
deleted file mode 100755
index e68f0fb..0000000
--- a/src/codemirror/theme/default.css
+++ /dev/null
@@ -1,19 +0,0 @@
-.cm-s-default span.cm-keyword {color: #708;}
-.cm-s-default span.cm-atom {color: #219;}
-.cm-s-default span.cm-number {color: #164;}
-.cm-s-default span.cm-def {color: #00f;}
-.cm-s-default span.cm-variable {color: black;}
-.cm-s-default span.cm-variable-2 {color: #05a;}
-.cm-s-default span.cm-variable-3 {color: #0a5;}
-.cm-s-default span.cm-property {color: black;}
-.cm-s-default span.cm-operator {color: black;}
-.cm-s-default span.cm-comment {color: #a50;}
-.cm-s-default span.cm-string {color: #a11;}
-.cm-s-default span.cm-string-2 {color: #f50;}
-.cm-s-default span.cm-meta {color: #555;}
-.cm-s-default span.cm-error {color: #f00;}
-.cm-s-default span.cm-qualifier {color: #555;}
-.cm-s-default span.cm-builtin {color: #30a;}
-.cm-s-default span.cm-bracket {color: #cc7;}
-.cm-s-default span.cm-tag {color: #170;}
-.cm-s-default span.cm-attribute {color: #00c;}
diff --git a/src/codemirror/theme/eclipse.css b/src/codemirror/theme/eclipse.css
deleted file mode 100755
index 0ec8d9a..0000000
--- a/src/codemirror/theme/eclipse.css
+++ /dev/null
@@ -1,24 +0,0 @@
-.cm-s-eclipse span.cm-meta {color: #FF1717;}
-.cm-s-eclipse span.cm-keyword { font-weight: bold; color: #7F0055; }
-.cm-s-eclipse span.cm-atom {color: #219;}
-.cm-s-eclipse span.cm-number {color: #164;}
-.cm-s-eclipse span.cm-def {color: #00f;}
-.cm-s-eclipse span.cm-variable {color: black;}
-.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
-.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
-.cm-s-eclipse span.cm-property {color: black;}
-.cm-s-eclipse span.cm-operator {color: black;}
-.cm-s-eclipse span.cm-comment {color: #3F7F5F;}
-.cm-s-eclipse span.cm-string {color: #2A00FF;}
-.cm-s-eclipse span.cm-string-2 {color: #f50;}
-.cm-s-eclipse span.cm-error {color: #f00;}
-.cm-s-eclipse span.cm-qualifier {color: #555;}
-.cm-s-eclipse span.cm-builtin {color: #30a;}
-.cm-s-eclipse span.cm-bracket {color: #cc7;}
-.cm-s-eclipse span.cm-tag {color: #170;}
-.cm-s-eclipse span.cm-attribute {color: #00c;}
-
-.CodeMirror-matchingbracket{
- border:1px solid grey;
- color:black !important;;
-}
\ No newline at end of file
diff --git a/src/codemirror/theme/elegant.css b/src/codemirror/theme/elegant.css
deleted file mode 100755
index 171683f..0000000
--- a/src/codemirror/theme/elegant.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
-.cm-s-elegant span.cm-comment {color: #262;font-style: italic;}
-.cm-s-elegant span.cm-meta {color: #555;font-style: italic;}
-.cm-s-elegant span.cm-variable {color: black;}
-.cm-s-elegant span.cm-variable-2 {color: #b11;}
-.cm-s-elegant span.cm-qualifier {color: #555;}
-.cm-s-elegant span.cm-keyword {color: #730;}
-.cm-s-elegant span.cm-builtin {color: #30a;}
-.cm-s-elegant span.cm-error {background-color: #fdd;}
diff --git a/src/codemirror/theme/neat.css b/src/codemirror/theme/neat.css
deleted file mode 100755
index 10d22c9..0000000
--- a/src/codemirror/theme/neat.css
+++ /dev/null
@@ -1,8 +0,0 @@
-.cm-s-neat span.cm-comment { color: #a86; }
-.cm-s-neat span.cm-keyword { font-weight: bold; color: blue; }
-.cm-s-neat span.cm-string { color: #a22; }
-.cm-s-neat span.cm-builtin { font-weight: bold; color: #077; }
-.cm-s-neat span.cm-special { font-weight: bold; color: #0aa; }
-.cm-s-neat span.cm-variable { color: black; }
-.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
-.cm-s-neat span.cm-meta {color: #555;}
diff --git a/src/codemirror/theme/night.css b/src/codemirror/theme/night.css
deleted file mode 100755
index a84ec4f..0000000
--- a/src/codemirror/theme/night.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Loosely based on the Midnight Textmate theme */
-
-.cm-s-night { background: #0a001f; color: #f8f8f8; }
-.cm-s-night span.CodeMirror-selected { background: #a8f !important; }
-.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
-.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
-.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
-
-.cm-s-night span.cm-comment { color: #6900a1; }
-.cm-s-night span.cm-atom { color: #845dc4; }
-.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
-.cm-s-night span.cm-keyword { color: #599eff; }
-.cm-s-night span.cm-string { color: #37f14a; }
-.cm-s-night span.cm-meta { color: #7678e2; }
-.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
-.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
-.cm-s-night span.cm-error { color: #9d1e15; }
-.cm-s-night span.cm-bracket { color: #8da6ce; }
-.cm-s-night span.cm-comment { color: #6900a1; }
-.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
diff --git a/src/css/coderdeck.css b/src/css/coderdeck.css
deleted file mode 100755
index 40a3b83..0000000
--- a/src/css/coderdeck.css
+++ /dev/null
@@ -1,390 +0,0 @@
-html, body {
- -webkit-font-smoothing: antialiased;
- color: #222;
- margin: 0;
- padding: 0;
- background: url(../../assets/ladieslearningcode-125x125.gif) 10px -10px no-repeat;
- /*border-top: 7px #b1009a solid;*/
-}
-h1, h2, h3 {
- /*text-transform: uppercase;*/
-}
-.deck-container em {
- font-weight: 600;
-}
-.deck-container #presentation {
- margin-top: 15px;
-}
-.deck-container {
- /*font-family: 'Istok Web', Arial, sans-serif;*/
- font-family: 'Open Sans', Arial, sans-serif;
- font-weight: 400;
- font-size: 1em;
- padding: 0; /* overriding deck.coder.css */
- padding-left: 5px; /* use 145px if using LLC logo */
-}
-.deck-container h1, .deck-container h2, .deck-container h3 {
- color: #B1009A;
- /*font-family: 'Podkova', Arial, sans-serif;*/
-}
-.deck-container strong {
- color: #2E2E2E;
-}
-
-
-.deck-container .slide {
- background: #fff;
- width: 940px;
- /*height: 100%;*/ /* allow vertical scrolling -- espeically when there's lots of code */
- min-height: 475px;
- border: 3px solid #b1009a;
- border-radius: 10px;
- -moz-border-radius: 10px;
- margin: 0 auto;
- padding: 30px 50px 40px 50px;
-}
-
-/* Added so code editor areas won't resize in height */
-.CodeMirror-scroll {
- height: auto !important;
- overflow-y: hidden;
- overflow-x: auto;
- width: 100%;
- min-height: 200px;
-}
-
-.coder-destination {
- bottom: auto !important;
- top: 0 !important;
-}
-
-.deck-container .slide-title {
- font-size: 1em;
- text-align: center;
-}
-.deck-container .slide-title .workshop_title {
- margin: 90px 0 0 0;
-}
-.deck-container .slide-title .download_link {
- font-size: 1.3em;
- letter-spacing: 0.05em;
-}
-.deck-container .slide-title .download_link a {
- font-size: 1.3em;
- font-weight: bold;
- letter-spacing: 0.03em;
- text-decoration: none;
-}
-
-/*.deck-container .instructor_holder {
- width: 560px;
- margin: 70px auto 0 auto;
-}
-.deck-container .instructor_holder h2 {
- text-transform: uppercase;
- font-size: 2em;
- margin-bottom: 1.5em;
-}
-.deck-container .instructor_holder div {
- width: 50%;
- float: left;
-}*/
-
-/*.deck-container .slide-title h1 {
- font-size: 4em;
- font-weight: 400;
- letter-spacing: -0.04em;
- text-transform: none;
- position: static;
- top: 0%;
-}*/
-
-.deck-container .slide-list h2 {
- font-size: 3.5em;
- padding-bottom: .07em;
- margin-bottom: .1em;
- margin-top: 0;
-}
-.deck-container .slide-list h3 {
- font-size: 2em;
- margin-bottom: .1em;
-}
-.deck-container .slide-list ul, .deck-container .slide-list p {
- font-size: 1.8em;
-}
-.deck-container .slide-list ul {
- margin-left: 1em;
- /*list-style-type: square;*/
- margin-bottom: 0.6em;
-}
-.deck-container .slide-list li {
- padding-left: .5em;
- line-height: 1.2em;
-}
-.deck-container .slide-list li ul {
- margin-bottom: 0;
-}
-.deck-container .slide-list li li {
- font-size: 0.5em;
-}
-
-.deck-container .slide-subhead h1 {
- font-size: 4em;
- line-height: 1em;
- margin: 0px;
- padding: 2em 0 0.5em 0;
- position: static;
- -webkit-transform: none;
- -moz-transform: none;
- -ms-transform: none;
- -o-transform: none;
- transform: none;
- text-transform: none;
- top: 0%;
-}
-.deck-container .slide-subhead h2 {
- font-size: 2em;
- text-align: center;
- margin: 0px;
- padding: 0px;
- padding-top: .1em;
-}
-.deck-container .slide-subhead p {
- font-size: 2em;
- text-align: center;
-}
-
-/*.deck-container h1 {
- font-weight: 700;
- letter-spacing: -0.04em;
- font-size: 4em;
- line-height: .9em;
- text-transform: none;
- padding-top: 7em;
-}*/
-.deck-container h2 {
- font-weight: 400;
- border: none;
- padding-top: 0;
-}
-.deck-container h3 {
- font-weight: 800;
-}
-.deck-container .slide > pre {
- padding:10px;
- border-color: #ccc;
- font-size: 1.2em;
-}
-.deck-container code {
- color: #888;
-}
-.deck-container blockquote {
- font-size: 2em;
- font-style: italic;
- padding: 1em 2em;
- color: #000;
- border-left: 5px solid #d3502c;
-}
-.deck-container blockquote p {
- margin: 0;
-}
-.deck-container blockquote cite {
- font-size: .5em;
- font-style: normal;
- font-weight: bold;
- color: #888;
-}
-.deck-container ::-moz-selection, .deck-container ::selection {
- background: #7E006E;
- color: #fff;
-}
-.deck-container a, .deck-container a:hover, .deck-container a:focus, .deck-container a:active, .deck-container a:visited {
- color: #444;
- text-decoration: underline;
-}
-.deck-container a:hover, .deck-container a:focus {
- color: #b1009a;
- text-decoration: none;
-}
-.deck-container .deck-prev-link, .deck-container .deck-next-link {
- background: #d3502c;
- font-family: serif;
-}
-.deck-container .deck-prev-link, .deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-prev-link:active, .deck-container .deck-prev-link:visited, .deck-container .deck-next-link, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus, .deck-container .deck-next-link:active, .deck-container .deck-next-link:visited {
- color: #fff;
-}
-.deck-container .deck-prev-link:hover, .deck-container .deck-prev-link:focus, .deck-container .deck-next-link:hover, .deck-container .deck-next-link:focus {
- background: #bf0000;
- text-decoration: none;
-}
-.deck-container .deck-status {
- font-size: 0.6666em;
-}
-.deck-container.deck-menu .slide {
- background: #eee;
-}
-.deck-container.deck-menu .deck-current {
- background: #ddf;
-}
-
-/* Logical Operators table */
-table.comparison-table {
- width: 460px;
-}
-table.comparison-table tr {
- border: 1px solid #000;
-}
-table.comparison-table tr td, table.comparison-table tr th {
- padding: 5px 10px;
-}
-
-
-.deck-container img {
- display: inline;
-}
-
-.deck-container ol {
- font-size: 1.8em;
-}
-
-.centered {
- text-align: center;
-}
-
-.vertically_centered {
- position: absolute;
- top:30%;
- left: 40%;
-}
-
-.sidenote {
- font-size: 17px !important;
- line-height: 18px;
-}
-
-.stickynote {
- border: 1px solid #ccc;
- background: url(../assets/icon-note.jpg) top left no-repeat;
-}
-.contains_sidebyside_icons {
- width: 400px;
- margin: 0 auto !important;
-}
-
-.sidebyside_download_icon {
- float: left;
- width: 200px;
- text-align: center;
-}
-
-.keyword {
- color: #B1009A;
- font-weight: 600!important;
- font-style: italic !important;
-}
-
-.deck-container .reminders {
- background: url("../../assets/icon-reminder.jpg") no-repeat;
- font-size: 1.2em;
- min-height: 60px;
- padding: 8px 0 0 90px;
-}
-.deck-container .reminders p {
- font-size: 1em;
-}
- .deck-container .reminders.single-line p,
- .deck-container .hint.single-line p {
- padding-top: 10px;
- margin-bottom: 0;
- }
-span.marker {
- position: absolute;
- top: 8px;
- right: 15px;
- font-size: 1.3em;
-}
-.assignment {
- font-weight: 900;
- color: red;
-}
-
-.hint {
- font-style: italic;
-}
-
-.deck-container .hint {
- background: url("../../assets/icon-hint.jpg") no-repeat;
- font-size: 1.2em;
- min-height: 60px;
- padding: 8px 0 0 90px;
-}
-.deck-container .hint p {
- font-size: 1em;
-}
-
-.var {
- color: #770088;
-}
-
-.highlight {
- background-color: #FF9;
-}
-
-.smaller {
- font-size: 0.5em !important;
-}
-
-.solution-link {
- text-align: center;
- padding-top: 20px !important;
- font-size: 17px !important;
-}
-
-.show-hint {
- color: #B1009A;
- font-size: 16px !important;
- font-style: italic !important;
- cursor: pointer;
-}
-
-.hint-solution {
- display: none;
- color: #888;
- font-size: 16px !important;
- font-style: italic !important;
-}
-
-/* Styles for specific slides */
-.deck-container .get-started {
- padding: 30px 110px 0;
-}
- .deck-container .get-started h2 {
- margin-bottom: 20px;
- }
- .deck-container .get-started a {
- margin-top: 40px;
- display: inline-block;
- }
-
-.deck-container .intro h1 {
- top: 120px;
- font-size: 60px;
-}
- .deck-container .intro .instructor_holder {
- margin-top: 180px;
- }
- .instructor_holder img {
- border-radius: 50%;
- }
- .instructor_holder a {
- text-decoration: none;
- }
-
-.csstransforms .deck-container h1.welcome {
- top: 34%;
-}
-.deck-container p.sponsor {
- text-align: center;
- margin-top: 30%;
-}
-
diff --git a/src/css/deck.coder.css b/src/css/deck.coder.css
deleted file mode 100755
index 55c160f..0000000
--- a/src/css/deck.coder.css
+++ /dev/null
@@ -1,67 +0,0 @@
-
-.deck-container {
- width:auto;
- padding:0 10%;
-
-}
-
-.deck-container .coder-wrapper {
- width:100%;
- position:relative;
- border:1px solid #CCC;
- border-radius: 15px;
- padding: 5px 0px;
- box-shadow: 4px 4px 10px #CCC;
-}
-
-.deck-container .coder-editor-wrapper {
- padding:5px 1%;
- border-right:1px solid #CCC;
-}
-
-.deck-container .coder-editor-wrapper pre {
- font-family: monospace, sans-serif;
- font-size:18px;
-}
-
-.deck-container .coder-destination {
- display:none;
- padding:5px 1%;
-}
-
-
-.deck-container .coder-wrapper-split .coder-editor-wrapper {
- width:48%;
-}
-
-
-.deck-container .coder-wrapper-split .coder-destination {
- padding:5px 1%;
- position:absolute; left:50%; bottom:0px;
- width:48%;
-
-}
-
-.deck-container .coder-wrapper .coder-buttons {
- position:absolute;
- top:5px;
- z-index:100;
- right: 3%;
-
-}
-
-.deck-container .coder-wrapper .coder-buttons button {
- border:none;
- border-radius:8px;
- padding:8px 12px;
- color:white;
- font-size:14px;
- background-color:#CCC;
- margin-left:5px;
-
-
-}
-
-.deck-container .coder-wrapper-split .coder-buttons {
- right: 53%;
-}
diff --git a/src/css/prettify.css b/src/css/prettify.css
deleted file mode 100755
index d44b3a2..0000000
--- a/src/css/prettify.css
+++ /dev/null
@@ -1 +0,0 @@
-.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
\ No newline at end of file
diff --git a/src/deck.coder.js b/src/deck.coder.js
deleted file mode 100755
index d26a138..0000000
--- a/src/deck.coder.js
+++ /dev/null
@@ -1,323 +0,0 @@
-/*!
- Copyright (c) 2011 Cykod LLC
- Dual licensed under the MIT license and the GPL license
-*/
-
-
-/*
-This module adds a code editor that shows up in individual slides
-*/
-
-
-
-(function($, deck, window, undefined) {
- var $d = $(document),
- $window = $(window),
- savedGistData = {};
-
- function unsanitize(str) {
- return addScript(str).replace(/</g,'<').replace(/>/g,'>');
- }
-
- function addScript(str) {
- return str.replace(/SCRIPTEND/g,'').replace(/SCRIPT/g,'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-