diff --git a/TestWebGen/GeneralBuilder.cpp b/TestWebGen/GeneralBuilder.cpp index 296094a..1d6ce90 100644 --- a/TestWebGen/GeneralBuilder.cpp +++ b/TestWebGen/GeneralBuilder.cpp @@ -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 rootFiles, list 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); diff --git a/TestWebGen/GeneralBuilder.h b/TestWebGen/GeneralBuilder.h index 3181681..711634d 100644 --- a/TestWebGen/GeneralBuilder.h +++ b/TestWebGen/GeneralBuilder.h @@ -22,8 +22,8 @@ public: void Body(Document &file, string cPath, Sites site, + Col color = White, PageType type = NORMAL); - void BuildHTMLFiles(Sites site, list rootFiles, list postFiles = {{}}); void WriteToFile(Document doc, string path); }; diff --git a/TestWebGen/TestWebGen.cpp b/TestWebGen/TestWebGen.cpp index 89c99b5..f3d9bb0 100644 --- a/TestWebGen/TestWebGen.cpp +++ b/TestWebGen/TestWebGen.cpp @@ -19,7 +19,7 @@ using namespace CTML; int main() { GeneralBuilder dev; - dev.BuildThePraSite(Utilities::DEV); + dev.BuildThePraSite(Utilities::ART); cout << "DONE"; getchar(); return 0; diff --git a/TestWebGen/TestWebGen.vcxproj b/TestWebGen/TestWebGen.vcxproj index f903e9b..c2aea7a 100644 --- a/TestWebGen/TestWebGen.vcxproj +++ b/TestWebGen/TestWebGen.vcxproj @@ -149,6 +149,9 @@ + + false + diff --git a/TestWebGen/TestWebGen.vcxproj.filters b/TestWebGen/TestWebGen.vcxproj.filters index 298995c..7a81f4f 100644 --- a/TestWebGen/TestWebGen.vcxproj.filters +++ b/TestWebGen/TestWebGen.vcxproj.filters @@ -45,6 +45,9 @@ Header Files + + Header Files + diff --git a/TestWebGen/ThePraArt.h b/TestWebGen/ThePraArt.h new file mode 100644 index 0000000..202ee07 --- /dev/null +++ b/TestWebGen/ThePraArt.h @@ -0,0 +1,233 @@ +#pragma once +#include "Utilities.h" +#include +#include + +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 NavigationBar(Levels level, DeskOrMob mtype, Col color); + static list SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list content = {""}); + static Node Player(Levels level, Col color); +}; + + +inline void ThePraArt::BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype) +{ + list navBar = NavigationBar(level, D, color); + list navBarM = NavigationBar(level, M, color); + list main = SingleMainContent(level, cPath, D); + list 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 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("( ・ω・)ノ"), + elem08 = Node(a.li).SetContent("\\(゜ロ゜)"), + 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)"), + 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("( ・ω・)ノ ヾ(・ω・o)"), + elem17 = Node(a.li+".bottomRounds.fs60").SetContent("\(゜ロ゜) "), + 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 ThePraArt::SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list 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; +} diff --git a/TestWebGen/ThePraDev.h b/TestWebGen/ThePraDev.h index afd09b6..b268a15 100644 --- a/TestWebGen/ThePraDev.h +++ b/TestWebGen/ThePraDev.h @@ -106,19 +106,19 @@ inline list ThePraDev::NavigationBar(Levels level, DeskOrMob mtype) .AppendChild(elem8)) .AppendChild(elem9); elem0.AppendChild(elem05); - cout << elem0.ToString(Readability::MULTILINE,5)< 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 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; } diff --git a/TestWebGen/Utilities.h b/TestWebGen/Utilities.h index fd84e3b..7642808 100644 --- a/TestWebGen/Utilities.h +++ b/TestWebGen/Utilities.h @@ -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()) {