From 40f8ca0d07e3900f33123480d9e0c7a6fdbdfd2f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 23 Oct 2019 10:07:41 +0200 Subject: [PATCH] syntax: html: colorize only full attributes, and colorize strings later Attribute names that are a part of another word should not be colored, nor should attribute names within strings. This addresses the other half of https://savannah.gnu.org/patch/?9865. Original-patch-by: Ryan Westlund --- syntax/html.nanorc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/syntax/html.nanorc b/syntax/html.nanorc index 05075127..194af884 100644 --- a/syntax/html.nanorc +++ b/syntax/html.nanorc @@ -11,18 +11,19 @@ color brightmagenta "" # Named character references: color red "&[^;[:space:]]*;" + +# Attributes: +color red "\<(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)=" +color red "\<(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)=" +color red "\<(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)=" +color red "\<(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)=" +color red "\<(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)=" +color red "\<(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)=" +color red "\<(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)=" +color red "\<(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)=" + # Strings: color green ""(\\.|[^"])*"" -# Attributes: -color red "(abbr|accept(-charset)?|accesskey|action|alink|align|alt|archive|axis|background|bgcolor|border)=" -color red "(cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)=" -color red "(content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|disabled|enctype)=" -color red "(for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)=" -color red "(label|lang|link|longdesc|margin(height|width)|maxlength|media|method|multiple)=" -color red "(name|nohref|noresize|noshade|object|onclick|onfocus|onload|onmouseover|profile|readonly|rel|rev)=" -color red "(rows(pan)?|rules|scheme|scope|scrolling|selected|shape|size|span|src|standby|start|style|summary)=" -color red "(tabindex|target|text|title|type|usemap|valign|value(type)?|vlink|vspace|width|xmlns|xml:space)=" - # Comments: color yellow start=""