From 92baad770c2633bef4c7eb14b17738600f13d111 Mon Sep 17 00:00:00 2001 From: Simon Volpert Date: Sat, 5 Jan 2019 13:53:26 +0200 Subject: [PATCH] Update HTML highlighting ruleset and merge J2 templating rules into it --- html.j2.nanorc | 17 ----------------- html.nanorc | 46 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 25 deletions(-) delete mode 100644 html.j2.nanorc diff --git a/html.j2.nanorc b/html.j2.nanorc deleted file mode 100644 index ff14a972..00000000 --- a/html.j2.nanorc +++ /dev/null @@ -1,17 +0,0 @@ -## Here is a short improved example for HTML. -## -syntax "HTML" "\.htm[l]?.j2$" -color brightblue start="<" end=">" -color red "&[^;[[:space:]]]*;" -color yellow ""[^"]*"|qq\|.*\|" -color red "(action|alt|bgcolor|height|href|id|label|longdesc|method|name|onclick|onfocus|onload|onmouseover|rel|size|span|src|style|target|title|type|value|width)=" -color magenta start="" - -## Trailing spaces -color ,green "[[:space:]]+$" - -## Jinja templating -color green "\{{2}.*\}{2}" -color green "\{\%.*\%\}" -color brightcyan "(if|endif|for)" - diff --git a/html.nanorc b/html.nanorc index dd019656..4f225d88 100644 --- a/html.nanorc +++ b/html.nanorc @@ -1,11 +1,41 @@ -## Here is a short improved example for HTML. -## -syntax "HTML" "\.htm[l]?$" -color brightblue start="<" end=">" -color red "&[^;[[:space:]]]*;" -color yellow ""[^"]*"|qq\|.*\|" -color red "(action|alt|bgcolor|height|href|id|label|longdesc|method|name|onclick|onfocus|onload|onmouseover|rel|size|span|src|style|target|title|type|value|width)=" -color magenta start="" +## HTML syntax highlighting rules for Nano + +syntax "HTML" "\.html?(.j2)?$" +magic "HTML document" +comment "" + +## Emphasis tags +color brightwhite start="<([biu]|em|strong)[^>]*>" end="" + +## Tags +color cyan start="<" end=">" + +## Attributes +color brightblue "[[:space:]](abbr|accept(-charset)?|accesskey|action|[av]?link|alt|archive|axis|background|(bg)?color|border)=" +color brightblue "[[:space:]](cell(padding|spacing)|char(off|set)?|checked|cite|class(id)?|compact|code(base|tag)?|cols(pan)?)=" +color brightblue "[[:space:]](content(editable)?|contextmenu|coords|data|datetime|declare|defer|dir|enctype)=" +color brightblue "[[:space:]](for|frame(border)?|headers|height|hidden|href(lang)?|hspace|http-equiv|id|ismap)=" +color brightblue "[[:space:]](label|lang|longdesc|margin(height|width)|maxlength|media|method|multiple)=" +color brightblue "[[:space:]](name|nohref|noresize|noshade|object|on(click|focus|load|mouseover|keypress)|profile|readonly|rel|rev)=" +color brightblue "[[:space:]](rows(pan)?|rules|scheme|scope|scrolling|shape|size|span|src|standby|start|style|summary|pattern)=" +color brightblue "[[:space:]](tabindex|target|text|title|type|usemap|v?align|value(type)?|vspace|width|xmlns|xml:space)=" +color brightblue "[[:space:]](required|disabled|selected)[[:space:]=>]" + +## Strings +color yellow ""(\\.|[^"])*"" + +## Named character references and entities +color red "&#?[[:alnum:]]*;" + +## Template strings (not in the HTML spec, but very commonly used) +color magenta "\{[^\}]*\}" +color brightgreen "[[:space:]]((end)?if|(end)?for|in|not|(end)?block)[[:space:]]" + +## Comments +color green start="" ## Trailing spaces color ,green "[[:space:]]+$" + +## Reminders +color brightwhite,yellow "(FIXME|TODO|XXX)"