diff options
author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-18 20:20:20 +0000 |
---|---|---|
committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-18 20:20:20 +0000 |
commit | a0f950a57be97a09ff1ea8a1339232379d37574c (patch) | |
tree | f1783d6d83356d348c07ab6159a2919acfd42e21 | |
parent | 974eeee2b59084e53fb24b36ca9ea83922bb8f77 (diff) | |
download | vdr-plugin-live-a0f950a57be97a09ff1ea8a1339232379d37574c.tar.gz vdr-plugin-live-a0f950a57be97a09ff1ea8a1339232379d37574c.tar.bz2 |
- added function StringEscapeAndBreak, which *first* html-escapes a string and *second* replaces \n by <br/>
- using StringEscapeAndBreak for description in whats_on
-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 { |