From 07986663d9599fd738eeb26057697a5549e5dd9d Mon Sep 17 00:00:00 2001 From: thepra Date: Tue, 2 May 2017 08:00:52 +0200 Subject: [PATCH] up --- TestWebGen/GeneralBuilder.cpp | 38 +++++++++------- TestWebGen/ThePraArt.h | 81 ++++++++++++++++++----------------- TestWebGen/ThePraDev.h | 2 + TestWebGen/Utilities.h | 5 --- 4 files changed, 66 insertions(+), 60 deletions(-) diff --git a/TestWebGen/GeneralBuilder.cpp b/TestWebGen/GeneralBuilder.cpp index 1d6ce90..a8ac694 100644 --- a/TestWebGen/GeneralBuilder.cpp +++ b/TestWebGen/GeneralBuilder.cpp @@ -25,32 +25,32 @@ void GeneralBuilder::BuildThePraSite(Sites site) ThePraDev a{ThePraDev()}; string link = "https://www.thepra-dev.com/", html = ".html"; - Document index = Document(); - Head(index, link + "index" + html, "ThePra WebSite"); + Document index{Document()}; + Head(index, link + "index" + html, "ThePra WebSite", ROOT, a.description); Body(index, cPath + a.contentLinks[0], site); cout << cPath + a.contentLinks[0] << endl; WriteToFile(index, a.outputLinks[0]); - Document code = Document(); - Head(code, link + "code" + html, "ThePra Code"); + Document code{Document()}; + Head(code, link + "code" + html, "ThePra Code", ROOT, a.description); Body(code, cPath + a.contentLinks[1], site); cout << cPath + a.contentLinks[1] << endl; WriteToFile(code, a.outputLinks[1]); - Document blog = Document(); - Head(blog, link + "blog" + html, "ThePra Blog"); + Document blog{Document()}; + Head(blog, link + "blog" + html, "ThePra Blog", ROOT, a.description); Body(blog, cPath + a.contentLinks[2], site); cout << cPath + a.contentLinks[2] << endl; WriteToFile(blog, a.outputLinks[2]); - Document about = Document(); - Head(about, link + "about" + html, "ThePra About"); + Document about{Document()}; + Head(about, link + "about" + html, "ThePra About", ROOT, a.description); Body(about, cPath + a.contentLinks[3], site); cout << cPath + a.contentLinks[3] << endl; WriteToFile(about, a.outputLinks[3]); - Document contact = Document(); - Head(contact, link + "contact" + html, "ThePra Contact"); + Document contact{Document()}; + Head(contact, link + "contact" + html, "ThePra Contact", ROOT, a.description); Body(contact, cPath + a.contentLinks[4], site); cout << cPath + a.contentLinks[4] << endl; WriteToFile(contact, a.outputLinks[4]); @@ -62,24 +62,30 @@ void GeneralBuilder::BuildThePraSite(Sites site) ThePraArt a{ThePraArt()}; string link = "http://art.thepra-dev.com/", html = ".html"; - Document index = Document(); - Head(index, link + "index" + html, "ThePra Art Blog"); + Document index{Document()}; + Head(index, link + "index" + html, "ThePra Art Blog", ROOT, a.description); 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, "ThePra About"); + Document aboutme{Document()}; + Head(aboutme, link + "aboutme" + html, "ThePra About", ROOT, a.description); 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, "ThePra Youtube videos"); + Document youtubePosts{Document()}; + Head(youtubePosts, link + "youtubeposts" + html, "ThePra Youtube videos", ROOT, a.description); Body(youtubePosts, cPath + a.contentLinks[2], site, Red); cout << cPath + a.contentLinks[2] << endl; WriteToFile(youtubePosts, a.outputLinks[2]); + Document postTemplate{Document()}; + Head(postTemplate, "", "*TEXT* - ThePra", ROOT, "*TEXT*"); + Body(postTemplate, cPath + a.contentLinks[3], site); + cout << cPath + a.contentLinks[3] << endl; + WriteToFile(postTemplate, a.outputLinks[3]); + } break; default: diff --git a/TestWebGen/ThePraArt.h b/TestWebGen/ThePraArt.h index 202ee07..87b4a77 100644 --- a/TestWebGen/ThePraArt.h +++ b/TestWebGen/ThePraArt.h @@ -6,6 +6,8 @@ class ThePraArt : Utilities { public: + string description = "The place of ThePra's artistic expression"; + string blog = "index.html", about = "aboutme.html", patreon = "https://www.patreon.com/thepra", @@ -30,18 +32,20 @@ public: Twitter = "Twitter", Menu = "Menu"; string contentFolder = "\\thepraart\\content\\"; - string contentLinks[3]{ + string contentLinks[4]{ contentFolder + "index.txt", contentFolder + "aboutme.txt", - contentFolder + "youtubeposts.txt" + contentFolder + "youtubeposts.txt", + contentFolder + "posttemplate.txt" }; string outputPath{current_path().append("output_thepraart\\").string()}; - string outputLinks[3]{ + string outputLinks[4]{ outputPath + "index.html", outputPath + "aboutme.html", - outputPath + "youtubeposts.html" + outputPath + "youtubeposts.html", + outputPath + "posttemplate.html" }; - + static void BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype = NORMAL); @@ -58,7 +62,6 @@ inline void ThePraArt::BuildBody(Document &file, string cPath, Levels level, Col 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) @@ -93,16 +96,16 @@ inline list ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col co { //leftfixed Node elem00 = Node("div.leftfixed"), - elem01 = Node("img").SetAttribute(a.src, "/images/navdecups"+c+".png").SetAttribute(a.alt, "Upper Left Decoration").UseClosingTag(false), + 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)), + 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); + elem10 = Node("img").SetAttribute(a.src, "images/navdecupg" + c + ".png").SetAttribute(a.alt, "Bottom Left Decoration").UseClosingTag(false); elem02.AppendChild(elem03) .AppendChild(elem04) @@ -116,11 +119,11 @@ inline list ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col co .AppendChild(elem10); //player - Node player = Player(level,color); - + 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), + 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)), @@ -128,7 +131,7 @@ inline list ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col co 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); + elem29 = Node("img").SetAttribute(a.src, "images/navdecupdg" + c + ".png").SetAttribute(a.alt, "Bottom Right Decoration").UseClosingTag(false); elem22.AppendChild(elem23) .AppendChild(elem24) @@ -139,19 +142,19 @@ inline list ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col co 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), + 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)), + 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)), @@ -161,26 +164,26 @@ inline list ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col co 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); + 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))); + .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}; } @@ -219,11 +222,11 @@ 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) + Node player = Node("div.playerfixed").SetAttribute("style", pl) .AppendChild(Node("audio") .SetAttribute("controls", "controls") .SetAttribute("preload", "auto") - .SetAttribute("class","player") + .SetAttribute("class", "player") .SetContent("Your browser does not support the audio element.") .AppendChild(Node("source") .SetAttribute(a.src, whichLevel + "videoplayback.ogg") diff --git a/TestWebGen/ThePraDev.h b/TestWebGen/ThePraDev.h index b268a15..f82c11b 100644 --- a/TestWebGen/ThePraDev.h +++ b/TestWebGen/ThePraDev.h @@ -6,6 +6,8 @@ class ThePraDev : Utilities { public: + string description = "ThePra's profile about computer-science/programming"; + string index = "index.html"; string code = "code.html"; string blog = "blog.html"; diff --git a/TestWebGen/Utilities.h b/TestWebGen/Utilities.h index 7642808..63dd499 100644 --- a/TestWebGen/Utilities.h +++ b/TestWebGen/Utilities.h @@ -72,13 +72,9 @@ inline string Utilities::ChooseLevel(Levels level) inline void Utilities::FullFillContent(string link, string* desktop, string* mobile) { - - //link = "C:\\content\\index.txt"; //TODO find out a general way to scan the folder env Utilities a = Utilities(); string line = ""; std::ifstream infile; - cout << link << endl << desktop; - infile.open(link); while (!infile.eof()) { @@ -109,7 +105,6 @@ inline string Utilities::GetCurrentPath() { path current = current_path(); string pathString = current.string(); - cout << pathString << endl; return pathString; }