Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 02-19-2011, 03:31 AM   #1
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
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.
cybmole is offline   Reply With Quote
Old 02-19-2011, 04:43 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
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.
Toxaris is offline   Reply With Quote
Old 02-19-2011, 05:24 AM   #3
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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.
ldolse is offline   Reply With Quote
Old 02-19-2011, 09:58 AM   #4
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Quote:
Originally Posted by ldolse View Post
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.
there is always some calibre class following the <p, and it s the same class ( per book) whether the line is 1st in chapter or later in chapter but now that I know where to add spaces & where not to, to satisfy the tidy function, all is well

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 ?
cybmole is offline   Reply With Quote
Old 02-19-2011, 10:42 AM   #5
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by cybmole View Post
your h2+P ... construction - does that apply to a p following a h2 only, then ?
Yes, that's what the "+" means, it applies only to the second tag, when the two tags are adjacent.

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 }
and it should have a higher priority than just "p.calibre10", because it is more specific.
Jellby is offline   Reply With Quote
Old 02-19-2011, 03:09 PM   #6
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
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.
HarryT is offline   Reply With Quote
Old 02-20-2011, 02:43 AM   #7
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Quote:
Originally Posted by HarryT View Post
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.
there's no HTML code as such for a section break is there - folks just add a blank line or two, or some squiggles ?
cybmole is offline   Reply With Quote
Old 02-20-2011, 03:18 AM   #8
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Quote:
Originally Posted by cybmole View Post
there's no HTML code as such for a section break is there - folks just add a blank line or two, or some squiggles ?
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.
HarryT is offline   Reply With Quote
Old 02-20-2011, 03:52 AM   #9
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by cybmole View Post
there's no HTML code as such for a section break is there - folks just add a blank line or two, or some squiggles ?
It depends of the book. If it's well formatted you might have:

Code:
<p>Some paragraph.</p>
<div class="break">* * *</div>
<p>Another paragraph after a "scene change".</p>
or just:

Code:
<p>Some paragraph.</p>
<p class="spaced">Another paragraph after a "scene change".</p>
Calibre probably changes class names, but those should be easy to style to remove the indent (use "p.spaced" or "div.break + p").
Jellby is offline   Reply With Quote
Old 02-20-2011, 03:56 AM   #10
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
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.
HarryT is offline   Reply With Quote
Old 02-21-2011, 03:47 AM   #11
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Quote:
Originally Posted by HarryT View Post
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.
If you're converting in Calibre and enable the heuristics option to detect and format scene breaks you can add the following to Calibre's extra CSS:

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.
ldolse is offline   Reply With Quote
Old 02-21-2011, 04:43 AM   #12
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
Quote:
Originally Posted by ldolse View Post
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 {
.
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
cybmole is offline   Reply With Quote
Old 02-21-2011, 06:03 AM   #13
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by cybmole View Post
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
Look for "CSS selectors", the spec is here

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 }
Jellby is offline   Reply With Quote
Old 02-21-2011, 06:09 AM   #14
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
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
ldolse is offline   Reply With Quote
Old 02-21-2011, 10:18 AM   #15
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,799
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by cybmole View Post
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
http://www.addedbytes.com/cheat-sheets/css-cheat-sheet/
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)
theducks is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 08:45 PM.


MobileRead.com is a privately owned, operated and funded community.