mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-01-05 14:46:40 +01:00
27 lines
2.0 KiB
JavaScript
27 lines
2.0 KiB
JavaScript
hljs.registerLanguage("less",(()=>{"use strict";return e=>{
|
|
var n="([\\w-]+|@\\{[\\w-]+\\})",a=[],s=[],t=e=>({className:"string",
|
|
begin:"~?"+e+".*?"+e}),r=(e,n,a)=>({className:e,begin:n,relevance:a}),i={
|
|
begin:"\\(",end:"\\)",contains:s,relevance:0}
|
|
;s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t("'"),t('"'),e.CSS_NUMBER_MODE,{
|
|
begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",
|
|
excludeEnd:!0}
|
|
},r("number","#[0-9A-Fa-f]+\\b"),i,r("variable","@@?[\\w-]+",10),r("variable","@\\{[\\w-]+\\}"),r("built_in","~?`[^`]*?`"),{
|
|
className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0
|
|
},{className:"meta",begin:"!important"});var c=s.concat({begin:/\{/,end:/\}/,
|
|
contains:a}),l={beginKeywords:"when",endsWithParent:!0,contains:[{
|
|
beginKeywords:"and not"}].concat(s)},g={begin:n+"\\s*:",returnBegin:!0,
|
|
end:"[;}]",relevance:0,contains:[{className:"attribute",begin:n,end:":",
|
|
excludeEnd:!0,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}
|
|
}]},d={className:"keyword",
|
|
begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",
|
|
starts:{end:"[;{}]",returnEnd:!0,contains:s,relevance:0}},o={
|
|
className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{
|
|
begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:c}},b={variants:[{
|
|
begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:n,end:/\{/}],returnBegin:!0,
|
|
returnEnd:!0,illegal:"[<='$\"]",relevance:0,
|
|
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l,r("keyword","all\\b"),r("variable","@\\{[\\w-]+\\}"),r("selector-tag",n+"%?",0),r("selector-id","#"+n),r("selector-class","\\."+n,0),r("selector-tag","&",0),{
|
|
className:"selector-attr",begin:"\\[",end:"\\]"},{className:"selector-pseudo",
|
|
begin:/:(:)?[a-zA-Z0-9_\-+()"'.]+/},{begin:"\\(",end:"\\)",contains:c},{
|
|
begin:"!important"}]}
|
|
;return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,d,o,g,b),{
|
|
name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:a}}})()); |