![]() |
#1 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
paragraph margins
Dear all
I have an epub with paragraphs that are either without blank space between them, or with a blank line. The latter are separated with Code:
<p>& # 160;</p> Code:
<p> </p> But it is way too much work to fix this, because when I define the blank line in css, I have to make a separate class for all those paragraphs without a blank line (and it's a big epub). Does anybody know of a quick fix? Or is the empty paragraph okay and should I just leave it at that? Will it give trouble with some reader-software? Thanks for the help! |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You are correct, you want to style your paragraph using css. How much you style is up to debate...
Use search/replace to remove them! search:<p>& # 160;</p> replace: (nothing) or search:<p> </p> replace: (nothing) It should only take a few seconds. Before doing that though, I would check all of your non-chapter files...back matter, ToC, Also From, etc. ...to make sure they don't have those blank lines that you actually want to keep. Cheers, |
![]() |
![]() |
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 312
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
paragraph margins
I would make a separate class only for the paragraphs that include the extra space (I assume there are fewer of them). For the ones that don't, I'd just style the <p> (no additional class needed).
Alternately, if the gaps represent scene breaks or similar, I am fairly sure it is semantically appropriate to use <hr> there. If so, that's probably the fastest way to resolve the issue (and you can style <hr> to just be a vertical gap). Last edited by phillipgessert; 11-17-2015 at 10:48 AM. |
![]() |
![]() |
![]() |
#4 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
@Turtle91 that solution will only mess up the entire document, because then all paragraphs will be the same style.
|
![]() |
![]() |
![]() |
#5 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
@phillipgessert I could do that, but the <hr> tag isn't really intended for that. I might as well stick with the <p> </p>, no? Epub validator doesn't complain, and it looks just fine on my sony.
|
![]() |
![]() |
![]() |
#6 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 312
Karma: 3196258
Join Date: Oct 2015
Location: Madison, WI
Device: Kindle 5th Gen
|
Quote:
http://www.idpf.org/accessibility/gu...ml/context.php "A context break represents a shift in thought, time, location, etc. in a work of fiction or non-fiction below the level of a section. These changes are typically represented by an extra blank line between paragraphs, sometimes including asterisms and other decorations (traditionally when the shift occurs immediately at the bottom of a print page). "In the past, CSS margins and images have been used to include context breaks, but the HTML5 specification has redefined the semantics of the hr element specifically for this purpose. The element should now always be used to represent these context changes. CSS styling can be applied to change the default appearance." Though I could totally be misreading it. If I'm reading it right, though, the benefit of <hr> over sticking with the empty paragraphs is that <hr> is semantically meaningful, but empty paragraphs aren't. That said though, I shouldn't try to guess at the semantics of this specific book, the <hr> stuff may not even apply here. |
|
![]() |
![]() |
![]() |
#7 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
In this specific book, about 70% of the paragraphs are separated by an empty line, so it would make sense to define p with a margin. This is a very long book though, and I'm not looking forward the tedious work of applying another class for the other 30% of the paragraphs so they display without this empty line (I'm not lazy, it is just a waste of time when it's not really necessary).
I have no pickle with the <p> <\p>, my only worry is that it won't display properly on some readers. If that's a non-issue, I just leave it as it is. |
![]() |
![]() |
![]() |
#8 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Search for: "<p> </p>\s+<p>" Replace: <p class="emptylineabove"> Of course you can also use & #160; |
|
![]() |
![]() |
![]() |
#9 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Brilliant, thank you! This would work even better if all the paragraph tags were the same. Still, saves me a lot of time!
|
![]() |
![]() |
![]() |
#10 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,303
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Sorry, I missed that only some paragraphs had a line above
![]() Definitely go with Toxaris' suggestion! |
![]() |
![]() |
![]() |
#11 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
No, it's about 70% of them.
After a lot of search and replace (there were also a lot of <i>'s , and <p class=...> to take into acount) it still looks kinda messed up. Right now I'm thinking 'fuck it, just level up all paragraphs and to hell with the original layout' ;-) |
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Usually you need a few runs for it. I have made a group of SR rules in Sigil to work through this. I just need to run the group which will run all the rules.
|
![]() |
![]() |
![]() |
#13 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
That's why you're the wizard and I'm the village idiot :-)
|
![]() |
![]() |
![]() |
#14 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Okay, so I'm even more of an idiot than I thought I was...
Anyway, I have this: Code:
p { text-indent: 0; line-height: normal; margin-bottom: 1em; } Code:
.nomargin { margin-bottom: 0em; } Code:
<p class="nomargin">Blablabla</p> <p class="nomargin">Blablabla</p> <p>Blablabla</p> What am I missing here? |
![]() |
![]() |
![]() |
#15 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,595
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
And margin-top?
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem: Merge two ebooks paragraph by paragraph... | akayacik80 | Workshop | 5 | 09-23-2014 09:05 AM |
Paragraph breaks when removing margins | Canorka | Conversion | 3 | 03-30-2012 02:00 AM |
Preference: Paragraph indent or a little paragraph spacing? | 1611mac | General Discussions | 48 | 11-11-2011 12:43 AM |
Paragraph question | shrktank | Calibre | 2 | 11-29-2009 12:07 AM |
Calibre collapses paragraph margins - why? | kiwik | Calibre | 2 | 01-08-2009 11:47 PM |