Difficulty with Numerical entities and Prettify in 1.9.20
I was showing a friend how they could improve the appearance of a solid block of text and html tags covering many paragraphs by the use of Tools > Reformat HTML > Mend and Prettify all HTML files. I was using as an example one of my epubs (epub2) in which I had removed the spacing and blank lines to provide a demo model.
This example contained some non-breaking spaces either inserted using Insert > Special Character > nbsp or with the numerical entity X#160; manually typed in. It also contained an 'ampersand' written as the numerical entity X#38; (I had been using X#38; instead of & because Epubcheck raised objections to & )
[I have had to replace the & in the numerical entities by an X, otherwise, the whole entity disappears when I preview the post even if I wrap it in quotes or code tags]
When I hit the Prettify command, the prettification occurred right enough with spaces and blank lines inserted but the effect on the entities was strange.
nbsp which had been displayed in code view as _. , became X#38;#160; and in preview panel it was displayed as X#160;
X#38; which had been displayed in code view as X#38; and in preview as &, became X#38;amp; in code view and was displayed in preview as &
I thought I had understood the Sigil User Guide for 1.9, section Preferences, Preserve Entities. I had entered both X#160; and X#38; in the Preserve Entities section in order to prevent them from being converted to Unicode chars.
If I remove those entries from Preferences, Preserve Entities, the numerical entities are converted to _. and & which is what I had been trying to prevent by following, as I thought, the instructions in the User Guide.
I get the same in UbuntuStudio and in Windows 10.
Is there something I have misunderstood or is there a bug here?
|