Data tables are removed as "unlikely candidates" when a class name contains "header" (e.g. Wikipedia's plainrowheaders)
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- web-dev
Hướng nghiên cứu
Bắt đầu với bước kiểm tra các ứng viên ít có khả năng trong _grabArticle và các bài kiểm thử hiện có về việc loại bỏ ứng viên và bảng. Tái hiện vấn đề bằng ví dụ được cung cấp, sau đó xác minh rằng một bảng có lớp header và các dấu hiệu của bảng dữ liệu được giữ lại, trong khi các bảng bố cục vẫn được xử lý bằng bước dọn dẹp có điều kiện hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
A data table whose class contains header is removed whole by the unlikely-candidate pass in _grabArticle, because REGEXPS.unlikelyCandidates matches header anywhere in the class string. Wikipedia uses class="wikitable sortable plainrowheaders" on many award, filmography and discography tables, so those tables disappear from the output.
Elements inside a table are already exempt (!this._hasAncestorTag(node, "table")), but the <table> element itself is not.
Steps to reproduce
Readability 0.6.0 with jsdom 26.1.0 (the same check exists on main at ab4027a8):
import { Readability } from "@mozilla/readability";
import { JSDOM } from "jsdom";
const para = (n) => Array.from({ length: n }, (_, i) =>
`<p>Paragraph ${i} of the article, long enough to be scored as content, with commas, clauses, and ordinary prose like a real page.</p>`).join("\n");
const table = (cls) => `<table class="${cls}"><caption>Awards</caption>
<tr><th>Award</th><th>Result</th></tr>
<tr><th scope="row">Academy Awards</th><td>Nominated</td></tr>
<tr><th scope="row">Annie Awards</th><td>Won</td></tr></table>`;
const run = (body) => new Readability(
new JSDOM(`<!doctype html><html><body><article>${body}</article></body></html>`).window.document
).parse().content;
for (const cls of ["wikitable", "wikitable plainrowheaders"]) {
console.log(cls, "→ table kept:", run(para(5) + table(cls) + para(2)).includes("Annie Awards"));
}
Output:
wikitable → table kept: true
wikitable plainrowheaders → table kept: false
With debug: true the log shows Removing unlikely candidate - wikitable sortable plainrowheaders ….
Real page: https://en.wikipedia.org/wiki/The_Wild_Robot_(film). The "Accolades" table (118 rows) is missing from the output.
Expected
A data table (one with a caption or <th> cells) is kept. In a table, "header" usually refers to the table's own header cells, not to the page header.
Possible fix
Exempt <table> elements from the unlikely-candidate check in the same way their descendants already are, or at least tables that _markDataTables would treat as data tables. Layout tables would still go through _cleanConditionally.
Related: #775 (also Wikipedia tables, different symptom).
- Ngôn ngữ chính
- JavaScript
- Star
- 11.5k
- Fork
- 741
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mozilla/readability
-
JSDOMParser: Element is missing a lang accessorCó thể đã có người làm @josuesto đã nhận 25 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
mozilla/readability#1026 ·
-
PHRASING_ELEMS missing <u>, <s>, and <bdi> elements causes paragraph splittingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mozilla/readability#997 ·
-
Độ khó 3/5 3-5 ngày Mức phù hợp với người mới 52/100
mozilla/readability#1039 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
mozilla/readability#1037 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
mozilla/readability#1031 ·
Tất cả issue của mozilla/readability
Issue tương tự
-
good first issue
Độ khó 2/5 3-5 ngày Mức phù hợp với người mới 62/100
paipai1999/POS-system#3 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
r-afael/better-yt-recommendations#36 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
microsoft/playwright#43875 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cli good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Run the dependency drift checkCó thể đã có người làm @spaceninja đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
cloudfour/stylelint-config-cloudfour#683 ·
Maintainer thường phản hồi trong vòng 1 ngày