Data tables are removed as "unlikely candidates" when a class name contains "header" (e.g. Wikipedia's plainrowheaders)
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- web-dev
調査の方向性
_grabArticle の可能性が低い候補のチェックと、候補の削除およびテーブルに関する既存のテストから始めてください。提示された例で問題を再現し、header クラスとデータテーブルのマーカーを持つテーブルが保持される一方で、レイアウトテーブルには引き続き既存の条件付きクリーンアップが適用されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- JavaScript
- スター
- 11.5k
- フォーク
- 741
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mozilla/readability のほかの issue
-
JSDOMParser: Element is missing a lang accessor対応中かも @josuesto が 22 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
mozilla/readability#1026 ·
-
PHRASING_ELEMS missing <u>, <s>, and <bdi> elements causes paragraph splitting対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mozilla/readability#997 ·
-
難易度 3/5 3〜5日 初心者へのやさしさ 52/100
mozilla/readability#1039 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
mozilla/readability#1037 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
mozilla/readability#1031 ·
mozilla/readability の issue をすべて見る
似ている issue
-
Let TypeScript accept an initial object in ReactiveDict対応中かも @yograj-vijay-yadav が今日担当しました。 オープンbug good first issue help wanted workshop
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
meteor/meteor#14919 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
akitaonrails/FrankMD#268 ·
メンテナーはふだん 1 日以内に返信
-
account: profile
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 5 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
mfreed7/xslt_polyfill#65 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信