eric6/QScintilla/Lexers/LexerHTML.py

changeset 8243
cc717c2ae956
parent 7923
91e843545d9a
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a HTML lexer with some additional methods. 7 Module implementing a HTML lexer with some additional methods.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.Qsci import QsciLexerHTML 12 from PyQt5.Qsci import QsciLexerHTML
11 13
12 from .Lexer import Lexer 14 from .Lexer import Lexer
13 import Preferences 15 import Preferences
46 """ 48 """
47 self.setFoldPreprocessor(Preferences.getEditor("HtmlFoldPreprocessor")) 49 self.setFoldPreprocessor(Preferences.getEditor("HtmlFoldPreprocessor"))
48 self.setCaseSensitiveTags( 50 self.setCaseSensitiveTags(
49 Preferences.getEditor("HtmlCaseSensitiveTags")) 51 Preferences.getEditor("HtmlCaseSensitiveTags"))
50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) 52 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
51 try: 53 with contextlib.suppress(AttributeError):
52 self.setFoldScriptComments( 54 self.setFoldScriptComments(
53 Preferences.getEditor("HtmlFoldScriptComments")) 55 Preferences.getEditor("HtmlFoldScriptComments"))
54 self.setFoldScriptHeredocs( 56 self.setFoldScriptHeredocs(
55 Preferences.getEditor("HtmlFoldScriptHeredocs")) 57 Preferences.getEditor("HtmlFoldScriptHeredocs"))
56 except AttributeError: 58 with contextlib.suppress(AttributeError):
57 pass
58 try:
59 self.setDjangoTemplates( 59 self.setDjangoTemplates(
60 Preferences.getEditor("HtmlDjangoTemplates")) 60 Preferences.getEditor("HtmlDjangoTemplates"))
61 self.setMakoTemplates(Preferences.getEditor("HtmlMakoTemplates")) 61 self.setMakoTemplates(Preferences.getEditor("HtmlMakoTemplates"))
62 except AttributeError:
63 pass
64 62
65 def isCommentStyle(self, style): 63 def isCommentStyle(self, style):
66 """ 64 """
67 Public method to check, if a style is a comment style. 65 Public method to check, if a style is a comment style.
68 66

eric ide

mercurial