Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-04-2014, 10:55 AM   #1
MULTIVAC
Junior Member
MULTIVAC began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2014
Device: Sony PRS-T2
Span Span Span Span

I frequently see epubs that have multiple spans-within spans-within spans-within spans ad nauseum. This goes on all through the file in every paragraph. I imagine this comes from the file being converted from some other format to epub. Other than looking ugly as heck and being extremely difficult to edit, does this kind of multiple nested spans affect how the file will perform on most readers? And is there an easy way to clean this kind of mess?

example:

Quote:
<p class="calibre25"><span class="calibre26"><span class="calibre23"><a class="calibre24"><span class="calibre21"><span class="calibre27">The actual text</span></span></a></span></span></p>

Last edited by MULTIVAC; 12-04-2014 at 10:58 AM.
MULTIVAC is offline   Reply With Quote
Old 12-04-2014, 10:17 PM   #2
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: 74,037
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
That is soke nasty looking code. Chances are it came from a conversion of an old Mobi. The code in old Mobi can be that nasty.

It could be slower to render, but on most modern Readers such as your T2, you won't notice it.

Personally, I'd give the code a good going over to get rid of all that garbage and redo the CSS so it matches what is supposed to happen. It's not that difficult if you can make use of search/replace/regex to get rid of the unwanted code.
JSWolf is offline   Reply With Quote
Advert
Old 12-04-2014, 10:52 PM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,176
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
In theory shouldn't one also look at the various CSS classes being used and ensure that any styling in them is combined?
PeterT is offline   Reply With Quote
Old 12-05-2014, 03:24 AM   #4
EowynCarter
Wizard
EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.
 
Posts: 4,332
Karma: 4000000
Join Date: Oct 2008
Location: Paris
Device: Cybooks; Sony PRS-T1
The one time i saw that, happened to be calibre generated code.
EowynCarter is offline   Reply With Quote
Old 12-05-2014, 05:27 AM   #5
Ghitulescu
Fanatic
Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.Ghitulescu ought to be getting tired of karma fortunes by now.
 
Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
I presume this comes from a document where, before converting in calibre, contains a lot of formatting.
Ghitulescu is offline   Reply With Quote
Advert
Old 12-05-2014, 05:47 AM   #6
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,176
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Quote:
Originally Posted by EowynCarter View Post
The one time i saw that, happened to be calibre generated code.
Hmm... whatever makes you think that... Maybe the inclusion of all the class="calibre..."
PeterT is offline   Reply With Quote
Old 12-05-2014, 07:58 AM   #7
EowynCarter
Wizard
EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.
 
Posts: 4,332
Karma: 4000000
Join Date: Oct 2008
Location: Paris
Device: Cybooks; Sony PRS-T1
Quote:
Originally Posted by PeterT View Post
Hmm... whatever makes you think that... Maybe the inclusion of all the class="calibre..."
Ah ! I didn't saw the example there was showing the calibre class. (Read too fast)
And yeah, that's when i looked at the css and saw that.
EowynCarter is offline   Reply With Quote
Old 12-06-2014, 08:58 AM   #8
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
This code is really easy to get rid of just but simple search & replace in Calibre for:
Quote:
<span class="calibre26">
then
Quote:
<span class="calibre27">
and so on and so forth, after you're done you're left with a lot of </span>'s so just use "Beautify all files" function and voila, youre HTML files are clean.

If you get some more annoying code such as:
Quote:
<p id="block_1"><b class="calibre_pb_1"></b></p>
in the next file you might see:
Quote:
<p id="block_2"><b class="calibre_pb_2"></b></p>
notice the running numbers.. what you want to do is use regex search & replace (also available in calibre) and it goes like this:
Search for:
Quote:
<p id="block_[0-9]*"><b class="calibre_pb_[0-9]*"></b></p>
Voila! those silly page breaks calibre makes are gone.

As for fixing the styling back to place, most of those spans calibre creates are repeated styling and usually contains only 2 rules, so it's rather easy to look at the CSS and see what kind of styling was applied on those spans and put them into the
Quote:
<p class="calibre25">
calibre25 css style.
odedta is offline   Reply With Quote
Reply

Tags
cleaning, editing, performance


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Span? Turtle91 ePub 4 05-20-2013 02:47 PM
span in span: is this problematic? tbuyus ePub 8 03-31-2013 08:01 AM
Regex and span JSWolf Sigil 7 01-23-2013 06:35 AM
how do I span more than one line with regex BartB Sigil 3 12-11-2011 05:12 PM
Remove <br /> together with span, and only span Razzia Recipes 3 05-30-2011 06:55 PM


All times are GMT -4. The time now is 09:03 PM.


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