Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-30-2019, 11:03 PM   #1
The_book
Zealot
The_book began at the beginning.
 
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
Problem of sigil's html reformat

When I use sigil's html reformat function, it cause problem. It changes format in <pre></pre>, which should not be changed.
The_book is offline   Reply With Quote
Old 10-30-2019, 11:34 PM   #2
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,606
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Must be a fairly old version, then. Sigil's Mend/Prettify has preserved the whitespace inside of pre tags for quite some time now.

Just ran a test on some pre formatted sections and Reformat Html didn't touch them. Do you have a small sample we can use to try to reproduce your issue (provided you verify you're using a recent version of Sigil)?

Last edited by DiapDealer; 10-30-2019 at 11:41 PM.
DiapDealer is offline   Reply With Quote
Advert
Old 10-31-2019, 02:21 AM   #3
The_book
Zealot
The_book began at the beginning.
 
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
Quote:
Originally Posted by DiapDealer View Post
Must be a fairly old version, then. Sigil's Mend/Prettify has preserved the whitespace inside of pre tags for quite some time now.

Just ran a test on some pre formatted sections and Reformat Html didn't touch them. Do you have a small sample we can use to try to reproduce your issue (provided you verify you're using a recent version of Sigil)?
Thanks. By testing, I find the problem is I use <pre><code></code></pre>, which can cause reformat.
The_book is offline   Reply With Quote
Old 10-31-2019, 06:22 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,606
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yes. The prettify function is not infallible. If there's a lot of nested html inside a pre section, there's bound to be some line-break alteration. It's probably best not to prettify in those rare situations. The use of pre tags in epubs should be pretty judicious to begin with. It's too easy to create scenarios where content can overflow screen boundaries if not very careful.
DiapDealer is offline   Reply With Quote
Old 10-31-2019, 07:42 AM   #5
carmenchu
Groupie
carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.
 
Posts: 183
Karma: 266070
Join Date: Dec 2010
Device: Win7,Win10,Lubuntu,smartphone
Workaround

Quote:
Originally Posted by DiapDealer View Post
... The use of pre tags in epubs should be pretty judicious to begin with. It's too easy to create scenarios where content can overflow screen boundaries if not very careful.
Well, you solve that with (picked up from W3Schools):

Code:
code, pre {white-space: pre-wrap;}
I add it to
-- the stylesheet of any ebook containing code (manuals...)
-- my user stylesheet in the viewer (calibre)
and everything behaves, without preventing past&copy...

If other viewers don't respect it, I feel strongly that they should...
carmenchu is offline   Reply With Quote
Advert
Old 10-31-2019, 08:40 AM   #6
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,606
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by carmenchu View Post
If other viewers don't respect it, I feel strongly that they should...
Epub doesn't actually work on strong "feels" and W3Schools is not EpubSchools.

But regardless ... this isn't an issue of respecting or rendering. Sigil's Preview handles (and correctly honors) pre code-wrapped content sections just fine (including the pre-wrap css attribute you mentioned). The issue is whether Sigil's Prettyify html feature (found under the Reformat HTML menu) can potentially alter how that same content renders. And the answer is yes... it sometimes can.

Luckily, though; un-Prettified xhtml renders just as correctly in Sigil's Preview. If you have complex pre/code sections with nested html inside that renders precisely how you want it to, it's in your best interest NOT to try and "Prettify" it with any kind of automatic tool.

This kind of situation is exactly why we made "Reformat HTML" an optional, manual choice, rather than the continuously running process it used to be: so people could always choose "correct" over "pretty."

Last edited by DiapDealer; 10-31-2019 at 08:44 AM.
DiapDealer is offline   Reply With Quote
Old 10-31-2019, 09:07 AM   #7
The_book
Zealot
The_book began at the beginning.
 
Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
I understand. Thanks.
The_book is offline   Reply With Quote
Old 10-31-2019, 09:16 AM   #8
carmenchu
Groupie
carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.carmenchu ought to be getting tired of karma fortunes by now.
 
Posts: 183
Karma: 266070
Join Date: Dec 2010
Device: Win7,Win10,Lubuntu,smartphone
Sorry--maybe there is some misunderstanding.
My comment was meant just for the quoted paragraph, which read 'almost' as a warning against <pre></pre> and <code></code>--or a hint towards some heavy manual editing.
For my part, the only issues I have ever encountered came from the lack of {withespace: pre-wrap}--no more editing seems necessary.
As I am just making manuals from some downloaded html pages, I would appreciate to known in advance if I happen to be wrong...

Last edited by carmenchu; 10-31-2019 at 09:17 AM. Reason: change wording
carmenchu is offline   Reply With Quote
Old 10-31-2019, 10:37 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,736
Karma: 5446592
Join Date: Nov 2009
Device: many
The problem is the semantic only code tag wrapping the entire contents of the pre tag including text. I will look into modifying the Sigil source prettify to treat code tags just like pre. Or alternatively change the order so that the code wraps the pre tag since it is only a semantic marker.
KevinH is offline   Reply With Quote
Old 10-31-2019, 11:28 AM   #10
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,606
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by carmenchu View Post
Sorry--maybe there is some misunderstanding.
My comment was meant just for the quoted paragraph, which read 'almost' as a warning against <pre></pre> and <code></code>
Oh, no 'almost' about it! You're, not wrong. I hate pre and all of its attributes and would absolutely recommend not using them in an epub unless absolutely necessary. It's just asking for trouble on various devices/apps, in my opinion.

But Sigil will allow you to use it and it will render it all correctly. You just might not be able to Prettify the code without altering how it renders (depending on if Kevin can make Prettify contend with the semantic-only code tags or not).
DiapDealer is offline   Reply With Quote
Old 10-31-2019, 12:03 PM   #11
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,566
Karma: 84810789
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
Of course someone is eventually going to come along with a book that uses the “white-space: pre” style on a div and complain that making it pretty messes up the rendering.
jhowell is online now   Reply With Quote
Old 10-31-2019, 12:22 PM   #12
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,606
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
INDD is notorious for inflicting “white-space: pre” on huge swathes of body content. Essentially making every line-break in the code relevant and thus unalterable.
DiapDealer is offline   Reply With Quote
Old 11-04-2019, 11:51 AM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,736
Karma: 5446592
Join Date: Nov 2009
Device: many
This should now be fixed in master as changing whitespace of anything inside a "code" tag whether wrapped in a pre or not really makes no sense.
KevinH is offline   Reply With Quote
Old 11-12-2019, 05:05 PM   #14
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by jhowell View Post
Of course someone is eventually going to come along with a book that uses the “white-space: pre” style on a div and complain that making it pretty messes up the rendering.
That did happen to me a couple of years ago.

There was some ascii art I did as a "p" style, which worked until Pretty trashed it. I made it a "pre" style and that worked.

So I learned that Pretty did not parse CSS, only respected default tags.
AlanHK is offline   Reply With Quote
Old 11-12-2019, 06:19 PM   #15
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,736
Karma: 5446592
Join Date: Nov 2009
Device: many
Yes, the inheritance rules of css make it hard to easily determine which rules will impact which tags and in what way without doing a complete browser layout andparsing. Since users can change what css is active by changing the css file, it is never perfectly clear when to prettify, so we only use the tags.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh files in Sigil when html files have changed outside Sigil Echeban Sigil 43 10-29-2021 08:29 PM
converting from HTML in Sigil ralphiedee Workshop 4 03-23-2016 05:07 PM
After changes to HTML in Sigil... Education Sigil 24 03-18-2014 10:39 AM
Problem with html -> Mobi conversion - html tags visible. khromov Calibre 9 08-06-2011 11:25 AM
Sigil freezes when I + HTML ebook. Anarel Sigil 4 08-16-2010 11:13 AM


All times are GMT -4. The time now is 08:07 AM.


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