mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-25 07:25:13 +00:00
tweak fn parsing
This commit is contained in:
parent
f916d5bd8f
commit
08cb023e9d
2 changed files with 11 additions and 1 deletions
|
@ -450,7 +450,7 @@ export const language = P.createLanguage({
|
|||
P.regexp(/[a-z0-9_]+/i),
|
||||
P.seq([
|
||||
P.str('='),
|
||||
P.regexp(/[a-z0-9_.]+/i),
|
||||
P.regexp(/[a-z0-9_.-]+/i),
|
||||
], 1).option(),
|
||||
]).map(result => {
|
||||
return {
|
||||
|
|
|
@ -1199,6 +1199,16 @@ hoge`;
|
|||
assert.deepStrictEqual(mfm.parse(input), output);
|
||||
});
|
||||
|
||||
it('with a string argument 2', () => {
|
||||
const input = '$[position.x=-3 a]';
|
||||
const output = [
|
||||
FN('position', { x: '-3' }, [
|
||||
TEXT('a')
|
||||
])
|
||||
];
|
||||
assert.deepStrictEqual(mfm.parse(input), output);
|
||||
});
|
||||
|
||||
it('invalid fn name', () => {
|
||||
const input = '$[関数 text]';
|
||||
const output = [
|
||||
|
|
Loading…
Reference in a new issue