JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
772 stars 165 forks source link

reworked royalroad paragraph spacing fix #806

Closed HazelSh closed 2 years ago

HazelSh commented 2 years ago

Now with fewer unintended consequences, and story urls for testing. Hoping to be done with #690 #798 etc.


Here's the links to affected stories I've stumbled across.

First issue is stories using <div>&nbsp;</div> for spacing. This is broken in fanficfare, and isn't a problem on the site. It also, IMO, makes stories totally unreadable.

The Flower That Bloomed Nowhere, chapter 25 (& other chapters). ch. 24 is fine. (yes, both chapters have the same name) https://www.royalroad.com/fiction/28806/the-flower-that-bloomed-nowhere/chapter/570921/025-in-fading-image https://www.royalroad.com/fiction/28806/the-flower-that-bloomed-nowhere/chapter/569067/024-in-fading-image

12 Miles Below, book 2 chapter 32 (contrast book 2 chapter 31) https://www.royalroad.com/fiction/42367/12-miles-below/chapter/819477/book-2-chapter-32-kidra-t https://www.royalroad.com/fiction/42367/12-miles-below/chapter/817701/book-2-chapter-31-bargains-offered-by-the-devil

Wizard's Tower, Ch. 33 (contrast ch.32) https://www.royalroad.com/fiction/41881/wizards-tower/chapter/677695/chapter-33 https://www.royalroad.com/fiction/41881/wizards-tower/chapter/677105/chapter-32

The second issue is double spacing with <p></p> tags. It's extremely annoying to read on a kindle, but true to the site. I'll understand if this is wontfix due to the stories themselves being broken. Still, the inconsistency for some stories suggests that it's not author intent.

Only Villians Do That (entire story) https://www.royalroad.com/fiction/40182/only-villains-do-that

The Daily Grind, ch.9 and other chapters intermittently https://www.royalroad.com/fiction/15925/the-daily-grind/chapter/186721/chapter-009

Beware of chicken, v2ch81 onwards https://www.royalroad.com/fiction/39408/beware-of-chicken/chapter/797029/v2c81-plum-blossom-contemplations

Prophecy Approved Companion (entire story) https://www.royalroad.com/fiction/35549/prophecy-approved-companion


There's at least one other royalroad paragraph spacing issue floating around that this doesn't fix. See The Calamitous Bob, chapter 38 (contrast with ch. 37) https://www.royalroad.com/fiction/44132/the-calamitous-bob/chapter/744534/chapter-38-mountain-people For me, this renders differently in the Calibri ebook reader vs the calibri ebook viewer (!) which I'm hoping is some configuration problem on my end, and not the previous changes to author's notes I submitted somehow messing things up.

JimmXinu commented 2 years ago

You have similar, but arguably unrelated issues here. And technically they all come under the heading of 'bad HTML from the author'.

First issue is stories using <div>&nbsp;</div> for spacing.

<div>&nbsp;</div> can be addressed with CSS, this works for me:

[https://www.royalroad.com/fiction/28806]
add_to_output_css:
 div { margin-bottom:1em; }

It basically just gives <div> the same margin as <p>. Can be more precisely targeted if you still have class attributes (which is FFF's default):

[https://www.royalroad.com/fiction/28806]
add_to_output_css:
 div.chapter-content div { margin-bottom:1em; }

The second issue is double spacing with <p></p> tags.

As you've found, removing p from keep_empty_tags will remove those.

However, I'm reluctant to change the default keep_empty_tags setting for all users for the whole the site. I see that not-infrequently on AO3, too, but I also see authors that legitimately use empty p tags as section breaks.

I think it's better handled by the user choosing to set that configuration for themselves for individual stories or the site as whole if they so choose.

I would accept adding a commented setting change in defaults.ini that explains why a user might want to have it that they could copy to personal.ini. It might be better handled as an FAQ.

See The Calamitous Bob, chapter 38 (contrast with ch. 37)

I don't have the calibri ebook viewer to look at (I assume you meant Calibre for one of them). Without knowing what's different I can only speculate.

That story has explicit style attributes on most p tags, such as <p style="margin-bottom: 1em">, also 0em and 2em. You may get better results with add_to_keep_html_attrs:,style, or if you already have that, they may be conflicting with your CSS settings.

Mandabar commented 2 years ago

I wonder if this is the issue I sometimes see with the story Delve and having two words with no spacing in between them.

JimmXinu commented 2 years ago

Possibly. If there's an empty tag between two word that is then removed, that could happen.

If you give a story URL, chapter and where in the chapter, I can look at it and tell you for sure.