Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-20-2019, 10:32 PM   #1
ranvel
Junior Member
ranvel began at the beginning.
 
ranvel's Avatar
 
Posts: 2
Karma: 10
Join Date: Jul 2019
Device: web
Epub->htmlz: Add <p> tags as <div class="Para"> children

Hello!

I have an epub that I am looking to fix when I export it to HTMLZ.

Currently, it defines the paragraph by a <div> with the class "Para" (short for 'Paragraph'). I am sure that I could just do a search and replace for all div that meet this criteria, just turning <div class="Para"> into <p>, but there are also 'id' tags in the mix, which are used for links.

So ideally, I'd like to add a child class to these divs.

Here's a quick example:

Current Epub:
<div id="link001" class="Para">
Let's start off by saying...
</div>

Current HTMLZ:
<div id="link001" class="Para">
Let's start off by saying...
</div>

Expected HTMLZ:
<div id="link001" class="Para">
<p>
Let's start off by saying...
</p>
</div>

Is this possible?

Thank you!
ranvel is offline   Reply With Quote
Old 07-21-2019, 11:39 AM   #2
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: 23,371
Karma: 25446786
Join Date: Aug 2009
Location: The Central Coast of California
Device: K4NT, Galaxy Tab A, Kobo Aura2
Diaps Editing Toolbag Plugin does this type of conversion/retag. Just remember to tick the Keep
https://www.mobileread.com/forums/sh....php?p=2980740
(It's on the Help: Get Plugins List. The easy way to install)
theducks is offline   Reply With Quote
Old 07-21-2019, 02:51 PM   #3
lumpynose
Guru
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 931
Karma: 4444444
Join Date: Jul 2012
Device: Palm Pilot M105
My first thought was to use a regular expression to change the 3 characters div to p so that you retain the ids for the linking and the class for any formatting. Make the regular expression match the div at the beginning and the "Para" at the end. But then I can't see how to change what was the matching div to a p since there are likely other non-Para divs. Maybe Diap's thing can do what I'm thinking of.
lumpynose is offline   Reply With Quote
Old 07-21-2019, 02:58 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,796
Karma: 47787659
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by lumpynose View Post
My first thought was to use a regular expression to change the 3 characters div to p so that you retain the ids for the linking and the class for any formatting. Make the regular expression match the div at the beginning and the "Para" at the end. But then I can't see how to change what was the matching div to a p since there are likely other non-Para divs. Maybe Diap's thing can do what I'm thinking of.
Search for...
<div id="(.*)" class="Para">

Replace with...
<p id="\1">
JSWolf is offline   Reply With Quote
Old 07-21-2019, 03:34 PM   #5
lumpynose
Guru
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 931
Karma: 4444444
Join Date: Jul 2012
Device: Palm Pilot M105
Quote:
Originally Posted by JSWolf View Post
Search for...
<div id="(.*)" class="Para">

Replace with...
<p id="\1">
But then what about what had been the matching div?
lumpynose is offline   Reply With Quote
Old 07-21-2019, 04:25 PM   #6
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 4,912
Karma: 11682688
Join Date: Sep 2009
Location: UK
Device: PRS-350, Kobo: Aura6", H2O, GloHD, KA1, ClaraHD, Forma
Quote:
Originally Posted by lumpynose View Post
But then what about what had been the matching div?
Diap's Editing Toolbag will handle both the start tag and its matching end tag.
jackie_w is offline   Reply With Quote
Old 07-21-2019, 05:04 PM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,796
Karma: 47787659
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by lumpynose View Post
But then what about what had been the matching div?
Yes, I did forget that.
JSWolf is offline   Reply With Quote
Old 07-21-2019, 05:09 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 52,796
Karma: 47787659
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 4, iPhone 5
Quote:
Originally Posted by jackie_w View Post
Diap's Editing Toolbag will handle both the start tag and its matching end tag.
I agree that this is the easiest and best solution.
JSWolf is offline   Reply With Quote
Old 07-21-2019, 09:46 PM   #9
ranvel
Junior Member
ranvel began at the beginning.
 
ranvel's Avatar
 
Posts: 2
Karma: 10
Join Date: Jul 2019
Device: web
Yes - this was exactly what I was looking for. It looks a bit manual in that you need to do each html file separately, but it gets the job done.

I'm attaching the settings that worked for me in case someone runs into this same issue.

Thanks!
Attached Thumbnails
Click image for larger version

Name:	Capture d’écran, le 2019-07-21 à 21.43.08.png
Views:	22
Size:	40.3 KB
ID:	172516  
ranvel is offline   Reply With Quote
Old 07-21-2019, 09:48 PM   #10
lumpynose
Guru
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 931
Karma: 4444444
Join Date: Jul 2012
Device: Palm Pilot M105
Quote:
Originally Posted by ranvel View Post
Yes - this was exactly what I was looking for. It looks a bit manual in that you need to do each html file separately, but it gets the job done.

I'm attaching the settings that worked for me in case someone runs into this same issue.

Thanks!
Try dragging or shift clicking and select several files; some of the plugins allow you to work on several files at the same time.

Last edited by lumpynose; 07-21-2019 at 09:55 PM.
lumpynose is offline   Reply With Quote
Old 07-21-2019, 10:42 PM   #11
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 4,912
Karma: 11682688
Join Date: Sep 2009
Location: UK
Device: PRS-350, Kobo: Aura6", H2O, GloHD, KA1, ClaraHD, Forma
Quote:
Originally Posted by ranvel View Post
It looks a bit manual in that you need to do each html file separately, but it gets the job done.
I don't have this plugin installed anymore, but I seem to remember that there was a sub-menu option to choose between whole book and current file only.
jackie_w is offline   Reply With Quote
Old 07-21-2019, 11:06 PM   #12
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: 23,371
Karma: 25446786
Join Date: Aug 2009
Location: The Central Coast of California
Device: K4NT, Galaxy Tab A, Kobo Aura2
Quote:
Originally Posted by jackie_w View Post
I don't have this plugin installed anymore, but I seem to remember that there was a sub-menu option to choose between whole book and current file only.
Yep, it is on the icon as a setting
theducks is offline   Reply With Quote
Reply

Tags
epub, htmlz, paragraphing

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DOCX->EPUB Header / <p class=" "> ElPeregrino Conversion 5 09-05-2018 02:29 AM
When I use merge as an option during ADD my "add tags" don't get added LadyKate Library Management 9 11-19-2016 07:49 PM
Changing or removing <div class="calibrenavbar"> ptsefton Recipes 3 05-28-2011 08:30 AM
Tags appearing when "Add Empty Book" fio_smiles Library Management 2 03-11-2011 03:43 AM
Line indents using "<div>" tags HarryT Kindle Formats 11 04-29-2009 10:18 PM


All times are GMT -4. The time now is 10:45 AM.


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