View Single Post
Old 06-24-2022, 11:45 AM   #7265
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,033
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by dysphere View Post
Hmm, it looks like it's removing more divs than necessary, starting on the 22nd file, which causes the location number to change on the kindle, which makes it more difficult for me to find where I was reading last. Epubs attached so you can compare.
The only change I see is removing empty div tags (containing only whitespace).

It looks like the author/poster is using p tags in some chapters and div tags--nested in other div tags with nested div tags containing   in-between--in many (but not all) chapters between chapters 22 and 83 to indicate paragraphs.

It's the difference between this:
Code:
<p>The first thought in my mind was: <em>Is he dead?</em></p>
And this:
Code:
<div>
<div>"So let me get this straight," Ran said, lowering her brow.</div>
</div>
<div>
<div>&nbsp;</div>
</div>
p is obviously preferred. Using div tags can work, but it requires some CSS to appear the same--div doesn't have the same spacing by default.

FFF has code to automatically remove most empty(whitespace only) tags because, generally speaking, that's how HTML is meant to work. For most tags, whitespace doesn't matter and an empty tag shouldn't do anything.

By default, the exceptions are p, th, and td tags, but that list can be changed with FFF setting keep_empty_tags.

So as far as I'm concerned, the question isn't why is this happening on update?, the question is why isn't this happening on the initial download?

And the answer is that FFF is removing the whitespace only tags (ie <div>&nbsp;</div>), but that removal leaves it's parent tag, which is now empty(except for whitespace),

This:
Code:
<div>
<div>&nbsp;</div>
</div>
...becomes this:
Code:
<div>

</div>
...and, on update, is itself removed.

So, for dysphere's immediate problem (locations in book reader changing between updates), the solution that's available today is to add div to keep_empty_tags, something like this:
Code:
[https://www.royalroad.com/fiction/28806]
add_to_keep_empty_tags:,div
Change the section to royalroad.com to apply it to all stories on the site.

This is less than ideal as it just keeps the 'empty' tags, but it will stop FFF changing the chapter text across updates.

I'm looking at ways to loop the remove-empty-tags code to also remove newly emptied tags. If I figure out something I'm happy with, there will be test version posted.
JimmXinu is offline   Reply With Quote