21 namespace seqan3::detail
34 class format_html :
public format_help_base<format_html>
37 using base_type = format_help_base<format_html>;
46 format_html() =
default;
47 format_html(format_html
const & pf) =
default;
48 format_html & operator=(format_html
const & pf) =
default;
49 format_html(format_html &&) =
default;
50 format_html & operator=(format_html &&) =
default;
51 ~format_html() =
default;
54 format_html(std::vector<std::string>
const & names,
bool const advanced =
false) : base_type{names,
advanced}
60 void maybe_close_list()
64 std::cout <<
"</dl>\n";
70 void maybe_close_paragraph()
74 std::cout <<
"</p>\n";
83 std::cout <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "
84 <<
"http://www.w3.org/TR/html4/strict.dtd\">\n"
85 <<
"<html lang=\"en\">\n"
87 <<
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n"
88 <<
"<title>" << escape_special_xml_chars(meta.app_name) <<
" — "
89 << escape_special_xml_chars(meta.short_description) <<
"</title>\n"
93 std::cout <<
"<h1>" << to_html(meta.app_name) <<
"</h1>\n"
94 <<
"<div>" << to_html(meta.short_description) <<
"</div>\n";
100 void print_section(std::string
const & title)
104 maybe_close_paragraph();
105 std::cout <<
"<h2>" << to_html(title) <<
"</h2>\n";
111 void print_subsection(std::string
const & title)
115 maybe_close_paragraph();
116 std::cout <<
"<h3>" << to_html(title) <<
"</h3>\n";
124 void print_line(std::string
const & text,
bool line_is_paragraph)
130 std::cout <<
"<p>\n";
133 std::cout << to_html(text) <<
"\n";
134 if (line_is_paragraph)
135 maybe_close_paragraph();
137 std::cout <<
"<br>\n";
149 void print_list_item(std::string
const & term, std::string
const & desc)
152 maybe_close_paragraph();
156 std::cout <<
"<dl>\n";
159 std::cout <<
"<dt>" << to_html(term) <<
"</dt>\n"
160 <<
"<dd>" << to_html(desc) <<
"</dd>\n";
166 maybe_close_paragraph();
169 std::cout <<
"</body></html>";
176 std::string to_html(std::string
const & input)
178 std::string buffer = escape_special_xml_chars(input);
180 std::vector<std::string> open_tags;
182 for (
auto it = input.begin(); it != input.end(); ++it)
188 assert(!(it == input.end()));
191 result.push_back(*it);
196 assert(!(it == input.end()));
199 open_tags.push_back(
"em");
200 result.append(
"<em>");
204 open_tags.push_back(
"strong");
205 result.append(
"<strong>");
209 assert(!open_tags.empty());
211 result.append(open_tags.back());
213 open_tags.pop_back();
217 result.append(
"\\f");
218 result.push_back(*it);
223 result.push_back(
'\\');
224 result.push_back(*it);
229 result.push_back(*it);
240 std::string in_bold(std::string
const & str)
242 return "<strong>" + str +
"</strong>";
@ advanced
Definition: auxiliary.hpp:245
Checks if program is run interactively and retrieves dimensions of terminal (Transferred from seqan2)...
Provides SeqAn version macros and global variables.