You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/11/14 22:32:52 UTC

[2/2] thrift git commit: THRIFT-2824 Flag to disable html escaping doctext Client: HTML Patch: Craig Peterson

THRIFT-2824 Flag to disable html escaping doctext
Client: HTML
Patch: Craig Peterson

This closes #266

commit 0df9592deb6dce477600f923745d6cdb113592ae
 Author: Craig Peterson <cp...@ancestry.com>
 Date: 2014-11-14T19:12:49Z

adding flag to allow unescaped html in doectexts


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/e38f1e2d
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/e38f1e2d
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/e38f1e2d

Branch: refs/heads/master
Commit: e38f1e2dc2aa5a3c232c54400a5609074f7c2476
Parents: 38f2a2a
Author: Jens Geyer <je...@apache.org>
Authored: Fri Nov 14 21:54:48 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Nov 14 22:31:22 2014 +0100

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_html_generator.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/e38f1e2d/compiler/cpp/src/generate/t_html_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_html_generator.cc b/compiler/cpp/src/generate/t_html_generator.cc
index b8dfa2a..a79ed50 100644
--- a/compiler/cpp/src/generate/t_html_generator.cc
+++ b/compiler/cpp/src/generate/t_html_generator.cc
@@ -64,6 +64,10 @@ class t_html_generator : public t_generator {
     iter = parsed_options.find("standalone");
     standalone_ = (iter != parsed_options.end());
 
+	iter = parsed_options.find("noescape");
+	unsafe_ = (iter != parsed_options.end());
+
+
     escape_.clear();
     escape_['&']  = "&amp;";
     escape_['<']  = "&lt;";
@@ -112,6 +116,7 @@ class t_html_generator : public t_generator {
   input_type input_type_;
   std::map<std::string, int> allowed_markup;
   bool standalone_;
+  bool unsafe_;
 };
 
 
@@ -399,7 +404,11 @@ std::string t_html_generator::make_file_link( std::string filename) {
  */
 void t_html_generator::print_doc(t_doc* tdoc) {
   if (tdoc->has_doc()) {
-    f_out_ << escape_html(tdoc->get_doc()) << "<br/>";
+	if (unsafe_) {
+      f_out_ << tdoc->get_doc() << "<br/>";
+    } else {
+      f_out_ << escape_html(tdoc->get_doc()) << "<br/>";
+    }
   }
 }
 
@@ -1079,4 +1088,5 @@ void t_html_generator::generate_service(t_service* tservice) {
 THRIFT_REGISTER_GENERATOR(html, "HTML",
 "    standalone:      Self-contained mode, includes all CSS in the HTML files.\n"
 "                     Generates no style.css file, but HTML files will be larger.\n"
+"    noescape:        Do not escape html in doc text.\n"
 )