mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
fix htmltoxhtml
This commit is contained in:
@ -27,11 +27,10 @@ static std::string mhtTohtml(std::string& sFileContent);
|
||||
static void replace_all(std::string& s, const std::string& s1, const std::string& s2)
|
||||
{
|
||||
size_t pos = s.find(s1);
|
||||
size_t l = s2.length();
|
||||
while(pos != std::string::npos)
|
||||
{
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + l);
|
||||
pos = s.find(s1, pos + s2.length());
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +62,17 @@ static std::wstring htmlToXhtml(std::string& sFileContent)
|
||||
}
|
||||
}
|
||||
|
||||
// Избавление от <a/>
|
||||
size_t posA = sFileContent.find("<a ");
|
||||
while(posA != std::string::npos)
|
||||
{
|
||||
size_t nBegin = sFileContent.find('<', posA + 1);
|
||||
size_t nEnd = sFileContent.find("/>", posA);
|
||||
if(nEnd < nBegin)
|
||||
sFileContent.replace(nEnd, 2, "></a>");
|
||||
posA = sFileContent.find("<a ", nBegin);
|
||||
}
|
||||
|
||||
// Gumbo
|
||||
GumboOptions options = kGumboDefaultOptions;
|
||||
GumboOutput* output = gumbo_parse_with_options(&options, sFileContent.data(), sFileContent.length());
|
||||
|
||||
Reference in New Issue
Block a user