remove LIBXML_NOEMPTYTAG because of double <br/>s - the #357 issue with

htmlpurifier might not be relevant anymore because of htmLawed switch,
but <br/>s are annoying
This commit is contained in:
Andrew Dolgov 2013-03-16 16:07:11 +04:00
parent ef1162593f
commit cc38c8e549
7 changed files with 9 additions and 21 deletions

View File

@ -2575,7 +2575,6 @@
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$entries = $xpath->query('(//a[@href]|//img[@src])'); $entries = $xpath->query('(//a[@href]|//img[@src])');
$br_inserted = 0;
foreach ($entries as $entry) { foreach ($entries as $entry) {
@ -2594,22 +2593,11 @@
if (strtolower($entry->nodeName) == "a") { if (strtolower($entry->nodeName) == "a") {
$entry->setAttribute("target", "_blank"); $entry->setAttribute("target", "_blank");
} }
if (strtolower($entry->nodeName) == "img" && !$br_inserted) {
$br = $doc->createElement("br");
if ($entry->parentNode->nextSibling) {
$entry->parentNode->insertBefore($br, $entry->nextSibling);
$br_inserted = 1;
}
}
} }
$node = $doc->getElementsByTagName('body')->item(0); $node = $doc->getElementsByTagName('body')->item(0);
// http://tt-rss.org/redmine/issues/357 return $doc->saveXML($node);
return $doc->saveXML($node, LIBXML_NOEMPTYTAG);
} }
function check_for_update($link) { function check_for_update($link) {
@ -3774,7 +3762,7 @@
// http://tt-rss.org/forum/viewtopic.php?f=1&t=970 // http://tt-rss.org/forum/viewtopic.php?f=1&t=970
if ($node) if ($node)
return $doc->saveXML($node, LIBXML_NOEMPTYTAG); return $doc->saveXML($node);
else else
return $html; return $html;
} }

View File

@ -1082,7 +1082,7 @@
$node = $doc->getElementsByTagName('body')->item(0); $node = $doc->getElementsByTagName('body')->item(0);
return $doc->saveXML($node, LIBXML_NOEMPTYTAG); return $doc->saveXML($node);
} }
function expire_lock_files($debug) { function expire_lock_files($debug) {
@ -1280,7 +1280,7 @@
$node = $doc->getElementsByTagName('body')->item(0); $node = $doc->getElementsByTagName('body')->item(0);
if ($node) { if ($node) {
$content = $doc->saveXML($node, LIBXML_NOEMPTYTAG); $content = $doc->saveXML($node);
return $content; return $content;
} }

View File

@ -44,7 +44,7 @@ class Af_Buttersafe extends Plugin {
} }
if ($basenode) { if ($basenode) {
$article["content"] = $doc->saveXML($basenode, LIBXML_NOEMPTYTAG); $article["content"] = $doc->saveXML($basenode);
$article["plugin_data"] = "buttersafe,$owner_uid:" . $article["plugin_data"]; $article["plugin_data"] = "buttersafe,$owner_uid:" . $article["plugin_data"];
} }
} }

View File

@ -44,7 +44,7 @@ class Af_Explosm extends Plugin {
} }
if ($basenode) { if ($basenode) {
$article["content"] = $doc->saveXML($basenode, LIBXML_NOEMPTYTAG); $article["content"] = $doc->saveXML($basenode);
$article["plugin_data"] = "explosm,$owner_uid:" . $article["plugin_data"]; $article["plugin_data"] = "explosm,$owner_uid:" . $article["plugin_data"];
} }
} }

View File

@ -44,7 +44,7 @@ class Af_GoComics extends Plugin {
} }
if ($basenode) { if ($basenode) {
$article["content"] = $doc->saveXML($basenode, LIBXML_NOEMPTYTAG); $article["content"] = $doc->saveXML($basenode);
$article["plugin_data"] = "gocomics,$owner_uid:" . $article["plugin_data"]; $article["plugin_data"] = "gocomics,$owner_uid:" . $article["plugin_data"];
} }
} }

View File

@ -44,7 +44,7 @@ class Af_PennyArcade extends Plugin {
} }
if ($basenode) { if ($basenode) {
$article["content"] = $doc->saveXML($basenode, LIBXML_NOEMPTYTAG); $article["content"] = $doc->saveXML($basenode);
$article["plugin_data"] = "pennyarcade,$owner_uid:" . $article["plugin_data"]; $article["plugin_data"] = "pennyarcade,$owner_uid:" . $article["plugin_data"];
} }
} }

View File

@ -113,7 +113,7 @@ class Af_RedditImgur extends Plugin {
$node = $doc->getElementsByTagName('body')->item(0); $node = $doc->getElementsByTagName('body')->item(0);
if ($node && $found) { if ($node && $found) {
$article["content"] = $doc->saveXML($node, LIBXML_NOEMPTYTAG); $article["content"] = $doc->saveXML($node);
if (!$force) $article["plugin_data"] = "redditimgur,$owner_uid:" . $article["plugin_data"]; if (!$force) $article["plugin_data"] = "redditimgur,$owner_uid:" . $article["plugin_data"];
} }
} }