mwoffliner icon indicating copy to clipboard operation
mwoffliner copied to clipboard

dump.isMainPage() method does not return true when retrieve single main page from CLI

Open VadimKovalenkoSNF opened this issue 1 year ago • 2 comments

mwoffliner doens't trigger events related to main page while trying to retrieve it directly

Steps to reproduce

Run: npm start -- --mwUrl=https://en.wikivoyage.org [email protected] --articleList=Main_Page

Expected result:

dump.isMainPage(articleId) to return true

Actual result:

dump.isMainPage(articleId) returns false

Solution

While deeper investigation I found that dump.mwMetaData.mainPage is set to an empty string on the stage of sanitizing the main page while the execution process is in src/mwoffliner.lib.ts. The sanitizing process should probably be refactored to handle a single main page in the article list. Also, the issue mentioned in https://github.com/openzim/mwoffliner/issues/1872 is probably a symptom of the wrong main page calculation.

VadimKovalenkoSNF avatar Aug 25 '23 11:08 VadimKovalenkoSNF

Upd: this problem might be mitigated by explicit setting of the main page title in the CLI: npm start -- --mwUrl=https://en.wikivoyage.org [email protected] --articleList=Main_Page --customMainPage=Main_Page

VadimKovalenkoSNF avatar Aug 25 '23 11:08 VadimKovalenkoSNF

Also, the issue mentioned in https://github.com/openzim/mwoffliner/issues/1872 is probably a symptom of the wrong main page calculation.

Upd 2: This is not related to a problem with CLI options but rather because injectHeader is not included in the Wikimedia Desktop API renderer.

VadimKovalenkoSNF avatar Aug 25 '23 12:08 VadimKovalenkoSNF