nano/syntax/xml.nanorc
Benno Schulenberg a3102cd4cf syntax: xml: recognize an XML file also by its first line
Some .rdf files are XML, but the .rdf extension seems to be used
also for other things.  So... use the 'header' mechanism.
2017-05-07 20:02:20 +02:00

23 lines
534 B
Plaintext

## Here is an example for XML files.
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
header "<\?xml.*version=.*\?>"
magic "(XML|SGML) (sub)?document text"
comment "<!--|-->"
# The entire content of the tag:
color green start="<" end=">"
# The start and the end of the tag:
color cyan "<[^> ]+" ">"
# The strings inside the tag:
color magenta "\"[^"]*\""
# Comments:
color yellow start="<!DOCTYPE" end="[/]?>"
color yellow start="<!--" end="-->"
# Escapes:
color red "&[^;]*;"