diff --git a/include/mstch/mstch.hpp b/include/mstch/mstch.hpp index 6847528..58d3330 100644 --- a/include/mstch/mstch.hpp +++ b/include/mstch/mstch.hpp @@ -10,6 +10,10 @@ namespace mstch { +struct config { + static std::function escape; +}; + namespace internal { template diff --git a/src/mstch.cpp b/src/mstch.cpp index 8851aca..4d84e97 100644 --- a/src/mstch.cpp +++ b/src/mstch.cpp @@ -5,6 +5,8 @@ using namespace mstch; +std::function mstch::config::escape; + std::string mstch::render( const std::string& tmplt, const node& root, diff --git a/src/utils.cpp b/src/utils.cpp index 032f89a..1646170 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,4 +1,5 @@ #include "utils.hpp" +#include "mstch/mstch.hpp" mstch::citer mstch::first_not_ws(mstch::citer begin, mstch::citer end) { for (auto it = begin; it != end; ++it) @@ -17,6 +18,9 @@ mstch::criter mstch::reverse(mstch::citer it) { } std::string mstch::html_escape(const std::string& str) { + if (mstch::config::escape) + return mstch::config::escape(str); + std::string out; citer start = str.begin();