diff --git a/.gitignore b/.gitignore index 2cb78e3..9dafa90 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,6 @@ *.app #CMake -build/* -Resources/Output/* +build/ +Resources/Output/ diff --git a/Src/BlogPageBuilder.cpp b/Src/BlogPageBuilder.cpp index 07ae0ff..6b2c905 100644 --- a/Src/BlogPageBuilder.cpp +++ b/Src/BlogPageBuilder.cpp @@ -109,6 +109,8 @@ std::string NavBarGenerator::insertPagesIntoCategories(std::string categories, s int insertLocation = 0; if (categoryStart != -1) insertLocation = categories.find(categoryOpening, categoryStart) + categoryOpening.length(); + else + insertLocation = navHeader.length(); categories.insert(insertLocation, item); @@ -121,6 +123,7 @@ std::string NavBarGenerator::generateNavSection(std::vector pages, std::s { this->options = options; std::string buffer; + buffer.append(navHeader); buffer.append(generateCategories(sourceFolderUrl)); buffer = insertPagesIntoCategories(buffer, pages); return buffer; diff --git a/Src/BlogPageBuilder.h b/Src/BlogPageBuilder.h index 9911949..d75386f 100644 --- a/Src/BlogPageBuilder.h +++ b/Src/BlogPageBuilder.h @@ -24,6 +24,7 @@ enum OptionFlags class NavBarGenerator { private: + std::string navHeader = "\n

Navigation

\n\n"; int options; std::string generateCategories(std::string rootFolderUrl); diff --git a/Src/blog.cpp b/Src/blog.cpp index b9e02c4..63619fe 100644 --- a/Src/blog.cpp +++ b/Src/blog.cpp @@ -34,8 +34,10 @@ std::string getArgValue(int argc, char* argv[], std::string argIdString) if (strncmp(argId, argv[i], idValSplit) == 0) return std::string(argv[i]).substr(idValSplit+1, strlen(argv[i])-(idValSplit+1)); } - printf("Missing argument! %s", argIdString); //the program exists if the value is 0 - return std::string("") + + std::cout << "Missing argument!"; //the program exists if the value is 0 + std::cout << argIdString; + exit(0); } bool doesArgExist(int argc, char* argv[], std::string argIdString) @@ -55,15 +57,6 @@ void copyFolderAndContents(std::string inUrl, std::string outUrl) std::filesystem::copy(inUrl, outUrl, opts); } -void checkForEmptyArguments() -{ - // I hate doing it like this - if (source.empty() || output.empty() || stat.empty() || siteWebUrl.empty() || blogTemplate.empty() || atomTemplate.empty()) - { - exit(0); - } -} - /* * -in="" // give source folder * -out="" // give output folder @@ -79,7 +72,6 @@ int main(int argc, char* argv[]) std::string blogTemplate = getArgValue(argc, argv, "-blogTemplate="); std::string atomTemplate = getArgValue(argc, argv, "-atomTemplate="); - checkForEmptyArguments() int flags = OptionFlags::NONE; if (doesArgExist(argc, argv, "-hide")) @@ -90,7 +82,7 @@ int main(int argc, char* argv[]) // pre-written pages and resources i.e. images copyFolderAndContents(stat, output); - printf("Enjoy your website :)"); + std::cout << "Enjoy your website :)"; } // TODO: nav sections :eww: