diff options
-rw-r--r-- | pages/whats_on.ecpp | 2 | ||||
-rw-r--r-- | tools.cpp | 12 | ||||
-rw-r--r-- | tools.h | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index 01010a3..be36f96 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -79,7 +79,7 @@ if (type == "now") { <div class="title"><$ title $></div> <div class="short"><$ short_description $></div> <div class="description"> - <$ description $> + <{ reply.out() << StringEscapeAndBreak( description ); }> </div> </div> </div> @@ -1,13 +1,15 @@ #include <stdexcept> +#include <tnt/ecpp.h> +#include <tnt/htmlescostream.h> #include <tnt/httprequest.h> #include <tnt/httpreply.h> -#include <tnt/ecpp.h> #include "exception.h" #include "live.h" #include "setup.h" #include "tools.h" using namespace std; +using namespace tnt; istream& operator>>( istream& is, tChannelID& ret ) { @@ -93,4 +95,12 @@ string StringWordTruncate(const string& input, size_t maxLen, bool& truncated) return result.substr(0, pos); } +string StringEscapeAndBreak( string const& input ) +{ + stringstream plainBuilder; + HtmlEscOstream builder( plainBuilder ); + builder << input; + return StringReplace( plainBuilder.str(), "\n", "<br/>" ); +} + } // namespace vdrlive @@ -27,6 +27,7 @@ std::vector< std::string > StringSplit( std::string const& text, char delimiter int StringToInt( std::string const& string, int base = 10 ); std::string StringRepeat(int times, const std::string& input); std::string StringWordTruncate(const std::string& input, size_t maxLen, bool& truncated); +std::string StringEscapeAndBreak( std::string const& input ); struct bad_lexical_cast: std::runtime_error { |