Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-23-2018, 07:02 PM   #1
degn
Member
degn began at the beginning.
 
degn's Avatar
 
Posts: 12
Karma: 10
Join Date: Jul 2018
Device: iBooks on iPad Pro
How to write fraction value using html?

Hello forum

Im using the code ⁄ to generate a fraction with HTML in Calibre, its working fine in the preview mode (picture 2) but not the final EPUB-file. The code is (picture 1):

Code:
<p class="rightalm"><span style="font-size:70%;"><sup>7</sup>&frasl;<sub>3</sub></span> 1911.</p>
I get this error:

“This page contains the following errors: error on line 88 at column 69: Entity 'frasl' not defined Below is a rendering of the page up to the first error.” (picture 3)

Any idea what is wrong? and how to solve the problem so I can display the fraction symbol?

Regards Dan
Attached Thumbnails
Click image for larger version

Name:	1.jpeg
Views:	121
Size:	36.0 KB
ID:	165169   Click image for larger version

Name:	2.jpeg
Views:	128
Size:	7.8 KB
ID:	165170   Click image for larger version

Name:	3.jpeg
Views:	145
Size:	96.1 KB
ID:	165171  

Last edited by degn; 07-23-2018 at 07:07 PM.
degn is offline   Reply With Quote
Old 07-23-2018, 08:10 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 36,622
Karma: 146499190
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by degn View Post
Hello forum

Im using the code &frasl; to generate a fraction with HTML in Calibre, its working fine in the preview mode (picture 2) but not the final EPUB-file. The code is (picture 1):

Code:
<p class="rightalm"><span style="font-size:70%;"><sup>7</sup>&frasl;<sub>3</sub></span> 1911.</p>
I get this error:

“This page contains the following errors: error on line 88 at column 69: Entity 'frasl' not defined Below is a rendering of the page up to the first error.” (picture 3)

Any idea what is wrong? and how to solve the problem so I can display the fraction symbol?

Regards Dan
What happens when you replace &frasl; with "& # 8260;" <remove the spaces>? AFAIR, the calibre editor removes the DOCTYPE declaration which is needed to use named entities in epub2 documents. With epub3 removing most named entities, I've gotten used to using numeric entities instead though they are a PITA since named entities are just so much easier to read. I seem to remember from a discussion 4 or so years ago, that the calibre editor would translate named entities to numeric or the actual character while stripping the DOCTYPE declaration but as I said, years back and I may be misremembering.

Using Sigil as the editor, if I remove the DOCTYPE declaration, I get the following error from epubcheck:

Code:
Col: 69: FATAL(RSC-016): Fatal Error while parsing file 'The entity "frasl" was referenced, but not declared.'.
whereas when I restore the DOCTYPE declaration, I get "No problems found!".

Just in case, what I am referring to as the DOCTYPE declaration follows after the ?xml line.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

Last edited by DNSB; 07-23-2018 at 08:24 PM. Reason: fat fingered typos strike again! More at 11!
DNSB is offline   Reply With Quote
Advert
Old 07-23-2018, 09:08 PM   #3
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,006
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Unless you have turned off entity replacement in the editor settings, typing &frasl; in the editor will simply give you the ⁄ unicode character which will work everywhere. Or use the Fix HTML tool which will automatically replace the entities for you in all html files.
kovidgoyal is offline   Reply With Quote
Old 07-24-2018, 07:29 AM   #4
degn
Member
degn began at the beginning.
 
degn's Avatar
 
Posts: 12
Karma: 10
Join Date: Jul 2018
Device: iBooks on iPad Pro
Hi DNSB

replacing with & # 8260; worked fine, thanks.
degn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML input plugin stripping text within toc tags in child html file nimblebooks Conversion 3 02-21-2012 03:24 PM
Calibre Recipe HTML content differs from raw html of index.html. krunk Calibre 4 09-20-2010 09:48 PM
Access to local HTML files and content, HTML ebooks, annotation on HTML ebooks leo315 enTourage Archive 2 05-10-2010 02:40 PM
Write Fast, Write Slow? Moejoe Writers' Corner 14 03-25-2009 09:55 AM
Fraction of ebooks vs paper books read? chlorine Lounge 26 02-15-2009 12:43 PM


All times are GMT -4. The time now is 08:22 PM.


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