openzim / mwoffliner

Mediawiki scraper: all your wiki articles in one highly compressed ZIM file
https://www.npmjs.com/package/mwoffliner
GNU General Public License v3.0
275 stars 72 forks source link

summary and details tag are no longer supported #1915

Open VadimKovalenkoSNF opened 11 months ago

VadimKovalenkoSNF commented 11 months ago

Before mobile-section deprecation mwoffliner used related JSON response to generate collapsible sections using Swig templates (see res/templates/section_wrapper.html file). Since page/html and page/mobile-html are responsible for outputting HTML content, no collapse sections are available. The symptom of this issue is mentioned in https://github.com/openzim/mwoffliner/issues/1860 and https://github.com/openzim/mwoffliner/issues/1866

There are multiple ways to bring these sections to work:

  1. Apply page/html output and related transformations from mobileapps in mwoffliner.
  2. Create our own collapsible sections but on top of page/mobile-html
Jaifroid commented 11 months ago

@VadimKovalenkoSNF I'm not quite sure how substitution happens in mwOffliner, but I've found that the following two steps easily restore the previous behaviour:

I can provide a one-line regular expression JS replacement that does this if you operate on the html as a string, though I suspect you might prefer to use DOM methods to select and replace/wrap the elements.

I have a working solution in prototype code for the Kiwix JS PWA, but it would be much better to fix in the ZIM. Happy to give details if it's helpful.

VadimKovalenkoSNF commented 11 months ago

Thanks, @Jaifroid . I'll probably use DOM methods for this indeed, but your idea seems valid.