summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pages/whats_on.ecpp2
-rw-r--r--tools.cpp12
-rw-r--r--tools.h1
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>
diff --git a/tools.cpp b/tools.cpp
index 2382d8f..9445c93 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -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
diff --git a/tools.h b/tools.h
index a269d22..589767c 100644
--- a/tools.h
+++ b/tools.h
@@ -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
{