Skip to main content

Getting the section breaks to show in FBReader

I've come across a very annoying design choice in FBReader. Since people have been complaining about it for over a decade, I'm sure it is a choice and not a bug. When FBReader encounters the <hr /> element in an EPUB, it ignores it entirely. Since this is a very common, and I would argue very correct, way to show a break a bit more than a new paragraph and a bit less than a new chapter, this seems like a bad design choice. However, apparently they're not even the only ones.

You could try to fix it by using some <p>&nbsp;</p> instead. This is another common way that ebook creators have used to show section breaks. It mimics the printer solution where everything is formatting and nothing is meaning. However, meaning is now possible and even considered desirable. Also, some ebook readers like to ignore this one as empty space, too. The fact that &nbsp; is explicitly not meant to be treated as empty space is beside the point, apparently. I found one quoted as saying you should be applying larger margins before or after the paragraph, not imposing an empty line. I can only say, no, both are wrong. It's certainly not an improvement.

 Back to the problem of FBReader ignoring <hr /> outright: This problem is particularly illustrated by Standard Ebooks, who have thought long and hard about having meaningful markup and concluded also that <hr /> is the right way. They also have made it so the first paragraph in any section does not have an indent although every other one does. So, when there's a paragraph that manages to finish very near the right edge and then a break and then a paragraph without an indent, there isn't even a clue that there's a new paragraph where there's probably been a complete change in all sorts of things like location and viewpoint and on and on. Authors have used these extensively for such things, after all.

 It creates a "WTF just happened?" situation as what looks like a continuous paragraph is actually a big change.

But in this is also the seed of a solution. The reader is listening to something to make those paragraphs have no indent. I looked at the code and they aren't specially marked up. I looked at the CSS files and those had a long list of "$thing + p" that would get no indent. One of those is "hr + p".

I tried this little bit of code:

hr + p{
    margin-top: 2em;
}

This probably goes in the "core.css" file in a Standard Ebook offering. It'll go in some CSS file in others. The size may be chosen differently, if one desires.

And it works! Well, it can't be styled the way an <hr /> element can, but it captures the look of most printer breaks. Admittedly, they add *** to breaks that occur at the start or end of a page because they are otherwise invisible and you can't here. Hopefully they're not quite so invisible.

Other solutions I have seen is to use (for the asterisk form):

<div class="break">***</div>

And then add some CSS code:

.break{
    margin: 1em 0; 
    text-align: center;
} 

Which still has its detractors since one won't align the text as desired. But it does sort of say what it is. Not just a "I feel like a bit of white space should go here for looks" but a meaningful break because something is changing.

 Anyway, I'll be adding the "hr + p" one into the CSS to get it working. It'll look a bit stupid if they ever see sense and implement the element, but those WTF moments are worse and this fixes it now. 

Comments

Popular posts from this blog

Strava Heat Map and Open Street Map

Found me a new trick for editing the map, which is really nice for confirming that other people also see the paths I see. The Strava Global Heat Map . They seem to be getting quite a few to participate and, while the heat may not be strong, it often extends into backcountry routes. You can get it as a background for editing Open Street Map via Strava-iD . The background here is not as detailed as can be found on the heat map if you are logged in and may be an older data set. I'm not sure. I am sure that it is useful. For instance, I found that my path and the marked path for climbing Medicine Bow on the popular eastern side did not match up. They were very much of the same shape, which is always a warning bell that some GPS might have transposed itself sideways. Both paths seemed to be following a line that could be a trail, but frankly the pictures aren't that great for that spot. Which is correct? Mine was the only GPS trace uploaded to Open Street Map, so that layer wasn...

Xero Shoes

I currently have Xero Shoes in two styles. The first is the TerraFlex and the second is the Mesa Trail. The TerraFlex has exposed webbing that I managed to chew through while hiking cross country in New Mexico. That first pair was replaced for free based on a picture of them with torn ribbons, so that was nice. Still, they need to be in nicer environments. There's actually a bit of wear on the rest of the shoe from the harsh ground in the boot heal. The Mesa Trail is a thinner sole. Conventional wisdom is that a stiffer sole allows going further with less energy. I find I'm about done in these after 10 miles and there's just a little too much ground feel for my taste. They both suffer from being low cut, which allows more crud to get in the top and the odd rock gets kicked up to whack me in the ankle. They've come out with some more hiking oriented shoes now as well as reworking the shoes I have into version 2. So, here is a comparison of the relevant parameters. ...