From 9c00965a149b2f9697f5c07a390cf2b0bc675d4d Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 28 Oct 2025 01:46:22 -0700 Subject: create helper functions for creating header and footer --- include/markdown_translator.hpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/markdown_translator.hpp b/include/markdown_translator.hpp index 6a3b91f..6eb32f8 100644 --- a/include/markdown_translator.hpp +++ b/include/markdown_translator.hpp @@ -36,7 +36,41 @@ private: void generateSideBar(std::stringstream& output, const std::vector& headers); std::string createAnchorId(const std::string& text); // Utility functions - std::string getCurrentDateTime(); + + std::string getCurrentDateTime() { + std::time_t now = std::time(nullptr); + std::tm* localTime = std::localtime(&now); + + char buffer[80]; + std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", localTime); + + return std::string(buffer); + } + + // HTML builders + std::string buildHTMLHeader(const std::string& title, const std::string& cssPath){ + return R"( + + + + + )" + title + R"( + + + + )"; + } + + std::string buildHTMLFooter(){ + return R"( + + + + + )"; + } // Member variables std::string title; -- cgit v1.2.3