2022-10-03 07:46:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <filesystem>
|
2022-12-05 13:16:10 +00:00
|
|
|
#include <unordered_map>
|
2022-10-03 07:46:41 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
using Path = std::filesystem::path;
|
2022-10-11 19:20:12 +00:00
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
class SiteGeneratorConfig;
|
|
|
|
class ContentPage;
|
|
|
|
class ContentArticle;
|
|
|
|
class TemplatingEngine;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
class WebsiteGenerator
|
2022-10-11 19:20:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-12-05 13:16:10 +00:00
|
|
|
WebsiteGenerator();
|
2022-10-11 19:20:12 +00:00
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
~WebsiteGenerator();
|
2022-11-10 09:06:02 +00:00
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
void doSubstitutions();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
void findProject(const std::string& searchPath);
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
void parseContentFiles();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
void parseTemplateFiles();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-12-05 13:16:10 +00:00
|
|
|
void readConfig();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
void write();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
|
|
|
private:
|
2022-10-09 16:39:46 +00:00
|
|
|
void findContentFiles();
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
Path getContentPath() const;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
Path getPagesPath() const;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2022-10-09 16:39:46 +00:00
|
|
|
Path getArticlesPath() const;
|
|
|
|
|
|
|
|
Path getConfigPath() const;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
|
|
|
std::filesystem::path mProjectPath;
|
2022-12-05 13:16:10 +00:00
|
|
|
|
|
|
|
std::unique_ptr<SiteGeneratorConfig> mConfig;
|
|
|
|
std::unique_ptr<TemplatingEngine> mTemplateEngine;
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<ContentPage> > mPages;
|
|
|
|
std::vector<std::unique_ptr<ContentArticle> > mArticles;
|
2022-10-03 07:46:41 +00:00
|
|
|
};
|