From 533a4b33a66253dde0e2e5b62f503a417ee51a11 Mon Sep 17 00:00:00 2001 From: marihachi <marihachi0620@gmail.com> Date: Mon, 24 Feb 2020 00:34:24 +0900 Subject: [PATCH] implement syntax: center, jump, flip --- src/parser/core-parser.pegjs | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/parser/core-parser.pegjs b/src/parser/core-parser.pegjs index 3e12149..29b7061 100644 --- a/src/parser/core-parser.pegjs +++ b/src/parser/core-parser.pegjs @@ -24,6 +24,8 @@ block / quote / search / blockCode + // / mathBlock + / center inline = big @@ -32,6 +34,16 @@ inline / italic / strike / motion + // / spin + / jump + / flip + // / inlineCode + // / mathInline + // / mention + // / hashtag + // / url + // / link + // / emoji / text text @@ -102,6 +114,15 @@ blockCode_line = !("```" ENDLINE) line:$(CHAR+) NEWLINE { return line; } +// block: center + +center + = BEGINLINE "<center>" content:(!"</center>" i:inline { return i; })+ "</center>" +{ + return createTree('center', { }, mergeText(content)); +} + + // inline: big big @@ -192,6 +213,24 @@ motionB } +// inline: jump + +jump + = "<jump>" content:(!"</jump>" i:inline { return i; })+ "</jump>" +{ + return createTree('jump', { }, mergeText(content)); +} + + +// inline: flip + +flip + = "<flip>" content:(!"</flip>" i:inline { return i; })+ "</flip>" +{ + return createTree('flip', { }, mergeText(content)); +} + + // Core rules CHAR -- GitLab