diff -r 49fdc2eb7cd4 -r e9edc3bd0301 src/html.cpp --- a/src/html.cpp Mon May 19 15:34:30 2025 +0200 +++ b/src/html.cpp Mon May 19 16:05:58 2025 +0200 @@ -25,6 +25,7 @@ #include "html.h" #include +#include 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");