Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 04-02-2014, 01:52 AM   #1
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
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.
DoctorOhh is offline   Reply With Quote
Old 04-02-2014, 02:33 AM   #2
DrChiper
Bookish
DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.
 
DrChiper's Avatar
 
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:
  1. first replacing the <p> with <h2>
  2. then replacing the </p> with </h2>
I almost never use the fix HTML tool for these changes. Everything with regex.

Last edited by DrChiper; 04-02-2014 at 02:36 AM.
DrChiper is offline   Reply With Quote
Advert
Old 04-02-2014, 02:37 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,343
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
kovidgoyal is offline   Reply With Quote
Old 04-02-2014, 02:39 AM   #4
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
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.
DoctorOhh is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 11:24 PM.


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