This commit is contained in:
thepra 2017-05-01 21:51:45 +02:00
parent f06ec5fe78
commit 689da7b90a
8 changed files with 279 additions and 71 deletions

View File

@ -2,6 +2,7 @@
#include "stdafx.h"
#include "GeneralBuilder.h"
#include "ThePraDev.h"
#include "ThePraArt.h"
GeneralBuilder::GeneralBuilder()
{
@ -58,27 +59,26 @@ void GeneralBuilder::BuildThePraSite(Sites site)
break;
case ART:
{
ThePraArt a{ThePraArt()};
string link = "http://art.thepra-dev.com/", html = ".html";
Document index = Document();
Head(index, link + "index" + html, "title");
Body(index, cPath, site);
Head(index, link + "index" + html, "ThePra Art Blog");
Body(index, cPath + a.contentLinks[0], site);
cout << cPath + a.contentLinks[0] << endl;
WriteToFile(index, a.outputLinks[0]);
Document aboutme = Document();
Head(aboutme, link + "aboutme" + html, "title");
Body(aboutme, cPath, site);
Document twitch = Document();
Head(twitch, link + "twitch" + html, "title");
Body(twitch, cPath, site);
Document twitter = Document();
Head(twitter, link + "twitter" + html, "title");
Body(twitter, cPath, site);
Head(aboutme, link + "aboutme" + html, "ThePra About");
Body(aboutme, cPath + a.contentLinks[1], site);
cout << cPath + a.contentLinks[1] << endl;
WriteToFile(aboutme, a.outputLinks[1]);
Document youtubePosts = Document();
Head(youtubePosts, link + "youtubePosts" + html, "title");
Body(youtubePosts, cPath, site);
Head(youtubePosts, link + "youtubeposts" + html, "ThePra Youtube videos");
Body(youtubePosts, cPath + a.contentLinks[2], site, Red);
cout << cPath + a.contentLinks[2] << endl;
WriteToFile(youtubePosts, a.outputLinks[2]);
}
break;
@ -138,7 +138,7 @@ void GeneralBuilder::Head(Document &file,
}
void GeneralBuilder::Body(Document &file, string cPath, Sites site, PageType type)
void GeneralBuilder::Body(Document &file, string cPath, Sites site, Col color, PageType type)
{
switch (site)
{
@ -148,7 +148,7 @@ void GeneralBuilder::Body(Document &file, string cPath, Sites site, PageType typ
}
case ART:
{
ThePraArt::BuildBody(file, cPath, ROOT, color, type);
}
default:// I'm drunk
@ -156,50 +156,6 @@ void GeneralBuilder::Body(Document &file, string cPath, Sites site, PageType typ
}
}
void GeneralBuilder::BuildHTMLFiles(Sites site, list<Document> rootFiles, list<Document> postFiles)
{
string cDevOutputPath{Utilities::GetCurrentPath() + "\\output_thepradev\\"};
string postcDevOutputPath{cDevOutputPath + "postsContent\\"};
path dir = current_path();
cout << dir.string() << endl;
for (auto& p : directory_iterator(dir))
{
path asd = p.path();
if (!is_directory(p))
cout << p.path().filename().string() << endl;
}
switch (site)
{
case DEV:
{
path devDir{dir};
devDir.append("thepradev");
path contentDir{devDir.append("content")};
path postsContentDir{devDir.append("postsContent")};
path outputDir{dir}; outputDir.append("output_thepradev");
path posts{outputDir}; posts.append("posts");
}
break;
case ART:
{
path artDir{dir};
artDir.append("thepraart");
path contentDir{artDir.append("content")};
path postsContentDir{artDir.append("postsContent")};
path outputDir{dir}; outputDir.append("output_thepraart");
path posts{outputDir}; posts.append("posts");
}
break;
default:
break;
}
}
void GeneralBuilder::WriteToFile(Document doc, string p)
{
path PathToCheck = path(p);

View File

@ -22,8 +22,8 @@ public:
void Body(Document &file,
string cPath,
Sites site,
Col color = White,
PageType type = NORMAL);
void BuildHTMLFiles(Sites site, list<Document> rootFiles, list<Document> postFiles = {{}});
void WriteToFile(Document doc, string path);
};

View File

@ -19,7 +19,7 @@ using namespace CTML;
int main()
{
GeneralBuilder dev;
dev.BuildThePraSite(Utilities::DEV);
dev.BuildThePraSite(Utilities::ART);
cout << "DONE";
getchar();
return 0;

View File

@ -149,6 +149,9 @@
<ClInclude Include="EnvironmentScanGrabTool.h" />
<ClInclude Include="Node.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="ThePraArt.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Utilities.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="GeneralBuilder.h" />

View File

@ -45,6 +45,9 @@
<ClInclude Include="Utilities.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ThePraArt.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

233
TestWebGen/ThePraArt.h Normal file
View File

@ -0,0 +1,233 @@
#pragma once
#include "Utilities.h"
#include <iostream>
#include <fstream>
class ThePraArt : Utilities
{
public:
string blog = "index.html",
about = "aboutme.html",
patreon = "https://www.patreon.com/thepra",
youtube = "https://www.youtube.com/channel/UCW-00DYkKRXLO6C_IIy8EEw",
youtubePosts = "youtubeposts.html",
twitch = "https://www.twitch.tv/thepra",
tumblr = "http://thepra.tumblr.com",
deviantArt = "http://thepra.deviantart.com",
instagram = "https://www.instagram.com/_thepra_",
facebook = "https://www.facebook.com/ThePratribal",
twitter = "https://twitter.com/_ThePra_";
string Home = "Blog",
AboutMe = "About Me",
Patreon = "Patreon",
YouTube = "YouTube",
Twitch = "Twitch",
Tumblr = "Tumblr",
DeviantArt = "DeviantArt",
Instagram = "Instagram",
Facebook = "Facebook",
Twitter = "Twitter",
Menu = "Menu";
string contentFolder = "\\thepraart\\content\\";
string contentLinks[3]{
contentFolder + "index.txt",
contentFolder + "aboutme.txt",
contentFolder + "youtubeposts.txt"
};
string outputPath{current_path().append("output_thepraart\\").string()};
string outputLinks[3]{
outputPath + "index.html",
outputPath + "aboutme.html",
outputPath + "youtubeposts.html"
};
static void BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype = NORMAL);
private:
static list<Node> NavigationBar(Levels level, DeskOrMob mtype, Col color);
static list<Node> SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list<string> content = {""});
static Node Player(Levels level, Col color);
};
inline void ThePraArt::BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype)
{
list<Node> navBar = NavigationBar(level, D, color);
list<Node> navBarM = NavigationBar(level, M, color);
list<Node> main = SingleMainContent(level, cPath, D);
list<Node> mainM = SingleMainContent(level, cPath, M);
navBar.push_front(Node());
Node desktop = Node("section.desktop");
Node mobile = Node("section.mobile");
for each (Node item in navBar)
{
desktop.AppendChild(item);
}
for each (Node item in navBarM)
{
mobile.AppendChild(item);
}
for each (Node item in main)
{
desktop.AppendChild(item);
}
for each (Node item in mainM)
{
mobile.AppendChild(item);
}
file.AddNodeToBody(desktop);
file.AddNodeToBody(mobile);
}
inline list<Node> ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col color)
{
ThePraArt a;
string whichLevel = ChooseLevel(level);
string c = (color == White) ? "" : "t";
switch (mtype)
{
case D:
{
//leftfixed
Node elem00 = Node("div.leftfixed"),
elem01 = Node("img").SetAttribute(a.src, "/images/navdecups"+c+".png").SetAttribute(a.alt, "Upper Left Decoration").UseClosingTag(false),
elem02 = Node(a.ul),
elem03 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.blog).SetContent(a.Home)),
elem04 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.patreon).SetAttribute("target","_blank").SetContent(a.Patreon)),
elem05 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.youtubePosts).SetContent(a.YouTube)),
elem06 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.about).SetContent(a.AboutMe)),
elem07 = Node(a.li).SetContent("( ・ω・)ノ<!--Hello there!-->"),
elem08 = Node(a.li).SetContent("\\(゜ロ゜)<!--Oh shit! Look up guys, someone who read the source file!! They uncovered us!!! WE ARE DOOMED!!!!-->"),
elem09 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitch).SetAttribute("target", "_blank").SetContent(a.Twitch)),
elem10 = Node("img").SetAttribute(a.src, "/images/navdecupg" + c + ".png").SetAttribute(a.alt, "Bottom Left Decoration").UseClosingTag(false);
elem02.AppendChild(elem03)
.AppendChild(elem04)
.AppendChild(elem05)
.AppendChild(elem06)
.AppendChild(elem07)
.AppendChild(elem08)
.AppendChild(elem09);
elem00.AppendChild(elem01)
.AppendChild(elem02)
.AppendChild(elem10);
//player
Node player = Player(level,color);
//rightfixed
Node elem20 = Node("div.rightfixed"),
elem21 = Node("img").SetAttribute(a.src,"/images/navdecupds" + c + ".png").SetAttribute(a.alt, "Upper Right Decoration").UseClosingTag(false),
elem22 = Node(a.ul),
elem23 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.tumblr).SetAttribute("target", "_blank").SetContent(a.Tumblr)),
elem24 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.deviantArt).SetAttribute("target", "_blank").SetContent(a.DeviantArt)),
elem25 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.instagram).SetAttribute("target", "_blank").SetContent(a.Instagram)),
elem26 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.facebook).SetAttribute("target", "_blank").SetContent(a.Facebook)),
elem27 = Node(a.li).SetContent("ヾ(・ω・o)<!--Hello!-->"),
elem28 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitter).SetAttribute("target", "_blank").SetContent(a.Twitter)),
elem29 = Node("img").SetAttribute(a.src, "/images/navdecupdg" + c + ".png").SetAttribute(a.alt, "Bottom Right Decoration").UseClosingTag(false);
elem22.AppendChild(elem23)
.AppendChild(elem24)
.AppendChild(elem25)
.AppendChild(elem26)
.AppendChild(elem27)
.AppendChild(elem28);
elem20.AppendChild(elem21)
.AppendChild(elem22)
.AppendChild(elem29);
return{elem00,player,elem20};
}
break;
case M:
{
Node elem00 = Node("img.immagini_laterali").SetAttribute(a.alt,"Top Left Decoration").SetAttribute(a.src,"/images/mobile/navdecupds" + c + ".png").UseClosingTag(false),
elem01 = Node("div.navigation_barm"),
elem02 = Node("nav"),
elem03 = Node("label.toggle").SetAttribute("for","drop").SetContent(a.Menu),
elem04 = Node("input#drop").SetAttribute("type","checkbox").UseClosingTag(false),
elem05 = Node(a.ul+".menu"),
elem06 = Node(a.li+".topRounds").AppendChild(Node(a.a).SetAttribute(a.href,a.blog).SetAttribute("target","_blank").SetContent(a.Home)),
elem07 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.patreon).SetAttribute("target", "_blank").SetContent(a.Patreon)),
elem08 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.youtubePosts).SetAttribute("target", "_blank").SetContent(a.YouTube)),
elem09 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.about).SetAttribute("target", "_blank").SetContent(a.AboutMe)),
elem10 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitch).SetAttribute("target", "_blank").SetContent(a.Twitch)),
elem11 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.tumblr).SetAttribute("target", "_blank").SetContent(a.Tumblr)),
elem12 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.deviantArt).SetAttribute("target", "_blank").SetContent(a.DeviantArt)),
elem13 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.instagram).SetAttribute("target", "_blank").SetContent(a.Instagram)),
elem14 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.facebook).SetAttribute("target", "_blank").SetContent(a.Facebook)),
elem15 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitter).SetAttribute("target", "_blank").SetContent(a.Twitter)),
elem16 = Node(a.li+".fs60").SetContent("( ・ω・)ノ <!--Hello there!--> <!--Hello!-->ヾ(・ω・o)"),
elem17 = Node(a.li+".bottomRounds.fs60").SetContent("\(゜ロ゜) <!--Oh shit!Look up guys, someone who read the source file!!They uncovered us!!!WE ARE DOOMED!!!!-->"),
elem18 = Node("img.immagini_laterali").SetAttribute(a.alt, "Top Right Decoration").SetAttribute(a.src, "/images/mobile/navdecups" + c + ".png").UseClosingTag(false);
elem01.AppendChild(elem02
.AppendChild(elem03)
.AppendChild(elem04)
.AppendChild(elem05
.AppendChild(elem06)
.AppendChild(elem07)
.AppendChild(elem08)
.AppendChild(elem09)
.AppendChild(elem10)
.AppendChild(elem11)
.AppendChild(elem12)
.AppendChild(elem13)
.AppendChild(elem14)
.AppendChild(elem15)
.AppendChild(elem16)
.AppendChild(elem17)));
return{elem00,elem01,elem18};
}
break;
default: return{{}};
break;
}
}
inline list<Node> ThePraArt::SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list<string> content)
{
ThePraArt a;
string whichLevel = ChooseLevel(level);
Node mainC = Node("div.main");
Node mainMC = mainC;
string STRING;
string contentDesktop = "";
string contentMobile = "";
FullFillContent(cPath, &contentDesktop, &contentMobile);
mainC.SetContent(contentDesktop);
mainMC.SetContent(contentMobile);
/*for each (string item in contentTest)
{
mainC.SetContent(item+"\n");
}*/
if (mtype == D)
return{mainC};
else return{mainMC};
}
inline Node ThePraArt::Player(Levels level, Col color)
{
ThePraArt a;
string pl = (color == White) ? "" : "box-shadow: rgba(204,24,30,.5) 0 0 20px 0";
string whichLevel = ChooseLevel(level);
Node player = Node("div.playerfixed").SetAttribute("style",pl)
.AppendChild(Node("audio")
.SetAttribute("controls", "controls")
.SetAttribute("preload", "auto")
.SetAttribute("class","player")
.SetContent("Your browser does not support the audio element.")
.AppendChild(Node("source")
.SetAttribute(a.src, whichLevel + "videoplayback.ogg")
.SetAttribute("type", "audio/ogg")
.UseClosingTag(false)));
return player;
}

View File

@ -106,19 +106,19 @@ inline list<Node> ThePraDev::NavigationBar(Levels level, DeskOrMob mtype)
.AppendChild(elem8))
.AppendChild(elem9);
elem0.AppendChild(elem05);
cout << elem0.ToString(Readability::MULTILINE,5)<<endl;
return{{elem0}};
}
break;
case M:
{
Node elem0 = Node("div.navigation_barm");
Node elem0 = Node("div#headerm");
Node elem05 = Node("div.navigation_barm");
Node elem1 = Node("img.immagini_laterali").SetAttribute(a.src, whichLevel + "icon/left.png").SetAttribute(a.alt, "Upper Left Decoration").UseClosingTag(false);
Node elem2 = Node("div.navigation_barminner");
Node elem3 = Node("nav._nav");
Node elem4 = Node("laber.toggle").SetAttribute("for", "drop").SetContent(a.Menu);
Node elem4 = Node("label.toggle").SetAttribute("for", "drop").SetContent(a.Menu);
Node elem5 = Node("input#drop").SetAttribute("type", "checkbox").UseClosingTag(false);
Node elem6 = Node("ul.menu");
Node elem7 = Node(a.li).AppendChild(Node(a.a, a.Home).SetAttribute(a.href, whichLevel + a.index));
@ -129,8 +129,7 @@ inline list<Node> ThePraDev::NavigationBar(Levels level, DeskOrMob mtype)
Node elem12 = Node("img.immagini_laterali").SetAttribute(a.src, whichLevel + "icon/right.png").SetAttribute(a.alt, "Upper Right Decoration").UseClosingTag(false);
elem0.AppendChild(elem1)
.AppendChild(elem2
elem05.AppendChild(elem2
.AppendChild(elem3
.AppendChild(elem4)
.AppendChild(elem5)
@ -139,8 +138,9 @@ inline list<Node> ThePraDev::NavigationBar(Levels level, DeskOrMob mtype)
.AppendChild(elem8)
.AppendChild(elem9)
.AppendChild(elem10)
.AppendChild(elem11))))
.AppendChild(elem12);
.AppendChild(elem11))));
elem0.AppendChild(elem1).AppendChild(elem05).AppendChild(elem12);
//cout << elem0.ToString(Readability::MULTILINE, 5) << endl;
return{{elem0}};
}
@ -192,8 +192,14 @@ inline Node ThePraDev::Player(Levels level)
ThePraDev a;
string whichLevel = ChooseLevel(level);
Node player = Node("div.player")
.AppendChild(Node("audio").SetAttribute("controls", "controls").SetAttribute("preload", "auto")
.AppendChild(Node("source").SetAttribute(a.src, whichLevel + "videoplayback.ogg").SetAttribute("type", "audio/ogg").SetContent("Your browser does not support the audio element.")));
.AppendChild(Node("audio")
.SetAttribute("controls", "controls")
.SetAttribute("preload", "auto")
.SetContent("Your browser does not support the audio element.")
.AppendChild(Node("source")
.SetAttribute(a.src, whichLevel + "videoplayback.ogg")
.SetAttribute("type", "audio/ogg")
.UseClosingTag(false)));
return player;
}

View File

@ -45,6 +45,11 @@ public:
NORMAL,
POST
};
enum Col
{
White,
Red
};
static string ChooseLevel(Levels level);
static void FullFillContent(string link, string* desktop, string* mobile);
@ -72,6 +77,8 @@ inline void Utilities::FullFillContent(string link, string* desktop, string* mob
Utilities a = Utilities();
string line = "";
std::ifstream infile;
cout << link << endl << desktop;
infile.open(link);
while (!infile.eof())
{