alexadam / save-as-ebook

Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera Web Extension
MIT License
1.1k stars 70 forks source link

Ruby rp tags dropped by extractCss() of extractHtml.js #65

Open nuthrash opened 2 years ago

nuthrash commented 2 years ago

It seems that the code if (!$pre.is(':visible')) { $pre.replaceWith(''); } would drop invisible tag 'rp' in recent versions of modern browsers. However, this method may cause some ePub readers which are not supported ruby (e.g. SumatraPDF) would missing parenthesis.

Taking SumatraPDF as ePub reader as an example, when ruby rp tags are existed would look like

ruby base(ruby text)

Meanwhile, the ePub file packed by save-as-ebook would look like

ruby base ruby text

I think it is better not drop the rp tags, even if they are invisible in ruby-supported browsers. My ugly workaround code is if( pre.tagName.toLowerCase() === 'rp' ) { return; } , it just simply exclude rp tags when drop invisible tags.