From a4edc1886a674b7e3e36a31ab42addd46c2cf180 Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Sat, 4 Aug 2018 16:01:12 +1200 Subject: [PATCH] Enforce standard tags rule --- src/main/c/stream/tag.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/c/stream/tag.c b/src/main/c/stream/tag.c index 4497de9..3749456 100644 --- a/src/main/c/stream/tag.c +++ b/src/main/c/stream/tag.c @@ -44,8 +44,14 @@ void hbs_tag(hbs_options_t so, hbu_pipe_t pipe) { hbsh_attr(pipe); } + hb_char_t *tag_name = hbu_buffer_underlying(opening_name); + + if (!hbs_options_supressed_error(so, HBE_PARSE_NONSTANDARD_TAG) && !hbr_tags_check(tag_name)) { + hbu_pipe_error(pipe, HBE_PARSE_NONSTANDARD_TAG, "Non-standard tag"); + } + // Self-closing or void tag - if (self_closing || hbr_voidtags_check(hbu_buffer_underlying(opening_name))) { + if (self_closing || hbr_voidtags_check(tag_name)) { return; } @@ -57,7 +63,7 @@ void hbs_tag(hbs_options_t so, hbu_pipe_t pipe) { hbsh_style(pipe); } else { // Content - hbs_content(so, pipe, hbu_buffer_underlying(opening_name)); + hbs_content(so, pipe, tag_name); } // Closing tag for non-void