From 86c98923cdb72f1051cb32684e311b5c36611614 Mon Sep 17 00:00:00 2001 From: krackers Date: Sat, 11 Jul 2020 16:10:00 -0700 Subject: [PATCH 1/2] Bug fixes for Webster entry detection * Using `!src` by itself seems insufficient since `.find` always returns a valid (i.e. non-null) JS object; you must further check that it contains the relevant tag * The match list excluded the "1913 Webster + PJC" source. --- index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 30c060d..bf73a8f 100644 --- a/index.ts +++ b/index.ts @@ -252,14 +252,15 @@ function parseFile (file: string) { if (ONLYWEBSTER) { let src; let p = el; - while (!src) { + while (!src || src.length == 0) { src = p.find('source'); p = p.next(); + if (p.length == 0) { + break; + } } - if (src.text().trim() !== '1913 Webster' && - src.text().trim() !== 'Webster 1913 Suppl.' - ) { + if (!src.text().includes('1913')) { return true; } From 1a7760999b5b23021837b8f0d1632c0bc29f8539 Mon Sep 17 00:00:00 2001 From: krackers Date: Sat, 11 Jul 2020 16:44:53 -0700 Subject: [PATCH 2/2] Revert inclusion of "1913 Webster + PJC" source --- index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index bf73a8f..7a4b4cb 100644 --- a/index.ts +++ b/index.ts @@ -260,7 +260,9 @@ function parseFile (file: string) { } } - if (!src.text().includes('1913')) { + if (src.text().trim() !== '1913 Webster' && + src.text().trim() !== 'Webster 1913 Suppl.' + ) { return true; }