vulkaninfo: add option to always open details for HTML
authorCharles Giessen <charles@lunarg.com>
Tue, 17 Nov 2020 18:30:08 +0000 (11:30 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 18 Nov 2020 17:00:02 +0000 (10:00 -0700)
Doesn't alter current behavior.

Change-Id: I76cb0c4395741848667b2687d722b9b2245fb296

vulkaninfo/outputprinter.h

index 862e965..730b1b6 100644 (file)
@@ -257,6 +257,11 @@ class Printer {
         return *this;
     }
 
+    Printer &SetAlwaysOpenDetails(bool value = true) {
+        should_always_open = value;
+        return *this;
+    }
+
     Printer &SetTitleAsType() {
         set_object_name_as_type = true;
         return *this;
@@ -298,7 +303,7 @@ class Printer {
             }
             case (OutputType::html):
                 out << std::string(static_cast<size_t>(indents), '\t');
-                if (set_details_open) {
+                if (set_details_open || should_always_open) {
                     out << "<details open>";
                     set_details_open = false;
                 } else {
@@ -398,7 +403,7 @@ class Printer {
             }
             case (OutputType::html):
                 out << std::string(static_cast<size_t>(indents), '\t');
-                if (set_details_open) {
+                if (set_details_open || should_always_open) {
                     out << "<details open>";
                     set_details_open = false;
                 } else {
@@ -663,6 +668,9 @@ class Printer {
     // open <details>
     bool set_details_open = false;
 
+    // always open <details>
+    bool should_always_open = false;
+
     // make object titles the color of types
     bool set_object_name_as_type = false;