![]() |
#1 |
Zealot
![]() 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.
|
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,542
Karma: 204127028
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. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Zealot
![]() Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,542
Karma: 204127028
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.
|
![]() |
![]() |
![]() |
#5 | |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 186
Karma: 266070
Join Date: Dec 2010
Location: Spain
Device: Win10,Win11,Ubuntu,PockbookLux44
|
Workaround
Quote:
Code:
code, pre {white-space: pre-wrap;} -- the stylesheet of any ebook containing code (manuals...) -- my user stylesheet in the viewer (calibre) and everything behaves, without preventing past©... If other viewers don't respect it, I feel strongly that they should... |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,542
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() 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. |
|
![]() |
![]() |
![]() |
#7 |
Zealot
![]() Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
I understand. Thanks.
|
![]() |
![]() |
![]() |
#8 |
Groupie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 186
Karma: 266070
Join Date: Dec 2010
Location: Spain
Device: Win10,Win11,Ubuntu,PockbookLux44
|
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 |
![]() |
![]() |
![]() |
#9 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,733
Karma: 5703586
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.
|
![]() |
![]() |
![]() |
#10 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,542
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() 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). |
|
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,062
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
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.
![]() |
![]() |
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,542
Karma: 204127028
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.
![]() |
![]() |
![]() |
![]() |
#13 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,733
Karma: 5703586
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.
|
![]() |
![]() |
![]() |
#14 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#15 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,733
Karma: 5703586
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.
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |