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...

Discoveries: Flower Crab Spiders

Once upon a time, while having some amazing Zion National Park rocks to look at, I took a moment to observe the flowers. There was one quite pretty penstemon getting pollinated by a bee. Except there was something wrong. The whole of the scene was very very still. The bee hung in front of the flower without so much as a wing flap. Where was physics? The natural laws were not being obeyed. A frozen tableau in Zion. I looked closer and found I wasn't seeing all of the bee. At first I saw something like two fangs and the negative space resolved itself into a large spider. The integrity of physics was restored, but flowers had just become very dangerous places. The things you find when out and about! But it does make a bit of sense. You hear that watering holes are one of the most dangerous places for wandering animals. This would just be the bee equivalent. I then returned home to those nice, safe flowers I'd known. A very familiar blue-dick hosting danger. Sp...

Winter Reading: Yosemite Trails by J. Smeaton Chase

Yosemite Trails was ostensibly a guide book, but I expect that if I were getting it for that purpose, I'd be rather disappointed. It's rather like the posts on my own blog in that it describes the route that was taken including remarks about the quality of the trail and excellence of a campsite. Sometimes options are mentioned. When an opportunity arises, a little camp etiquette might get thrown in. However, he even spends a week of one trip not knowing for sure where he is. It is actually a story of traveling the trails of Yosemite. The first part contains a couple small stories plus a circumnavigation of the rim. The second part goes further afield in traveling the high country near the park. Published in 1911, he describes a familiar and unfamiliar place. The Tioga road, which I should follow for some fifteen miles, is a rough track built in historic days by the owners of the once famous Tioga mine, which, long since abandoned, lies near the crest of the Sierra about t...