From f3d3ab13cbdafe7951fc020706f942f3719ea9b8 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 9 Jan 2024 20:58:44 +0400 Subject: [PATCH] Exposed escapeForJSON() in kiwix namespace Note that it is declared in stringTools.h but its definition remains in otherTools.cpp (to minimize the diff). --- src/tools/otherTools.cpp | 8 ++++---- src/tools/stringTools.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/otherTools.cpp b/src/tools/otherTools.cpp index 85e58a496..97d1567f7 100644 --- a/src/tools/otherTools.cpp +++ b/src/tools/otherTools.cpp @@ -327,10 +327,7 @@ std::string kiwix::render_template(const std::string& template_str, kainjow::mus return ss.str(); } -namespace -{ - -std::string escapeForJSON(const std::string& s) +std::string kiwix::escapeForJSON(const std::string& s) { std::ostringstream oss; for (char c : s) { @@ -345,6 +342,9 @@ std::string escapeForJSON(const std::string& s) return oss.str(); } +namespace +{ + std::string makeFulltextSearchSuggestion(const std::string& lang, const std::string& queryString) { diff --git a/src/tools/stringTools.h b/src/tools/stringTools.h index 14fed7574..890254283 100644 --- a/src/tools/stringTools.h +++ b/src/tools/stringTools.h @@ -53,6 +53,7 @@ private: const icu::Locale locale; }; +std::string escapeForJSON(const std::string& s); /* urlEncode() is the equivalent of JS encodeURIComponent(), with the only * difference that the slash (/) symbol is NOT encoded. */