RSS generator: write_line(): Move endtag detection into lambda.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
7518947766
commit
1af807e588
|
@ -45,18 +45,19 @@ using std::chrono::system_clock;
|
||||||
void write_line(ostream &out, const uint8_t spaces, const string_view rsstag,
|
void write_line(ostream &out, const uint8_t spaces, const string_view rsstag,
|
||||||
const string_view value)
|
const string_view value)
|
||||||
{
|
{
|
||||||
string endtag;
|
// clang-format off
|
||||||
// If there is a space in the rsstag, use only the part up until the space
|
const string endtag{[&rsstag]
|
||||||
// for the ending rsstag.
|
|
||||||
const size_t pos = rsstag.find(' ');
|
|
||||||
if (pos == string_view::npos)
|
|
||||||
{
|
{
|
||||||
endtag = rsstag;
|
// If there is a space in the rsstag, use only the part up until the
|
||||||
}
|
// space for the ending RSS tag.
|
||||||
else
|
const size_t pos = rsstag.find(' ');
|
||||||
{
|
if (pos == string_view::npos)
|
||||||
endtag = rsstag.substr(0, pos);
|
{
|
||||||
}
|
return rsstag;
|
||||||
|
}
|
||||||
|
return rsstag.substr(0, pos);
|
||||||
|
}()};
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
out << string(spaces, ' ');
|
out << string(spaces, ' ');
|
||||||
out << '<' << rsstag << '>' << value << "</" << endtag << ">\n";
|
out << '<' << rsstag << '>' << value << "</" << endtag << ">\n";
|
||||||
|
|
Reference in New Issue