diff --git a/.gitmodules b/.gitmodules index cf06646..01aa736 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/better-enums"] path = lib/better-enums url = https://github.com/aantron/better-enums +[submodule "lib/mstch"] + path = lib/mstch + url = https://github.com/no1msd/mstch.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b604920..21a37f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,4 +5,5 @@ project(tawashi_top) set(TAWASHI_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") add_subdirectory(lib/incredis) +add_subdirectory(lib/mstch) add_subdirectory(src) diff --git a/index.html.mstch b/index.html.mstch new file mode 100644 index 0000000..d0ef4bc --- /dev/null +++ b/index.html.mstch @@ -0,0 +1,7 @@ +
tawashi v{{version}}
+ diff --git a/lib/mstch b/lib/mstch new file mode 160000 index 0000000..0fde1cf --- /dev/null +++ b/lib/mstch @@ -0,0 +1 @@ +Subproject commit 0fde1cf94c26ede7fa267f4b64c0efe5da81a77a diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a975b85..ab82adc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -project(tawashi CXX) +project(tawashi VERSION 0.1.0 LANGUAGES CXX) find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options filesystem system) find_package(CURL REQUIRED) @@ -36,6 +36,7 @@ configure_file( target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/kakoune + PRIVATE ${TAWASHI_SOURCE_ROOT}/lib/mstch/include ) target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} @@ -48,6 +49,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE incredis PRIVATE ${CURL_LIBRARIES} PRIVATE ${SourceHighlight_LIBRARIES} + PRIVATE mstch ) target_compile_definitions(${PROJECT_NAME} PRIVATE BOOST_SPIRIT_USE_PHOENIX_V3=1 diff --git a/src/index_response.cpp b/src/index_response.cpp index 483f4f5..f1740f8 100644 --- a/src/index_response.cpp +++ b/src/index_response.cpp @@ -23,12 +23,5 @@ namespace tawashi { Response(Response::ContentType, "text/html", "index", parIni, false) { } - - void IndexResponse::on_send (std::ostream& parStream) { - std::string html(load_mustache()); - - boost::replace_all(html, "{base_uri}", base_uri()); - parStream << html; - } } //namespace tawashi diff --git a/src/index_response.hpp b/src/index_response.hpp index 717e89a..466735c 100644 --- a/src/index_response.hpp +++ b/src/index_response.hpp @@ -26,6 +26,5 @@ namespace tawashi { explicit IndexResponse (const IniFile& parIni); private: - virtual void on_send (std::ostream& parStream) override; }; } //namespace tawashi diff --git a/src/response.cpp b/src/response.cpp index e78d50c..9c247a4 100644 --- a/src/response.cpp +++ b/src/response.cpp @@ -18,6 +18,8 @@ #include "response.hpp" #include "incredis/incredis.hpp" #include "ini_file.hpp" +#include "tawashiConfig.h" +#include "duckhandy/stringize.h" #include