startgitStatic page generator for git repositories | 
          
| git clone git://git.dimitrijedobrota.com/startgit.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
document.cpp (2917B)
    0 #include "document.hpp"
          
              2 #include <hemplate/html.hpp>
          
              4 #include "arguments.hpp"
          
              6 namespace startgit
              7 {
          
              9 void document::render(std::ostream& ost, const content_t& content) const
             10 {
             11   using namespace hemplate::html;  // NOLINT
             12   using hemplate::html::div;
             13   using hemplate::html::link;
          
             15   ost << element {
             16       doctype {},
             17       html {
             18           {{"lang", "en"}},
             19           head {
             20               title {m_title},
          
             22               metaUTF8 {},
             23               metaName {"author", m_author},
             24               metaName {"description", m_desc},
             25               metaName {"viewport", "width=device-width, initial-scale=1"},
          
             27               linkStylesheet {args.resource_url + "/css/index.css"},
             28               linkStylesheet {args.resource_url + "/css/colors.css"},
          
             30               m_has_feed ? element {
             31                               linkRss {"RSS feed", m_relpath + "rss.xml"},
             32                               linkAtom {"Atom feed", m_relpath + "atom.xml"},
             33                           } : element {},
          
             35               linkIcon {"32x32", args.resource_url + "/img/favicon-32x32.png"},
             36               linkIcon {"16x16", args.resource_url + "/img/favicon-16x16.png"},
             37           },
             38           body {
             39               input {{
             40                   {"type", "checkbox"},
             41                   {"id", "theme_switch"},
             42                   {"class", "theme_switch"},
             43               }},
             44               div {
             45                   {{"id", "content"}},
             46                   main {
             47                       label {{
             48                           {"class", "switch_label"},
             49                           {"for", "theme_switch"},
             50                       }},
             51                       content(),
             52                   },
             53               },
             54               script {{{"src", args.resource_url + "/scripts/main.js"}}},
             55               script {
             56                   "function switchPage(value) {"
             57                   "   let arr = window.location.href.split('/');"
             58                   "   arr[4] = value;"
             59                   "   history.replaceState(history.state, '', arr.join('/'));"
             60                   "   location.reload();"
             61                   "}"
             62               },
             63               style {"  table { "
             64                      " margin-left: 0;"
             65                      " background-color: inherit;"
             66                      " border: none"
             67                      "} select { "
             68                      " color: var(--theme_fg1);"
             69                      " background-color: inherit;"
             70                      " border: 1px solid var(--theme_bg4);"
             71                      "} select option {"
             72                      " color: var(--theme_fg2) !important;"
             73                      " background-color: var(--theme_bg3) !important;"
             74                      "} .add {"
             75                      " color: var(--theme_green);"
             76                      "} .del {"
             77                      " color: var(--theme_red);"
             78                      "} .inline {"
             79                      " white-space: pre;"
             80                      "}"},
             81           },
             82       },
             83   };
             84 }
          
             86 }  // namespace startgit