src/html.cpp

changeset 20
8639ccd855ba
parent 15
ef0f2497843e
child 22
a9230f197e61
equal deleted inserted replaced
19:2c128952f198 20:8639ccd855ba
65 } 65 }
66 return buffer; 66 return buffer;
67 } 67 }
68 } 68 }
69 69
70 void html::open() { 70 void html::open(bool fragment) {
71 puts( 71 if (fragment) {
72 R"(<html> 72 puts("<div class=\"heatmap-content\">");
73 indentation = 1;
74 } else {
75 puts(R"(<html>
73 <head> 76 <head>
74 <style> 77 <style>
75 table.heatmap { 78 table.heatmap {
76 table-layout: fixed; 79 table-layout: fixed;
77 border-collapse: collapse; 80 border-collapse: collapse;
114 table.heatmap td.commit-spam { 117 table.heatmap td.commit-spam {
115 background-color: #008000; 118 background-color: #008000;
116 } 119 }
117 </style> 120 </style>
118 </head> 121 </head>
119 <body>)"); 122 <body>
120 indentation = 2; 123 <div class=\"heatmap-content\">)");
121 } 124 indentation = 3;
122 125 }
123 void html::close() { 126 }
124 puts("\t</body>\n</html>"); 127
128 void html::close(bool fragment) {
129 if (fragment) {
130 puts("</div>");
131 } else {
132 puts("\t\t</div>\n\t</body>\n</html>");
133 }
125 } 134 }
126 135
127 void html::h1(const std::string& heading) { 136 void html::h1(const std::string& heading) {
128 indent(); 137 indent();
129 printf("<h1>%s</h1>\n", encode(heading).c_str()); 138 printf("<h1>%s</h1>\n", encode(heading).c_str());

mercurial