projects
/
biaweb_qt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modified the template editing setup
[biaweb_qt.git]
/
highlighter.py
diff --git
a/highlighter.py
b/highlighter.py
index
95cfa90
..
3213755
100644
(file)
--- a/
highlighter.py
+++ b/
highlighter.py
@@
-9,16
+9,24
@@
class SimpleHtmlHighlighter (PyQt4.QtGui.QSyntaxHighlighter):
def highlightBlock (self, text):
# define the character highlight formats
def highlightBlock (self, text):
# define the character highlight formats
+
+ # for tags
charfmt1 = PyQt4.QtGui.QTextCharFormat ()
charfmt1.setFontWeight (PyQt4.QtGui.QFont.Bold)
charfmt1.setForeground (PyQt4.QtCore.Qt.blue)
charfmt1 = PyQt4.QtGui.QTextCharFormat ()
charfmt1.setFontWeight (PyQt4.QtGui.QFont.Bold)
charfmt1.setForeground (PyQt4.QtCore.Qt.blue)
+ # for strings
charfmt2 = PyQt4.QtGui.QTextCharFormat ()
charfmt2.setForeground (PyQt4.QtCore.Qt.darkGreen)
charfmt2 = PyQt4.QtGui.QTextCharFormat ()
charfmt2.setForeground (PyQt4.QtCore.Qt.darkGreen)
+ # for html entities
+ charfmt3 = PyQt4.QtGui.QTextCharFormat ()
+ charfmt3.setForeground (PyQt4.QtCore.Qt.magenta)
+
# matching regular expressions
htmltagexps = [ (PyQt4.QtCore.QRegExp ("<[^<>]+>"), charfmt1),
# matching regular expressions
htmltagexps = [ (PyQt4.QtCore.QRegExp ("<[^<>]+>"), charfmt1),
- (PyQt4.QtCore.QRegExp ("\"[^\"]+\""), charfmt2)
+ (PyQt4.QtCore.QRegExp ("\"[^\"]+\""), charfmt2),
+ (PyQt4.QtCore.QRegExp ("&[^;]+;"), charfmt3)
]
# run through the list of regular expressions to highlight
]
# run through the list of regular expressions to highlight