Add HTML tag enum

This commit is contained in:
Jacob 2024-05-15 10:21:39 +02:00
parent 1458273912
commit d7107de41b
5 changed files with 477 additions and 45 deletions

View file

@ -11,7 +11,7 @@
#include <docpp/docpp.hpp> #include <docpp/docpp.hpp>
int main() { int main() {
docpp::HTML::Section html(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section html(docpp::HTML::ELEMENT_HTML, {});
html.push_back({"title", {}, "Google"}); html.push_back({"title", {}, "Google"});
@ -32,7 +32,7 @@ int main() {
html.push_back({"style", {}, sheet.get(docpp::CSS::FORMATTING_PRETTY)}); html.push_back({"style", {}, sheet.get(docpp::CSS::FORMATTING_PRETTY)});
docpp::HTML::Section div{docpp::HTML::SECTION_DIV, {docpp::HTML::Property("class", "center")}}; docpp::HTML::Section div{docpp::HTML::ELEMENT_DIV, {docpp::HTML::Property("class", "center")}};
div.push_back({"font", {docpp::HTML::Property("color", "blue")}, "G"}); div.push_back({"font", {docpp::HTML::Property("color", "blue")}, "G"});
div.push_back({"font", {docpp::HTML::Property("color", "red")}, "o"}); div.push_back({"font", {docpp::HTML::Property("color", "red")}, "o"});
@ -43,7 +43,7 @@ int main() {
html.push_back(div); html.push_back(div);
docpp::HTML::Section div2{docpp::HTML::SECTION_DIV, {docpp::HTML::Property("align", "center")}}; docpp::HTML::Section div2{docpp::HTML::ELEMENT_DIV, {docpp::HTML::Property("align", "center")}};
docpp::HTML::Section form{"form", {{docpp::HTML::Property("action", "https://google.com/search"), docpp::HTML::Property("method", "get")}}}; docpp::HTML::Section form{"form", {{docpp::HTML::Property("action", "https://google.com/search"), docpp::HTML::Property("method", "get")}}};
form.push_back({"input", docpp::HTML::Properties({docpp::HTML::Property("type", "text"), docpp::HTML::Property("name", "q")}), "", docpp::HTML::TYPE_SELF_CLOSING}); form.push_back({"input", docpp::HTML::Properties({docpp::HTML::Property("type", "text"), docpp::HTML::Property("name", "q")}), "", docpp::HTML::TYPE_SELF_CLOSING});

View file

@ -19,7 +19,7 @@ int main() {
docpp::HTML::Document doc{}; docpp::HTML::Document doc{};
/* This is an HTML section. It can hold any number of elements and/or sections. /* This is an HTML section. It can hold any number of elements and/or sections.
* The first argument is the type of section, and this can either be a predefined value (e.g., docpp::HTML::SECTION_HTML) or a * The first argument is the type of section, and this can either be a predefined value (e.g., docpp::HTML::ELEMENT_HTML) or a
* custom value in the form of an std::string object. * custom value in the form of an std::string object.
* *
* The second argument is an HTMLProperties object, which is a collection of Property objects. Each property is a std::pair of an * The second argument is an HTMLProperties object, which is a collection of Property objects. Each property is a std::pair of an
@ -32,10 +32,10 @@ int main() {
* *
* To get the section as an std::string object, call section.get(). * To get the section as an std::string object, call section.get().
*/ */
docpp::HTML::Section htmlSection(docpp::HTML::SECTION_HTML, {}); // <html></html> docpp::HTML::Section htmlSection(docpp::HTML::ELEMENT_HTML, {}); // <html></html>
docpp::HTML::Section headSection(docpp::HTML::SECTION_HEAD, {}); // <head></head> docpp::HTML::Section headSection(docpp::HTML::ELEMENT_HEAD, {}); // <head></head>
docpp::HTML::Section bodySection(docpp::HTML::SECTION_BODY, {}); // <body></body> docpp::HTML::Section bodySection(docpp::HTML::ELEMENT_BODY, {}); // <body></body>
docpp::HTML::Section footerSection(docpp::HTML::SECTION_FOOTER, {}); // <footer></footer> docpp::HTML::Section footerSection(docpp::HTML::ELEMENT_FOOTER, {}); // <footer></footer>
/* This is an HTML element. Unlike a section, an element cannot hold any other elements or sections, rather it holds text and/or attributes. /* This is an HTML element. Unlike a section, an element cannot hold any other elements or sections, rather it holds text and/or attributes.
* The first argument is the type of element, and this should simply be the tag name (e.g., "p", "h1", "a", etc.). * The first argument is the type of element, and this should simply be the tag name (e.g., "p", "h1", "a", etc.).
@ -91,7 +91,7 @@ int main() {
/* Add a paragraph element to the footer section. */ /* Add a paragraph element to the footer section. */
footerSection.push_back(docpp::HTML::Element("p", {}, "This is the footer.")); // <p>This is the footer.</p> footerSection.push_back(docpp::HTML::Element("p", {}, "This is the footer.")); // <p>This is the footer.</p>
docpp::HTML::Section divSection(docpp::HTML::SECTION_DIV, {{docpp::HTML::Property("id", "main")}}); // <div id="main"></div> docpp::HTML::Section divSection(docpp::HTML::ELEMENT_DIV, {{docpp::HTML::Property("id", "main")}}); // <div id="main"></div>
/* Add a header element and a paragraph element to the div section. */ /* Add a header element and a paragraph element to the div section. */
divSection.push_back(docpp::HTML::Element("h1", {}, "Hello world!")); // <h1>Hello world!</h1> divSection.push_back(docpp::HTML::Element("h1", {}, "Hello world!")); // <h1>Hello world!</h1>

View file

@ -48,12 +48,148 @@ namespace docpp {
*/ */
namespace HTML { namespace HTML {
enum { enum {
SECTION_EMPTY, ELEMENT_EMPTY,
SECTION_HTML, ELEMENT_ABBREVIATION,
SECTION_HEAD, ELEMENT_ABBR,
SECTION_BODY, ELEMENT_ACRONYM,
SECTION_FOOTER, ELEMENT_ADDRESS,
SECTION_DIV, ELEMENT_ANCHOR,
ELEMENT_A,
ELEMENT_APPLET,
ELEMENT_ARTICLE,
ELEMENT_AREA,
ELEMENT_ASIDE,
ELEMENT_AUDIO,
ELEMENT_BASE,
ELEMENT_BASEFONT,
ELEMENT_BDI,
ELEMENT_BDO,
ELEMENT_BGSOUND,
ELEMENT_BIG,
ELEMENT_BLOCKQUOTE,
ELEMENT_BODY,
ELEMENT_BOLD,
ELEMENT_B,
ELEMENT_BR,
ELEMENT_BREAK,
ELEMENT_BUTTON,
ELEMENT_CAPTION,
ELEMENT_CANVAS,
ELEMENT_CENTER,
ELEMENT_CITE,
ELEMENT_CODE,
ELEMENT_COLGROUP,
ELEMENT_COL,
ELEMENT_COLUMN,
ELEMENT_DATA,
ELEMENT_DATALIST,
ELEMENT_DD,
ELEMENT_DFN,
ELEMENT_DEFINE,
ELEMENT_DELETE,
ELEMENT_DEL,
ELEMENT_DETAILS,
ELEMENT_DIALOG,
ELEMENT_DIR,
ELEMENT_DIV,
ELEMENT_DL,
ELEMENT_DT,
ELEMENT_EMBED,
ELEMENT_FIELDSET,
ELEMENT_FIGCAPTION,
ELEMENT_FIGURE,
ELEMENT_FONT,
ELEMENT_FOOTER,
ELEMENT_FORM,
ELEMENT_FRAME,
ELEMENT_FRAMESET,
ELEMENT_HEAD,
ELEMENT_HEADER,
ELEMENT_H1,
ELEMENT_H2,
ELEMENT_H3,
ELEMENT_H4,
ELEMENT_H5,
ELEMENT_H6,
ELEMENT_HGROUP,
ELEMENT_HTML,
ELEMENT_IFRAME,
ELEMENT_IMAGE,
ELEMENT_IMG,
ELEMENT_INPUT,
ELEMENT_INS,
ELEMENT_ISINDEX,
ELEMENT_ITALIC,
ELEMENT_I,
ELEMENT_KBD,
ELEMENT_KEYGEN,
ELEMENT_LABEL,
ELEMENT_LEGEND,
ELEMENT_LIST,
ELEMENT_LI,
ELEMENT_MAIN,
ELEMENT_MARK,
ELEMENT_MARQUEE,
ELEMENT_MENUITEM,
ELEMENT_META,
ELEMENT_METER,
ELEMENT_NAV,
ELEMENT_NOBREAK,
ELEMENT_NOBR,
ELEMENT_NOEMBED,
ELEMENT_NOSCRIPT,
ELEMENT_OBJECT,
ELEMENT_OPTGROUP,
ELEMENT_OPTION,
ELEMENT_OUTPUT,
ELEMENT_PARAGRAPH,
ELEMENT_P,
ELEMENT_PARAM,
ELEMENT_PHRASE,
ELEMENT_PRE,
ELEMENT_PROGRESS,
ELEMENT_QUOTE,
ELEMENT_Q,
ELEMENT_RP,
ELEMENT_RT,
ELEMENT_RUBY,
ELEMENT_OUTDATED,
ELEMENT_S,
ELEMENT_SAMPLE,
ELEMENT_SAMP,
ELEMENT_SCRIPT,
ELEMENT_SECTION,
ELEMENT_SMALL,
ELEMENT_SOURCE,
ELEMENT_SPACER,
ELEMENT_SPAN,
ELEMENT_STRIKE,
ELEMENT_STRONG,
ELEMENT_STYLE,
ELEMENT_SUB,
ELEMENT_SUBSCRIPT,
ELEMENT_SUP,
ELEMENT_SUPERSCRIPT,
ELEMENT_SUMMARY,
ELEMENT_SVG,
ELEMENT_TABLE,
ELEMENT_TBODY,
ELEMENT_TD,
ELEMENT_TEMPLATE,
ELEMENT_TFOOT,
ELEMENT_TH,
ELEMENT_THEAD,
ELEMENT_TIME,
ELEMENT_TITLE,
ELEMENT_TR,
ELEMENT_TRACK,
ELEMENT_TT,
ELEMENT_UNDERLINE,
ELEMENT_U,
ELEMENT_VAR,
ELEMENT_VIDEO,
ELEMENT_WBR,
ELEMENT_XMP,
TYPE_SELF_CLOSING, TYPE_SELF_CLOSING,
TYPE_NON_SELF_CLOSING, TYPE_NON_SELF_CLOSING,
TYPE_NON_CLOSED, TYPE_NON_CLOSED,
@ -319,6 +455,13 @@ namespace docpp {
* @param data The data of the element * @param data The data of the element
*/ */
Element(const std::string& tag, const Properties& properties = {}, const std::string& data = {}, const int type = TYPE_NON_SELF_CLOSING); Element(const std::string& tag, const Properties& properties = {}, const std::string& data = {}, const int type = TYPE_NON_SELF_CLOSING);
/**
* @brief Construct a new Element object
* @param tag The tag of the element
* @param properties The properties of the element
* @param data The data of the element
*/
Element(const int tag, const Properties& properties = {}, const std::string& data = {}, const int type = TYPE_NON_SELF_CLOSING);
/** /**
* @brief Construct a new Element object * @brief Construct a new Element object
*/ */
@ -664,6 +807,12 @@ namespace docpp {
Document operator=(const Document& document); Document operator=(const Document& document);
Document operator=(const Section& section); Document operator=(const Section& section);
}; };
/**
* @brief Resolve a tag.
* @param tag The tag to resolve
*/
template <typename T> T resolve_tag(const int tag);
} // namespace HTML } // namespace HTML
/** /**

View file

@ -179,6 +179,10 @@ docpp::HTML::Element::Element(const std::string& tag, const Properties& properti
this->set(tag, properties, data, type); this->set(tag, properties, data, type);
} }
docpp::HTML::Element::Element(const int tag, const Properties& properties, const std::string& data, const int type) {
this->set(resolve_tag<std::string>(tag), properties, data, type);
}
docpp::HTML::Element docpp::HTML::Element::operator=(const docpp::HTML::Element& element) { docpp::HTML::Element docpp::HTML::Element::operator=(const docpp::HTML::Element& element) {
this->set(element.get_tag(), element.properties, element.get_data(), element.type); this->set(element.get_tag(), element.properties, element.get_data(), element.type);
return *this; return *this;
@ -296,19 +300,298 @@ void docpp::HTML::Section::set(const std::string& tag, const Properties& propert
this->properties = properties; this->properties = properties;
} }
void docpp::HTML::Section::set(const int tag, const Properties& properties) { template <typename T> T docpp::HTML::resolve_tag(const int tag) {
if (tag == docpp::HTML::SECTION_DIV) { switch (tag) {
this->tag = "div"; case ELEMENT_EMPTY:
} else if (tag == docpp::HTML::SECTION_BODY) { return "";
this->tag = "body"; case ELEMENT_ABBREVIATION:
} else if (tag == docpp::HTML::SECTION_FOOTER) { return "abbr";
this->tag = "footer"; case ELEMENT_ABBR:
} else if (tag == docpp::HTML::SECTION_HEAD) { return "abbr";
this->tag = "head"; case ELEMENT_ACRONYM:
} else if (tag == docpp::HTML::SECTION_HTML) { return "acronym";
this->tag = "html"; case ELEMENT_ADDRESS:
return "address";
case ELEMENT_APPLET:
return "applet";
case ELEMENT_ANCHOR:
return "a";
case ELEMENT_A:
return "a";
case ELEMENT_ARTICLE:
return "article";
case ELEMENT_AREA:
return "area";
case ELEMENT_ASIDE:
return "aside";
case ELEMENT_AUDIO:
return "audio";
case ELEMENT_BASE:
return "base";
case ELEMENT_BASEFONT:
return "basefont";
case ELEMENT_BDI:
return "bdi";
case ELEMENT_BDO:
return "bdo";
case ELEMENT_BGSOUND:
return "bgsound";
case ELEMENT_BIG:
return "big";
case ELEMENT_BLOCKQUOTE:
return "blockquote";
case ELEMENT_BODY:
return "body";
case ELEMENT_B:
return "b";
case ELEMENT_BOLD:
return "b";
case ELEMENT_BR:
return "br";
case ELEMENT_BREAK:
return "br";
case ELEMENT_BUTTON:
return "button";
case ELEMENT_CAPTION:
return "caption";
case ELEMENT_CANVAS:
return "canvas";
case ELEMENT_CENTER:
return "center";
case ELEMENT_CITE:
return "cite";
case ELEMENT_CODE:
return "code";
case ELEMENT_COLGROUP:
return "colgroup";
case ELEMENT_COLUMN:
return "col";
case ELEMENT_COL:
return "col";
case ELEMENT_DATA:
return "data";
case ELEMENT_DATALIST:
return "datalist";
case ELEMENT_DD:
return "dd";
case ELEMENT_DFN:
return "dfn";
case ELEMENT_DEFINE:
return "dfn";
case ELEMENT_DELETE:
return "del";
case ELEMENT_DEL:
return "del";
case ELEMENT_DETAILS:
return "details";
case ELEMENT_DIALOG:
return "dialog";
case ELEMENT_DIR:
return "dir";
case ELEMENT_DIV:
return "div";
case ELEMENT_DL:
return "dl";
case ELEMENT_DT:
return "dt";
case ELEMENT_EMBED:
return "embed";
case ELEMENT_FIELDSET:
return "fieldset";
case ELEMENT_FIGCAPTION:
return "figcaption";
case ELEMENT_FIGURE:
return "figure";
case ELEMENT_FONT:
return "font";
case ELEMENT_FOOTER:
return "footer";
case ELEMENT_FORM:
return "form";
case ELEMENT_FRAME:
return "frame";
case ELEMENT_FRAMESET:
return "frameset";
case ELEMENT_HEAD:
return "head";
case ELEMENT_HEADER:
return "header";
case ELEMENT_H1:
return "h1";
case ELEMENT_H2:
return "h2";
case ELEMENT_H3:
return "h3";
case ELEMENT_H4:
return "h4";
case ELEMENT_H5:
return "h5";
case ELEMENT_H6:
return "h6";
case ELEMENT_HGROUP:
return "hgroup";
case ELEMENT_HTML:
return "html";
case ELEMENT_IFRAME:
return "iframe";
case ELEMENT_IMAGE:
return "img";
case ELEMENT_IMG:
return "img";
case ELEMENT_INPUT:
return "input";
case ELEMENT_INS:
return "ins";
case ELEMENT_ISINDEX:
return "isindex";
case ELEMENT_ITALIC:
return "i";
case ELEMENT_I:
return "i";
case ELEMENT_KBD:
return "kbd";
case ELEMENT_KEYGEN:
return "keygen";
case ELEMENT_LABEL:
return "label";
case ELEMENT_LEGEND:
return "legend";
case ELEMENT_LIST:
return "li";
case ELEMENT_LI:
return "li";
case ELEMENT_MAIN:
return "main";
case ELEMENT_MARK:
return "mark";
case ELEMENT_MARQUEE:
return "marquee";
case ELEMENT_MENUITEM:
return "menuitem";
case ELEMENT_META:
return "meta";
case ELEMENT_METER:
return "meter";
case ELEMENT_NAV:
return "nav";
case ELEMENT_NOBREAK:
return "nobr";
case ELEMENT_NOBR:
return "nobr";
case ELEMENT_NOEMBED:
return "noembed";
case ELEMENT_NOSCRIPT:
return "noscript";
case ELEMENT_OBJECT:
return "object";
case ELEMENT_OPTGROUP:
return "optgroup";
case ELEMENT_OPTION:
return "option";
case ELEMENT_OUTPUT:
return "output";
case ELEMENT_PARAGRAPH:
return "p";
case ELEMENT_P:
return "p";
case ELEMENT_PARAM:
return "param";
case ELEMENT_PHRASE:
return "phrase";
case ELEMENT_PRE:
return "pre";
case ELEMENT_PROGRESS:
return "progress";
case ELEMENT_QUOTE:
return "q";
case ELEMENT_Q:
return "q";
case ELEMENT_RP:
return "rp";
case ELEMENT_RT:
return "rt";
case ELEMENT_RUBY:
return "ruby";
case ELEMENT_OUTDATED:
return "s";
case ELEMENT_S:
return "s";
case ELEMENT_SAMPLE:
return "samp";
case ELEMENT_SAMP:
return "samp";
case ELEMENT_SCRIPT:
return "script";
case ELEMENT_SECTION:
return "section";
case ELEMENT_SMALL:
return "small";
case ELEMENT_SOURCE:
return "source";
case ELEMENT_SPACER:
return "spacer";
case ELEMENT_SPAN:
return "span";
case ELEMENT_STRIKE:
return "strike";
case ELEMENT_STRONG:
return "strong";
case ELEMENT_STYLE:
return "style";
case ELEMENT_SUB:
return "sub";
case ELEMENT_SUBSCRIPT:
return "sub";
case ELEMENT_SUP:
return "sup";
case ELEMENT_SUPERSCRIPT:
return "sup";
case ELEMENT_SUMMARY:
return "summary";
case ELEMENT_SVG:
return "svg";
case ELEMENT_TABLE:
return "table";
case ELEMENT_TBODY:
return "tbody";
case ELEMENT_TD:
return "td";
case ELEMENT_TEMPLATE:
return "template";
case ELEMENT_TFOOT:
return "tfoot";
case ELEMENT_TH:
return "th";
case ELEMENT_THEAD:
return "thead";
case ELEMENT_TIME:
return "time";
case ELEMENT_TITLE:
return "title";
case ELEMENT_TRACK:
return "track";
case ELEMENT_TT:
return "tt";
case ELEMENT_UNDERLINE:
return "u";
case ELEMENT_U:
return "u";
case ELEMENT_VAR:
return "var";
case ELEMENT_VIDEO:
return "video";
case ELEMENT_WBR:
return "wbr";
case ELEMENT_XMP:
return "xmp";
default:
break;
} }
return "";
}
void docpp::HTML::Section::set(const int tag, const Properties& properties) {
this->tag = resolve_tag<std::string>(tag);
this->properties = properties; this->properties = properties;
} }

View file

@ -9,12 +9,12 @@
SCENARIO("Test HTML", "[HTML]") { SCENARIO("Test HTML", "[HTML]") {
const auto test1 = []() { const auto test1 = []() {
docpp::HTML::Document doc{}; docpp::HTML::Document doc{};
docpp::HTML::Section html(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section html(docpp::HTML::ELEMENT_HTML, {});
docpp::HTML::Section head(docpp::HTML::SECTION_HEAD, {}); docpp::HTML::Section head(docpp::HTML::ELEMENT_HEAD, {});
docpp::HTML::Section body(docpp::HTML::SECTION_BODY, {}); docpp::HTML::Section body(docpp::HTML::ELEMENT_BODY, {});
docpp::HTML::Section div(docpp::HTML::SECTION_DIV, {}); docpp::HTML::Section div(docpp::HTML::ELEMENT_DIV, {});
docpp::HTML::Section footer(docpp::HTML::SECTION_FOOTER, {}); docpp::HTML::Section footer(docpp::HTML::ELEMENT_FOOTER, {});
head.push_back(docpp::HTML::Element("title", {}, "Test Title")); head.push_back(docpp::HTML::Element("title", {}, "Test Title"));
body.push_back(docpp::HTML::Element("h1", {}, "Test Header")); body.push_back(docpp::HTML::Element("h1", {}, "Test Header"));
@ -45,7 +45,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test2 = []() { const auto test2 = []() {
docpp::HTML::Section section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -58,7 +58,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test3 = []() { const auto test3 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -72,7 +72,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test4 = []() { const auto test4 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -87,12 +87,12 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test5 = []() { const auto test5 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
docpp::HTML::Section subsection(docpp::HTML::SECTION_DIV, {}); docpp::HTML::Section subsection(docpp::HTML::ELEMENT_DIV, {});
subsection.push_back(docpp::HTML::Element("p", {}, "Test 1")); subsection.push_back(docpp::HTML::Element("p", {}, "Test 1"));
docpp::HTML::Section subsection2(docpp::HTML::SECTION_DIV, {}); docpp::HTML::Section subsection2(docpp::HTML::ELEMENT_DIV, {});
subsection2.push_back(docpp::HTML::Element("p", {}, "Test 2")); subsection2.push_back(docpp::HTML::Element("p", {}, "Test 2"));
subsection.push_back(subsection2); subsection.push_back(subsection2);
@ -161,7 +161,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test10 = []() { const auto test10 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -173,7 +173,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test11 = []() { const auto test11 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -185,7 +185,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test12 = []() { const auto test12 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -197,7 +197,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test13 = []() { const auto test13 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -273,7 +273,7 @@ SCENARIO("Test HTML", "[HTML]") {
doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 2")); doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 2"));
doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 3")); doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 3"));
doc.get_section() = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); doc.get_section() = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 4")); doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 4"));
doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 5")); doc.get_section().push_back(docpp::HTML::Element("p", {}, "Test 5"));
@ -285,7 +285,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test17 = []() { const auto test17 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -297,7 +297,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test18 = []() { const auto test18 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_EMPTY, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_EMPTY, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));
@ -307,7 +307,7 @@ SCENARIO("Test HTML", "[HTML]") {
}; };
const auto test19 = []() { const auto test19 = []() {
docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::SECTION_HTML, {}); docpp::HTML::Section section = docpp::HTML::Section(docpp::HTML::ELEMENT_HTML, {});
section.push_back(docpp::HTML::Element("p", {}, "Test 1")); section.push_back(docpp::HTML::Element("p", {}, "Test 1"));
section.push_back(docpp::HTML::Element("p", {}, "Test 2")); section.push_back(docpp::HTML::Element("p", {}, "Test 2"));