0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

modules/webhook: Simplify string escapes.

This commit is contained in:
Jason Volk 2019-01-21 14:24:54 -08:00
parent c9a4690d0c
commit c30dfac408

View file

@ -197,7 +197,7 @@ github_heading(std::ostream &out,
content["repository"] content["repository"]
}; };
out << "<a href=\\\"" << unquote(repository["html_url"]) << "\\\">" out << "<a href=\"" << unquote(repository["html_url"]) << "\">"
<< unquote(repository["full_name"]) << unquote(repository["full_name"])
<< "</a>"; << "</a>";
@ -207,9 +207,9 @@ github_heading(std::ostream &out,
}; };
if(commit_hash && type == "push") if(commit_hash && type == "push")
out << " <b><font color=\\\"#FF5733\\\">"; out << " <b><font color=\"#FF5733\">";
else if(commit_hash && type == "pull_request") else if(commit_hash && type == "pull_request")
out << " <b><font color=\\\"#CC00CC\\\">"; out << " <b><font color=\"#CC00CC\">";
else if(commit_hash) else if(commit_hash)
out << " <b>"; out << " <b>";
@ -233,9 +233,9 @@ github_heading(std::ostream &out,
}; };
out << " by " out << " by "
<< "<a href=\\\"" << "<a href=\""
<< party.second << party.second
<< "\\\">" << "\">"
<< party.first << party.first
<< "</a>"; << "</a>";
@ -258,7 +258,7 @@ github_handle__push(std::ostream &out,
if(!count) if(!count)
{ {
out << " <font color=\\\"#FF0000\\\">"; out << " <font color=\"#FF0000\">";
if(content["ref"]) if(content["ref"])
out << " " << unquote(content["ref"]); out << " " << unquote(content["ref"]);
@ -274,7 +274,7 @@ github_handle__push(std::ostream &out,
<< token_last(ref, '/'); << token_last(ref, '/');
} }
out << " <a href=\\\"" << unquote(content["compare"]) << "\\\">" out << " <a href=\"" << unquote(content["compare"]) << "\">"
<< "<b>" << count << " commits</b>" << "<b>" << count << " commits</b>"
<< "</a>"; << "</a>";
@ -287,7 +287,7 @@ github_handle__push(std::ostream &out,
const auto url(unquote(commit["url"])); const auto url(unquote(commit["url"]));
const auto id(unquote(commit["id"])); const auto id(unquote(commit["id"]));
const auto sid(id.substr(0, 8)); const auto sid(id.substr(0, 8));
out << " <a href=\\\"" << url << "\\\">" out << " <a href=\"" << url << "\">"
<< "<b>" << sid << "</b>" << "<b>" << sid << "</b>"
<< "</a>"; << "</a>";
@ -334,7 +334,7 @@ github_handle__pull_request(std::ostream &out,
if(pr["merged"] == "true") if(pr["merged"] == "true")
out << ' ' out << ' '
<< "<b>" << "<b>"
<< "<font color=\\\"#CC00CC\\\">" << "<font color=\"#CC00CC\">"
<< "merged" << "merged"
<< "</font>" << "</font>"
<< "</b>" << "</b>"
@ -345,9 +345,9 @@ github_handle__pull_request(std::ostream &out,
const json::object merged_by{pr["merged_by"]}; const json::object merged_by{pr["merged_by"]};
out << " " out << " "
<< "by " << "by "
<< "<a href=\\\"" << "<a href=\""
<< unquote(merged_by["html_url"]) << unquote(merged_by["html_url"])
<< "\\\">" << "\">"
<< unquote(merged_by["login"]) << unquote(merged_by["login"])
<< "</a>" << "</a>"
; ;
@ -359,7 +359,7 @@ github_handle__pull_request(std::ostream &out,
case hash("null"): case hash("null"):
out << " / " out << " / "
<< "<b>" << "<b>"
<< "<font color=\\\"#FFCC00\\\">" << "<font color=\"#FFCC00\">"
<< "CHECKING MERGE" << "CHECKING MERGE"
<< "</font>" << "</font>"
<< "</b>" << "</b>"
@ -369,7 +369,7 @@ github_handle__pull_request(std::ostream &out,
case hash("true"): case hash("true"):
out << " / " out << " / "
<< "<b>" << "<b>"
<< "<font color=\\\"#33CC33\\\">" << "<font color=\"#33CC33\">"
<< "MERGEABLE" << "MERGEABLE"
<< "</font>" << "</font>"
<< "</b>" << "</b>"
@ -379,7 +379,7 @@ github_handle__pull_request(std::ostream &out,
case hash("false"): case hash("false"):
out << " / " out << " / "
<< "<b>" << "<b>"
<< "<font color=\\\"#CC0000\\\">" << "<font color=\"#CC0000\">"
<< "MERGE CONFLICT" << "MERGE CONFLICT"
<< "</font>" << "</font>"
<< "</b>" << "</b>"
@ -390,7 +390,7 @@ github_handle__pull_request(std::ostream &out,
if(pr.has("additions")) if(pr.has("additions"))
out << " / " out << " / "
<< "<b>" << "<b>"
<< "<font color=\\\"#33CC33\\\">" << "<font color=\"#33CC33\">"
<< "++" << "++"
<< "</font>" << "</font>"
<< pr["additions"] << pr["additions"]
@ -400,7 +400,7 @@ github_handle__pull_request(std::ostream &out,
if(pr.has("deletions")) if(pr.has("deletions"))
out << " / " out << " / "
<< "<b>" << "<b>"
<< "<font color=\\\"#CC0000\\\">" << "<font color=\"#CC0000\">"
<< "--" << "--"
<< "</font>" << "</font>"
<< pr["deletions"] << pr["deletions"]
@ -412,7 +412,7 @@ github_handle__pull_request(std::ostream &out,
<< "<b>" << "<b>"
<< pr["changed_files"] << pr["changed_files"]
<< ' ' << ' '
<< "<font color=\\\"#476b6b\\\">" << "<font color=\"#476b6b\">"
<< "files" << "files"
<< "</font>" << "</font>"
<< "</b>" << "</b>"
@ -425,9 +425,9 @@ github_handle__pull_request(std::ostream &out,
out << " " out << " "
<< "<pre>" << "<pre>"
<< "<a href=\\\"" << "<a href=\""
<< unquote(pr["html_url"]) << unquote(pr["html_url"])
<< "\\\">" << "\">"
<< "<b>" << "<b>"
<< unquote(head["sha"]).substr(0, 8) << unquote(head["sha"]).substr(0, 8)
<< "</b>" << "</b>"