mirror of
https://github.com/szymon-jozef/static-site-generator.git
synced 2026-09-07 20:20:41 +02:00
created builder files
This commit is contained in:
32
src/builder/builder.cpp
Normal file
32
src/builder/builder.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "builder/builder.hpp"
|
||||
#include "config/config.hpp"
|
||||
#include "format/format.hpp"
|
||||
|
||||
std::string build_header(const std::string &TEMPLATE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result =
|
||||
format_file(TEMPLATE, "{{title}}", INFORMATION.metadata.title);
|
||||
;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string build_head(const std::string &TEMPLATE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result =
|
||||
format_file(TEMPLATE, "{{title}}", INFORMATION.metadata.title);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string build_footer(const std::string &TEMPLATE,
|
||||
const Information &INFORMATION) {
|
||||
std::string result = TEMPLATE;
|
||||
result =
|
||||
format_file_conditionally(TEMPLATE, "{{if email}}", "{{endif}}",
|
||||
"{{email}}", INFORMATION.config.contact.email);
|
||||
|
||||
result = format_file_conditionally(TEMPLATE, "{{if signal}}", "{{endif}}",
|
||||
"{{signal}}",
|
||||
INFORMATION.config.contact.signal);
|
||||
return result;
|
||||
}
|
||||
7
src/builder/builder.hpp
Normal file
7
src/builder/builder.hpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "config/config.hpp"
|
||||
#include "markdown/markdown.hpp"
|
||||
|
||||
struct Information {
|
||||
Config config;
|
||||
Metadata metadata;
|
||||
};
|
||||
@@ -9,7 +9,8 @@ SOURCES = main.cpp \
|
||||
config/config.cpp \
|
||||
format/format.cpp \
|
||||
markdown/markdown.cpp \
|
||||
io/io.cpp
|
||||
io/io.cpp \
|
||||
builder/builder.cpp
|
||||
|
||||
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o)
|
||||
|
||||
@@ -17,7 +18,8 @@ TEST_SOURCES = tests.cpp \
|
||||
config/config.cpp \
|
||||
format/format.cpp \
|
||||
markdown/markdown.cpp \
|
||||
io/io.cpp
|
||||
io/io.cpp \
|
||||
builder/builder.cpp
|
||||
|
||||
TEST_OBJECTS = $(TEST_SOURCES:%.cpp=$(BUILD_DIR)/%.o)
|
||||
|
||||
@@ -33,6 +35,7 @@ directories:
|
||||
@mkdir -p $(BUILD_DIR)/format
|
||||
@mkdir -p $(BUILD_DIR)/io
|
||||
@mkdir -p $(BUILD_DIR)/markdown
|
||||
@mkdir -p $(BUILD_DIR)/builder
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
Reference in New Issue
Block a user