Added 2 more helpers to HTMLBuilder.

This commit is contained in:
Relintai 2021-11-16 16:51:02 +01:00
parent eee908912d
commit 7e4c5eeb3e
2 changed files with 27 additions and 0 deletions

View File

@ -1500,6 +1500,30 @@ HTMLTag *HTMLBuilder::wbr() {
return tag.start("wbr");
}
HTMLTag *HTMLBuilder::a(const String &href, const String &cls, const String &id) {
HTMLTag *t = input_text();
t->href(href);
if (cls != "") {
t->cls(cls);
}
if (id != "") {
t->id(id);
}
return t;
}
HTMLBuilder *HTMLBuilder::fa(const String &href, const String &body, const String &cls, const String &id) {
a(href, cls, id);
w(body);
ca();
return this;
}
//Closing tags
HTMLBuilder *HTMLBuilder::ca() {

View File

@ -304,6 +304,9 @@ public:
HTMLTag *video();
HTMLTag *wbr();
HTMLTag *a(const String& href, const String& cls = "", const String& id = "");
HTMLBuilder *fa(const String& href, const String& body, const String& cls = "", const String& id = "");
//closing tags c prefix means close
//Note simple tags should not have these like <br>
//Note that I might have a few that shouldn't be here, those will be removed as I find them