Skip to content

Commit

Permalink
Remove need to fix self closing tags by improving gumbo
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Nov 25, 2015
1 parent 3063085 commit 716666a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/Misc/GumboInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ void GumboInterface::parse()
if (!m_source.isEmpty() && (m_output == NULL)) {

m_hasnbsp = m_source.contains(" ");
// fix any non html valid self-closing tags
m_source = fix_self_closing_tags(m_source);
m_utf8src = m_source.toStdString();
// remove any xml header line and any trailing whitespace
if (m_utf8src.compare(0,5,"<?xml") == 0) {
Expand Down Expand Up @@ -457,9 +455,6 @@ QList<GumboWellFormedError> GumboInterface::error_check()

if (!m_source.isEmpty() && (m_output == NULL)) {

// fix any non html valid self-closing tags
m_source = fix_self_closing_tags(m_source);

m_utf8src = m_source.toStdString();
// remove any xml header line and trailing whitespace
if (m_utf8src.compare(0,5,"<?xml") == 0) {
Expand Down Expand Up @@ -1212,6 +1207,7 @@ std::string GumboInterface::prettyprint(GumboNode* node, int lvl, const std::str
}


#if 0

// handle a few special cases that are hard to deal with inside of gumbo

Expand All @@ -1224,8 +1220,6 @@ static QStringList allowed_void_tags = QStringList() << "area" << "base"
<< "param" << "source" << "spacer"
<< "track" << "wbr";

#if 0

// Handle the general case
QString GumboInterface::fix_self_closing_tags(const QString &source)
{
Expand Down Expand Up @@ -1256,8 +1250,6 @@ QString GumboInterface::fix_self_closing_tags(const QString &source)
return newsource;
}

#else

// Handle the specific problem of iframe being self-closed
QString GumboInterface::fix_self_closing_tags(const QString &source)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Misc/GumboInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class GumboInterface

void replace_all(std::string &s, const char * s1, const char * s2);

QString fix_self_closing_tags(const QString & source);
// Hopefully now unneeded
// QString fix_self_closing_tags(const QString & source);

QString m_source;
GumboOutput* m_output;
Expand Down

0 comments on commit 716666a

Please sign in to comment.