From 1af558c6da91cbbe669665e5a70cca06febaa0cd Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 18 May 2010 01:11:30 +0000 Subject: Fix for bug #3002874 make Django template highlighting work also within Javascript and other script regions of html files. --- src/LexHTML.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index a3d883ab8..9bec3a214 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -642,6 +642,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { scriptLanguage = eScriptComment; } + script_type beforeLanguage = ScriptOfState(beforePreProc); // property fold.html // Folding is turned on or off for HTML and XML files with this option. @@ -948,7 +949,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } // handle the start Django template code - else if (isDjango && scriptLanguage == eScriptNone && (ch == '{' && (chNext == '%' || chNext == '{'))) { + else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) { if (chNext == '%') strcpy(djangoBlockType, "%"); else @@ -963,6 +964,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty i += 1; visibleChars += 1; state = SCE_HP_START; + beforeLanguage = scriptLanguage; scriptLanguage = eScriptPython; styler.ColourTo(i, SCE_H_ASP); if (foldHTMLPreprocessor && chNext == '%') @@ -1096,7 +1098,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (foldHTMLPreprocessor) { levelCurrent--; } - scriptLanguage = eScriptNone; + scriptLanguage = beforeLanguage; continue; } -- cgit v1.2.3