Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-13-2017, 09:35 PM   #1
DanThompson
Junior Member
DanThompson began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2017
Device: Kindle Paperwhite
Question How to handle ampersand (&) in 0.9.8

I use the character & in several places through my book, e.g. S&P 500.

When I first had it simply as the standalone &, I would get an error in the preview window pointing out that & is an escape code and should be followed by other characters or a # and then numbers. So I replaced it with & which is the HTML named code for that character.

However, when I save the file, "&" is replaced by "&"

I tried using "& # 38;" (without the spaces) instead, but on saving, it's replaced by "&"

Subsequent saves just make the chain that much longer.

Both & and & # 38;(without the spaces) are in my list of entities to preserve, along with various quotes, dashes, and ellipses. None of those others are affected. Only the ampersand is getting messed with.

I'm running 0.9.8. Is anyone else seeing this problem? Is there a workaround?
DanThompson is offline   Reply With Quote
Old 05-13-2017, 11:01 PM   #2
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: 29,754
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Have you tried using the special character tool (the omega)
typing IN CODE VIEW
Code:
&
behaves as expected

also 0.9.8 W10 x64
theducks is online now   Reply With Quote
Advert
Old 05-13-2017, 11:25 PM   #3
DanThompson
Junior Member
DanThompson began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2017
Device: Kindle Paperwhite
I am using & in the code view, which is what the Omega tool gives me.
However, when the "mend HTML" option is checked during save or open, it's expanding it into nonsense like:
Code:
&
And after the next save, it becomes:
Code:
&
And so on.

I did find the workaround by turning off the HTML mending option on save/open, but this makes me think there's a bug in that code. None of the other special characters like — were altered.
DanThompson is offline   Reply With Quote
Old 05-14-2017, 06:27 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,532
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Remove the & and & from your Preserve Entities preferences. Sigil can deal with ampersands inherently. Also remember to turn your "Mend on Save/Open" back on.

Adding Preserve Entities entries for:

& / &
< / <
> / >

is unnecessary and will only serve to confuse/break things (as you've discovered). Those three entities are handled inherently/internally.

Last edited by DiapDealer; 05-14-2017 at 07:03 AM.
DiapDealer is offline   Reply With Quote
Old 05-14-2017, 03:14 PM   #5
DanThompson
Junior Member
DanThompson began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2017
Device: Kindle Paperwhite
Except that it's *not* handling &'s natively. When I put one in the middle of a sentence, the preview window and book view give me this error:

Quote:
This page contains the following errors:

error on line 18 at column 152: Expected '#' or '[a-zA-Z]', but got ' '.
Below is a rendering of the page up to the first error.
Meaning it only knows how to deal with & as an escape code.
DanThompson is offline   Reply With Quote
Advert
Old 05-14-2017, 03:24 PM   #6
DanThompson
Junior Member
DanThompson began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2017
Device: Kindle Paperwhite
Wait, I think I see what you're saying. Once I removed & from the preserve entities, then & was fine in the text, not being altered by save/load/etc.

Last edited by DanThompson; 05-14-2017 at 03:25 PM. Reason: typo
DanThompson is offline   Reply With Quote
Old 05-14-2017, 04:16 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,532
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yes. Adding any of the ampersand or < or > entities to the Preserve Entities list is going to cause problems. I'll look into getting those specific ones ignored if they happen to get added to the Preserve Entities list.
DiapDealer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ampersand (&) in tags Alex II Calibre 6 01-16-2016 06:02 AM
Vitrual Lib-Names with ampersand at Content Server Divingduck Calibre 3 02-28-2014 03:10 AM
Title problems with 'with' and 'and' being changed to ampersand rwmcafee Calibre 4 06-25-2012 09:05 AM
Ampersand missing from cover flow window PatNY Calibre 11 12-07-2011 02:36 PM
Ampersand Issue with downloaded metedata danwdoo Calibre 5 03-25-2009 10:29 PM


All times are GMT -4. The time now is 12:05 AM.


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