05-26-2012, 03:01 PM | #46 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Sorry for any confusion, but I was only addressing your specific example... the one where it wouldn't make any sense to use a two step process that required manual intervention. But even taking into account other situations, I've found that if you dig deep enough, there's almost always something unique in the code that will allow you to isolate the chapter headings (or at the very least the vast majority of them) with regex.
|
05-26-2012, 03:03 PM | #47 | |
Resident Curmudgeon
Posts: 73,974
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
As for the other bloat, I've been dealing with that. <p class="para"> becomes <p> and that <a id="page10" /> get removed as I don't care about print page numbers. Also, when we get <h2 class="chapterNumber" id="id_01"> that gets fixed to remove the bloat so the id goes away. I do remove excess <div> that have no need at all. Publishers do put in a lot of bloat. The CSS they usually use is a catchall and has all kinds of crap in it. |
|
05-26-2012, 03:05 PM | #48 | |
Resident Curmudgeon
Posts: 73,974
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
05-26-2012, 03:17 PM | #49 | |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
(and if they don't render differently than the regular text... then how were they even chapter headers?) |
|
05-26-2012, 04:07 PM | #50 |
Evangelist
Posts: 416
Karma: 1045911
Join Date: Sep 2011
Location: Cape Town, South Africa
Device: Kindle 3
|
I just use h1 for title page, h2 for chapters and fore/aft areas. In a few cases I've needed to give specific h2 classes for chapter headers where I wanted to style things nicely... but it's pretty rare.
So yeah, most of the time I just use the tags directly in css. No mess, no fuss, lower cross-section for quirks and problems. At the end of the day, I also have a strong opinion that minimal markup is something that people develop a subconscious appreciation of, and one of the things that I am fond of mobi for. |
05-26-2012, 06:53 PM | #51 | |
Resident Curmudgeon
Posts: 73,974
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
05-26-2012, 07:08 PM | #52 |
Well trained by Cats
Posts: 29,801
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Code:
<p>IX</p> |
05-30-2012, 02:10 AM | #53 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi,
Guido Henkel's idea implemented here in a slightly different way using writer2xhtml and Sigil - in French -. It's about underlining a h2 title with an ornament. https://www.mobileread.com/forums/sho...&postcount=147 1. In your odt file, insert image under the first h2 title, anchored to paragraph, without border, 30% size 2. Once your odt file has been converted to EPUB, open the EPUB with Sigil and insert the 30 remaining images using this Regex (all html files). It looks complex but in fact you just have to copy the code that writer2xhtml wrote for you for the first image... Search </h2> Replace</h2><div style="text-align:center"><img alt="images3" class="frameGraphics" id="images3graphic" src="../Images/image003.png" style="width:30%" /></div> 3. Then you adjust the lower margin of the ornament on the main style sheet (here: margin-bottom: 1em) You can adjust in the same way, the h2 margin-bottom if need be. Last edited by roger64; 05-30-2012 at 03:14 AM. |
05-30-2012, 07:19 AM | #54 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
But please:
Change alt="images3" to alt="" the alt attribute is what would be used by a screen reader program, or what would be displayed if images are disabled... and you don't want "images3" to be read aloud or shown. The alt attribute should only be used (i.e. non-blank) when an image needs some kind of description (and beware of duplicating the caption, if there's one). The id="images3graphic" is probably not needed at all, unless you want to specifically link to the image. Also, if there are several chapters in a single file, they should have different id attributes. Optionally, move the style="width: 30%" to the stylesheet. |
05-30-2012, 10:50 AM | #55 |
Well trained by Cats
Posts: 29,801
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
I would also move the div style to the stylesheet and possibly condense the whole lot into a simpler <h2 class="chaphead"> style since this is being used in every chapter. and 1 change would have you back changing every chapter
CSS = Define it once, use many times |
05-30-2012, 12:31 PM | #56 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
@Jellby and theducks
Thanks for your very informative corrections and proposals. I was happy to obtain at first try a working solution in ADE. The fact is that I use images usually once. This time the same image has to be used 31 times and you are right to pinpoint that this asks for some adjustments. I will now have also a more elegant solution. I will post a v2 ( v1 are just made for this). |
05-31-2012, 11:45 AM | #57 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Coming back after trial.
I implemented the first two remarks from Jellby since it's to delete useless stuff. Finally I did not change anything else. If I move the style=width="30%" down to the main stylesheet in frameGraphics, I remarked in Sigil that the image of the ornament does not scale well while it does scale in its current place. So, I kept it this way even if it's written 30 times... Using % or em instead of px as suggested by theducks would indeed be an improvement. In fact writer2xhtml has for now % only for font-size and images and tables. I hope they will introduce this feature soon. As it is, it works. I join the text. Even if I cleaned up the stylesheet, I only performed minor changes, so I do not call it a v2. If somebody finds something else ugly inside, please do tell me. I am quite open for this and really thankful. Last edited by roger64; 05-31-2012 at 11:52 AM. |
05-31-2012, 06:51 PM | #58 | |
Well trained by Cats
Posts: 29,801
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:
the entry should read: Code:
width: 30%; |
|
06-01-2012, 06:32 AM | #59 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
I am not used to tweak a lot my stylesheet, and probably I did this mistake. I agree that the detailed implementation you just gave me is both good and shorter. I take good note of it. The standard procedure used by writer2xhtml works well for standalone images but should be improved for repetitive images to keep a compact code. These ones should be treated in a slightly different way. I will submit a proposal to the author to take care of this. |
06-04-2012, 08:48 PM | #60 | |
Enthusiast
Posts: 35
Karma: 110336
Join Date: Dec 2011
Location: Los Angeles, CA
Device: Kindle n-T, Nook Color Tablet, Nexus 6
|
Quote:
then apply the heading style of your choice |
|
|
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 |