Compare commits
5 commits
c3ba877c0e
...
a33833875c
Author | SHA1 | Date | |
---|---|---|---|
|
a33833875c | ||
|
8e3d1557a8 | ||
|
ba86b5bf9b | ||
|
a42d8c5477 | ||
|
fdff6eb23c |
4 changed files with 15 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -32,6 +32,6 @@
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
#CMake
|
#CMake
|
||||||
build/
|
build/*
|
||||||
Resources/Output/
|
Resources/Output/*
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,6 @@ std::string NavBarGenerator::insertPagesIntoCategories(std::string categories, s
|
||||||
int insertLocation = 0;
|
int insertLocation = 0;
|
||||||
if (categoryStart != -1)
|
if (categoryStart != -1)
|
||||||
insertLocation = categories.find(categoryOpening, categoryStart) + categoryOpening.length();
|
insertLocation = categories.find(categoryOpening, categoryStart) + categoryOpening.length();
|
||||||
else
|
|
||||||
insertLocation = navHeader.length();
|
|
||||||
|
|
||||||
|
|
||||||
categories.insert(insertLocation, item);
|
categories.insert(insertLocation, item);
|
||||||
|
@ -123,7 +121,6 @@ std::string NavBarGenerator::generateNavSection(std::vector<Page*> pages, std::s
|
||||||
{
|
{
|
||||||
this->options = options;
|
this->options = options;
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
buffer.append(navHeader);
|
|
||||||
buffer.append(generateCategories(sourceFolderUrl));
|
buffer.append(generateCategories(sourceFolderUrl));
|
||||||
buffer = insertPagesIntoCategories(buffer, pages);
|
buffer = insertPagesIntoCategories(buffer, pages);
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -24,7 +24,6 @@ enum OptionFlags
|
||||||
class NavBarGenerator
|
class NavBarGenerator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string navHeader = "\n<h1>Navigation</h1>\n\n";
|
|
||||||
int options;
|
int options;
|
||||||
|
|
||||||
std::string generateCategories(std::string rootFolderUrl);
|
std::string generateCategories(std::string rootFolderUrl);
|
||||||
|
|
18
Src/blog.cpp
18
Src/blog.cpp
|
@ -34,10 +34,8 @@ std::string getArgValue(int argc, char* argv[], std::string argIdString)
|
||||||
if (strncmp(argId, argv[i], idValSplit) == 0)
|
if (strncmp(argId, argv[i], idValSplit) == 0)
|
||||||
return std::string(argv[i]).substr(idValSplit+1, strlen(argv[i])-(idValSplit+1));
|
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
|
||||||
std::cout << "Missing argument!"; //the program exists if the value is 0
|
return std::string("")
|
||||||
std::cout << argIdString;
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doesArgExist(int argc, char* argv[], std::string argIdString)
|
bool doesArgExist(int argc, char* argv[], std::string argIdString)
|
||||||
|
@ -57,6 +55,15 @@ void copyFolderAndContents(std::string inUrl, std::string outUrl)
|
||||||
std::filesystem::copy(inUrl, outUrl, opts);
|
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
|
* -in="" // give source folder
|
||||||
* -out="" // give output folder
|
* -out="" // give output folder
|
||||||
|
@ -72,6 +79,7 @@ int main(int argc, char* argv[])
|
||||||
std::string blogTemplate = getArgValue(argc, argv, "-blogTemplate=");
|
std::string blogTemplate = getArgValue(argc, argv, "-blogTemplate=");
|
||||||
std::string atomTemplate = getArgValue(argc, argv, "-atomTemplate=");
|
std::string atomTemplate = getArgValue(argc, argv, "-atomTemplate=");
|
||||||
|
|
||||||
|
checkForEmptyArguments()
|
||||||
|
|
||||||
int flags = OptionFlags::NONE;
|
int flags = OptionFlags::NONE;
|
||||||
if (doesArgExist(argc, argv, "-hide"))
|
if (doesArgExist(argc, argv, "-hide"))
|
||||||
|
@ -82,7 +90,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// pre-written pages and resources i.e. images
|
// pre-written pages and resources i.e. images
|
||||||
copyFolderAndContents(stat, output);
|
copyFolderAndContents(stat, output);
|
||||||
std::cout << "Enjoy your website :)";
|
printf("Enjoy your website :)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: nav sections :eww:
|
// TODO: nav sections :eww:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue