parent
299063e02c
commit
b1dcdea95e
@ -140,8 +140,10 @@ void html_all(const std::vector<std::vector<search::match>> &matches_all,
|
|||||||
{
|
{
|
||||||
std::uint64_t count{1};
|
std::uint64_t count{1};
|
||||||
|
|
||||||
cout << "<!DOCTYPE html>\n"
|
cout << "<!DOCTYPE html>\n";
|
||||||
<< "<html><head><title>epubgrep output</title>"
|
// Translators: Replace “en” with your language code here.
|
||||||
|
cout << format(R"(<html lang="{0:s}">)", translate("en").str());
|
||||||
|
cout << "<head><title>epubgrep output</title>"
|
||||||
"<style>article { margin: 1em; }</style>"
|
"<style>article { margin: 1em; }</style>"
|
||||||
"</head><body>\n\n";
|
"</head><body>\n\n";
|
||||||
|
|
||||||
@ -182,6 +184,15 @@ void html_all(const std::vector<std::vector<search::match>> &matches_all,
|
|||||||
|
|
||||||
for (const auto &match : matches)
|
for (const auto &match : matches)
|
||||||
{
|
{
|
||||||
|
const auto lang{[&match]
|
||||||
|
{
|
||||||
|
if (!match.language.empty())
|
||||||
|
{
|
||||||
|
return format(R"( lang="{0:s}")",
|
||||||
|
match.language);
|
||||||
|
}
|
||||||
|
return std::string{};
|
||||||
|
}()};
|
||||||
cout << " <tr>\n";
|
cout << " <tr>\n";
|
||||||
if (!opts.no_fn_epub)
|
if (!opts.no_fn_epub)
|
||||||
{
|
{
|
||||||
@ -190,15 +201,16 @@ void html_all(const std::vector<std::vector<search::match>> &matches_all,
|
|||||||
match.filepath_inside)
|
match.filepath_inside)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
cout << format(R"( <td headers="headline_{0:d}">{1:s}</td>)",
|
cout << format(
|
||||||
count, match.headline)
|
R"( <td headers="headline_{0:d}"{1:s}>{2:s}</td>)", count,
|
||||||
|
lang, match.headline)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
cout << format(R"( <td headers="page_{0:d}">{1:s}</td>)",
|
cout << format(R"( <td headers="page_{0:d}">{1:s}</td>)",
|
||||||
count, match.page)
|
count, match.page)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
cout << format(R"( <td headers="match_{0:d}">{1:s})"
|
cout << format(R"( <td headers="match_{0:d}"{1:s}>{2:s})"
|
||||||
R"(<strong>{2:s}</strong>{3:s}</td>)",
|
R"(<strong>{3:s}</strong>{4:s}</td>)",
|
||||||
count, match.context.first, match.text,
|
count, lang, match.context.first, match.text,
|
||||||
match.context.second)
|
match.context.second)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
cout << " </tr>\n";
|
cout << " </tr>\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user