using namespace std::chrono;
@@ -32,9 +33,11 @@
static constexpr const char* weekdays[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
static unsigned indentation;
- static const char *tabs = " ";
+ static const char *tabs = " ";
static void indent(int change = 0) {
indentation += change;
+ assert(indentation >= 0);
+ assert(indentation <= max_indentation);
fwrite(tabs, 4, indentation, stdout);
}
@@ -67,10 +70,11 @@
}
}
-void html::open(bool fragment) {
+void html::open(bool fragment, unsigned char fragment_indent) {
if (fragment) {
+ indent(fragment_indent);
puts("");
- indentation = 1;
+ indentation++;
} else {
puts(R"(
@@ -128,6 +132,7 @@
void html::close(bool fragment) {
if (fragment) {
+ indent(-1);
puts("
");
} else {
puts(" \n \n