You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2013/09/20 04:29:24 UTC
svn commit: r1524887 [19/34] - in /tomee/tomee/trunk/tomee: ./
tomee-webaccess/ tomee-webaccess/src/ tomee-webaccess/src/main/
tomee-webaccess/src/main/config/ tomee-webaccess/webaccess-gui-libs/
tomee-webaccess/webaccess-gui-libs/backbone/ tomee-webac...
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/markdown.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/markdown.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/markdown.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/markdown.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,551 @@
+CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
+
+ var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
+ var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain");
+ var aliases = {
+ html: "htmlmixed",
+ js: "javascript",
+ json: "application/json",
+ c: "text/x-csrc",
+ "c++": "text/x-c++src",
+ java: "text/x-java",
+ csharp: "text/x-csharp",
+ "c#": "text/x-csharp",
+ scala: "text/x-scala"
+ };
+
+ var getMode = (function () {
+ var i, modes = {}, mimes = {}, mime;
+
+ var list = [];
+ for (var m in CodeMirror.modes)
+ if (CodeMirror.modes.propertyIsEnumerable(m)) list.push(m);
+ for (i = 0; i < list.length; i++) {
+ modes[list[i]] = list[i];
+ }
+ var mimesList = [];
+ for (var m in CodeMirror.mimeModes)
+ if (CodeMirror.mimeModes.propertyIsEnumerable(m))
+ mimesList.push({mime: m, mode: CodeMirror.mimeModes[m]});
+ for (i = 0; i < mimesList.length; i++) {
+ mime = mimesList[i].mime;
+ mimes[mime] = mimesList[i].mime;
+ }
+
+ for (var a in aliases) {
+ if (aliases[a] in modes || aliases[a] in mimes)
+ modes[a] = aliases[a];
+ }
+
+ return function (lang) {
+ return modes[lang] ? CodeMirror.getMode(cmCfg, modes[lang]) : null;
+ };
+ }());
+
+ // Should underscores in words open/close em/strong?
+ if (modeCfg.underscoresBreakWords === undefined)
+ modeCfg.underscoresBreakWords = true;
+
+ // Turn on fenced code blocks? ("```" to start/end)
+ if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false;
+
+ // Turn on task lists? ("- [ ] " and "- [x] ")
+ if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
+
+ var codeDepth = 0;
+
+ var header = 'header'
+ , code = 'comment'
+ , quote1 = 'atom'
+ , quote2 = 'number'
+ , list1 = 'variable-2'
+ , list2 = 'variable-3'
+ , list3 = 'keyword'
+ , hr = 'hr'
+ , image = 'tag'
+ , linkinline = 'link'
+ , linkemail = 'link'
+ , linktext = 'link'
+ , linkhref = 'string'
+ , em = 'em'
+ , strong = 'strong';
+
+ var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
+ , ulRE = /^[*\-+]\s+/
+ , olRE = /^[0-9]+\.\s+/
+ , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
+ , headerRE = /^(?:\={1,}|-{1,})$/
+ , 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 blankLine(state) {
+ // Reset linkTitle state
+ state.linkTitle = false;
+ // Reset EM state
+ state.em = false;
+ // Reset STRONG state
+ state.strong = false;
+ // Reset state.quote
+ state.quote = 0;
+ if (!htmlFound && state.f == htmlBlock) {
+ state.f = inlineNormal;
+ state.block = blockNormal;
+ }
+ // Reset state.trailingSpace
+ state.trailingSpace = 0;
+ state.trailingSpaceNewLine = false;
+ // Mark this line as blank
+ state.thisLineHasContent = false;
+ return null;
+ }
+
+ function blockNormal(stream, state) {
+
+ var prevLineIsList = (state.list !== false);
+ if (state.list !== false && state.indentationDiff >= 0) { // Continued list
+ if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
+ state.indentation -= state.indentationDiff;
+ }
+ state.list = null;
+ } else if (state.list !== false && state.indentation > 0) {
+ state.list = null;
+ state.listDepth = Math.floor(state.indentation / 4);
+ } else if (state.list !== false) { // No longer a list
+ state.list = false;
+ state.listDepth = 0;
+ }
+
+ if (state.indentationDiff >= 4) {
+ state.indentation -= 4;
+ stream.skipToEnd();
+ return code;
+ } else if (stream.eatSpace()) {
+ return null;
+ } else if (stream.peek() === '#' || (state.prevLineHasContent && stream.match(headerRE)) ) {
+ state.header = true;
+ } else if (stream.eat('>')) {
+ state.indentation++;
+ state.quote = 1;
+ stream.eatSpace();
+ while (stream.eat('>')) {
+ stream.eatSpace();
+ state.quote++;
+ }
+ } else if (stream.peek() === '[') {
+ return switchInline(stream, state, footnoteLink);
+ } else if (stream.match(hrRE, true)) {
+ return hr;
+ } else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, true) || stream.match(olRE, true))) {
+ state.indentation += 4;
+ state.list = true;
+ state.listDepth++;
+ if (modeCfg.taskLists && stream.match(taskListRE, false)) {
+ state.taskList = true;
+ }
+ } else if (modeCfg.fencedCodeBlocks && stream.match(/^```([\w+#]*)/, true)) {
+ // try switching mode
+ state.localMode = getMode(RegExp.$1);
+ if (state.localMode) state.localState = state.localMode.startState();
+ switchBlock(stream, state, local);
+ return code;
+ }
+
+ return switchInline(stream, state, state.inline);
+ }
+
+ function htmlBlock(stream, state) {
+ var style = htmlMode.token(stream, state.htmlState);
+ if (htmlFound && style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
+ state.f = inlineNormal;
+ state.block = blockNormal;
+ }
+ if (state.md_inside && stream.current().indexOf(">")!=-1) {
+ state.f = inlineNormal;
+ state.block = blockNormal;
+ state.htmlState.context = undefined;
+ }
+ return style;
+ }
+
+ function local(stream, state) {
+ if (stream.sol() && stream.match(/^```/, true)) {
+ state.localMode = state.localState = null;
+ state.f = inlineNormal;
+ state.block = blockNormal;
+ return code;
+ } else if (state.localMode) {
+ return state.localMode.token(stream, state.localState);
+ } else {
+ stream.skipToEnd();
+ return code;
+ }
+ }
+
+ // Inline
+ function getType(state) {
+ var styles = [];
+
+ if (state.taskOpen) { return "meta"; }
+ if (state.taskClosed) { return "property"; }
+
+ if (state.strong) { styles.push(strong); }
+ if (state.em) { styles.push(em); }
+
+ if (state.linkText) { styles.push(linktext); }
+
+ if (state.code) { styles.push(code); }
+
+ if (state.header) { styles.push(header); }
+ if (state.quote) { styles.push(state.quote % 2 ? quote1 : quote2); }
+ if (state.list !== false) {
+ var listMod = (state.listDepth - 1) % 3;
+ if (!listMod) {
+ styles.push(list1);
+ } else if (listMod === 1) {
+ styles.push(list2);
+ } else {
+ styles.push(list3);
+ }
+ }
+
+ if (state.trailingSpaceNewLine) {
+ styles.push("trailing-space-new-line");
+ } else if (state.trailingSpace) {
+ styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
+ }
+
+ return styles.length ? styles.join(' ') : null;
+ }
+
+ function handleText(stream, state) {
+ if (stream.match(textRE, true)) {
+ return getType(state);
+ }
+ return undefined;
+ }
+
+ function inlineNormal(stream, state) {
+ var style = state.text(stream, state);
+ if (typeof style !== 'undefined')
+ return style;
+
+ if (state.list) { // List marker (*, +, -, 1., etc)
+ state.list = null;
+ return getType(state);
+ }
+
+ if (state.taskList) {
+ var taskOpen = stream.match(taskListRE, true)[1] !== "x";
+ if (taskOpen) state.taskOpen = true;
+ else state.taskClosed = true;
+ state.taskList = false;
+ return getType(state);
+ }
+
+ state.taskOpen = false;
+ state.taskClosed = false;
+
+ var ch = stream.next();
+
+ if (ch === '\\') {
+ stream.next();
+ return getType(state);
+ }
+
+ // Matches link titles present on next line
+ if (state.linkTitle) {
+ state.linkTitle = false;
+ var matchCh = ch;
+ if (ch === '(') {
+ matchCh = ')';
+ }
+ matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
+ var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
+ if (stream.match(new RegExp(regex), true)) {
+ return linkhref;
+ }
+ }
+
+ // If this block is changed, it may need to be updated in GFM mode
+ if (ch === '`') {
+ var t = getType(state);
+ var before = stream.pos;
+ stream.eatWhile('`');
+ var difference = 1 + stream.pos - before;
+ if (!state.code) {
+ codeDepth = difference;
+ state.code = true;
+ return getType(state);
+ } else {
+ if (difference === codeDepth) { // Must be exact
+ state.code = false;
+ return t;
+ }
+ return getType(state);
+ }
+ } else if (state.code) {
+ return getType(state);
+ }
+
+ if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
+ stream.match(/\[[^\]]*\]/);
+ state.inline = state.f = linkHref;
+ return image;
+ }
+
+ if (ch === '[' && stream.match(/.*\](\(| ?\[)/, false)) {
+ state.linkText = true;
+ return getType(state);
+ }
+
+ if (ch === ']' && state.linkText) {
+ var type = getType(state);
+ state.linkText = false;
+ state.inline = state.f = linkHref;
+ return type;
+ }
+
+ if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
+ return switchInline(stream, state, inlineElement(linkinline, '>'));
+ }
+
+ if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
+ return switchInline(stream, state, inlineElement(linkemail, '>'));
+ }
+
+ if (ch === '<' && stream.match(/^\w/, false)) {
+ if (stream.string.indexOf(">")!=-1) {
+ var atts = stream.string.substring(1,stream.string.indexOf(">"));
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) {
+ state.md_inside = true;
+ }
+ }
+ stream.backUp(1);
+ return switchBlock(stream, state, htmlBlock);
+ }
+
+ if (ch === '<' && stream.match(/^\/\w*?>/)) {
+ state.md_inside = false;
+ return "tag";
+ }
+
+ var ignoreUnderscore = false;
+ if (!modeCfg.underscoresBreakWords) {
+ if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
+ var prevPos = stream.pos - 2;
+ if (prevPos >= 0) {
+ var prevCh = stream.string.charAt(prevPos);
+ if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
+ ignoreUnderscore = true;
+ }
+ }
+ }
+ }
+ var t = getType(state);
+ if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
+ if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
+ state.strong = false;
+ return t;
+ } else if (!state.strong && stream.eat(ch)) { // Add STRONG
+ state.strong = ch;
+ return getType(state);
+ } else if (state.em === ch) { // Remove EM
+ state.em = false;
+ return t;
+ } else if (!state.em) { // Add EM
+ state.em = ch;
+ return getType(state);
+ }
+ } else if (ch === ' ') {
+ if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
+ return getType(state);
+ } else { // Not surrounded by spaces, back up pointer
+ stream.backUp(1);
+ }
+ }
+ }
+
+ if (ch === ' ') {
+ if (stream.match(/ +$/, false)) {
+ state.trailingSpace++;
+ } else if (state.trailingSpace) {
+ state.trailingSpaceNewLine = true;
+ }
+ }
+
+ return getType(state);
+ }
+
+ function linkHref(stream, state) {
+ // Check if space, and return NULL if so (to avoid marking the space)
+ if(stream.eatSpace()){
+ return null;
+ }
+ 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) {
+ // Check if space, and return NULL if so (to avoid marking the space)
+ if(stream.eatSpace()){
+ return null;
+ }
+ // Match URL
+ stream.match(/^[^\s]+/, true);
+ // Check for link title
+ if (stream.peek() === undefined) { // End of line, set flag to check next line
+ state.linkTitle = true;
+ } else { // More content on line, check if link title
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
+ }
+ state.f = state.inline = inlineNormal;
+ return linkhref;
+ }
+
+ var savedInlineRE = [];
+ function inlineRE(endChar) {
+ if (!savedInlineRE[endChar]) {
+ // Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
+ endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
+ // Match any non-endChar, escaped character, as well as the closing
+ // endChar.
+ savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')');
+ }
+ return savedInlineRE[endChar];
+ }
+
+ function inlineElement(type, endChar, next) {
+ next = next || inlineNormal;
+ return function(stream, state) {
+ stream.match(inlineRE(endChar));
+ state.inline = state.f = next;
+ return type;
+ };
+ }
+
+ return {
+ startState: function() {
+ return {
+ f: blockNormal,
+
+ prevLineHasContent: false,
+ thisLineHasContent: false,
+
+ block: blockNormal,
+ htmlState: CodeMirror.startState(htmlMode),
+ indentation: 0,
+
+ inline: inlineNormal,
+ text: handleText,
+
+ linkText: false,
+ linkTitle: false,
+ em: false,
+ strong: false,
+ header: false,
+ taskList: false,
+ list: false,
+ listDepth: 0,
+ quote: 0,
+ trailingSpace: 0,
+ trailingSpaceNewLine: false
+ };
+ },
+
+ copyState: function(s) {
+ return {
+ f: s.f,
+
+ prevLineHasContent: s.prevLineHasContent,
+ thisLineHasContent: s.thisLineHasContent,
+
+ block: s.block,
+ htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
+ indentation: s.indentation,
+
+ localMode: s.localMode,
+ localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
+
+ inline: s.inline,
+ text: s.text,
+ linkTitle: s.linkTitle,
+ em: s.em,
+ strong: s.strong,
+ header: s.header,
+ taskList: s.taskList,
+ list: s.list,
+ listDepth: s.listDepth,
+ quote: s.quote,
+ trailingSpace: s.trailingSpace,
+ trailingSpaceNewLine: s.trailingSpaceNewLine,
+ md_inside: s.md_inside
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (stream.match(/^\s*$/, true)) {
+ state.prevLineHasContent = false;
+ return blankLine(state);
+ } else {
+ state.prevLineHasContent = state.thisLineHasContent;
+ state.thisLineHasContent = true;
+ }
+
+ // Reset state.header
+ state.header = false;
+
+ // Reset state.taskList
+ state.taskList = false;
+
+ // Reset state.code
+ state.code = false;
+
+ // Reset state.trailingSpace
+ state.trailingSpace = 0;
+ state.trailingSpaceNewLine = false;
+
+ state.f = state.block;
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
+ var difference = Math.floor((indentation - state.indentation) / 4) * 4;
+ if (difference > 4) difference = 4;
+ var adjustedIndentation = state.indentation + difference;
+ state.indentationDiff = adjustedIndentation - state.indentation;
+ state.indentation = adjustedIndentation;
+ if (indentation > 0) return null;
+ }
+ return state.f(stream, state);
+ },
+
+ blankLine: blankLine,
+
+ getType: getType
+ };
+
+}, "xml");
+
+CodeMirror.defineMIME("text/x-markdown", "markdown");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/test.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/test.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/test.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/markdown/test.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,656 @@
+(function() {
+ var mode = CodeMirror.getMode({tabSize: 4}, "markdown");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("plainText",
+ "foo");
+
+ // Don't style single trailing space
+ MT("trailingSpace1",
+ "foo ");
+
+ // Two or more trailing spaces should be styled with line break character
+ MT("trailingSpace2",
+ "foo[trailing-space-a ][trailing-space-new-line ]");
+
+ MT("trailingSpace3",
+ "foo[trailing-space-a ][trailing-space-b ][trailing-space-new-line ]");
+
+ MT("trailingSpace4",
+ "foo[trailing-space-a ][trailing-space-b ][trailing-space-a ][trailing-space-new-line ]");
+
+ // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value)
+ MT("codeBlocksUsing4Spaces",
+ " [comment foo]");
+
+ // Code blocks using 4 spaces with internal indentation
+ MT("codeBlocksUsing4SpacesIndentation",
+ " [comment bar]",
+ " [comment hello]",
+ " [comment world]",
+ " [comment foo]",
+ "bar");
+
+ // Code blocks using 4 spaces with internal indentation
+ MT("codeBlocksUsing4SpacesIndentation",
+ " foo",
+ " [comment bar]",
+ " [comment hello]",
+ " [comment world]");
+
+ // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value)
+ MT("codeBlocksUsing1Tab",
+ "\t[comment foo]");
+
+ // Inline code using backticks
+ MT("inlineCodeUsingBackticks",
+ "foo [comment `bar`]");
+
+ // Block code using single backtick (shouldn't work)
+ MT("blockCodeSingleBacktick",
+ "[comment `]",
+ "foo",
+ "[comment `]");
+
+ // Unclosed backticks
+ // Instead of simply marking as CODE, it would be nice to have an
+ // incomplete flag for CODE, that is styled slightly different.
+ MT("unclosedBackticks",
+ "foo [comment `bar]");
+
+ // Per documentation: "To include a literal backtick character within a
+ // code span, you can use multiple backticks as the opening and closing
+ // delimiters"
+ MT("doubleBackticks",
+ "[comment ``foo ` bar``]");
+
+ // Tests based on Dingus
+ // http://daringfireball.net/projects/markdown/dingus
+ //
+ // Multiple backticks within an inline code block
+ MT("consecutiveBackticks",
+ "[comment `foo```bar`]");
+
+ // Multiple backticks within an inline code block with a second code block
+ MT("consecutiveBackticks",
+ "[comment `foo```bar`] hello [comment `world`]");
+
+ // Unclosed with several different groups of backticks
+ MT("unclosedBackticks",
+ "[comment ``foo ``` bar` hello]");
+
+ // Closed with several different groups of backticks
+ MT("closedBackticks",
+ "[comment ``foo ``` bar` hello``] world");
+
+ // atx headers
+ // http://daringfireball.net/projects/markdown/syntax#header
+
+ MT("atxH1",
+ "[header # foo]");
+
+ MT("atxH2",
+ "[header ## foo]");
+
+ MT("atxH3",
+ "[header ### foo]");
+
+ MT("atxH4",
+ "[header #### foo]");
+
+ MT("atxH5",
+ "[header ##### foo]");
+
+ MT("atxH6",
+ "[header ###### foo]");
+
+ // H6 - 7x '#' should still be H6, per Dingus
+ // http://daringfireball.net/projects/markdown/dingus
+ MT("atxH6NotH7",
+ "[header ####### foo]");
+
+ // Setext headers - H1, H2
+ // Per documentation, "Any number of underlining =âs or -âs will work."
+ // http://daringfireball.net/projects/markdown/syntax#header
+ // Ideally, the text would be marked as `header` as well, but this is
+ // not really feasible at the moment. So, instead, we're testing against
+ // what works today, to avoid any regressions.
+ //
+ // Check if single underlining = works
+ MT("setextH1",
+ "foo",
+ "[header =]");
+
+ // Check if 3+ ='s work
+ MT("setextH1",
+ "foo",
+ "[header ===]");
+
+ // Check if single underlining - works
+ MT("setextH2",
+ "foo",
+ "[header -]");
+
+ // Check if 3+ -'s work
+ MT("setextH2",
+ "foo",
+ "[header ---]");
+
+ // Single-line blockquote with trailing space
+ MT("blockquoteSpace",
+ "[atom > foo]");
+
+ // Single-line blockquote
+ MT("blockquoteNoSpace",
+ "[atom >foo]");
+
+ // No blank line before blockquote
+ MT("blockquoteNoBlankLine",
+ "foo",
+ "[atom > bar]");
+
+ // Nested blockquote
+ MT("blockquoteSpace",
+ "[atom > foo]",
+ "[number > > foo]",
+ "[atom > > > foo]");
+
+ // Single-line blockquote followed by normal paragraph
+ MT("blockquoteThenParagraph",
+ "[atom >foo]",
+ "",
+ "bar");
+
+ // Multi-line blockquote (lazy mode)
+ MT("multiBlockquoteLazy",
+ "[atom >foo]",
+ "[atom bar]");
+
+ // Multi-line blockquote followed by normal paragraph (lazy mode)
+ MT("multiBlockquoteLazyThenParagraph",
+ "[atom >foo]",
+ "[atom bar]",
+ "",
+ "hello");
+
+ // Multi-line blockquote (non-lazy mode)
+ MT("multiBlockquote",
+ "[atom >foo]",
+ "[atom >bar]");
+
+ // Multi-line blockquote followed by normal paragraph (non-lazy mode)
+ MT("multiBlockquoteThenParagraph",
+ "[atom >foo]",
+ "[atom >bar]",
+ "",
+ "hello");
+
+ // Check list types
+
+ MT("listAsterisk",
+ "foo",
+ "bar",
+ "",
+ "[variable-2 * foo]",
+ "[variable-2 * bar]");
+
+ MT("listPlus",
+ "foo",
+ "bar",
+ "",
+ "[variable-2 + foo]",
+ "[variable-2 + bar]");
+
+ MT("listDash",
+ "foo",
+ "bar",
+ "",
+ "[variable-2 - foo]",
+ "[variable-2 - bar]");
+
+ MT("listNumber",
+ "foo",
+ "bar",
+ "",
+ "[variable-2 1. foo]",
+ "[variable-2 2. bar]");
+
+ // Lists require a preceding blank line (per Dingus)
+ MT("listBogus",
+ "foo",
+ "1. bar",
+ "2. hello");
+
+ // Formatting in lists (*)
+ MT("listAsteriskFormatting",
+ "[variable-2 * ][variable-2&em *foo*][variable-2 bar]",
+ "[variable-2 * ][variable-2&strong **foo**][variable-2 bar]",
+ "[variable-2 * ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]",
+ "[variable-2 * ][variable-2&comment `foo`][variable-2 bar]");
+
+ // Formatting in lists (+)
+ MT("listPlusFormatting",
+ "[variable-2 + ][variable-2&em *foo*][variable-2 bar]",
+ "[variable-2 + ][variable-2&strong **foo**][variable-2 bar]",
+ "[variable-2 + ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]",
+ "[variable-2 + ][variable-2&comment `foo`][variable-2 bar]");
+
+ // Formatting in lists (-)
+ MT("listDashFormatting",
+ "[variable-2 - ][variable-2&em *foo*][variable-2 bar]",
+ "[variable-2 - ][variable-2&strong **foo**][variable-2 bar]",
+ "[variable-2 - ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]",
+ "[variable-2 - ][variable-2&comment `foo`][variable-2 bar]");
+
+ // Formatting in lists (1.)
+ MT("listNumberFormatting",
+ "[variable-2 1. ][variable-2&em *foo*][variable-2 bar]",
+ "[variable-2 2. ][variable-2&strong **foo**][variable-2 bar]",
+ "[variable-2 3. ][variable-2&strong **][variable-2&em&strong *foo**][variable-2&em *][variable-2 bar]",
+ "[variable-2 4. ][variable-2&comment `foo`][variable-2 bar]");
+
+ // Paragraph lists
+ MT("listParagraph",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]");
+
+ // Multi-paragraph lists
+ //
+ // 4 spaces
+ MT("listMultiParagraph",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ " [variable-2 hello]");
+
+ // 4 spaces, extra blank lines (should still be list, per Dingus)
+ MT("listMultiParagraphExtra",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ "",
+ " [variable-2 hello]");
+
+ // 4 spaces, plus 1 space (should still be list, per Dingus)
+ MT("listMultiParagraphExtraSpace",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ " [variable-2 hello]",
+ "",
+ " [variable-2 world]");
+
+ // 1 tab
+ MT("listTab",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ "\t[variable-2 hello]");
+
+ // No indent
+ MT("listNoIndent",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ "hello");
+
+ // Blockquote
+ MT("blockquote",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ " [variable-2&atom > hello]");
+
+ // Code block
+ MT("blockquoteCode",
+ "[variable-2 * foo]",
+ "",
+ "[variable-2 * bar]",
+ "",
+ " [comment > hello]",
+ "",
+ " [variable-2 world]");
+
+ // Code block followed by text
+ MT("blockquoteCodeText",
+ "[variable-2 * foo]",
+ "",
+ " [variable-2 bar]",
+ "",
+ " [comment hello]",
+ "",
+ " [variable-2 world]");
+
+ // Nested list
+
+ MT("listAsteriskNested",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 * bar]");
+
+ MT("listPlusNested",
+ "[variable-2 + foo]",
+ "",
+ " [variable-3 + bar]");
+
+ MT("listDashNested",
+ "[variable-2 - foo]",
+ "",
+ " [variable-3 - bar]");
+
+ MT("listNumberNested",
+ "[variable-2 1. foo]",
+ "",
+ " [variable-3 2. bar]");
+
+ MT("listMixed",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 + bar]",
+ "",
+ " [keyword - hello]",
+ "",
+ " [variable-2 1. world]");
+
+ MT("listBlockquote",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 + bar]",
+ "",
+ " [atom&variable-3 > hello]");
+
+ MT("listCode",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 + bar]",
+ "",
+ " [comment hello]");
+
+ // Code with internal indentation
+ MT("listCodeIndentation",
+ "[variable-2 * foo]",
+ "",
+ " [comment bar]",
+ " [comment hello]",
+ " [comment world]",
+ " [comment foo]",
+ " [variable-2 bar]");
+
+ // List nesting edge cases
+ MT("listNested",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 * bar]",
+ "",
+ " [variable-2 hello]"
+ );
+ MT("listNested",
+ "[variable-2 * foo]",
+ "",
+ " [variable-3 * bar]",
+ "",
+ " [variable-3 * foo]"
+ );
+
+ // Code followed by text
+ MT("listCodeText",
+ "[variable-2 * foo]",
+ "",
+ " [comment bar]",
+ "",
+ "hello");
+
+ // Following tests directly from official Markdown documentation
+ // http://daringfireball.net/projects/markdown/syntax#hr
+
+ MT("hrSpace",
+ "[hr * * *]");
+
+ MT("hr",
+ "[hr ***]");
+
+ MT("hrLong",
+ "[hr *****]");
+
+ MT("hrSpaceDash",
+ "[hr - - -]");
+
+ MT("hrDashLong",
+ "[hr ---------------------------------------]");
+
+ // Inline link with title
+ MT("linkTitle",
+ "[link [[foo]]][string (http://example.com/ \"bar\")] hello");
+
+ // Inline link without title
+ MT("linkNoTitle",
+ "[link [[foo]]][string (http://example.com/)] bar");
+
+ // Inline link with image
+ MT("linkImage",
+ "[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar");
+
+ // Inline link with Em
+ MT("linkEm",
+ "[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar");
+
+ // Inline link with Strong
+ MT("linkStrong",
+ "[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar");
+
+ // Inline link with EmStrong
+ MT("linkEmStrong",
+ "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar");
+
+ // Image with title
+ MT("imageTitle",
+ "[tag ![[foo]]][string (http://example.com/ \"bar\")] hello");
+
+ // Image without title
+ MT("imageNoTitle",
+ "[tag ![[foo]]][string (http://example.com/)] bar");
+
+ // Image with asterisks
+ MT("imageAsterisks",
+ "[tag ![[*foo*]]][string (http://example.com/)] bar");
+
+ // Not a link. Should be normal text due to square brackets being used
+ // regularly in text, especially in quoted material, and no space is allowed
+ // between square brackets and parentheses (per Dingus).
+ MT("notALink",
+ "[[foo]] (bar)");
+
+ // Reference-style links
+ MT("linkReference",
+ "[link [[foo]]][string [[bar]]] hello");
+
+ // Reference-style links with Em
+ MT("linkReferenceEm",
+ "[link [[][link&em *foo*][link ]]][string [[bar]]] hello");
+
+ // Reference-style links with Strong
+ MT("linkReferenceStrong",
+ "[link [[][link&strong **foo**][link ]]][string [[bar]]] hello");
+
+ // Reference-style links with EmStrong
+ MT("linkReferenceEmStrong",
+ "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello");
+
+ // Reference-style links with optional space separator (per docuentation)
+ // "You can optionally use a space to separate the sets of brackets"
+ MT("linkReferenceSpace",
+ "[link [[foo]]] [string [[bar]]] hello");
+
+ // Should only allow a single space ("...use *a* space...")
+ MT("linkReferenceDoubleSpace",
+ "[[foo]] [[bar]] hello");
+
+ // Reference-style links with implicit link name
+ MT("linkImplicit",
+ "[link [[foo]]][string [[]]] hello");
+
+ // @todo It would be nice if, at some point, the document was actually
+ // checked to see if the referenced link exists
+
+ // Link label, for reference-style links (taken from documentation)
+
+ MT("labelNoTitle",
+ "[link [[foo]]:] [string http://example.com/]");
+
+ MT("labelIndented",
+ " [link [[foo]]:] [string http://example.com/]");
+
+ MT("labelSpaceTitle",
+ "[link [[foo bar]]:] [string http://example.com/ \"hello\"]");
+
+ MT("labelDoubleTitle",
+ "[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\"");
+
+ MT("labelTitleDoubleQuotes",
+ "[link [[foo]]:] [string http://example.com/ \"bar\"]");
+
+ MT("labelTitleSingleQuotes",
+ "[link [[foo]]:] [string http://example.com/ 'bar']");
+
+ MT("labelTitleParenthese",
+ "[link [[foo]]:] [string http://example.com/ (bar)]");
+
+ MT("labelTitleInvalid",
+ "[link [[foo]]:] [string http://example.com/] bar");
+
+ MT("labelLinkAngleBrackets",
+ "[link [[foo]]:] [string <http://example.com/> \"bar\"]");
+
+ MT("labelTitleNextDoubleQuotes",
+ "[link [[foo]]:] [string http://example.com/]",
+ "[string \"bar\"] hello");
+
+ MT("labelTitleNextSingleQuotes",
+ "[link [[foo]]:] [string http://example.com/]",
+ "[string 'bar'] hello");
+
+ MT("labelTitleNextParenthese",
+ "[link [[foo]]:] [string http://example.com/]",
+ "[string (bar)] hello");
+
+ MT("labelTitleNextMixed",
+ "[link [[foo]]:] [string http://example.com/]",
+ "(bar\" hello");
+
+ MT("linkWeb",
+ "[link <http://example.com/>] foo");
+
+ MT("linkWebDouble",
+ "[link <http://example.com/>] foo [link <http://example.com/>]");
+
+ MT("linkEmail",
+ "[link <us...@example.com>] foo");
+
+ MT("linkEmailDouble",
+ "[link <us...@example.com>] foo [link <us...@example.com>]");
+
+ MT("emAsterisk",
+ "[em *foo*] bar");
+
+ MT("emUnderscore",
+ "[em _foo_] bar");
+
+ MT("emInWordAsterisk",
+ "foo[em *bar*]hello");
+
+ MT("emInWordUnderscore",
+ "foo[em _bar_]hello");
+
+ // Per documentation: "...surround an * or _ with spaces, itâll be
+ // treated as a literal asterisk or underscore."
+
+ MT("emEscapedBySpaceIn",
+ "foo [em _bar _ hello_] world");
+
+ MT("emEscapedBySpaceOut",
+ "foo _ bar[em _hello_]world");
+
+ // Unclosed emphasis characters
+ // Instead of simply marking as EM / STRONG, it would be nice to have an
+ // incomplete flag for EM and STRONG, that is styled slightly different.
+ MT("emIncompleteAsterisk",
+ "foo [em *bar]");
+
+ MT("emIncompleteUnderscore",
+ "foo [em _bar]");
+
+ MT("strongAsterisk",
+ "[strong **foo**] bar");
+
+ MT("strongUnderscore",
+ "[strong __foo__] bar");
+
+ MT("emStrongAsterisk",
+ "[em *foo][em&strong **bar*][strong hello**] world");
+
+ MT("emStrongUnderscore",
+ "[em _foo][em&strong __bar_][strong hello__] world");
+
+ // "...same character must be used to open and close an emphasis span.""
+ MT("emStrongMixed",
+ "[em _foo][em&strong **bar*hello__ world]");
+
+ MT("emStrongMixed",
+ "[em *foo][em&strong __bar_hello** world]");
+
+ // These characters should be escaped:
+ // \ backslash
+ // ` backtick
+ // * asterisk
+ // _ underscore
+ // {} curly braces
+ // [] square brackets
+ // () parentheses
+ // # hash mark
+ // + plus sign
+ // - minus sign (hyphen)
+ // . dot
+ // ! exclamation mark
+
+ MT("escapeBacktick",
+ "foo \\`bar\\`");
+
+ MT("doubleEscapeBacktick",
+ "foo \\\\[comment `bar\\\\`]");
+
+ MT("escapeAsterisk",
+ "foo \\*bar\\*");
+
+ MT("doubleEscapeAsterisk",
+ "foo \\\\[em *bar\\\\*]");
+
+ MT("escapeUnderscore",
+ "foo \\_bar\\_");
+
+ MT("doubleEscapeUnderscore",
+ "foo \\\\[em _bar\\\\_]");
+
+ MT("escapeHash",
+ "\\# foo");
+
+ MT("doubleEscapeHash",
+ "\\\\# foo");
+
+
+ // Tests to make sure GFM-specific things aren't getting through
+
+ MT("taskList",
+ "[variable-2 * [ ]] bar]");
+
+ MT("fencedCodeBlocks",
+ "[comment ```]",
+ "foo",
+ "[comment ```]");
+})();
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/meta.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/meta.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/meta.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/meta.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,81 @@
+CodeMirror.modeInfo = [
+ {name: 'APL', mime: 'text/apl', mode: 'apl'},
+ {name: 'Asterisk', mime: 'text/x-asterisk', mode: 'asterisk'},
+ {name: 'C', mime: 'text/x-csrc', mode: 'clike'},
+ {name: 'C++', mime: 'text/x-c++src', mode: 'clike'},
+ {name: 'Cobol', mime: 'text/x-cobol', mode: 'cobol'},
+ {name: 'Java', mime: 'text/x-java', mode: 'clike'},
+ {name: 'C#', mime: 'text/x-csharp', mode: 'clike'},
+ {name: 'Scala', mime: 'text/x-scala', mode: 'clike'},
+ {name: 'Clojure', mime: 'text/x-clojure', mode: 'clojure'},
+ {name: 'CoffeeScript', mime: 'text/x-coffeescript', mode: 'coffeescript'},
+ {name: 'Common Lisp', mime: 'text/x-common-lisp', mode: 'commonlisp'},
+ {name: 'CSS', mime: 'text/css', mode: 'css'},
+ {name: 'D', mime: 'text/x-d', mode: 'd'},
+ {name: 'diff', mime: 'text/x-diff', mode: 'diff'},
+ {name: 'ECL', mime: 'text/x-ecl', mode: 'ecl'},
+ {name: 'Erlang', mime: 'text/x-erlang', mode: 'erlang'},
+ {name: 'Gas', mime: 'text/x-gas', mode: 'gas'},
+ {name: 'GitHub Flavored Markdown', mime: 'text/x-gfm', mode: 'gfm'},
+ {name: 'GO', mime: 'text/x-go', mode: 'go'},
+ {name: 'Groovy', mime: 'text/x-groovy', mode: 'groovy'},
+ {name: 'Haskell', mime: 'text/x-haskell', mode: 'haskell'},
+ {name: 'Haxe', mime: 'text/x-haxe', mode: 'haxe'},
+ {name: 'ASP.NET', mime: 'application/x-aspx', mode: 'htmlembedded'},
+ {name: 'Embedded Javascript', mime: 'application/x-ejs', mode: 'htmlembedded'},
+ {name: 'JavaServer Pages', mime: 'application/x-jsp', mode: 'htmlembedded'},
+ {name: 'HTML', mime: 'text/html', mode: 'htmlmixed'},
+ {name: 'HTTP', mime: 'message/http', mode: 'http'},
+ {name: 'Jade', mime: 'text/x-jade', mode: 'jade'},
+ {name: 'JavaScript', mime: 'text/javascript', mode: 'javascript'},
+ {name: 'JSON', mime: 'application/x-json', mode: 'javascript'},
+ {name: 'JSON', mime: 'application/json', mode: 'javascript'},
+ {name: 'TypeScript', mime: 'application/typescript', mode: 'javascript'},
+ {name: 'Jinja2', mime: 'jinja2', mode: 'jinja2'},
+ {name: 'LESS', mime: 'text/x-less', mode: 'less'},
+ {name: 'LiveScript', mime: 'text/x-livescript', mode: 'livescript'},
+ {name: 'Lua', mime: 'text/x-lua', mode: 'lua'},
+ {name: 'Markdown (GitHub-flavour)', mime: 'text/x-markdown', mode: 'markdown'},
+ {name: 'mIRC', mime: 'text/mirc', mode: 'mirc'},
+ {name: 'Nginx', mime: 'text/x-nginx-conf', mode: 'nginx'},
+ {name: 'NTriples', mime: 'text/n-triples', mode: 'ntriples'},
+ {name: 'OCaml', mime: 'text/x-ocaml', mode: 'ocaml'},
+ {name: 'Pascal', mime: 'text/x-pascal', mode: 'pascal'},
+ {name: 'Perl', mime: 'text/x-perl', mode: 'perl'},
+ {name: 'PHP', mime: 'text/x-php', mode: 'php'},
+ {name: 'PHP(HTML)', mime: 'application/x-httpd-php', mode: 'php'},
+ {name: 'Pig', mime: 'text/x-pig', mode: 'pig'},
+ {name: 'Plain Text', mime: 'text/plain', mode: 'null'},
+ {name: 'Properties files', mime: 'text/x-properties', mode: 'properties'},
+ {name: 'Python', mime: 'text/x-python', mode: 'python'},
+ {name: 'Cython', mime: 'text/x-cython', mode: 'python'},
+ {name: 'R', mime: 'text/x-rsrc', mode: 'r'},
+ {name: 'reStructuredText', mime: 'text/x-rst', mode: 'rst'},
+ {name: 'Ruby', mime: 'text/x-ruby', mode: 'ruby'},
+ {name: 'Rust', mime: 'text/x-rustsrc', mode: 'rust'},
+ {name: 'Sass', mime: 'text/x-sass', mode: 'sass'},
+ {name: 'Scheme', mime: 'text/x-scheme', mode: 'scheme'},
+ {name: 'SCSS', mime: 'text/x-scss', mode: 'css'},
+ {name: 'Shell', mime: 'text/x-sh', mode: 'shell'},
+ {name: 'Sieve', mime: 'application/sieve', mode: 'sieve'},
+ {name: 'Smalltalk', mime: 'text/x-stsrc', mode: 'smalltalk'},
+ {name: 'Smarty', mime: 'text/x-smarty', mode: 'smarty'},
+ {name: 'SmartyMixed', mime: 'text/x-smarty', mode: 'smartymixed'},
+ {name: 'SPARQL', mime: 'application/x-sparql-query', mode: 'sparql'},
+ {name: 'SQL', mime: 'text/x-sql', mode: 'sql'},
+ {name: 'MariaDB', mime: 'text/x-mariadb', mode: 'sql'},
+ {name: 'sTeX', mime: 'text/x-stex', mode: 'stex'},
+ {name: 'LaTeX', mime: 'text/x-latex', mode: 'stex'},
+ {name: 'Tcl', mime: 'text/x-tcl', mode: 'tcl'},
+ {name: 'TiddlyWiki ', mime: 'text/x-tiddlywiki', mode: 'tiddlywiki'},
+ {name: 'Tiki wiki', mime: 'text/tiki', mode: 'tiki'},
+ {name: 'VB.NET', mime: 'text/x-vb', mode: 'vb'},
+ {name: 'VBScript', mime: 'text/vbscript', mode: 'vbscript'},
+ {name: 'Velocity', mime: 'text/velocity', mode: 'velocity'},
+ {name: 'Verilog', mime: 'text/x-verilog', mode: 'verilog'},
+ {name: 'XML', mime: 'application/xml', mode: 'xml'},
+ {name: 'HTML', mime: 'text/html', mode: 'xml'},
+ {name: 'XQuery', mime: 'application/xquery', mode: 'xquery'},
+ {name: 'YAML', mime: 'text/x-yaml', mode: 'yaml'},
+ {name: 'Z80', mime: 'text/x-z80', mode: 'z80'}
+];
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,161 @@
+<!doctype html>
+
+<title>CodeMirror: mIRC mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/twilight.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="mirc.js"></script>
+<style>.CodeMirror {border: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">mIRC</a>
+ </ul>
+</div>
+
+<article>
+<h2>mIRC mode</h2>
+<form><textarea id="code" name="code">
+;AKA Nick Tracker by Ford_Lawnmower irc.GeekShed.net #Script-Help
+;*****************************************************************************;
+;**Start Setup
+;Change JoinDisplay, below, for On Join AKA Display. On = 1 - Off = 0
+alias -l JoinDisplay { return 1 }
+;Change MaxNicks, below, to the number of nicknames you want to store for each hostmask. I wouldn't go over 400 with this ;/
+alias -l MaxNicks { return 20 }
+;Change AKALogo, below, To the text you want displayed before each AKA result.
+alias -l AKALogo { return 06 05A06K07A 06 }
+;**End Setup
+;*****************************************************************************;
+On *:Join:#: {
+ if ($nick == $me) { .timer 1 1 ialupdateCheck $chan }
+ NickNamesAdd $nick $+($network,$wildsite)
+ if ($JoinDisplay) { .timerNickNames $+ $nick 1 2 NickNames.display $nick $chan $network $wildsite }
+}
+on *:Nick: { NickNamesAdd $newnick $+($network,$wildsite) $nick }
+alias -l NickNames.display {
+ if ($gettok($hget(NickNames,$+($3,$4)),0,126) > 1) {
+ echo -g $2 $AKALogo $+(09,$1) $AKALogo 07 $mid($replace($hget(NickNames,$+($3,$4)),$chr(126),$chr(44)),2,-1)
+ }
+}
+alias -l NickNamesAdd {
+ if ($hget(NickNames,$2)) {
+ if (!$regex($hget(NickNames,$2),/~\Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E~/i)) {
+ if ($gettok($hget(NickNames,$2),0,126) <= $MaxNicks) {
+ hadd NickNames $2 $+($hget(NickNames,$2),$1,~)
+ }
+ else {
+ hadd NickNames $2 $+($mid($hget(NickNames,$2),$pos($hget(NickNames,$2),~,2)),$1,~)
+ }
+ }
+ }
+ else {
+ hadd -m NickNames $2 $+(~,$1,~,$iif($3,$+($3,~)))
+ }
+}
+alias -l Fix.All.MindUser {
+ var %Fix.Count = $hfind(NickNames,/[^~]+[0-9]{4}~/,0,r).data
+ while (%Fix.Count) {
+ if ($Fix.MindUser($hget(NickNames,$hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data))) {
+ echo -ag Record %Fix.Count - $v1 - Was Cleaned
+ hadd NickNames $hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data $v1
+ }
+ dec %Fix.Count
+ }
+}
+alias -l Fix.MindUser { return $regsubex($1,/[^~]+[0-9]{4}~/g,$null) }
+menu nicklist,query {
+ -
+ .AKA
+ ..Check $$1: {
+ if ($gettok($hget(NickNames,$+($network,$address($1,2))),0,126) > 1) {
+ NickNames.display $1 $active $network $address($1,2)
+ }
+ else { echo -ag $AKALogo $+(09,$1) 07has not been known by any other nicknames while I have been watching. }
+ }
+ ..Cleanup $$1:hadd NickNames $+($network,$address($1,2)) $fix.minduser($hget(NickNames,$+($network,$address($1,2))))
+ ..Clear $$1:hadd NickNames $+($network,$address($1,2)) $+(~,$1,~)
+ ..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
+ -
+}
+menu status,channel {
+ -
+ .AKA
+ ..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
+ ..Clean All Records:Fix.All.Minduser
+ -
+}
+dialog AKA_Search {
+ title "AKA Search Engine"
+ size -1 -1 206 221
+ option dbu
+ edit "", 1, 8 5 149 10, autohs
+ button "Search", 2, 163 4 32 12
+ radio "Search HostMask", 4, 61 22 55 10
+ radio "Search Nicknames", 5, 123 22 56 10
+ list 6, 8 38 190 169, sort extsel vsbar
+ button "Check Selected", 7, 67 206 40 12
+ button "Close", 8, 160 206 38 12, cancel
+ box "Search Type", 3, 11 17 183 18
+ button "Copy to Clipboard", 9, 111 206 46 12
+}
+On *:Dialog:Aka_Search:init:*: { did -c $dname 5 }
+On *:Dialog:Aka_Search:Sclick:2,7,9: {
+ if ($did == 2) && ($did($dname,1)) {
+ did -r $dname 6
+ var %search $+(*,$v1,*), %type $iif($did($dname,5).state,data,item), %matches = $hfind(NickNames,%search,0,w). [ $+ [ %type ] ]
+ while (%matches) {
+ did -a $dname 6 $hfind(NickNames,%search,%matches,w). [ $+ [ %type ] ]
+ dec %matches
+ }
+ did -c $dname 6 1
+ }
+ elseif ($did == 7) && ($did($dname,6).seltext) { echo -ga $AKALogo 07 $mid($replace($hget(NickNames,$v1),$chr(126),$chr(44)),2,-1) }
+ elseif ($did == 9) && ($did($dname,6).seltext) { clipboard $mid($v1,$pos($v1,*,1)) }
+}
+On *:Start:{
+ if (!$hget(NickNames)) { hmake NickNames 10 }
+ if ($isfile(NickNames.hsh)) { hload NickNames NickNames.hsh }
+}
+On *:Exit: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
+On *:Disconnect: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
+On *:Unload: { hfree NickNames }
+alias -l ialupdateCheck {
+ inc -z $+(%,ialupdateCheck,$network) $calc($nick($1,0) / 4)
+ ;If your ial is already being updated on join .who $1 out.
+ ;If you are using /names to update ial you will still need this line.
+ .who $1
+}
+Raw 352:*: {
+ if ($($+(%,ialupdateCheck,$network),2)) haltdef
+ NickNamesAdd $6 $+($network,$address($6,2))
+}
+Raw 315:*: {
+ if ($($+(%,ialupdateCheck,$network),2)) haltdef
+}
+
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ tabMode: "indent",
+ theme: "twilight",
+ lineNumbers: true,
+ matchBrackets: true,
+ indentUnit: 4,
+ mode: "text/mirc"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/mirc</code>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/mirc.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/mirc.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/mirc.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/mirc/mirc.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,177 @@
+//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
+CodeMirror.defineMIME("text/mirc", "mirc");
+CodeMirror.defineMode("mirc", function() {
+ function parseWords(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+ var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " +
+ "$activewid $address $addtok $agent $agentname $agentstat $agentver " +
+ "$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " +
+ "$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " +
+ "$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " +
+ "$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " +
+ "$com $comcall $comchan $comerr $compact $compress $comval $cos $count " +
+ "$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " +
+ "$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " +
+ "$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " +
+ "$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " +
+ "$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " +
+ "$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " +
+ "$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " +
+ "$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " +
+ "$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " +
+ "$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " +
+ "$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " +
+ "$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " +
+ "$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " +
+ "$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " +
+ "$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " +
+ "$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " +
+ "$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " +
+ "$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " +
+ "$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " +
+ "$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " +
+ "$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " +
+ "$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " +
+ "$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " +
+ "$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " +
+ "$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " +
+ "$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " +
+ "$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " +
+ "$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " +
+ "$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor");
+ var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " +
+ "away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " +
+ "channel clear clearall cline clipboard close cnick color comclose comopen " +
+ "comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " +
+ "debug dec describe dialog did didtok disable disconnect dlevel dline dll " +
+ "dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " +
+ "drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " +
+ "events exit fclose filter findtext finger firewall flash flist flood flush " +
+ "flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " +
+ "gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " +
+ "halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " +
+ "ialmark identd if ignore iline inc invite iuser join kick linesep links list " +
+ "load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " +
+ "notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " +
+ "qme qmsg query queryn quit raw reload remini remote remove rename renwin " +
+ "reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " +
+ "say scid scon server set showmirc signam sline sockaccept sockclose socklist " +
+ "socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " +
+ "sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " +
+ "toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " +
+ "var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " +
+ "isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " +
+ "isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " +
+ "elseif else goto menu nicklist status title icon size option text edit " +
+ "button check radio box scroll list combo link tab item");
+ var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
+ var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
+ 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();
+ if (/[\[\]{}\(\),\.]/.test(ch)) {
+ if (ch == "(" && beforeParams) state.inParams = true;
+ else if (ch == ")") state.inParams = false;
+ return null;
+ }
+ else if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ else if (ch == "\\") {
+ stream.eat("\\");
+ stream.eat(/./);
+ return "number";
+ }
+ else if (ch == "/" && stream.eat("*")) {
+ return chain(stream, state, tokenComment);
+ }
+ else if (ch == ";" && stream.match(/ *\( *\(/)) {
+ return chain(stream, state, tokenUnparsed);
+ }
+ else if (ch == ";" && !state.inParams) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ else if (ch == '"') {
+ stream.eat(/"/);
+ return "keyword";
+ }
+ else if (ch == "$") {
+ stream.eatWhile(/[$_a-z0-9A-Z\.:]/);
+ if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) {
+ return "keyword";
+ }
+ else {
+ state.beforeParams = true;
+ return "builtin";
+ }
+ }
+ else if (ch == "%") {
+ stream.eatWhile(/[^,^\s^\(^\)]/);
+ state.beforeParams = true;
+ return "string";
+ }
+ else if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+ else {
+ stream.eatWhile(/[\w\$_{}]/);
+ var word = stream.current().toLowerCase();
+ if (keywords && keywords.propertyIsEnumerable(word))
+ return "keyword";
+ if (functions && functions.propertyIsEnumerable(word)) {
+ state.beforeParams = true;
+ return "keyword";
+ }
+ return null;
+ }
+ }
+ 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";
+ }
+ return {
+ startState: function() {
+ return {
+ tokenize: tokenBase,
+ beforeParams: false,
+ inParams: false
+ };
+ },
+ token: function(stream, state) {
+ if (stream.eatSpace()) return null;
+ return state.tokenize(stream, state);
+ }
+ };
+});
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,181 @@
+<!doctype html>
+
+<title>CodeMirror: NGINX mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="nginx.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+ <link rel="stylesheet" href="../../doc/docs.css">
+ </head>
+
+ <style>
+ body {
+ margin: 0em auto;
+ }
+
+ .CodeMirror, .CodeMirror-scroll {
+ height: 600px;
+ }
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">NGINX</a>
+ </ul>
+</div>
+
+<article>
+<h2>NGINX mode</h2>
+<form><textarea id="code" name="code" style="height: 800px;">
+server {
+ listen 173.255.219.235:80;
+ server_name website.com.au;
+ rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
+}
+
+server {
+ listen 173.255.219.235:443;
+ server_name website.com.au;
+ rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
+}
+
+server {
+
+ listen 173.255.219.235:80;
+ server_name www.website.com.au;
+
+
+
+ root /data/www;
+ index index.html index.php;
+
+ location / {
+ index index.html index.php; ## Allow a static html file to be shown first
+ try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
+ expires 30d; ## Assume all files are cachable
+ }
+
+ ## These locations would be hidden by .htaccess normally
+ location /app/ { deny all; }
+ location /includes/ { deny all; }
+ location /lib/ { deny all; }
+ location /media/downloadable/ { deny all; }
+ location /pkginfo/ { deny all; }
+ location /report/config.xml { deny all; }
+ location /var/ { deny all; }
+
+ location /var/export/ { ## Allow admins only to view export folder
+ auth_basic "Restricted"; ## Message shown in login window
+ auth_basic_user_file /rs/passwords/testfile; ## See /etc/nginx/htpassword
+ autoindex on;
+ }
+
+ location /. { ## Disable .htaccess and other hidden files
+ return 404;
+ }
+
+ location @handler { ## Magento uses a common front handler
+ rewrite / /index.php;
+ }
+
+ location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
+ rewrite ^/(.*.php)/ /$1 last;
+ }
+
+ location ~ \.php$ {
+ if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
+
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include /rs/confs/nginx/fastcgi_params;
+ }
+
+}
+
+
+server {
+
+ listen 173.255.219.235:443;
+ server_name website.com.au www.website.com.au;
+
+ root /data/www;
+ index index.html index.php;
+
+ ssl on;
+ ssl_certificate /rs/ssl/ssl.crt;
+ ssl_certificate_key /rs/ssl/ssl.key;
+
+ ssl_session_timeout 5m;
+
+ ssl_protocols SSLv2 SSLv3 TLSv1;
+ ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
+ ssl_prefer_server_ciphers on;
+
+
+
+ location / {
+ index index.html index.php; ## Allow a static html file to be shown first
+ try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
+ expires 30d; ## Assume all files are cachable
+ }
+
+ ## These locations would be hidden by .htaccess normally
+ location /app/ { deny all; }
+ location /includes/ { deny all; }
+ location /lib/ { deny all; }
+ location /media/downloadable/ { deny all; }
+ location /pkginfo/ { deny all; }
+ location /report/config.xml { deny all; }
+ location /var/ { deny all; }
+
+ location /var/export/ { ## Allow admins only to view export folder
+ auth_basic "Restricted"; ## Message shown in login window
+ auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
+ autoindex on;
+ }
+
+ location /. { ## Disable .htaccess and other hidden files
+ return 404;
+ }
+
+ location @handler { ## Magento uses a common front handler
+ rewrite / /index.php;
+ }
+
+ location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
+ rewrite ^/(.*.php)/ /$1 last;
+ }
+
+ location ~ .php$ { ## Execute PHP scripts
+ if (!-e $request_filename) { rewrite /index.php last; } ## Catch 404s that try_files miss
+
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include /rs/confs/nginx/fastcgi_params;
+
+ fastcgi_param HTTPS on;
+ }
+
+}
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/nginx</code>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/nginx.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/nginx.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/nginx.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/nginx/nginx.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,163 @@
+CodeMirror.defineMode("nginx", 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(
+ /* ngxDirectiveControl */ "break return rewrite set" +
+ /* ngxDirective */ " accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fas
tcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_clien
t_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key prox
y_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in
_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core
worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"
+ );
+
+ var keywords_block = words(
+ /* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map"
+ );
+
+ var keywords_important = words(
+ /* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"
+ );
+
+ var indentUnit = config.indentUnit, type;
+ function ret(style, tp) {type = tp; return style;}
+
+ function tokenBase(stream, state) {
+
+
+ stream.eatWhile(/[\w\$_]/);
+
+ var cur = stream.current();
+
+
+ if (keywords.propertyIsEnumerable(cur)) {
+ return "keyword";
+ }
+ else if (keywords_block.propertyIsEnumerable(cur)) {
+ return "variable-2";
+ }
+ else if (keywords_important.propertyIsEnumerable(cur)) {
+ return "string-2";
+ }
+ /**/
+
+ 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.skipToEnd();
+ return ret("comment", "comment");
+ }
+ 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;
+ type = 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/nginx", "text/x-nginx-conf");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<title>CodeMirror: NTriples mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="ntriples.js"></script>
+<style type="text/css">
+ .CodeMirror {
+ border: 1px solid #eee;
+ }
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">NTriples</a>
+ </ul>
+</div>
+
+<article>
+<h2>NTriples mode</h2>
+<form>
+<textarea id="ntriples" name="ntriples">
+<http://Sub1> <http://pred1> <http://obj> .
+<http://Sub2> <http://pred2#an2> "literal 1" .
+<http://Sub3#an3> <http://pred3> _:bnode3 .
+_:bnode4 <http://pred4> "literal 2"@lang .
+_:bnode5 <http://pred5> "literal 3"^^<http://type> .
+</textarea>
+</form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("ntriples"), {});
+ </script>
+ <p><strong>MIME types defined:</strong> <code>text/n-triples</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/ntriples.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/ntriples.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/ntriples.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ntriples/ntriples.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,170 @@
+/**********************************************************
+* 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() {
+
+ var 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;
+ }
+
+ 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");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ocaml/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ocaml/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ocaml/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/ocaml/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,146 @@
+<!doctype html>
+
+<title>CodeMirror: OCaml mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src=../../addon/edit/matchbrackets.js></script>
+<script src=ocaml.js></script>
+<style type=text/css>
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">OCaml</a>
+ </ul>
+</div>
+
+<article>
+<h2>OCaml mode</h2>
+
+
+<textarea id=code>
+(* Summing a list of integers *)
+let rec sum xs =
+ match xs with
+ | [] -> 0
+ | x :: xs' -> x + sum xs'
+
+(* Quicksort *)
+let rec qsort = function
+ | [] -> []
+ | pivot :: rest ->
+ let is_less x = x < pivot in
+ let left, right = List.partition is_less rest in
+ qsort left @ [pivot] @ qsort right
+
+(* Fibonacci Sequence *)
+let rec fib_aux n a b =
+ match n with
+ | 0 -> a
+ | _ -> fib_aux (n - 1) (a + b) a
+let fib n = fib_aux n 0 1
+
+(* Birthday paradox *)
+let year_size = 365.
+
+let rec birthday_paradox prob people =
+ let prob' = (year_size -. float people) /. year_size *. prob in
+ if prob' < 0.5 then
+ Printf.printf "answer = %d\n" (people+1)
+ else
+ birthday_paradox prob' (people+1) ;;
+
+birthday_paradox 1.0 1
+
+(* Church numerals *)
+let zero f x = x
+let succ n f x = f (n f x)
+let one = succ zero
+let two = succ (succ zero)
+let add n1 n2 f x = n1 f (n2 f x)
+let to_string n = n (fun k -> "S" ^ k) "0"
+let _ = to_string (add (succ two) two)
+
+(* Elementary functions *)
+let square x = x * x;;
+let rec fact x =
+ if x <= 1 then 1 else x * fact (x - 1);;
+
+(* Automatic memory management *)
+let l = 1 :: 2 :: 3 :: [];;
+[1; 2; 3];;
+5 :: l;;
+
+(* Polymorphism: sorting lists *)
+let rec sort = function
+ | [] -> []
+ | x :: l -> insert x (sort l)
+
+and insert elem = function
+ | [] -> [elem]
+ | x :: l ->
+ if elem < x then elem :: x :: l else x :: insert elem l;;
+
+(* Imperative features *)
+let add_polynom p1 p2 =
+ let n1 = Array.length p1
+ and n2 = Array.length p2 in
+ let result = Array.create (max n1 n2) 0 in
+ for i = 0 to n1 - 1 do result.(i) <- p1.(i) done;
+ for i = 0 to n2 - 1 do result.(i) <- result.(i) + p2.(i) done;
+ result;;
+add_polynom [| 1; 2 |] [| 1; 2; 3 |];;
+
+(* We may redefine fact using a reference cell and a for loop *)
+let fact n =
+ let result = ref 1 in
+ for i = 2 to n do
+ result := i * !result
+ done;
+ !result;;
+fact 5;;
+
+(* Triangle (graphics) *)
+let () =
+ ignore( Glut.init Sys.argv );
+ Glut.initDisplayMode ~double_buffer:true ();
+ ignore (Glut.createWindow ~title:"OpenGL Demo");
+ let angle t = 10. *. t *. t in
+ let render () =
+ GlClear.clear [ `color ];
+ GlMat.load_identity ();
+ GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. ();
+ GlDraw.begins `triangles;
+ List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
+ GlDraw.ends ();
+ Glut.swapBuffers () in
+ GlMat.mode `modelview;
+ Glut.displayFunc ~cb:render;
+ Glut.idleFunc ~cb:(Some Glut.postRedisplay);
+ Glut.mainLoop ()
+
+(* A Hundred Lines of Caml - http://caml.inria.fr/about/taste.en.html *)
+(* OCaml page on Wikipedia - http://en.wikipedia.org/wiki/OCaml *)
+</textarea>
+
+<script>
+ var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+ mode: 'ocaml',
+ lineNumbers: true,
+ matchBrackets: true
+ });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-ocaml</code>.</p>
+</article>