From 55b9135c5ae71d079c307672c0463e034a2d7e3a Mon Sep 17 00:00:00 2001 From: James Meng Date: Mon, 2 Dec 2024 10:47:09 -0800 Subject: [PATCH] Add 'doc' to TAGS_WITHOUT_MARKUP reason: doc tag cannot have markup, so we strip it if present in stage 2. --- packages/liquid-html-parser/src/grammar.ts | 1 + packages/liquid-html-parser/src/stage-2-ast.spec.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/liquid-html-parser/src/grammar.ts b/packages/liquid-html-parser/src/grammar.ts index 79675ad7..18167b8e 100644 --- a/packages/liquid-html-parser/src/grammar.ts +++ b/packages/liquid-html-parser/src/grammar.ts @@ -53,4 +53,5 @@ export const TAGS_WITHOUT_MARKUP = [ 'continue', 'comment', 'raw', + 'doc', ]; diff --git a/packages/liquid-html-parser/src/stage-2-ast.spec.ts b/packages/liquid-html-parser/src/stage-2-ast.spec.ts index d88a557e..84848ccb 100644 --- a/packages/liquid-html-parser/src/stage-2-ast.spec.ts +++ b/packages/liquid-html-parser/src/stage-2-ast.spec.ts @@ -1224,6 +1224,7 @@ describe('Unit: Stage 2 (AST)', () => { ast = toLiquidAST(`{% doc %}{% enddoc %}`); expectPath(ast, 'children.0.type').to.eql('LiquidRawTag'); expectPath(ast, 'children.0.name').to.eql('doc'); + expectPath(ast, 'children.0.markup').toEqual(''); expectPath(ast, 'children.0.body.value').to.eql(''); expectPath(ast, 'children.0.body.type').toEqual('RawMarkup'); expectPath(ast, 'children.0.body.nodes').toEqual([]);