Author: anoopknayak
Date: Fri Oct 4 16:26:57 2013
New Revision: 1529207
URL: http://svn.apache.org/r1529207
Log:
Updated code to highlight camelCase words which indicate the WikiPageNames
Modified:
bloodhound/branches/livesyntaxhighlighting/bloodhound_livesyntaxhighlighting/bhlivesyntaxhighlight/htdocs/js/wikimarkup.js
Modified:
bloodhound/branches/livesyntaxhighlighting/bloodhound_livesyntaxhighlighting/bhlivesyntaxhighlight/htdocs/js/wikimarkup.js
URL:
http://svn.apache.org/viewvc/bloodhound/branches/livesyntaxhighlighting/bloodhound_livesyntaxhighlighting/bhlivesyntaxhighlight/htdocs/js/wikimarkup.js?rev=1529207&r1=1529206&r2=1529207&view=diff
==============================================================================
---
bloodhound/branches/livesyntaxhighlighting/bloodhound_livesyntaxhighlighting/bhlivesyntaxhighlight/htdocs/js/wikimarkup.js
(original)
+++
bloodhound/branches/livesyntaxhighlighting/bloodhound_livesyntaxhighlighting/bhlivesyntaxhighlight/htdocs/js/wikimarkup.js
Fri Oct 4 16:26:57 2013
@@ -24,7 +24,6 @@ CodeMirror.defineMode('wikimarkup', func
return style;
};
}
-
function inText(stream, state) {
function chain(parser) {
state.tokenize = parser;
@@ -34,6 +33,7 @@ CodeMirror.defineMode('wikimarkup', func
var sol = stream.sol();
var ch = stream.next();
+
//non start of line
switch (ch) { //switch is generally much faster than if, so it is used
here
case "{": //plugin
@@ -64,12 +64,6 @@ CodeMirror.defineMode('wikimarkup', func
return chain(inBlock("em", "''", inText));
}
break;
-// case "'": //italics
-// if (stream.eat("'")) {
-// // Italic text
-// return chain(inBlock("em", "''", inText));
-// }
-// break;
case "(":// Wiki Link
if (stream.eat("(")) {
return chain(inBlock("variable-2", "))", inText));
@@ -83,7 +77,7 @@ CodeMirror.defineMode('wikimarkup', func
if(stream.eat("="))
return chain(inBlock("header comment","=||", inText));
else if(stream.eat("|") )
- return chain(inBlock("comment", "||"));
+ return chain(inBlock("comment", "||"));
}
break;
case "~":
@@ -126,7 +120,6 @@ CodeMirror.defineMode('wikimarkup', func
else
return chain(inBlock("wm-header1","="));
break;
-
}
//start of line types
@@ -141,6 +134,17 @@ CodeMirror.defineMode('wikimarkup', func
break;
}
}
+ // For matching wikiPageNames. Basically matches CamelCase
+ // TO DETECT CAMEL CASE - Needs a fix badly
+ if(ch >= "A" && ch <= "Z"){
+
if(stream.match(/([A-Z]*[a-z][a-z]*[A-Z]|[a-z]*[A-Z][A-Z]*[a-z])[A-Za-z]*/)){
+ var string = stream.string;
+ return chain(inBlock("variable-2", " ", inText));
+ }
+ }
+ else{
+ stream.eatSpace();
+ }
//stream.eatWhile(/[&{]/); was eating up plugins, turned off to act
less like html and more like wikimarkup
return null;