adds last few files before removal of blog posts from this repo

adds ability to flag pages as "alwaysHidden"
This commit is contained in:
Rosia E Evans 2023-10-13 10:57:11 +01:00
parent 9966927e5c
commit 8cfcf1a721
20 changed files with 83 additions and 29 deletions

View file

@ -105,6 +105,8 @@ std::string NavBarGenerator::insertPagesIntoCategories(std::string categories, s
{
for (Page* page : pages)
{
if (page->getPageFlags().alwaysHidden)
continue;
if (page->getPageFlags().hidden &&
isOptionEnabled(OptionFlags::HIDE_PRIVATE))
continue;

View file

@ -129,6 +129,9 @@ FileFlags FlagReader::readFlags(std::string flagString)
case 'p':
flags.hidden = true;
break;
case 'P':
flags.alwaysHidden = true;
break;
}
}

View file

@ -11,7 +11,8 @@
struct FileFlags
{
bool hidden;
bool hidden; // removes page from navbar when hidePages option is set
bool alwaysHidden; // page will never be added to navbar, good for files you want to keep but only link to
};
class FlagReader

View file

@ -55,6 +55,7 @@ void copyFolderAndContents(std::string inUrl, std::string outUrl)
/*
* -in="" // give source folder
* -out="" // give output folder
* -static="" // give static resources folder (images and things to copy across to output folder go in here)
* -hide // hides private posts
*/
int main(int argc, char* argv[])
@ -63,8 +64,12 @@ int main(int argc, char* argv[])
if (source == "")
source = SOURCE_FILE_FOLDER;
std::string output = getArgValue(argc, argv, "-out=");
if (output == "")
output = OUTPUT_FILE_FOLDER;
if (output == "")
output = OUTPUT_FILE_FOLDER;
std::string stat = getArgValue(argc, argv, "-static=");
if (stat == "")
stat = STATIC_RESOURCES_FOLDER;
int flags = OptionFlags::NONE;
if (doesArgExist(argc, argv, "-hide"))
flags |= OptionFlags::HIDE_PRIVATE;
@ -74,7 +79,7 @@ int main(int argc, char* argv[])
builder->buildAllPages();
// pre-written pages and resources i.e. images
copyFolderAndContents(STATIC_RESOURCES_FOLDER, output);
copyFolderAndContents(stat, output);
}