mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Plain text inside an html script tag
This commit is contained in:
@@ -150,21 +150,11 @@ abstract class BaseHtmlLexer extends DelegateLexer {
|
||||
|
||||
@NonNls String mimeType = TreeUtil.getTokenText(lexer);
|
||||
if (caseInsensitive) mimeType = mimeType.toLowerCase();
|
||||
if (supportMimeType(mimeType)) {
|
||||
scriptType = mimeType;
|
||||
}
|
||||
else {
|
||||
seenScript = false;
|
||||
seenTag = true; // will be switched of on tag name in end
|
||||
}
|
||||
scriptType = mimeType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean supportMimeType(String mimeType) {
|
||||
return findScriptContentProvider(mimeType) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IElementType getCurrentScriptElementType() {
|
||||
HtmlScriptContentProvider scriptContentProvider = findScriptContentProvider(scriptType);
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.lang.HtmlInlineScriptTokenTypesProvider;
|
||||
import com.intellij.lang.HtmlScriptContentProvider;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.LanguageHtmlInlineScriptTokenTypesProvider;
|
||||
import com.intellij.lang.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
@@ -124,7 +121,11 @@ public class HtmlHighlightingLexer extends BaseHtmlLexer {
|
||||
if (scriptLexer == null) {
|
||||
if (hasSeenTag()) {
|
||||
HtmlScriptContentProvider provider = findScriptContentProvider(scriptType);
|
||||
scriptLexer = provider != null ? provider.getHighlightingLexer() : null;
|
||||
if (provider != null) {
|
||||
scriptLexer = provider.getHighlightingLexer();
|
||||
} else {
|
||||
scriptLexer = SyntaxHighlighterFactory.getSyntaxHighlighter(StdLanguages.TEXT, null, null).getHighlightingLexer();
|
||||
}
|
||||
}
|
||||
else if (hasSeenAttribute()) {
|
||||
SyntaxHighlighter syntaxHighlighter =
|
||||
|
||||
@@ -75,10 +75,10 @@ public class HtmlLexer extends BaseHtmlLexer {
|
||||
tokenType = ourInlineStyleElementType;
|
||||
}
|
||||
} else if (hasSeenScript()) {
|
||||
IElementType currentScriptElementType = getCurrentScriptElementType();
|
||||
if (hasSeenTag() && currentScriptElementType != null && isStartOfEmbeddmentTagContent(tokenType)) {
|
||||
if (hasSeenTag() && isStartOfEmbeddmentTagContent(tokenType)) {
|
||||
myTokenEnd = skipToTheEndOfTheEmbeddment();
|
||||
tokenType = currentScriptElementType;
|
||||
IElementType currentScriptElementType = getCurrentScriptElementType();
|
||||
tokenType = currentScriptElementType == null ? XmlTokenType.XML_DATA_CHARACTERS : currentScriptElementType;
|
||||
} else if (hasSeenAttribute() && isStartOfEmbeddmentAttributeValue(tokenType) && ourInlineScriptElementType!=null) {
|
||||
myTokenEnd = skipToTheEndOfTheEmbeddment();
|
||||
tokenType = ourInlineScriptElementType;
|
||||
|
||||
Reference in New Issue
Block a user