Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: Frank Lanitz frank@frank.uvena.de Date: Thu, 31 Oct 2013 07:55:15 UTC Commit: a46a5500c5eb0679251438740d55a4e707fe8e52 https://github.com/geany/geany-plugins/commit/a46a5500c5eb0679251438740d55a4...
Log Message: ----------- Merge pull request #122 from vmkononenko/master
PairTagHighlighter: add empty tags checking
Modified Paths: -------------- pairtaghighlighter/src/pair_tag_highlighter.c
Modified: pairtaghighlighter/src/pair_tag_highlighter.c 22 files changed, 20 insertions(+), 2 deletions(-) =================================================================== @@ -138,6 +138,23 @@ static gboolean is_tag_self_closing(ScintillaObject *sci, gint closingBracket) }
+static gboolean is_tag_empty(gchar *tagName) +{ + const char *emptyTags[] = {"area", "base", "br", "col", "embed", + "hr", "img", "input", "keygen", "link", "meta", + "param", "source", "track", "wbr", "!DOCTYPE"}; + + int i; + for(i=0; i<(sizeof(emptyTags)/sizeof(emptyTags[0])); i++) + { + if(strcmp(tagName, emptyTags[i]) == 0) + return TRUE; + } + + return FALSE; +} + + static gboolean is_tag_opening(ScintillaObject *sci, gint openingBracket) { gboolean isTagOpening = TRUE; @@ -281,10 +298,11 @@ static void findMatchingTag(ScintillaObject *sci, gint openingBracket, gint clos gchar tagName[MAX_TAG_NAME]; gboolean isTagOpening = is_tag_opening(sci, openingBracket);
- if(is_tag_self_closing(sci, closingBracket)) { + get_tag_name(sci, openingBracket, closingBracket, tagName, isTagOpening); + + if(is_tag_self_closing(sci, closingBracket) || is_tag_empty(tagName)) { highlight_tag(sci, openingBracket, closingBracket, EMPTY_TAG_COLOR); } else { - get_tag_name(sci, openingBracket, closingBracket, tagName, isTagOpening); if(isTagOpening) findMatchingClosingTag(sci, tagName, closingBracket); else
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org