![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
remove indent from 1st line of chapter only
is there a quick way to do this without having to go to stylesheet & define a new class ?
every book I inspected has same tags for 1st line of chapter as for rest of chapter text. as I was advised in another thread I can locate them with regex, by looking for the preceeding closing h2 tag - but is there anything I can to in a regex replace that will overwrite the default indent also I tried to guess solutions e.g. byb adding text-indent directly afdter the class, but I get syntax errors. I begin to think it's a lot of work to edit books for this one small visual change but if there is a slicker way.... so I can find end of chapter title </h2> space <p class = whatever.>... start of 1st line i want to to replace / edit the p class bit because my p has a default indent, and I want to overrule it just for this line. can it be done ? updates - this removes the initial indent, but can I combine it with the class = bit somehow find (regex) </h2>\s*<p class="calibre9" replace </h2> <p style "text-indent: 0" otherwise it loses other attributes of the calibre9 class something else untoward is happening with the above code sigil is extracting that change & creating a new class definition p.sgc-1 {text-indent:} but it is losing the trailing zero in doing so & thus not working as intended. I can't figure out why it's losing that last zero - AHA - it cannot cope with embedded spaces - this replace is OK </h2> <p style "text-indent:0" Last edited by cybmole; 02-19-2011 at 04:06 AM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
It should work I think. It would be nicer and more structured to define a special class for it in the stylesheet though.
If you don't want Sigil to create a instyle sgc-1, you need to switch of Tidy. That is what is causing that. I am not quite sure why the 0 is removed, perhaps it is a bug. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
As long as the <p> tags don't have a over-riding class assigned to them you can just do this in the css:
h2 + p { text-indent:0; } p { text-indent:whatever; } If there is an over-riding class I believe the above should still work as long as you remove any indent settings from that class. |
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
Quote:
I am now using this - which preserves my preferred <p linespacing find </h2>\s*<p class="calibreN" where N is is the right value for that book replace all </h2> <p style "text-indent:0;margin-bottom:0.3em" then I go to stylesheet & edit margin-bottom to 0.3em for that same calibre style I can do a book in well under a minute with this technique, as I do not have to add any new lines to style sheet this is my manual workaround for the issue discussed ad-nauseum in other threads, after calibre had removed all blank lines. PS your h2+P ... construction - does that apply to a p following a h2 only, then ? |
|
![]() |
![]() |
![]() |
#5 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,531
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
If, in your case, all <p> are <p class="calibre10">, for instance, you can add to the stylesheet: Code:
h2 + p.calibre10 { text-indent: 0 } |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
One should also do the same for the paragraph immediately following a section break, but that's probably a lot more difficult to programatically define.
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
there's no HTML code as such for a section break is there - folks just add a blank line or two, or some squiggles ?
|
![]() |
![]() |
![]() |
#8 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Yes, that's exactly my point: that there's probably no way to automate it; the indent would need to be removed manually from the paragraph immediately following a section break.
|
![]() |
![]() |
![]() |
#9 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,531
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
<p>Some paragraph.</p> <div class="break">* * *</div> <p>Another paragraph after a "scene change".</p> Code:
<p>Some paragraph.</p> <p class="spaced">Another paragraph after a "scene change".</p> |
|
![]() |
![]() |
![]() |
#10 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
If the book is that well-formatted, though, you probably wouldn't have the issue in the first place. Unfortunately there comes a point in almost every eBook where you just have to get stuck in and edit manually.
|
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Quote:
p.softbreak+p, p.scenebreak+p {text-indent:0} Works in a fair number of common cases, and it should improve over time. Of course if you've already converted once using Calibre then you may need to find what calibrexxx tag your paragraphs are using and do something along the lines of what Jelby described earlier. Last edited by ldolse; 02-21-2011 at 03:50 AM. |
|
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
I have searched in vain for a crib sheet / tutorial book that defines these types of + constructions, also for one that explains the use of <h> without a number, in style definitions, can you recommend links / books please
|
![]() |
![]() |
![]() |
#13 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,531
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
For <h> with no number, I don't think you can use in anywhere, all you can do is put all 6 instances in a list: h1, h2, h3, h4, h5, h6 { text-align: center } |
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
|
Maybe this will help, also includes a link to the correct w3c docs:
https://www.mobileread.com/forums/sho...d.php?t=112344 |
![]() |
![]() |
![]() |
#15 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,326
Karma: 58000000
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() has 3 'cheat sheets': CSS, HTML and REGEX that I keep in clear folders and refer to regularly a (MR post put me onto these) |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CSS wacky p indent post-chapter split? | Hitch | Sigil | 0 | 06-17-2010 08:59 PM |
Remove Chapter Breaks and Search an Entire Document | Marcy | Sigil | 6 | 04-15-2010 12:11 PM |
PRS-900 Problem with 1st line on a page cut off? | Marcy | Sony Reader | 7 | 02-17-2010 01:20 AM |
PRS-600 Horizontal line at start of chapter | Gernella | Sony Reader | 0 | 01-03-2010 10:28 AM |
First Line indent for Mobi conversion | tbergman | Calibre | 7 | 09-06-2009 09:09 AM |