mwoffliner
mwoffliner copied to clipboard
dump.isMainPage() method does not return true when retrieve single main page from CLI
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.
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
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.