Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 05-14-2021, 03:27 AM   #1
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Differences between results in different modes

I have a metadata plugboard to put the comments plus some other information in the comments when sending books to my Kobo devices. Due to various reasons, I have different versions in different libraries. And whether the KoboTouch or KoboTouchExtended driver is used. While they are producing slightly different results, I also noticed that the treatment of new lines was different between the different template modes. For the basic template, the new lines are replaced with a space. With the GPM, they are not.

For example, if the comment is:

Code:
<div>
<p>Line one</p>
<p>Line two</p></div>
That is how the control used for this will layout the code.

If the template is simply:
Code:
{comment}
The result will be:

Code:
<div> <p>Line one</p> <p>Line two</p></div>
If the template is (the first two lines of a much longer template):

Code:
program:
comment=field('comments');
The result is the same as the input, so it is:
Code:
<div>
<p>Line one</p>
<p>Line two</p></div>
This shouldn't matter. But, for some reason, when this is displayed on the Kobo devices, the new lines are actually interpreted as new lines. Which means there is an extra line between each of the above. And it gets worse with the full template I use. I have reported this to Kobo and will have to wait to see what happens. In the meantime...

Should there be a difference between the two?

As a workaround, I could do a replace of new lines with spaces. But, if there are new lines in the actual text, that could affect the output in undesirable ways. Is there any other way to push it through the formatting that the basic template does?
davidfor is offline   Reply With Quote
Old 05-14-2021, 03:50 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by davidfor View Post
This shouldn't matter. But, for some reason, when this is displayed on the Kobo devices, the new lines are actually interpreted as new lines. Which means there is an extra line between each of the above. And it gets worse with the full template I use. I have reported this to Kobo and will have to wait to see what happens. In the meantime...

Should there be a difference between the two?

As a workaround, I could do a replace of new lines with spaces. But, if there are new lines in the actual text, that could affect the output in undesirable ways. Is there any other way to push it through the formatting that the basic template does?
This is happening because of a change to GPM templates. For GPM, in the past all sequences of space-like characters were changed to a single space using the regular expression r'\s+'. That was changed recently so that newlines could pass through, now stripping spaces from the beginning and the end.

There isn't any way to turn the old behavior back on for GPM templates. However, you can get the equivalent by doing re(x, '\s+', ' '), which will produce the same answer as before.

BTW: only for the record as you clearly know it, the Kobo is getting it wrong. In HTML a newline is equivalent to a space (and to other characters). It can be made significant using the "white-space" style.
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search results only show first result. How can I view successive results? lovedj1 Calibre 2 05-07-2021 07:53 AM
Refresh modes and app optimisation inconsistency meccup Onyx Boox 0 07-05-2020 02:23 PM
Forma Search-in-book results sometimes ends on page17, even if there's more (hidden)results droopy Kobo Reader 9 06-30-2020 11:05 AM
Diferences among various rendering modes ps67 KOReader 2 08-14-2019 02:37 PM
Kindle Previewer: Differences between Kindle and iPhone/iPad modes Jackwritesbooks Kindle Formats 5 06-22-2011 12:25 PM


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


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