xml.min.js 2.0 KB

1234567891011121314151617181920212223242526272829
  1. /*! `xml` grammar compiled for Highlight.js 11.7.0 */
  2. (()=>{var e=(()=>{"use strict";return e=>{
  3. const a=e.regex,n=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={
  4. className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},t={begin:/\s/,
  5. contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]
  6. },i=e.inherit(t,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{
  7. className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),r={
  8. endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",
  9. begin:/[\p{L}0-9._:-]+/u,relevance:0},{begin:/=\s*/,relevance:0,contains:[{
  10. className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{
  11. begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{
  12. name:"HTML, XML",
  13. aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],
  14. case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,
  15. end:/>/,relevance:10,contains:[t,l,c,i,{begin:/\[/,end:/\]/,contains:[{
  16. className:"meta",begin:/<![a-z]/,end:/>/,contains:[t,i,l,c]}]}]
  17. },e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,
  18. relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,
  19. relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",
  20. begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[r],starts:{
  21. end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",
  22. begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[r],starts:{
  23. end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{
  24. className:"tag",begin:/<>|<\/>/},{className:"tag",
  25. begin:a.concat(/</,a.lookahead(a.concat(n,a.either(/\/>/,/>/,/\s/)))),
  26. end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:r}]},{
  27. className:"tag",begin:a.concat(/<\//,a.lookahead(a.concat(n,/>/))),contains:[{
  28. className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}
  29. })();hljs.registerLanguage("xml",e)})();