From 28c630268c9a765ea1fc96fd6fd257dcb99f6c94 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 11 May 2020 16:28:23 -0700 Subject: [PATCH] modules/web_hook: Replace and fix multi-line content formattings. --- modules/web_hook.cc | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/modules/web_hook.cc b/modules/web_hook.cc index f61aec9c1..b10402af0 100644 --- a/modules/web_hook.cc +++ b/modules/web_hook.cc @@ -419,16 +419,11 @@ github_handle__gollum(std::ostream &out, static const auto delim("\\r\\n"); const json::string body(page["summary"]); - auto lines(split(body, delim)); do + ircd::tokens(body, delim, [&out] + (const string_view &line) { - out - << lines.first - << "
" - ; - - lines = split(lines.second, delim); - } - while(!empty(lines.second)); + out << line << "
"; + }); out << "" @@ -871,15 +866,11 @@ github_handle__issues(std::ostream &out, static const auto delim("\\r\\n"); const json::string body(issue["body"]); - auto lines(split(body, delim)); do + ircd::tokens(body, delim, [&out] + (const string_view &line) { - out << lines.first - << "
" - ; - - lines = split(lines.second, delim); - } - while(!empty(lines.second)); + out << line << "
"; + }); out << "" << "" @@ -1058,15 +1049,11 @@ github_handle__issue_comment(std::ostream &out, static const auto delim("\\r\\n"); const json::string body(comment["body"]); - auto lines(split(body, delim)); do + ircd::tokens(body, delim, [&out] + (const string_view &line) { - out << lines.first - << "\\n" - ; - - lines = split(lines.second, delim); - } - while(!empty(lines.second)); + out << line << "
"; + }); out << "" << ""