Fix pagebreak-iterators.
Oopsie! 😄
This commit is contained in:
parent
99e1cd8e98
commit
9067b387ef
|
@ -136,6 +136,8 @@ void cleanup_text(string &text)
|
||||||
size_t pos{};
|
size_t pos{};
|
||||||
while ((pos = text.find('<', pos)) != string::npos)
|
while ((pos = text.find('<', pos)) != string::npos)
|
||||||
{
|
{
|
||||||
|
auto endpos{text.find('>', pos) + 1};
|
||||||
|
|
||||||
// Mark headlines. We need them later on.
|
// Mark headlines. We need them later on.
|
||||||
string replacement;
|
string replacement;
|
||||||
if (boost::regex_match(text.substr(pos, 3), re_header_start))
|
if (boost::regex_match(text.substr(pos, 3), re_header_start))
|
||||||
|
@ -148,13 +150,11 @@ void cleanup_text(string &text)
|
||||||
}
|
}
|
||||||
else if (text.substr(pos, 6) == "<span ")
|
else if (text.substr(pos, 6) == "<span ")
|
||||||
{
|
{
|
||||||
auto endpos{text.find('>')};
|
|
||||||
|
|
||||||
boost::match_results<string::const_iterator> match;
|
boost::match_results<string::const_iterator> match;
|
||||||
using it_size_t = string::const_iterator::difference_type;
|
using it_size_t = string::const_iterator::difference_type;
|
||||||
string::const_iterator begin{text.begin()
|
string::const_iterator begin{text.begin()
|
||||||
+ static_cast<it_size_t>(pos)};
|
+ static_cast<it_size_t>(pos)};
|
||||||
string::const_iterator end{text.end()
|
string::const_iterator end{text.begin()
|
||||||
+ static_cast<it_size_t>(endpos)};
|
+ static_cast<it_size_t>(endpos)};
|
||||||
|
|
||||||
if (boost::regex_search(begin, end, match, re_pagebreak))
|
if (boost::regex_search(begin, end, match, re_pagebreak))
|
||||||
|
@ -168,7 +168,7 @@ void cleanup_text(string &text)
|
||||||
pos = text.find('>', pos) + 1;
|
pos = text.find('>', pos) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
text.replace(pos, text.find('>', pos) + 1 - pos, replacement);
|
text.replace(pos, endpos - pos, replacement);
|
||||||
pos += replacement.length();
|
pos += replacement.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user