![]() |
#1 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
[Solved] I'm a little confused about the Fix HTML - all files Tool
This is the first unexpected behavior I ran into. I had the following:
<p class="calibre2">Chapter 2 — Qwerty</p> I replaced all, to swap the <p class="calibre2">Chapter with <h2>Chapter and ended up with: <h2>Chapter 2 — Qwerty</p> I ran the Fix HTML - all files Tool and ended up with: </h2><h2>Chapter 2 — Qwerty</p> The </h2> was closing the Chapter 1 <h2> tag. What I expected was: <h2>Chapter 2 — Qwerty</h2> Was my expectation unreasonable? What would be a better method to make this <p> to <h2> change keeping in mind the second part (Qwerty) is different for every chapter? Last edited by DoctorOhh; 04-02-2014 at 02:53 AM. |
![]() |
![]() |
![]() |
#2 |
Bookish
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,017
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
|
I use a 2 pass approach in these cases:
Last edited by DrChiper; 04-02-2014 at 02:36 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Fix HTML uses the HTML 5 algorithm to fix broken HTML. In other words it results in exactly the HTML you would get if you tried to display your broken HTML in a modern web browser. This is the only sane way to implement fix html. It means that the result of doing fix html will look no different than what the original HTML looked in an actual HTML renderer.
If you want to change it using search replace use: search: <p.*?>(Chapter\s+\d+.*?)</p> replace: <h2>\1</h2> If all the p tags have the same class you can be more specific in the above expression |
![]() |
![]() |
![]() |
#4 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
Thanks Kovid.
What you said makes sense. I got used to being sloppy since Sigil magically fixed these errors for me. Also thanks for the example. Last edited by DoctorOhh; 04-02-2014 at 02:42 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Where is epub-fix tool? | 127 | Calibre | 4 | 03-26-2013 04:20 AM |
My Calibre is confused about htm/html books | pmulcahy11b | Conversion | 3 | 12-04-2012 06:51 AM |
ePub Squeaker: Tool to fix covers for Color/Touch (Windows only) | ATimson | Barnes & Noble NOOK | 4 | 05-01-2012 08:42 AM |
Looking for a tool to find/fix mis-matched quotes... | therealjoeblow | Calibre | 4 | 09-04-2011 01:25 AM |
Confused on how to fix this problem (pic included) | Frogsmasha | Sony Reader | 9 | 04-12-2007 07:53 AM |