diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-11 07:09:37 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-11 07:09:37 -0400 |
commit | f9729e0a6b15c3d977f6b6e6e9060a554dbe23e0 (patch) | |
tree | e6a007eb8aa84a550f0b7cc7d3a59addb759dfe7 /src-qt5/desktop-utils | |
parent | Add support for a new "file_regex" flag in the JSON syntax manifests that can... (diff) | |
download | lumina-f9729e0a6b15c3d977f6b6e6e9060a554dbe23e0.tar.gz lumina-f9729e0a6b15c3d977f6b6e6e9060a554dbe23e0.tar.bz2 lumina-f9729e0a6b15c3d977f6b6e6e9060a554dbe23e0.zip |
Add an XML syntax highlighting rule to LTE. Seems fully-functional.
Diffstat (limited to 'src-qt5/desktop-utils')
3 files changed, 75 insertions, 12 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp index e5286e7b..646c2e98 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp @@ -175,10 +175,6 @@ QStringList Custom_Syntax::availableRules(QSettings *settings){ QStringList avail; QList<SyntaxFile> files = SyntaxFile::availableFiles(settings); for(int i=0; i<files.length(); i++){ avail << files[i].name(); } - /*avail << "C++"; - //avail << "Python"; - avail << "Shell"; - avail << "reST";*/ return avail; } diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h index d168b70f..bffbfd1a 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h @@ -24,11 +24,6 @@ struct SyntaxRule{ QRegExp startPattern, endPattern; //multi-line rules QTextCharFormat format; }; -//Complicated/multi-line rules -struct SyntaxRuleSplit{ - QRegExp startPattern, endPattern; - QTextCharFormat format; -}; class SyntaxFile{ private: @@ -63,10 +58,7 @@ class Custom_Syntax : public QSyntaxHighlighter{ Q_OBJECT private: QSettings *settings; - //QString lasttype; SyntaxFile syntax; - //QVector<SyntaxRule> rules; - //QVector<SyntaxRuleSplit> splitrules; public: Custom_Syntax(QSettings *set, QTextDocument *parent = 0) : QSyntaxHighlighter(parent){ diff --git a/src-qt5/desktop-utils/lumina-textedit/syntax_rules/xml.syntax b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/xml.syntax new file mode 100644 index 00000000..3ceb22fa --- /dev/null +++ b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/xml.syntax @@ -0,0 +1,75 @@ +# Syntax support file for the Lumina Text Editor +# =================================== +# XML language support rules +# Written by Ken Moore <ken@ixsystems.com> +# Released under the 2-clause BSD license +# =================================== + +{ + "meta": { + "name": "XML", + "file_suffix": ["xml", "xslt", "jsx", "jrs"] + }, + "format": { + "line_wrap": false, + "highlight_whitespace_eol" : true, + "columns_per_line" : 70, + "font_type" : "monospace", + "tab_width": 8 + }, + "rules": [{ + "name": "8 spaces rather than a tab", + "regex": "([ ]{8})+", + "background": "colors/bracket-missing" + }, + { + "name": "tabs after spaces", + "regex": "( )+\\t", + "background": "colors/bracket-missing" + }, + { + "name" : "odd number of spaces within indentation", + "regex": "(^|\\t)([ ]{2})*[ ](?=\\<)", + "background": "colors/bracket-missing" + }, + { + "name" : "ID of a tag", + "regex": "<[^> ]+[>]?", + "font_weight" : "bold", + "foreground" : "colors/function" + }, + { + "name" : "tag modifiers", + "regex" : "\\s[^\\= ]+(?=\\=)", + "foreground" : "colors/class" + }, + { + "name" : "strings inside a tag", + "regex": "\\\"[^\\\"]*\\\"", + "foreground" : "colors/text" + }, + { + "name" : "comment", + "regex_start" : "<!DOCTYPE", + "regex_end" : "[/]?>", + "foreground" : "colors/comment" + }, + { + "name" : "comment", + "regex_start" : "<!--", + "regex_end" : "-->", + "foreground" : "colors/comment" + }, + { + "name" : "escapes", + "regex" : "&[^;]*;", + "foreground" : "colors/preprocessor" + }, + { + "name" : "XML preprocessor", + "regex_start" : "\\<\\?xml ", + "regex_end" : "\\?>", + "foreground" : "colors/preprocessor" + } + ] +} |