remove fn v1 syntax (#79)

This commit is contained in:
marihachi 2021-10-01 22:05:11 +09:00 committed by GitHub
parent a91ffbfd1c
commit 703f82215d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 70 deletions

View file

@ -607,24 +607,6 @@ $[shake.speed=1s 🍮]
$[flip.h,v MisskeyでFediverseの世界が広がります]
```
構文2:
**廃止予定の構文。代替の構文(構文1)が用意されています。**
```
[shake 🍮]
```
```
[spin.alternate 🍮]
```
```
[shake.speed=1s 🍮]
```
```
[flip.h,v MisskeyでFediverseの世界が広がります]
```
## 詳細
- 内容には再度InlineParserを適用する。
- 内容には改行も含めることが可能です。

View file

@ -92,9 +92,8 @@ full
/ mention
/ hashtag
/ url
/ fnVer2
/ fn
/ link
/ fnVer1
/ search // block
/ inlineText
@ -111,9 +110,8 @@ inline
/ mention
/ hashtag
/ url
/ fnVer2
/ fn
/ link
/ fnVer1
/ inlineText
plain
@ -415,15 +413,8 @@ linkUrl
// inline: fn
fnVer1
= "[" name:$([a-z0-9_]i)+ args:fnArgs? _ content:fnContentPart+ "]"
{
args = args || {};
return FN(name, args, mergeText(content));
}
fnVer2
= "$[" name:$([a-z0-9_]i)+ args:fnArgs? _ content:fnContentPart+ "]"
fn
= "$[" name:$([a-z0-9_]i)+ args:fnArgs? _ content:(!("]") @inline)+ "]"
{
args = args || {};
return FN(name, args, mergeText(content));
@ -449,9 +440,6 @@ fnArg
return { k: k, v: true };
}
fnContentPart
= !("]") @inline
// inline: text
inlineText

View file

@ -1018,41 +1018,7 @@ hoge`;
});
});
describe('fn v1', () => {
it('basic', () => {
const input = '[tada abc]';
const output = [
FN('tada', { }, [
TEXT('abc')
])
];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('with a string argument', () => {
const input = '[spin.speed=1.1s a]';
const output = [
FN('spin', { speed: '1.1s' }, [
TEXT('a')
])
];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('nest', () => {
const input = '[spin.speed=1.1s [shake a]]';
const output = [
FN('spin', { speed: '1.1s' }, [
FN('shake', { }, [
TEXT('a')
])
])
];
assert.deepStrictEqual(mfm.parse(input), output);
});
});
describe('fn v2', () => {
describe('fn', () => {
it('basic', () => {
const input = '$[tada abc]';
const output = [
@ -1090,7 +1056,7 @@ hoge`;
const input =
`before
<center>
Hello [tada everynyan! 🎉]
Hello $[tada everynyan! 🎉]
I'm @ai, A bot of misskey!