05-24-2012, 03:31 PM | #31 |
Calibre Plugins Developer
Posts: 4,673
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Thats a typo on my part - my point being that leaving the class is not desired in this case. Yes if the *only* point of applying header tags was for building a TOC I can see why you would be happy with it. But the fact is that unless the original style had everything specified on it (which often it doesn't) then applying a heading tag will screw with the appearance, and you end up with a frankenstein of whatever the original text was plus whatever the defaults for the heading are.
Last edited by kiwidude; 05-24-2012 at 03:33 PM. |
05-25-2012, 04:17 AM | #32 | |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Code:
p { margin: 0; text-indent: 1em; } h2 { text-align: center, margin: 2em 0 1em 0; } .important { font-style: italic; color: red; } |
|
Advert | |
|
05-25-2012, 04:57 AM | #33 | |
Evangelist
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
Quote:
I think if that were the case that headings were important, they would be made as such in their css (i.e. h2 {...}), rather than indirectly. If it were not the case, and this were somehow special, I'm sure someone editing would have no problem moving the tag by hand in the code view. Considering they are using the book view for editing, do you really think that they understand this? It's just one of those things which should be kept as simple as possible, especially if the future holds custom tag/class etc options for that menu. Last edited by Serpentine; 05-25-2012 at 04:59 AM. |
|
05-25-2012, 07:04 AM | #34 |
Calibre Plugins Developer
Posts: 4,673
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Perhaps there are two distinct use cases here.
Use Case 1: your chapter heading already has a distinct class assigned to it that is dedicated just to those headings. In that circumstance your only reason for using the <heading> style dropdown is for the purposes of building a TOC. Note however that unless your heading style is very highly specified you are still going to alter the appearance of your headings, which may or may not be desirable. This is what the current Sigil behaviour suits well as per the example from Jellby above. Use Case 2: You are using Sigil as a book editor to cleanup a book, and the chapter headings do not already have a dedicated style. In this case the chapter headings are often intermingled with standard paragaraph text, heck sometimes even appended to the end of a paragraph block if its a really bad scan/conversion. Here is where you don't want Sigil to be "inheriting" whatever rubbish style the headings had previously underneath. I've only ever used Sigil book view to apply headings in the second case, since other than for splitting pages it is the only time I would edit in book view. I guess I saw the heading dropdown with "Heading 1" etc similar to choosing a heading style in word - once applied, your text gets that (and *only* that) "heading style". Which used to be the case, the text would only get a <h3> or whatever tag around it. I don't know the answer, I just find the current behaviour not useful since I am unlikely to go through a retail ePub page by page changing styles in book view to build a TOC, since regex is way faster. Anyways, hope that explains it better from my head. |
05-25-2012, 07:25 AM | #35 |
Sigil developer
Posts: 1,274
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
Hmm, well I can see why both might be desired. But I'd guess that if you are using Book View then you don't really know or care much about the HTML underneath (at least for the time you're using Book View). In that case you might want the selection of the format to nuke all other formats. And if you want to retain those classes, you are more likely to use Code View anyway since Book View will often not apply styles in the way you want. Whether it'll change or not is another issue, but it might be something you can customize in the new version.
|
Advert | |
|
05-25-2012, 01:42 PM | #36 | |
Enthusiast
Posts: 35
Karma: 110336
Join Date: Dec 2011
Location: Los Angeles, CA
Device: Kindle n-T, Nook Color Tablet, Nexus 6
|
the great is the enemy of the good
Quote:
I only work in code view in Sigil, and I select each rubbish paragraph style, do a global search and replace each one with <p>. Then I find the Chapter hypercode, and perform a global search and replace with <h2>. I would be perfectly content to have only 2 categories in my ebook-- <p> and <h2>-- all I want is flowable text that is left aligned and a table of contents. I would rather spend more time READING a book than fussing endlessly. As I said, I don't know CSS, and I don't know HTML-- I'm learning as I'm doing. I borrow regex strings from this forum to clean up page headers and footers from scanned books, or extra carriage returns from text files. Each time I'm successful, I'm ready to learn something new. |
|
05-25-2012, 10:22 PM | #37 | |
Resident Curmudgeon
Posts: 75,899
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
05-25-2012, 10:28 PM | #38 |
Resident Curmudgeon
Posts: 75,899
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Let me make this simple and show you how it's done and how to do it your way easily.
I'll start with chapter headers using <p class="para">Chapter One</p>. We change that to <h2 class="para">Chapter One</h2>. With me so far? Good. Now you've fixed all the chapter titles to be <h2 class="para">chaptertitle</h2> and that's good except you don't want the class there. Now the easy part begins. All you do is search <h2 class="para"> and replace it with <h2>. See, easy. All it takes is one extra simple step and it works and it gets the job done. Did you follow that? |
05-25-2012, 10:45 PM | #39 | |
Grand Sorcerer
Posts: 27,903
Karma: 198500000
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Or I could just search for <p class=.*?>Chapter(.*?)</p> and replace it with <h2>Chapter\1</h2> and call it a day. Last edited by DiapDealer; 05-25-2012 at 10:53 PM. |
|
05-26-2012, 10:24 AM | #40 | |
Well trained by Cats
Posts: 30,377
Karma: 58053698
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
<p class="para">Chapter (.+)</p> Code:
<h2 class="chapno">Chapter \1</h2> Code:
.chapno {display: block} |
|
05-26-2012, 01:28 PM | #41 |
frumious Bandersnatch
Posts: 7,533
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
If all your <h2> are class="chapno", you don't need the class at all to style them.
It might be interesting, however, to have the possibility of styling the word "Chapter" and the chapter number (and the title, if any) separately, with something like this: Code:
<h2><span class="name">Chapter</span> <span class="num">1</span><br/> <span class="title">An Unexpected Party</span></h2> |
05-26-2012, 01:50 PM | #42 | |
Well trained by Cats
Posts: 30,377
Karma: 58053698
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
<h2 class="calibre9" id="calibre_pb_21"><span class="calibre10"><span class="calibre28"> CH</span>A<span class="calibre28">PTER<br /> 1 </span></span></h2> |
|
05-26-2012, 02:43 PM | #43 |
Resident Curmudgeon
Posts: 75,899
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
But some books don't use the work Chapter. So you can get One, Two, Three, etc.. for your chapter titles. So there's no way to fix it easily with regex is the class uses is also used elsehwere in the book. The way I suggested uses the heading option to change the chapter headers from <p to <h2 and that gives you then the way to do the search/replace easily. So sure, your way would work only if Chapter was a used word in all the chapter titles.
|
05-26-2012, 02:45 PM | #44 | |
Resident Curmudgeon
Posts: 75,899
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
<h2>Chapter 1</h2> Code:
h2 { margin-top: .75em; margin-bottom: 1em; text-align: center } |
|
05-26-2012, 02:52 PM | #45 | |
Well trained by Cats
Posts: 30,377
Karma: 58053698
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
My chapno usually has Chapter head Margins (and padding for off center placement). Sheesh! that bloat is minimal. There are lots more frequently (mis)used styling in every single paragraph. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre: Chapter Headings | Paxman53 | Introduce Yourself | 5 | 10-22-2011 09:13 AM |
Chapter Headings | Paxman53 | Conversion | 3 | 10-12-2011 12:31 PM |
Chapter Headings on their own page? Help! | Lee5150 | Calibre | 3 | 10-06-2011 08:12 AM |
Why H1 and H2 Chapter Headings? | Ransom | Calibre | 11 | 08-10-2011 04:29 PM |
Help converting chapter headings | p3aul | Conversion | 6 | 04-03-2011 12:56 PM |