Fix end-of-headline detection.

This commit is contained in:
tastytea 2021-05-29 23:00:16 +02:00
parent 0accd77a2c
commit 790e60a055
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 4 additions and 7 deletions

View File

@ -117,7 +117,7 @@ std::vector<match> search(const fs::path &filepath,
void cleanup_text(string &text) void cleanup_text(string &text)
{ {
static const boost::regex re_header_start{"<[hH][1-6]"}; static const boost::regex re_header_start{"<[hH][1-6]"};
static const boost::regex re_header_end{"</[hH]"}; static const boost::regex re_header_end{"</[hH][1-6]"};
static const boost::regex re_pagebreak{".+pagebreak.+(title|aria-label)" static const boost::regex re_pagebreak{".+pagebreak.+(title|aria-label)"
"=\"([[:alnum:]]+)\".*"}; "=\"([[:alnum:]]+)\".*"};
@ -130,7 +130,7 @@ void cleanup_text(string &text)
{ {
replacement = "<H>"; replacement = "<H>";
} }
else if (boost::regex_match(text.substr(pos, 3), re_header_end)) else if (boost::regex_match(text.substr(pos, 4), re_header_end))
{ {
replacement = "</H>"; replacement = "</H>";
} }

View File

@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: epubgrep 0.4.0\n" "Project-Id-Version: epubgrep 0.4.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-29 18:42+0200\n" "POT-Creation-Date: 2021-05-29 22:16+0200\n"
"PO-Revision-Date: 2021-05-29 18:42+0200\n" "PO-Revision-Date: 2021-05-29 22:16+0200\n"
"Last-Translator: tastytea <tastytea@tastytea.de>\n" "Last-Translator: tastytea <tastytea@tastytea.de>\n"
"Language-Team: tastytea <https://schlomp.space/tastytea/epubgrep>\n" "Language-Team: tastytea <https://schlomp.space/tastytea/epubgrep>\n"
"Language: de\n" "Language: de\n"
@ -181,6 +181,3 @@ msgstr "Konnte {0:s} nicht schließen."
msgid "{0:s} is damaged. Could not read spine. Skipping file.\n" msgid "{0:s} is damaged. Could not read spine. Skipping file.\n"
msgstr "" msgstr ""
"{0:s} ist beschädigt. Konnte „Spine“ nicht lesen. Überspringe Datei.\n" "{0:s} ist beschädigt. Konnte „Spine“ nicht lesen. Überspringe Datei.\n"
#~ msgid " (while searching {0:s})"
#~ msgstr " (während {0:s} durchsucht wurde)"