32#include <fmt/format.h>
38 std::stringstream out;
40 for (
const auto& plot : figure.
GetPlots()) {
41 out <<
" <embed src=\"" << plot.fsPath <<
"\" style=\"width:" <<
kFigureWidth <<
"\">\n";
44 out <<
" <figcaption>Fig.[" << figure.
GetLabel() <<
"]: " << figure.
GetCaption() <<
"</figcaption>\n";
55 std::stringstream out;
59 out <<
"<!DOCTYPE html>\n";
62 out <<
"table {\n boarder-collapse: collapse;\n width: 100%;\n"
66 out <<
"tr:nth-child(even) {\n background-color: #EEEEEE;\n}\n";
69 out <<
" <title>" << header.
GetTitle() <<
"</title>\n";
72 out <<
"<h1>" << header.
GetTitle() <<
"</h1>\n\n";
74 out <<
"<h2>" << header.
GetSubtitle() <<
"</h2>\n\n";
76 auto timeNow = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
77 out <<
"<table style=\"width:1\">\n";
79 out <<
" <td>Generated on:</td>\n";
80 out <<
" <td>" << std::put_time(std::localtime(&timeNow),
"%a %d.%m.%Y, %X") <<
"</td>\n";
83 out <<
" <td>Author:</td>\n";
84 out <<
" <td>" << header.
GetAuthor() <<
"</td>\n";
88 out <<
" <td>Setup:</td>\n";
89 out <<
" <td>" << header.
GetSetup() <<
"</td>\n";
92 out <<
"</table>\n\n";
101 std::stringstream out;
102 std::string sSectionTag = fmt::format(
"h{}", std::min((section.
GetLevel() + 2), 6));
104 out <<
'<' << sSectionTag <<
'>' << section.
GetTitle() <<
"</" << sSectionTag <<
">\n\n";
106 out << pElement->GetBody(*
this) <<
'\n';
117 std::stringstream out;
124 out <<
" <tablecaption>Table: " << table.
GetCaption() <<
"</tablecaption>\n";
128 for (
int iCol = 0; iCol < nCols; ++iCol) {
133 for (
int iRow = 0; iRow < nRows; ++iRow) {
135 for (
int iCol = 0; iCol < nCols; ++iCol) {
136 out <<
" <td>" << table(iRow, iCol) <<
"</td>\n";
149 std::stringstream out;
HTML document engine for the cbm::qa::report (source)
Base class for the report section (header)
Base class for the report table (header)
const std::vector< std::shared_ptr< Element > > GetDaughterElements() const
Get daughter elements.
const std::string & GetTitle() const
Gets name.
const std::string & GetLabel() const
Gets label.
static constexpr std::string_view kTableTextAlign
Table: align.
static constexpr double kFigureWidth
Figure width [in page width].
std::string TableBody(const Table &table) const override
Creates a body for table.
std::string TailBody(const Tail &tail) const override
Creates a body for tail.
std::string FigureBody(const Figure &figure) const override
Creates a body for figure.
std::string HeaderBody(const Header &header) const override
Creates a body for header.
static constexpr int kTablePadding
Table: rows padding [px].
std::string SectionBody(const Section §ion) const override
Creates a body for section.
int GetLevel() const
Gets level of the section.
Table element in the report.
const std::string & GetColumnTitle(int iCol) const
Gets column title.
int GetNofRows() const
Gets number of rows.
int GetNofCols() const
Gets number of columns.
const std::string & GetCaption() const
Gets caption.