Skip to content

Commit cee764c

Browse files
committed
[numerical commas] made it so that commas that appear in numbers like 9,99 don't count towards the actual readability score
1 parent 08be6b4 commit cee764c

5 files changed

Lines changed: 5597 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ You can run it using:
4545
$ node test/generate-testcase.js slug https://example.com/article
4646

4747
Replacing `slug` with the identifier the test should use, and providing a URL
48-
to an actual article on which the test should be based. If your test case involves dynamic content, you can save the page to disk and pass the file as a `file://` URL.
48+
to an actual article on which the test should be based.
49+
50+
If you find it difficult to download the page for some reason, you can create the testcase folder (in the test-pages directory) with the `slug` as the name, and add the source.html from the page. Be sure to delete as many script tags as possible so jsDom acts properly. Then finally, running the following actual command to generate the `expected.html` and `expected-metadata.json`
51+
52+
$ node test/generate-testcase.js slug
4953

5054
You may need to make the `tidy` binary executable before that script will succeed. If you see an `EACCES` error when running that script, try:
5155

Readability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Readability.prototype = {
164164
b64DataUrl: /^data:\s*([^\s;,]+)\s*;\s*base64\s*,/i,
165165
// Commas as used in Latin, Sindhi, Chinese and various other scripts.
166166
// see: https://en.wikipedia.org/wiki/Comma#Comma_variants
167-
commas: /\u002C|\u060C|\uFE50|\uFE10|\uFE11|\u2E41|\u2E34|\u2E32|\uFF0C/g,
167+
commas: /[\s\D][\u002C\u060C\uFE50\uFE10\uFE11\u2E41\u2E34\u2E32\uFF0C][\s\D]/g,
168168
// See: https://schema.org/Article
169169
jsonLdArticleTypes:
170170
/^Article|AdvertiserContentArticle|NewsArticle|AnalysisNewsArticle|AskPublicNewsArticle|BackgroundNewsArticle|OpinionNewsArticle|ReportageNewsArticle|ReviewNewsArticle|Report|SatiricalArticle|ScholarlyArticle|MedicalScholarlyArticle|SocialMediaPosting|BlogPosting|LiveBlogPosting|DiscussionForumPosting|TechArticle|APIReference$/,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"title": "Airfryer kopen? Beste prijs, snelle levering",
3+
"byline": null,
4+
"dir": null,
5+
"lang": "nl",
6+
"excerpt": "Vind je airfryer of hetelucht friteuse bij Krëfel. Voor 22u00 besteld, volgende dag gratis geleverd. Laagste prijsgarantie. Bestel nu online.",
7+
"siteName": null,
8+
"publishedTime": null,
9+
"readerable": true
10+
}

0 commit comments

Comments
 (0)