From 3e2f81131c3e57a13ac756112021fe57e3a904c1 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 16 Apr 2018 21:05:46 +0200 Subject: [PATCH] remove trailing newlines in description --- CMakeLists.txt | 2 +- src/parse.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d540b45..e699a05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastorss - VERSION 0.5.5 + VERSION 0.5.6 LANGUAGES CXX ) diff --git a/src/parse.cpp b/src/parse.cpp index 18de035..3ba60fe 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -173,6 +173,12 @@ std::vector parse_website(const string &xml) str.resize(str.rfind(' ')); // Cut at word boundary str += " […]"; } + // Remove trailing newlines + while (str.back() == '\n' || + str.back() == '\r') + { + str.resize(str.length() - 1); + } str += "\n\n" + link + "\n\n#bot"; ret.push_back(str); }