#include "html_builder.h"
HTMLTag *HTMLTag::str(const String &str) {
result += " " + str;
return this;
}
HTMLTag *HTMLTag::style(const String &val) {
attrib("style", val);
return this;
}
HTMLTag *HTMLTag::href(const String &val) {
attrib("href", val);
return this;
}
HTMLTag *HTMLTag::cls(const String &val) {
attrib("class", val);
return this;
}
HTMLTag *HTMLTag::clsse(const String &val) {
if (val == "") {
return this;
}
attrib("class", val);
return this;
}
HTMLTag *HTMLTag::id(const String &val) {
attrib("id", val);
return this;
}
HTMLTag *HTMLTag::name(const String &val) {
attrib("name", val);
return this;
}
HTMLTag *HTMLTag::content(const String &val) {
attrib("content", val);
return this;
}
HTMLTag *HTMLTag::value(const String &val) {
attrib("value", val);
return this;
}
HTMLTag *HTMLTag::accept(const String &val) {
attrib("accept", val);
return this;
}
HTMLTag *HTMLTag::src(const String &val) {
attrib("src", val);
return this;
}
HTMLTag *HTMLTag::alt(const String &val) {
attrib("alt", val);
return this;
}
HTMLTag *HTMLTag::autocomplete(const String &val) {
attrib("autocomplete", val);
return this;
}
HTMLTag *HTMLTag::autocomplete_off() {
attrib("autocomplete", "off");
return this;
}
HTMLTag *HTMLTag::autocomplete_on() {
attrib("autocomplete", "on");
return this;
}
HTMLTag *HTMLTag::autocomplete_name() {
attrib("autocomplete", "name");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_honorific_prefix() {
attrib("autocomplete", "honorific-prefix");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_given_name() {
attrib("autocomplete", "given-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_additional_name() {
attrib("autocomplete", "additional-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_family_name() {
attrib("autocomplete", "family-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_honorific_suffix() {
attrib("autocomplete", "honorific-suffix");
return this;
}
HTMLTag *HTMLTag::autocomplete_name_nickname() {
attrib("autocomplete", "nickname");
return this;
}
HTMLTag *HTMLTag::autocomplete_email() {
attrib("autocomplete", "email");
return this;
}
HTMLTag *HTMLTag::autocomplete_username() {
attrib("autocomplete", "username");
return this;
}
HTMLTag *HTMLTag::autocomplete_new_password() {
attrib("autocomplete", "new-password");
return this;
}
HTMLTag *HTMLTag::autocomplete_current_password() {
attrib("autocomplete", "current-password");
return this;
}
HTMLTag *HTMLTag::autocomplete_one_time_code() {
attrib("autocomplete", "one-time-code");
return this;
}
HTMLTag *HTMLTag::autocomplete_organization_title() {
attrib("autocomplete", "organization-title");
return this;
}
HTMLTag *HTMLTag::autocomplete_organization() {
attrib("autocomplete", "organization");
return this;
}
HTMLTag *HTMLTag::autocomplete_street_address() {
attrib("autocomplete", "street-address");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_line1() {
attrib("autocomplete", "address-line1");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_line2() {
attrib("autocomplete", "address-line2");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_line3() {
attrib("autocomplete", "address-line3");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_level_1() {
attrib("autocomplete", "address-level1");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_level_2() {
attrib("autocomplete", "address-level2");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_level_3() {
attrib("autocomplete", "address-level3");
return this;
}
HTMLTag *HTMLTag::autocomplete_address_level_4() {
attrib("autocomplete", "address-level4");
return this;
}
HTMLTag *HTMLTag::autocomplete_country() {
attrib("autocomplete", "country");
return this;
}
HTMLTag *HTMLTag::autocomplete_country_name() {
attrib("autocomplete", "country-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_postal_code() {
attrib("autocomplete", "postal-code");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_name() {
attrib("autocomplete", "cc-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_given_name() {
attrib("autocomplete", "cc-given-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_additional_name() {
attrib("autocomplete", "cc-additional-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_family_name() {
attrib("autocomplete", "cc-family-name");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_number() {
attrib("autocomplete", "cc-number");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_exp() {
attrib("autocomplete", "cc-exp");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_exp_month() {
attrib("autocomplete", "cc-exp-month");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_exp_year() {
attrib("autocomplete", "cc-exp-year");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_csc() {
attrib("autocomplete", "cc-csc");
return this;
}
HTMLTag *HTMLTag::autocomplete_cc_type() {
attrib("autocomplete", "cc-type");
return this;
}
HTMLTag *HTMLTag::autocomplete_transaction_currency() {
attrib("autocomplete", "transaction-currency");
return this;
}
HTMLTag *HTMLTag::autocomplete_transaction_amount() {
attrib("autocomplete", "transaction-amount");
return this;
}
HTMLTag *HTMLTag::autocomplete_language() {
attrib("autocomplete", "language");
return this;
}
HTMLTag *HTMLTag::autocomplete_bday() {
attrib("autocomplete", "bday");
return this;
}
HTMLTag *HTMLTag::autocomplete_bday_day() {
attrib("autocomplete", "bday-day");
return this;
}
HTMLTag *HTMLTag::autocomplete_bday_month() {
attrib("autocomplete", "bday-month");
return this;
}
HTMLTag *HTMLTag::autocomplete_bday_year() {
attrib("autocomplete", "bday-year");
return this;
}
HTMLTag *HTMLTag::autocomplete_sex() {
attrib("autocomplete", "sex");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel() {
attrib("autocomplete", "tel");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel_country_code() {
attrib("autocomplete", "tel-country-code");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel_national() {
attrib("autocomplete", "tel-national");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel_area_code() {
attrib("autocomplete", "tel-area-code");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel_local() {
attrib("autocomplete", "tel-local");
return this;
}
HTMLTag *HTMLTag::autocomplete_tel_extension() {
attrib("autocomplete", "tel-extension");
return this;
}
HTMLTag *HTMLTag::autocomplete_impp() {
attrib("autocomplete", "impp");
return this;
}
HTMLTag *HTMLTag::autocomplete_url() {
attrib("autocomplete", "url");
return this;
}
HTMLTag *HTMLTag::autocomplete_photo() {
attrib("autocomplete", "photo");
return this;
}
HTMLTag *HTMLTag::onclick(const String &val) {
attrib("onclick", val);
return this;
}
HTMLTag *HTMLTag::inputmode(const String &val) {
attrib("inputmode", val);
return this;
}
HTMLTag *HTMLTag::list(const String &val) {
attrib("list", val);
return this;
}
HTMLTag *HTMLTag::checked(const bool val) {
if (val) {
result += " checked";
}
return this;
}
HTMLTag *HTMLTag::selected(const bool val) {
if (val) {
result += " selected";
}
return this;
}
HTMLTag *HTMLTag::autofocus(const bool val) {
if (val) {
result += " autofocus";
}
return this;
}
HTMLTag *HTMLTag::disabled(const bool val) {
if (val) {
result += " disabled";
}
return this;
}
HTMLTag *HTMLTag::multiple(const bool val) {
if (val) {
result += " multiple";
}
return this;
}
HTMLTag *HTMLTag::required(const bool val) {
if (val) {
result += " required";
}
return this;
}
HTMLTag *HTMLTag::spellcheck(const bool val) {
if (val) {
attrib("spellcheck", "true");
} else {
attrib("spellcheck", "false");
}
return this;
}
HTMLTag *HTMLTag::max(const String &val) {
attrib("max", val);
return this;
}
HTMLTag *HTMLTag::min(const String &val) {
attrib("min", val);
return this;
}
HTMLTag *HTMLTag::step(const String &val) {
attrib("step", val);
return this;
}
HTMLTag *HTMLTag::step_any() {
attrib("step", "any");
return this;
}
HTMLTag *HTMLTag::minlength(const int val) {
attrib("minlength", String::num(val));
return this;
}
HTMLTag *HTMLTag::minlength(const String &val) {
attrib("minlength", val);
return this;
}
HTMLTag *HTMLTag::maxlength(const int val) {
attrib("maxlength", String::num(val));
return this;
}
HTMLTag *HTMLTag::maxlength(const String &val) {
attrib("maxlength", val);
return this;
}
HTMLTag *HTMLTag::size(const int val) {
attrib("size", String::num(val));
return this;
}
HTMLTag *HTMLTag::size(const String &val) {
attrib("size", val);
return this;
}
HTMLTag *HTMLTag::width(const int val) {
attrib("width", String::num(val));
return this;
}
HTMLTag *HTMLTag::width(const String &val) {
attrib("width", val);
return this;
}
HTMLTag *HTMLTag::height(const int val) {
attrib("height", String::num(val));
return this;
}
HTMLTag *HTMLTag::height(const String &val) {
attrib("height", val);
return this;
}
HTMLTag *HTMLTag::pattern(const String &val) {
attrib("pattern", val);
return this;
}
HTMLTag *HTMLTag::method(const String &val) {
attrib("method", val);
return this;
}
HTMLTag *HTMLTag::method_get() {
attrib("method", "get");
return this;
}
HTMLTag *HTMLTag::method_post() {
attrib("method", "post");
return this;
}
HTMLTag *HTMLTag::action(const String &val) {
attrib("action", val);
return this;
}
HTMLTag *HTMLTag::type(const String &val) {
attrib("type", val);
return this;
}
HTMLTag *HTMLTag::placeholder(const String &val) {
attrib("placeholder", val);
return this;
}
HTMLTag *HTMLTag::fora(const String &val) {
attrib("for", val);
return this;
}
HTMLTag *HTMLTag::rel(const String &val) {
attrib("rel", val);
return this;
}
HTMLTag *HTMLTag::rel_stylesheet() {
attrib("rel", "stylesheet");
return this;
}
HTMLTag *HTMLTag::rel_alternate() {
attrib("rel", "alternate");
return this;
}
HTMLTag *HTMLTag::rel_author() {
attrib("rel", "author");
return this;
}
HTMLTag *HTMLTag::rel_bookmark() {
attrib("rel", "bookmark");
return this;
}
HTMLTag *HTMLTag::rel_external() {
attrib("rel", "external");
return this;
}
HTMLTag *HTMLTag::rel_help() {
attrib("rel", "help");
return this;
}
HTMLTag *HTMLTag::rel_next() {
attrib("rel", "next");
return this;
}
HTMLTag *HTMLTag::rel_nofollow() {
attrib("rel", "nofollow");
return this;
}
HTMLTag *HTMLTag::rel_noopener() {
attrib("rel", "noopener");
return this;
}
HTMLTag *HTMLTag::rel_noreferrer() {
attrib("rel", "noreferrer");
return this;
}
HTMLTag *HTMLTag::rel_prev() {
attrib("rel", "prev");
return this;
}
HTMLTag *HTMLTag::rel_search() {
attrib("rel", "search");
return this;
}
HTMLTag *HTMLTag::rel_tag() {
attrib("rel", "tag");
return this;
}
HTMLTag *HTMLTag::charset(const String &val) {
attrib("charset", val);
return this;
}
HTMLTag *HTMLTag::charset_utf_8() {
attrib("charset", "utf-8");
return this;
}
HTMLTag *HTMLTag::itbutton() {
attrib("type", "button");
return this;
}
HTMLTag *HTMLTag::itcheckbox() {
attrib("type", "checkbox");
return this;
}
HTMLTag *HTMLTag::itcolor() {
attrib("type", "color");
return this;
}
HTMLTag *HTMLTag::itdate() {
attrib("type", "date");
return this;
}
HTMLTag *HTMLTag::itdatetime_local() {
attrib("type", "datetime_local");
return this;
}
HTMLTag *HTMLTag::itemail() {
attrib("type", "email");
return this;
}
HTMLTag *HTMLTag::itfile() {
attrib("type", "file");
return this;
}
HTMLTag *HTMLTag::ithidden() {
attrib("type", "hidden");
return this;
}
HTMLTag *HTMLTag::itimage() {
attrib("type", "image");
return this;
}
HTMLTag *HTMLTag::itmonth() {
attrib("type", "month");
return this;
}
HTMLTag *HTMLTag::itnumber() {
attrib("type", "number");
return this;
}
HTMLTag *HTMLTag::itpassword() {
attrib("type", "password");
return this;
}
HTMLTag *HTMLTag::itradio() {
attrib("type", "radio");
return this;
}
HTMLTag *HTMLTag::itrange() {
attrib("type", "range");
return this;
}
HTMLTag *HTMLTag::itreset() {
attrib("type", "reset");
return this;
}
HTMLTag *HTMLTag::itsearch() {
attrib("type", "search");
return this;
}
HTMLTag *HTMLTag::itsubmit() {
attrib("type", "submit");
return this;
}
HTMLTag *HTMLTag::ittel() {
attrib("type", "tel");
return this;
}
HTMLTag *HTMLTag::ittext() {
attrib("type", "text");
return this;
}
HTMLTag *HTMLTag::ittime() {
attrib("type", "time");
return this;
}
HTMLTag *HTMLTag::iturl() {
attrib("type", "url");
return this;
}
HTMLTag *HTMLTag::itweek() {
attrib("type", "week");
return this;
}
HTMLTag *HTMLTag::inputmode_none() {
attrib("inputmode", "none");
return this;
}
HTMLTag *HTMLTag::inputmode_text() {
attrib("inputmode", "text");
return this;
}
HTMLTag *HTMLTag::inputmode_decimal() {
attrib("inputmode", "decimal");
return this;
}
HTMLTag *HTMLTag::inputmode_numeric() {
attrib("inputmode", "numeric");
return this;
}
HTMLTag *HTMLTag::inputmode_tel() {
attrib("inputmode", "tel");
return this;
}
HTMLTag *HTMLTag::inputmode_search() {
attrib("inputmode", "search");
return this;
}
HTMLTag *HTMLTag::inputmode_email() {
attrib("inputmode", "email");
return this;
}
HTMLTag *HTMLTag::inputmode_url() {
attrib("inputmode", "url");
return this;
}
HTMLTag *HTMLTag::attrib(const String &attr, const String &val) {
result += " " + attr + "=\"" + val + "\"";
return this;
}
HTMLTag *HTMLTag::start(const String &p_tag, const bool p_simple) {
simple = p_simple;
result = "<" + p_tag;
return this;
}
HTMLTag *HTMLTag::reset() {
result.clear();
return this;
}
HTMLTag *HTMLTag::close() {
if (simple) {
result += "/>";
} else {
result += ">";
}
return this;
}
HTMLBuilder *HTMLTag::f() {
return owner;
}
bool HTMLTag::has_data() {
return result.size() > 0;
}
HTMLTag::HTMLTag() {
simple = true;
owner = nullptr;
}
HTMLBuilder *HTMLBuilder::comment(const String &val) {
write_tag();
result += "";
return this;
}
HTMLTag *HTMLBuilder::doctype() {
write_tag();
return tag.start("!DOCTYPE");
}
HTMLBuilder *HTMLBuilder::doctype(const String &val) {
write_tag();
result += "";
return this;
}
HTMLTag *HTMLBuilder::a() {
write_tag();
return tag.start("a");
}
HTMLTag *HTMLBuilder::abbr() {
write_tag();
return tag.start("abbr");
}
HTMLTag *HTMLBuilder::acronym() { // Not supported in HTML5. Use instead. Defines an acronym
write_tag();
return tag.start("acronym");
}
HTMLTag *HTMLBuilder::address() {
write_tag();
return tag.start("address");
}
HTMLTag *HTMLBuilder::applet() { // Not supported in HTML5. Use ";
return this;
}
HTMLBuilder *HTMLBuilder::cacronym() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::caddress() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::capplet() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::carea() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::carticle() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::caside() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::caudio() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cb() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cbasefont() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cbdi() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cbdo() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cbig() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cblockquote() {
write_tag();
result += "";
return this;
}
HTMLBuilder *HTMLBuilder::cbody() {
write_tag();
result += "