aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-04-06 09:52:24 +1000
committernyamatongwe <unknown>2011-04-06 09:52:24 +1000
commit27bc1530f3e369105377fa2de8e200c85d42aa52 (patch)
tree442221521a8ed5cea76b80946330c2cd7ee98003
parentb733adddc30795c140316a914406fbd1afdfdfa9 (diff)
downloadscintilla-mirror-27bc1530f3e369105377fa2de8e200c85d42aa52.tar.gz
Django in HTML lexer recognizes {# #} comments. Bug #3013798.
From Stephan R.A. Deibel at Wingware.
-rw-r--r--lexers/LexHTML.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx
index ae4b74c7d..fe681cc9d 100644
--- a/lexers/LexHTML.cxx
+++ b/lexers/LexHTML.cxx
@@ -955,6 +955,37 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
continue;
}
+ // handle the start/end of Django comment
+ else if (isDjango && state != SCE_H_COMMENT && (ch == '{' && chNext == '#')) {
+ styler.ColourTo(i - 1, StateToPrint);
+ beforePreProc = state;
+ beforeLanguage = scriptLanguage;
+ if (inScriptType == eNonHtmlScript)
+ inScriptType = eNonHtmlScriptPreProc;
+ else
+ inScriptType = eNonHtmlPreProc;
+ i += 1;
+ visibleChars += 1;
+ scriptLanguage = eScriptComment;
+ state = SCE_H_COMMENT;
+ styler.ColourTo(i, SCE_H_ASP);
+ ch = static_cast<unsigned char>(styler.SafeGetCharAt(i));
+ continue;
+ }
+ else if (isDjango && state == SCE_H_COMMENT && (ch == '#' && chNext == '}')) {
+ styler.ColourTo(i - 1, StateToPrint);
+ i += 1;
+ visibleChars += 1;
+ styler.ColourTo(i, SCE_H_ASP);
+ state = beforePreProc;
+ if (inScriptType == eNonHtmlScriptPreProc)
+ inScriptType = eNonHtmlScript;
+ else
+ inScriptType = eHtml;
+ scriptLanguage = beforeLanguage;
+ continue;
+ }
+
// handle the start Django template code
else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) {
if (chNext == '%')