mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-23 13:05:13 +00:00
Method and property support
This commit is contained in:
parent
351f306cd9
commit
4cabbe1668
2 changed files with 34 additions and 0 deletions
|
@ -240,6 +240,33 @@ const elements = [
|
|||
}
|
||||
},
|
||||
|
||||
// method
|
||||
code => {
|
||||
const match = code.match(/^([a-zA-Z_-]+?)\(/);
|
||||
if (!match) return null;
|
||||
|
||||
if (match[1] == '-') return null;
|
||||
|
||||
return {
|
||||
html: `<span class="method">${match[1]}</span>`,
|
||||
next: match[1].length
|
||||
};
|
||||
},
|
||||
|
||||
// property
|
||||
(code, i, source) => {
|
||||
const prev = source[i - 1];
|
||||
if (prev != '.') return null;
|
||||
|
||||
const match = code.match(/^[a-zA-Z_-]+/);
|
||||
if (!match) return null;
|
||||
|
||||
return {
|
||||
html: `<span class="property">${match[0]}</span>`,
|
||||
next: match[0].length
|
||||
};
|
||||
},
|
||||
|
||||
// symbol
|
||||
code => {
|
||||
const match = symbols.filter(s => code[0] == s)[0];
|
||||
|
|
|
@ -141,6 +141,13 @@ pre > code
|
|||
font-style italic
|
||||
//text-decoration underline
|
||||
|
||||
.method
|
||||
font-style italic
|
||||
color #8964c1
|
||||
|
||||
.property
|
||||
color #a71d5d
|
||||
|
||||
mk-locker
|
||||
display block
|
||||
position fixed
|
||||
|
|
Loading…
Reference in a new issue