Commit Graph

10 Commits (3844d8f05b3f114e3df16c3bc3caf44e5ba52181)

Author SHA1 Message Date
PalmerAL 3844d8f05b
Include more ancestors in candidate scoring (#611)
* include more ancestors in candidate scoring

* fix medium-3 testcase

The original source file contained two copies of the document, which
was causing incorrect results

* remove unnecessary nested elements

* fix removal of empty elements

* add option to regenerate all testcases

* update tests

* fix quanta testcase

* fix creating testcase from network

* fix early exit in testcase generation

* format HTML before comparing while testing

* upgrade js-beautify

* don't merge outer readability div
4 years ago
Gijs Kruitbosch b2f3a43f9f Detect 'trailing' content when comparing DOMs 4 years ago
Radhi Fadlillah c942b32945 Revert source files and fix expected results 5 years ago
Radhi Fadlillah 3e025d58e5 fix error in testing "lwn-01" 5 years ago
David A Roberts 9f2c5cb42e Put phrasing content into paragraphs
This removes the need for `p.readability-styled` elements.
6 years ago
Cameron McCormack 5ad448f831 Update test expectations. 7 years ago
Taylor Hunt b7c32feb25 Remove presentational HTML attributes (#385)
* Remove presentational HTML attributes

Fixes #383

This patch loops through a list of known-presentational attributes in HTML, attempting to remove each from each cleaned element. (Checking for the attribute's existence first seems to just add needless overhead.)

The extra check for the HTML namespace is to avoid removing attributes that inline SVG needs.

* Only remove `width`/`height` for certain elements

Embedded media elements are allowed to have them, but not others.

* Address PR feedback

* Fix loop index formatting
* Only remove `width`/`height` from certain elements
* Combine logic into a single check/remove

* Attempt fixing my recursion

* One weird trick to get your loops to run

* Add inline SVG bailout

Try not to touch any styles for `<svg>`, because it's inherently presentational.

* Update tests to match newly-removed attributes

* Oh those wacky SVGs

The `position:absolute` is a trick to import clipping paths into the document without putting a big 300×150 empty space in it. (`display:none` and such disable the clipPath in some browsers.)

* Whoops, missed some `width`s

* Normalize SVG tagName

JSDOMParser differs from the official DOM here
7 years ago
Gijs Kruitbosch 2e1cb3f467 Fix issue #251 by making JSDOMParser expect XML and stop making excuses for 'self-closed' things, when all that does is cause trouble 8 years ago
Nicolas Perriault 9dbc009376 Fixes #113 - Recursive node ancestor scoring. 9 years ago
Nicolas Perriault 2451a07a7d Fixes #150 - Keep article intermediary headings. 9 years ago