1
0
mirror of https://github.com/scopatz/nanorc synced 2024-11-25 01:45:39 +01:00

Merge pull request #203 from simon-v/html-improvements

Update HTML highlighting ruleset and merge Jinja2 templating rules into it
This commit is contained in:
Anthony Scopatz 2019-01-05 12:55:54 -05:00 committed by GitHub
commit 00ed4d7ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 25 deletions

View File

@ -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="<!--" end="-->"
## Trailing spaces
color ,green "[[:space:]]+$"
## Jinja templating
color green "\{{2}.*\}{2}"
color green "\{\%.*\%\}"
color brightcyan "(if|endif|for)"

1
html.j2.nanorc Symbolic link
View File

@ -0,0 +1 @@
html.nanorc

View File

@ -1,11 +1,41 @@
## Here is a short improved example for HTML. ## HTML syntax highlighting rules for Nano
##
syntax "HTML" "\.htm[l]?$" syntax "HTML" "\.html?(.j2)?$"
color brightblue start="<" end=">" magic "HTML document"
color red "&[^;[[:space:]]]*;" comment "<!--|-->"
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)=" ## Emphasis tags
color magenta start="<!--" end="-->" color brightwhite start="<([biu]|em|strong)[^>]*>" end="</([biu]|em|strong)>"
## 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="<!--" end="-->"
## Trailing spaces ## Trailing spaces
color ,green "[[:space:]]+$" color ,green "[[:space:]]+$"
## Reminders
color brightwhite,yellow "(FIXME|TODO|XXX)"