It's now in a working state. Yay!
This commit is contained in:
parent
9a2a5e029d
commit
f650427646
12
main.cpp
12
main.cpp
@ -6,7 +6,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
const int MAX_FILE_SIZE = 8096;
|
||||
const int MAX_FILE_SIZE = 65536;
|
||||
|
||||
string32 readfile(const char* name) {
|
||||
std::fstream file_stream;
|
||||
@ -27,16 +27,18 @@ int main() {
|
||||
std::string path = "source";
|
||||
|
||||
string32 layout = readfile("source/_layout.html");
|
||||
fs::remove_all("output");
|
||||
|
||||
for (const auto & file : fs::recursive_directory_iterator(path)) {
|
||||
if (file.is_regular_file()) {
|
||||
if (file.path().stem().string().at(0) != '_') {
|
||||
string32 newFile = layout;
|
||||
newFile.replace("{{ content }}", readfile(file.path().string().c_str()));
|
||||
std::cout << "File: " << file.path() << "\n-----\n" << newFile << "\n-----\n";
|
||||
newFile.replace("{{ content }}", readfile(file.path().c_str()));
|
||||
fs::create_directories("output" + file.path().parent_path().string().substr(6));
|
||||
std::ofstream outfile("output" + file.path().string().substr(6));
|
||||
outfile << newFile;
|
||||
outfile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << layout << "\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user