mirror of
https://github.com/szymon-jozef/static-site-generator.git
synced 2026-09-07 12:10:42 +02:00
added build_index() function
This commit is contained in:
@@ -2,6 +2,17 @@
|
||||
#include "config/config.hpp"
|
||||
#include "format/format.hpp"
|
||||
|
||||
std::string build_index(const std::string &TEMPLATE, const Page &PAGE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result = TEMPLATE;
|
||||
result = format_file(result, "{{lang}}", INFORMATION.config.general.lang);
|
||||
result = format_file(result, "{{head}}", PAGE.head);
|
||||
result = format_file(result, "{{header}}", PAGE.header);
|
||||
result = format_file(result, "{{main}}", PAGE.main);
|
||||
result = format_file(result, "{{footer}}", PAGE.footer);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string build_header(const std::string &TEMPLATE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result =
|
||||
@@ -22,10 +33,10 @@ std::string build_footer(const std::string &TEMPLATE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result = TEMPLATE;
|
||||
result =
|
||||
format_file_conditionally(TEMPLATE, "{{if email}}", "{{endif}}",
|
||||
format_file_conditionally(result, "{{if email}}", "{{endif}}",
|
||||
"{{email}}", INFORMATION.config.contact.email);
|
||||
|
||||
result = format_file_conditionally(TEMPLATE, "{{if signal}}", "{{endif}}",
|
||||
result = format_file_conditionally(result, "{{if signal}}", "{{endif}}",
|
||||
"{{signal}}",
|
||||
INFORMATION.config.contact.signal);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user