mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-26 22:29:28 +09:00
Fix bug
This commit is contained in:
parent
65e95cc8df
commit
3742f4fe52
@ -288,23 +288,6 @@ const elements = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// keyword
|
|
||||||
(code, i, source) => {
|
|
||||||
const prev = source[i - 1];
|
|
||||||
if (prev && /[a-zA-Z]/.test(prev)) return null;
|
|
||||||
|
|
||||||
const match = keywords.filter(k => code.substr(0, k.length) == k)[0];
|
|
||||||
if (match) {
|
|
||||||
if (/^[a-zA-Z]/.test(code.substr(match.length))) return null;
|
|
||||||
return {
|
|
||||||
html: `<span class="keyword ${match}">${match}</span>`,
|
|
||||||
next: match.length
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// method
|
// method
|
||||||
code => {
|
code => {
|
||||||
const match = code.match(/^([a-zA-Z_-]+?)\(/);
|
const match = code.match(/^([a-zA-Z_-]+?)\(/);
|
||||||
@ -332,6 +315,23 @@ const elements = [
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// keyword
|
||||||
|
(code, i, source) => {
|
||||||
|
const prev = source[i - 1];
|
||||||
|
if (prev && /[a-zA-Z]/.test(prev)) return null;
|
||||||
|
|
||||||
|
const match = keywords.filter(k => code.substr(0, k.length) == k)[0];
|
||||||
|
if (match) {
|
||||||
|
if (/^[a-zA-Z]/.test(code.substr(match.length))) return null;
|
||||||
|
return {
|
||||||
|
html: `<span class="keyword ${match}">${match}</span>`,
|
||||||
|
next: match.length
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// symbol
|
// symbol
|
||||||
code => {
|
code => {
|
||||||
const match = symbols.filter(s => code[0] == s)[0];
|
const match = symbols.filter(s => code[0] == s)[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user