Implemented more tags.

This commit is contained in:
Relintai 2020-12-27 02:38:09 +01:00
parent fe162b60af
commit e20f1c98a2

View File

@ -88,14 +88,88 @@ void Utils::eval_element(std::string *str, bbcpp::BBElementPtr element) {
return;
}
if (element->getNodeName() == "center") {
(*str) += "<span style=\"text-decoration: line-through;\">";
return;
}
if (element->getNodeName() == "center") {
(*str) += "<span style=\"text-align: center;\">";
return;
}
if (element->getNodeName() == "left") {
(*str) += "<span style=\"text-align: left;\">";
return;
}
if (element->getNodeName() == "right") {
(*str) += "<span style=\"text-align: right;\">";
return;
}
if (element->getNodeName() == "quote") {
(*str) += "<blockquote>";
return;
}
if (element->getNodeName() == "spoiler") {
(*str) += "<details>";
return;
}
if (element->getNodeName() == "summary") {
(*str) += "<summary>";
return;
}
break;
}
case bbcpp::BBElement::ElementType::VALUE: {
//NYI
//nyi
break;
}
case bbcpp::BBElement::ElementType::PARAMETER: {
if (element->getNodeName() == "style") {
bbcpp::ParameterMap m = element->getParameters();
(*str) += "<span style=\"";
std::string p = m["size"];
if (p != "") {
(*str) += "font-size: " + p + ";";
}
p = m["color"];
if (p != "") {
(*str) += "color: " + p + ";";
}
(*str) += "\">";
return;
}
if (element->getNodeName() == "quote") {
bbcpp::ParameterMap m = element->getParameters();
(*str) += "<span style=\"";
std::string p = m["name"];
if (p != "") {
(*str) += "<blockquote cite=\"" + p + "\">";
} else {
(*str) += "<blockquote>";
}
return;
}
break;
}
case bbcpp::BBElement::ElementType::CLOSING: {
@ -119,7 +193,45 @@ void Utils::eval_element(std::string *str, bbcpp::BBElementPtr element) {
return;
}
if (element->getNodeName() == "size") {
(*str) += "</span>";
return;
}
if (element->getNodeName() == "color") {
(*str) += "</span>";
return;
}
if (element->getNodeName() == "center") {
(*str) += "</span>";
return;
}
if (element->getNodeName() == "left") {
(*str) += "</span>";
return;
}
if (element->getNodeName() == "right") {
(*str) += "</span>";
return;
}
if (element->getNodeName() == "quote") {
(*str) += "</blockquote>";
return;
}
if (element->getNodeName() == "spoiler") {
(*str) += "</details>";
return;
}
if (element->getNodeName() == "summary") {
(*str) += "</summary>";
return;
}
break;
}