From ee4989f6e3fc9b00c2ef83012c3fa29dfde04397 Mon Sep 17 00:00:00 2001 From: Miguel Lechon Date: Sun, 21 Feb 2021 18:58:33 +0100 Subject: [PATCH] Enforce lack of whitespace between a tag and its arguments. This makes constructs such as "@a (1, 2)" behave like "@a {1, 2}", where @a tags the set (1, 2). --- source/md_impl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/md_impl.c b/source/md_impl.c index 0ae471a..2000521 100644 --- a/source/md_impl.c +++ b/source/md_impl.c @@ -1733,7 +1733,11 @@ _MD_ParseTagList(MD_ParseCtx *ctx, MD_Node **first_out, MD_Node **last_out) if(MD_Parse_RequireKind(ctx, MD_TokenKind_Identifier, &name)) { MD_Node *tag = _MD_MakeNodeFromToken_Ctx(ctx, MD_NodeKind_Tag, name); - _MD_ParseSet(ctx, tag, _MD_ParseSetFlag_Paren, &tag->first_child, &tag->last_child); + MD_Token token = MD_Parse_PeekSkipSome(ctx, 0); + if(MD_StringMatch(token.string, MD_S8Lit("("), 0)) + { + _MD_ParseSet(ctx, tag, _MD_ParseSetFlag_Paren, &tag->first_child, &tag->last_child); + } _MD_PushNodeToList(&first, &last, MD_NilNode(), tag); } else