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 02-08-2016, 09:57 AM   #1
senhal
Connoisseur
senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.
 
senhal's Avatar
 
Posts: 82
Karma: 25684
Join Date: Sep 2014
Device: Kindle NT
Possibile bug in Beautifier

When I apply Beautify, a code like this:

Code:
<h1>C<span class="smallcaps">HAPTER</span> O<span class="smallcaps">NE</span></h1>
became:

Code:
<h1>C

    <span class="smallcaps">HAPTER</span> O

    <span class="smallcaps">NE</span>

  </h1>
Before:



After:



Wrong spaces have been added
Am i doing something wrong?
senhal is offline   Reply With Quote
Old 02-08-2016, 11:24 AM   #2
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: 44,530
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I cannot reproduce this, copy pasting your example and running beautify, results in

Code:
<h1>C<span class="smallcaps">HAPTER</span> O<span class="smallcaps">NE</span></h1>
kovidgoyal is online now   Reply With Quote
Advert
Old 02-08-2016, 02:55 PM   #3
senhal
Connoisseur
senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.
 
senhal's Avatar
 
Posts: 82
Karma: 25684
Join Date: Sep 2014
Device: Kindle NT
I'm Using Calibre 64bit 2.50.1 and Calibre 32bit (same version) on Windows 7.
They both give the same result.
senhal is offline   Reply With Quote
Old 02-08-2016, 06:56 PM   #4
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,746
Karma: 75000002
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Why not attach a complete epub showing the issue? Maybe 2 chapters; one pre beautify; one post beautify?
PeterT is offline   Reply With Quote
Old 02-09-2016, 12:15 AM   #5
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: 30,442
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by PeterT View Post
Why not attach a complete epub showing the issue? Maybe 2 chapters; one pre beautify; one post beautify?
I have seen Similar before. I always assumed those few case were due to sloppy REGEX when wrapping a Initial Letter or small cappin with a span.

It does not happen that often, so maybe the coder is using a non-breaking character at the Span to keep it from splitting the C from hapter
theducks is offline   Reply With Quote
Advert
Old 02-09-2016, 03:36 AM   #6
senhal
Connoisseur
senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.
 
senhal's Avatar
 
Posts: 82
Karma: 25684
Join Date: Sep 2014
Device: Kindle NT
Quote:
Originally Posted by PeterT View Post
Why not attach a complete epub showing the issue? Maybe 2 chapters; one pre beautify; one post beautify?
Here it is
Note that applying beautifier again and again, the space between lines increases.
Attached Files
File Type: epub before_and_after_beautify.epub (1.8 KB, 146 views)

Last edited by senhal; 02-09-2016 at 03:39 AM.
senhal is offline   Reply With Quote
Old 02-09-2016, 04:54 AM   #7
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
Curious...
Only it happens when there is only one line of code inside <body>.
With two lines working properly.

Code:
  <h1>C<span class="smallcaps">HAPTER</span> O<span class="smallcaps">NE</span></h1>

  <h1>C<span class="smallcaps">HAPTER</span> O<span class="smallcaps">NE</span></h1>

Last edited by jbacelar; 02-09-2016 at 04:56 AM.
jbacelar is offline   Reply With Quote
Old 02-09-2016, 07:28 AM   #8
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: 44,530
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Ah yes that will be because of a heuristic in the beautifier. Normally, the beautifier does not adjust code inside a block level tag, precisely because of the problem described here, except in the case of the block level tag being the only child of body, in which case it is assumed to be a wrapper tag. I suppose I can adjust the heuristic to also check the tag name and reject heading tags, since they are unlikely to be wrapper tags.
kovidgoyal is online now   Reply With Quote
Old 02-09-2016, 08:15 AM   #9
senhal
Connoisseur
senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.senhal knows what's going on.
 
senhal's Avatar
 
Posts: 82
Karma: 25684
Join Date: Sep 2014
Device: Kindle NT
Quote:
Originally Posted by kovidgoyal View Post
Ah yes that will be because of a heuristic in the beautifier. Normally, the beautifier does not adjust code inside a block level tag, precisely because of the problem described here, except in the case of the block level tag being the only child of body, in which case it is assumed to be a wrapper tag. I suppose I can adjust the heuristic to also check the tag name and reject heading tags, since they are unlikely to be wrapper tags.
Oh, I see.
However, the same happens with:
Code:
<p>C<span class="smallcaps">HAPTER</span> O<span class="smallcaps">NE</span></p>
senhal is offline   Reply With Quote
Old 02-09-2016, 11:46 PM   #10
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: 44,530
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yes, it will happen with any block level tag, as I explained before. It is a tradeoff, either one disables this functionality in which the common pattern of having all content in a top level wrapper tag will not be beautified or one accepts that int he rare case of html files having a single block level tag, the beautifier will insert extra spaces.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[BUG] - M96 out of memory - [BUG] Alf77 Onyx Boox 5 02-05-2015 12:47 PM
DR800 Help, I've got a bug!! A bug on my screen!! Franky iRex 4 06-21-2011 12:45 PM
Embedded font bug or CSS bug in ADE JSWolf ePub 10 06-11-2011 03:34 PM
Is it a bug or is it me? jekoby Calibre 13 03-29-2011 04:23 PM
PRS-505 bug or eBookLib bug? porkupan Sony Reader 3 10-07-2007 11:44 PM


All times are GMT -4. The time now is 02:17 AM.


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