17namespace sharg::detail
32class format_html :
public format_help_base<format_html>
35 using base_type = format_help_base<format_html>;
44 format_html() =
default;
45 format_html(format_html
const & pf) =
default;
46 format_html & operator=(format_html
const & pf) =
default;
47 format_html(format_html &&) =
default;
48 format_html & operator=(format_html &&) =
default;
49 ~format_html() =
default;
57 void maybe_close_list()
67 void maybe_close_paragraph()
80 std::cout <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "
81 <<
"http://www.w3.org/TR/html4/strict.dtd\">\n"
82 <<
"<html lang=\"en\">\n"
84 <<
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n"
85 <<
"<title>" << escape_special_xml_chars(meta.app_name) <<
" — "
86 << escape_special_xml_chars(meta.short_description) <<
"</title>\n"
90 std::cout <<
"<h1>" << to_html(meta.app_name) <<
"</h1>\n"
91 <<
"<div>" << to_html(meta.short_description) <<
"</div>\n";
101 maybe_close_paragraph();
102 std::cout <<
"<h2>" << to_html(title) <<
"</h2>\n";
112 maybe_close_paragraph();
113 std::cout <<
"<h3>" << to_html(title) <<
"</h3>\n";
121 void print_line(
std::string const & text,
bool line_is_paragraph)
131 if (line_is_paragraph)
132 maybe_close_paragraph();
149 maybe_close_paragraph();
156 std::cout <<
"<dt>" << to_html(term) <<
"</dt>\n"
157 <<
"<dd>" << to_html(desc) <<
"</dd>\n";
163 maybe_close_paragraph();
175 std::string buffer = escape_special_xml_chars(input);
179 for (
auto it = input.
begin(); it != input.
end(); ++it)
185 assert(!(it == input.
end()));
193 assert(!(it == input.
end()));
202 result.
append(
"<strong>");
206 assert(!open_tags.
empty());
239 return "<strong>" + str +
"</strong>";