--- a/eric6/QScintilla/Lexers/LexerHTML.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/QScintilla/Lexers/LexerHTML.py Thu Apr 15 18:11:24 2021 +0200 @@ -7,6 +7,8 @@ Module implementing a HTML lexer with some additional methods. """ +import contextlib + from PyQt5.Qsci import QsciLexerHTML from .Lexer import Lexer @@ -48,19 +50,15 @@ self.setCaseSensitiveTags( Preferences.getEditor("HtmlCaseSensitiveTags")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) - try: + with contextlib.suppress(AttributeError): self.setFoldScriptComments( Preferences.getEditor("HtmlFoldScriptComments")) self.setFoldScriptHeredocs( Preferences.getEditor("HtmlFoldScriptHeredocs")) - except AttributeError: - pass - try: + with contextlib.suppress(AttributeError): self.setDjangoTemplates( Preferences.getEditor("HtmlDjangoTemplates")) self.setMakoTemplates(Preferences.getEditor("HtmlMakoTemplates")) - except AttributeError: - pass def isCommentStyle(self, style): """