1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-12-23 21:25:43 +00:00

Add a pastie_page mustache token.

This commit is contained in:
King_DuckZ 2017-06-19 15:45:56 +01:00
parent 543b3bdfee
commit 17a5009f1f
3 changed files with 5 additions and 1 deletions

View file

@ -37,6 +37,7 @@ namespace kamokan {
virtual std::string on_mustache_retrieve() override;
virtual tawashi::HttpHeader on_general_pastie_process() override;
virtual void on_general_mustache_prepare (std::string&& parPastie, mstch::map& parContext) override;
virtual bool is_pastie_page() const override { return false; }
std::string m_lang_file;
std::string m_langmap_dir;

View file

@ -178,12 +178,14 @@ namespace kamokan {
statuslog->info("Sending response");
SPDLOG_TRACE(statuslog, "Preparing mustache dictionary");
const bool is_submit_page = this->is_submit_page();
const bool is_pastie_page = this->is_pastie_page();
mstch::map mustache_context {
{"submit_page", is_submit_page},
{"version", boost::string_view{STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_PATCH)}},
{"tawashi_version", tawashi::version()},
{"base_uri", base_uri()},
{"host_path", make_host_path(this->settings())}
{"host_path", make_host_path(this->settings())},
{"pastie_page", is_pastie_page}
};
m_storage.finalize_connection();

View file

@ -71,6 +71,7 @@ namespace kamokan {
virtual std::string on_mustache_retrieve();
virtual std::string default_pastie_lang();
virtual bool is_submit_page() { return false; }
virtual bool is_pastie_page() const { return false; }
Storage m_storage;
Kakoune::SafePtr<cgi::Env> m_cgi_env;