From 671d2b94996ac71d56b2d05d5fe694ed7d84fa59 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 4 Apr 2012 12:27:35 -0700 Subject: upgrading to CodeMirror 2.23, since it has an important fix to Not close Ninja, if backspace is pressed while autocomplete dropdown is open. Signed-off-by: Ananya Sen --- imports/codemirror/mode/tiddlywiki/index.html | 69 ++++------------------ imports/codemirror/mode/tiddlywiki/tiddlywiki.css | 2 +- imports/codemirror/mode/tiddlywiki/tiddlywiki.js | 72 +++++++++++++---------- 3 files changed, 55 insertions(+), 88 deletions(-) (limited to 'imports/codemirror/mode/tiddlywiki') diff --git a/imports/codemirror/mode/tiddlywiki/index.html b/imports/codemirror/mode/tiddlywiki/index.html index 36d0975c..2f7da0e0 100644 --- a/imports/codemirror/mode/tiddlywiki/index.html +++ b/imports/codemirror/mode/tiddlywiki/index.html @@ -16,27 +16,18 @@ !TiddlyWiki Formatting * Rendered versions can be found at: http://www.tiddlywiki.com/#Reference -|!Option|!Syntax|!Output| -|bold font|{{{''bold''}}}|''bold''| -|italic type|{{{//italic//}}}|//italic//| -|underlined text|{{{__underlined__}}}|__underlined__| -|strikethrough text|{{{--strikethrough--}}}|--strikethrough--| -|superscript text|{{{^^super^^script}}}|^^super^^script| -|subscript text|{{{~~sub~~script}}}|~~sub~~script| -|highlighted text|{{{@@highlighted@@}}}|@@highlighted@@| -|preformatted text|{{{preformatted}}}|{{{preformatted}}}| +|!Option | !Syntax | +|bold font | ''bold'' | +|italic type | //italic// | +|underlined text | __underlined__ | +|strikethrough text | --strikethrough-- | +|superscript text | super^^script^^ | +|subscript text | sub~~script~~ | +|highlighted text | @@highlighted@@ | +|preformatted text | {{{preformatted}}} | !Block Elements -!!Headings -{{{ -!Heading 1 -!!Heading 2 -!!!Heading 3 -!!!!Heading 4 -!!!!!Heading 5 -}}} <<< - !Heading 1 !!Heading 2 @@ -49,18 +40,6 @@ <<< !!Lists -{{{ -* unordered list, level 1 -** unordered list, level 2 -*** unordered list, level 3 - -# ordered list, level 1 -## ordered list, level 2 -### unordered list, level 3 - -; definition list, term -: definition list, description -}}} <<< * unordered list, level 1 ** unordered list, level 2 @@ -75,15 +54,6 @@ <<< !!Blockquotes -{{{ -> blockquote, level 1 ->> blockquote, level 2 ->>> blockquote, level 3 - -<<< -blockquote -<<< -}}} <<< > blockquote, level 1 >> blockquote, level 2 @@ -93,11 +63,6 @@ blockquote <<< !!Preformatted Text -
-{{{
-preformatted (e.g. code)
-}}}
-
<<< {{{ preformatted (e.g. code) @@ -105,6 +70,7 @@ preformatted (e.g. code) <<< !!Code Sections +<<< {{{ Text style code }}} @@ -116,9 +82,10 @@ JS styled code. TiddlyWiki mixed mode should support highlighter switching in th XML styled code. TiddlyWiki mixed mode should support highlighter switching in the future. +<<< !!Tables -{{{ +<<< |CssClass|k |!heading column 1|!heading column 2| |row 1, column 1|row 1, column 2| @@ -128,21 +95,11 @@ XML styled code. TiddlyWiki mixed mode should support highlighter switching in t |~| ... | |CssProperty:value;...| ... | |caption|c -}}} + ''Annotation:'' * The {{{>}}} marker creates a "colspan", causing the current cell to merge with the one to the right. * The {{{~}}} marker creates a "rowspan", causing the current cell to merge with the one above. <<< -|CssClass|k -|!heading column 1|!heading column 2| -|row 1, column 1|row 1, column 2| -|row 2, column 1|row 2, column 2| -|>|COLSPAN| -|ROWSPAN| ... | -|~| ... | -|CssProperty:value;...| ... | -|caption|c -<<< !!Images /% TODO %/ cf. [[TiddlyWiki.com|http://www.tiddlywiki.com/#EmbeddedImages]] diff --git a/imports/codemirror/mode/tiddlywiki/tiddlywiki.css b/imports/codemirror/mode/tiddlywiki/tiddlywiki.css index 767f3de2..dba05c0f 100644 --- a/imports/codemirror/mode/tiddlywiki/tiddlywiki.css +++ b/imports/codemirror/mode/tiddlywiki/tiddlywiki.css @@ -11,7 +11,7 @@ .cm-s-default span.cm-link-external {color: blue;} .cm-s-default span.cm-brace {color: #170; font-weight: bold;} .cm-s-default span.cm-macro {color: #9E3825;} -.cm-s-default span.cm-table {color: blue;} +.cm-s-default span.cm-table {color: blue; font-weight: bold;} .cm-s-default span.cm-warning {color: red; font-weight: bold;} .cm-s-default span.cm-underlined {text-decoration: underline;} diff --git a/imports/codemirror/mode/tiddlywiki/tiddlywiki.js b/imports/codemirror/mode/tiddlywiki/tiddlywiki.js index e07124c2..1d26967e 100644 --- a/imports/codemirror/mode/tiddlywiki/tiddlywiki.js +++ b/imports/codemirror/mode/tiddlywiki/tiddlywiki.js @@ -1,18 +1,18 @@ /*** - |''Name''|tiddlywiki.js| - |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror2| - |''Author''|PMario| - |''Version''|0.1.6| - |''Status''|''beta''| - |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| - |''Documentation''|http://codemirror.tiddlyspace.com/| - |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| - |''CoreVersion''|2.5.0| - |''Requires''|codemirror.js| - |''Keywords''|syntax highlighting color code mirror codemirror| - ! Info - CoreVersion parameter is needed for TiddlyWiki only! - ***/ +|''Name''|tiddlywiki.js| +|''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| +|''Author''|PMario| +|''Version''|0.1.7| +|''Status''|''stable''| +|''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| +|''Documentation''|http://codemirror.tiddlyspace.com/| +|''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]| +|''CoreVersion''|2.5.0| +|''Requires''|codemirror.js| +|''Keywords''|syntax highlighting color code mirror codemirror| +! Info +CoreVersion parameter is needed for TiddlyWiki only! +***/ //{{{ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { var indentUnit = config.indentUnit; @@ -47,20 +47,20 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { }(); var isSpaceName = /[\w_\-]/i, - reHR = /^\-\-\-\-+$/, + reHR = /^\-\-\-\-+$/, //
reWikiCommentStart = /^\/\*\*\*$/, // /*** reWikiCommentStop = /^\*\*\*\/$/, // ***/ reBlockQuote = /^<<<$/, - reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ - reJsCodeStop = /^\/\/\}\}\}$/, // //}}} - reXmlCodeStart = /^$/, - reXmlCodeStop = /^$/, + reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start + reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop + reXmlCodeStart = /^$/, // xml block start + reXmlCodeStop = /^$/, // xml stop - reCodeBlockStart = /^\{\{\{$/, - reCodeBlockStop = /^\}\}\}$/, + reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start + reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop - reCodeStart = /\{\{\{/, + reCodeStart = /\{\{\{/, // {{{ code span start reUntilCodeStop = /.*?\}\}\}/; function chain(stream, state, f) { @@ -95,9 +95,9 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { state.block = false; // indicates the start of a code block. - ch = stream.peek(); // don't eat, to make match simpler + ch = stream.peek(); // don't eat, to make matching simpler - // check start of blocks + // check start of blocks if (sol && /[<\/\*{}\-]/.test(ch)) { if (stream.match(reCodeBlockStart)) { state.block = true; @@ -116,7 +116,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { return ret('hr', 'hr'); } } // sol - var ch = stream.next(); + ch = stream.next(); if (sol && /[\/\*!#;:>|]/.test(ch)) { if (ch == "!") { // tw header @@ -131,11 +131,11 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { stream.eatWhile('#'); return ret("list", "list"); } - if (ch == ";") { // tw list + if (ch == ";") { // definition list, term stream.eatWhile(';'); return ret("list", "list"); } - if (ch == ":") { // tw list + if (ch == ":") { // definition list, description stream.eatWhile(':'); return ret("list", "list"); } @@ -162,6 +162,9 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { if (ch == '"') { return ret('string', 'string'); } + if (ch == '~') { // _no_ CamelCase indicator should be bold + return ret('text', 'brace'); + } if (/[\[\]]/.test(ch)) { // check for [[..]] if (stream.peek() == ch) { stream.next(); @@ -189,9 +192,15 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { return chain(stream, state, twTokenUnderline); } } - if (ch == "-") { // tw strikethrough TODO looks ugly .. different handling see below; + // strikethrough and mdash handling + if (ch == "-") { if (stream.eat("-")) { - return chain(stream, state, twTokenStrike); + // if strikethrough looks ugly, change CSS. + if (stream.peek() != ' ') + return chain(stream, state, twTokenStrike); + // mdash + if (stream.peek() == ' ') + return ret('text', 'brace'); } } if (ch == "'") { // tw bold @@ -208,6 +217,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { return ret(ch); } + // core macro handling stream.eatWhile(/[\w\$_]/); var word = stream.current(), known = textwords.propertyIsEnumerable(word) && textwords[word]; @@ -301,8 +311,8 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) { return ret("text", "underlined"); } - // tw strike through text looks ugly - // TODO just strike through the first and last 2 chars if possible. + // tw strike through text looks ugly + // change CSS if needed function twTokenStrike(stream, state) { var maybeEnd = false, ch, nr; -- cgit v1.2.3