summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFiveFilters.org <[email protected]>2021-08-17 16:02:56 +0200
committerFiveFilters.org <[email protected]>2021-08-17 16:02:56 +0200
commit731d21d80e885db262eb8d2ad787a290752d262b (patch)
tree48749d6e5f94930b443f786c81cbfa979be00914
parentabc413822a719be660a0a57cc1db3b7970e9e7f6 (diff)
Fix table header missing
https://github.com/mozilla/readability/commit/9009f64f9ce8b7d593c1ef90864843f72e193cba
-rw-r--r--src/Readability.php1
-rw-r--r--test/test-pages/keep-tabular-data/expected.html16
-rw-r--r--test/test-pages/uses-getfirstelementchild-function/expected.html6
3 files changed, 10 insertions, 13 deletions
diff --git a/src/Readability.php b/src/Readability.php
index 12d7af1..078663a 100644
--- a/src/Readability.php
+++ b/src/Readability.php
@@ -707,6 +707,7 @@ class Readability
if (
preg_match(NodeUtility::$regexps['unlikelyCandidates'], $matchString) &&
!preg_match(NodeUtility::$regexps['okMaybeItsACandidate'], $matchString) &&
+ !$node->hasAncestorTag( 'table') &&
$node->nodeName !== 'body' &&
$node->nodeName !== 'a'
) {
diff --git a/test/test-pages/keep-tabular-data/expected.html b/test/test-pages/keep-tabular-data/expected.html
index ab10fe6..5d0d89a 100644
--- a/test/test-pages/keep-tabular-data/expected.html
+++ b/test/test-pages/keep-tabular-data/expected.html
@@ -41,14 +41,14 @@
<tbody>
<tr>
<td></td>
-
-
-
-
-
-
-
-
+ <td>General&nbsp;UX</td>
+ <td>UX&nbsp;draft</td>
+ <td>UX&nbsp;review</td>
+ <td>UI&nbsp;mockup</td>
+ <td>UI&nbsp;review</td>
+ <td>Implementation draft</td>
+ <td>Implementation review</td>
+ <td>Final&nbsp;review</td>
</tr>
<tr>
<td>Load&nbsp;map</td>
diff --git a/test/test-pages/uses-getfirstelementchild-function/expected.html b/test/test-pages/uses-getfirstelementchild-function/expected.html
index 1287fc8..b9f0750 100644
--- a/test/test-pages/uses-getfirstelementchild-function/expected.html
+++ b/test/test-pages/uses-getfirstelementchild-function/expected.html
@@ -1,6 +1,4 @@
<div>
- <td>
- <div>
<p><img src="http://fakehost/test/logo.jpg" width="400" height="235">
</p>
<div>
@@ -173,6 +171,4 @@
</table>
</div>
- </div>
- </td>
- </div> \ No newline at end of file
+ </div> \ No newline at end of file