#pragma once #include "Utilities.h" 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"; string about = "about.html"; string contact = "contact.html"; string Home = "Home"; string Code = "Code"; string Blog = "Blog"; string About = "About"; string Contact = "Contact"; string Menu = "Menu"; string contentFolder = "\\thepradev\\content\\"; string contentLinks[5]{ contentFolder + "index.txt", contentFolder + "code.txt", contentFolder + "blog.txt", contentFolder + "about.txt", contentFolder + "contact.txt" }; string outputPath{ current_path().append("output_thepradev\\").string() }; string outputLinks[5]{ outputPath + "index.html", outputPath + "code.html", outputPath + "blog.html", outputPath + "about.html", outputPath + "contact.html" }; static void BuildBody(Document &file, string cPath, Levels level, PageType ptype = NORMAL); private: static list NavigationBar(Levels level, DeskOrMob mtype); static list SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list content = { "" }); static Node Extra(Levels level); static Node Player(Levels level); }; inline void ThePraDev::BuildBody(Document &file, string cPath, Levels level, PageType ptype) { list navBar = NavigationBar(level, D); list navBarM = NavigationBar(level, M); list main = SingleMainContent(level, cPath, D); list mainM = SingleMainContent(level, cPath, M); 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 ThePraDev::NavigationBar(Levels level, DeskOrMob mtype) { ThePraDev a; string whichLevel = ChooseLevel(level); switch (mtype) { case D: { Node elem0 = Node("div#header"); Node elem05 = Node("div.navigation_bar"); Node elem1 = Node("img").SetAttribute(a.src, whichLevel + "icon/up.png").SetAttribute(a.alt, "Upper Decoration").UseClosingTag(false); Node elem2 = Node("ul.bortrr.borbrr"); Node elem3 = Node("li.bortrr").AppendChild(Node(a.a, a.Home).SetAttribute(a.href, whichLevel + a.index)); Node elem4 = Node(a.li).AppendChild(Node(a.a, a.Code).SetAttribute(a.href, whichLevel + a.code)); Node elem5 = Node(a.li).AppendChild(Node(a.a, a.Blog).SetAttribute(a.href, whichLevel + a.blog)); Node elem6 = Node(a.li).AppendChild(Node(a.a, a.About).SetAttribute(a.href, whichLevel + a.about)); Node elem7 = Node(a.li).AppendChild(Node(a.a, a.Contact).SetAttribute(a.href, whichLevel + a.contact)); Node elem8 = Extra(level); Node elem9 = Node("img").SetAttribute(a.src, whichLevel + "icon/down.png").SetAttribute(a.alt, "Down Decoration").UseClosingTag(false); elem05.AppendChild(elem1) .AppendChild(elem2 .AppendChild(elem3) .AppendChild(elem4) .AppendChild(elem5) .AppendChild(elem6) .AppendChild(elem7) .AppendChild(elem8)) .AppendChild(elem9); elem0.AppendChild(elem05); return{ {elem0} }; } break; case M: { 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("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)); Node elem8 = Node(a.li).AppendChild(Node(a.a, a.Code).SetAttribute(a.href, whichLevel + a.code)); Node elem9 = Node(a.li).AppendChild(Node(a.a, a.Blog).SetAttribute(a.href, whichLevel + a.blog)); Node elem10 = Node(a.li).AppendChild(Node(a.a, a.About).SetAttribute(a.href, whichLevel + a.about)); Node elem11 = Node(a.li).AppendChild(Node(a.a, a.Contact).SetAttribute(a.href, whichLevel + a.contact)); Node elem12 = Node("img.immagini_laterali").SetAttribute(a.src, whichLevel + "icon/right.png").SetAttribute(a.alt, "Upper Right Decoration").UseClosingTag(false); elem05.AppendChild(elem2 .AppendChild(elem3 .AppendChild(elem4) .AppendChild(elem5) .AppendChild(elem6 .AppendChild(elem7) .AppendChild(elem8) .AppendChild(elem9) .AppendChild(elem10) .AppendChild(elem11)))); elem0.AppendChild(elem1).AppendChild(elem05).AppendChild(elem12); //cout << elem0.ToString(Readability::MULTILINE, 5) << endl; return{ {elem0} }; } break; default: return{ {} }; break; } } inline list ThePraDev::SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list content) { ThePraDev 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 ThePraDev::Extra(Levels level) { ThePraDev a; string whichLevel = ChooseLevel(level); Node extra = Node("li.borbrr") .AppendChild(Node(a.a, "+ Extra +")) .AppendChild(Node("ul.borbrr") .AppendChild(Node("li.colbk") .AppendChild(Node("img.fiximgmenu").SetAttribute(a.src, whichLevel + "icon/signbot.gif").SetAttribute(a.alt, "MotD").UseClosingTag(false))) .AppendChild(Node(a.li) .AppendChild(Player(level)))); return extra; } 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") .SetAttribute(a.src, whichLevel + "videoplayback.ogg") .SetContent("Your browser does not support the audio element.")); return player; }