Skip to content

Commit

Permalink
(wip) vaev-markup: parse inbody elements
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloamed committed Jan 6, 2025
1 parent d74fe13 commit 9d5dd5b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/web/vaev-markup/html.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4310,6 +4310,12 @@ void HtmlParser::_handleAfterHead(HtmlToken const &t) {
// 13.2.6.4.7 MARK: The "in body" insertion mode
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
void HtmlParser::_handleInBody(HtmlToken const &t) {
auto closePElementIfInButtonScope = [&]() {
if (_hasElementInScope(Html::P)) {
// TODO
}
};

// A character token that is U+0000 NULL
if (t.type == HtmlToken::CHARACTER and t.rune == '\0') {
_raise();
Expand Down Expand Up @@ -4386,12 +4392,28 @@ void HtmlParser::_handleInBody(HtmlToken const &t) {

}

// TODO: A start tag whose tag name is one of:
// A start tag whose tag name is one of:
// "address", "article", "aside", "blockquote", "center",
// "details", "dialog", "dir", "div", "dl", "fieldset",
// "figcaption", "figure", "footer", "header", "hgroup",
// "main", "menu", "nav", "ol", "p", "search", "section",
// "summary", "ul"
else if (
t.type == HtmlToken::START_TAG and
(t.name == "address" or t.name == "article" or t.name == "aside" or t.name == "blockquote" or
t.name == "center" or t.name == "details" or t.name == "dialog" or t.name == "dir" or
t.name == "div" or t.name == "dl" or t.name == "fieldset" or t.name == "figcaption" or
t.name == "figure" or t.name == "footer" or t.name == "header" or t.name == "hgroup" or
t.name == "main" or t.name == "menu" or t.name == "nav" or t.name == "ol" or
t.name == "p" or t.name == "search" or t.name == "section" or t.name == "summary" or t.name == "ul"
)
) {

// If the stack of open elements has a p element in button scope, then close a p element.
closePElementIfInButtonScope();

insertHtmlElement(*this, t);
}

// TODO: A start tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"

Expand Down

0 comments on commit 9d5dd5b

Please sign in to comment.