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, 08: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, 10: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,034
Karma: 22669822
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 offline   Reply With Quote
Advert
Old 02-08-2016, 01: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, 05: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,283
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
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-08-2016, 11:15 PM   #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,002
Karma: 57259778
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, 02: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, 129 views)

Last edited by senhal; 02-09-2016 at 02:39 AM.
senhal is offline   Reply With Quote
Old 02-09-2016, 03: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 03:56 AM.
jbacelar is offline   Reply With Quote
Old 02-09-2016, 06: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,034
Karma: 22669822
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 offline   Reply With Quote
Old 02-09-2016, 07: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, 10: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,034
Karma: 22669822
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 offline   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 11:47 AM
DR800 Help, I've got a bug!! A bug on my screen!! Franky iRex 4 06-21-2011 11:45 AM
Embedded font bug or CSS bug in ADE JSWolf ePub 10 06-11-2011 02:34 PM
Is it a bug or is it me? jekoby Calibre 13 03-29-2011 03:23 PM
PRS-505 bug or eBookLib bug? porkupan Sony Reader 3 10-07-2007 10:44 PM


All times are GMT -4. The time now is 06:43 AM.


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