diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-12-15 18:29:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-15 18:29:26 +0100 |
| commit | 484195d6f27c37053b77822330a73359e00cd254 (patch) | |
| tree | 73aba4133395e0beaa3f27a09c4f7ab1bfe371b5 /src/html_formatter.cc | |
| parent | 002ca1461d2f57df3f740d1e3c5373c3f2fdc54c (diff) | |
Diffstat (limited to 'src/html_formatter.cc')
| -rw-r--r-- | src/html_formatter.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/html_formatter.cc b/src/html_formatter.cc index 0e796cc3..6b5930d2 100644 --- a/src/html_formatter.cc +++ b/src/html_formatter.cc @@ -23,7 +23,9 @@ #include <boost/filesystem.hpp> +using std::string; using std::unique_ptr; +using std::vector; using namespace dcp; @@ -95,13 +97,24 @@ HTMLFormatter::unordered_list() void -HTMLFormatter::list_item(std::string const& text, boost::optional<std::string> type) +HTMLFormatter::list_item(std::string const& text, boost::optional<std::string> type, vector<string> const& details) { if (type) { - _file.puts(dcp::String::compose("<li class=\"%1\">%2</li>\n", *type, text).c_str()); + _file.puts(dcp::String::compose("<li class=\"%1\">%2", *type, text).c_str()); } else { - _file.puts(dcp::String::compose("<li>%1</li>\n", text).c_str()); + _file.puts(dcp::String::compose("<li>%1", text).c_str()); } + + if (!details.empty()) + { + _file.puts("<ol>\n"); + for (auto const& detail: details) { + _file.puts(fmt::format("<li>{}", detail).c_str()); + } + _file.puts("</ol>\n"); + } + + _file.puts("</li>\n"); } |
