diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-02-10 01:36:19 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-02-10 01:36:19 +0900 |
| commit | 3742f4fe52a9459e84b7fca2683c0cd575109956 (patch) | |
| tree | 757d73b34e441d13aa988603ae313bcaaa1f7f18 /src/common/text/elements | |
| parent | Add keywoprd (diff) | |
| download | misskey-3742f4fe52a9459e84b7fca2683c0cd575109956.tar.gz misskey-3742f4fe52a9459e84b7fca2683c0cd575109956.tar.bz2 misskey-3742f4fe52a9459e84b7fca2683c0cd575109956.zip | |
Fix bug
Diffstat (limited to 'src/common/text/elements')
| -rw-r--r-- | src/common/text/elements/code.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/common/text/elements/code.js b/src/common/text/elements/code.js index 4c074492f6..ccca5ab4ab 100644 --- a/src/common/text/elements/code.js +++ b/src/common/text/elements/code.js @@ -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 code => { 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 code => { const match = symbols.filter(s => code[0] == s)[0]; |