05-17-2012, 01:07 AM | #1 |
Zealot
Posts: 101
Karma: 12
Join Date: Apr 2010
Location: Melbourne, Australia
Device: Kobo Sage, Kobo Aura H2O, LG V20
|
How to stop Sigil from changing my HTML?
I have HTML Tidy turned off.
I've also tried to remove it's shortcut key after hitting it by mistake when saving, but every time Sigil restarts it's back. Sigil is still reformatting my HTML. Why? I have several pages of vocabulary to correct and format and it's a whole lot easier if I keep the format compact... Code:
<dt>Munter</dt><dd>—A kind of native apple grown on the seacoast.</dd> <dt>Mir-nat</dt><dd>—A bulrush.</dd> Code:
<dt>Munter</dt> <dd>—A kind of native apple grown on the seacoast.</dd> <dt>Mir-nat</dt> <dd>—A bulrush.</dd> I think it does this when it saves, though it doesn't update the code view to reflect it at all. You just get a nasty surprise, sometimes when you click on the book view to update the preview and then click back on the code view, sometimes when you next open the document. Totally inconsistent and unpredictable. Why can't I rely on code view to actually show me what's currently in my document? Is that too much to ask? Why is a good thing for a program to change your input without even alerting you? |
05-17-2012, 07:03 AM | #2 | |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
Advert | |
|
05-17-2012, 07:08 AM | #3 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
The book view editor is being changed in the next version. So suggest you wait and see what happens.
Code view is what is truly in the document. Book view is only for convenience, as each e-reader will have its own way of displaying the code. Seems to me that most editors will not save particular arrangements of text but display it in a way which shows the structure. You can insert comments: <!--This is a comment. Comments are not displayed in the browser-->. These can mark out areas of importance to you and will also help anyone looking at your code. An editor is not a word processor, so its aim is not to preserve a particular display of code. |
05-17-2012, 10:25 AM | #4 |
Well trained by Cats
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
05-17-2012, 10:44 AM | #5 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
Ducks,
That was my intention is for him to put notes such as end of first section, or section end, etc. If he did put that in it would make it a lot easier to fix 5 years from now after he has changed his way of doing things 4 or 5 different times. |
Advert | |
|
05-17-2012, 10:27 PM | #6 | ||
Zealot
Posts: 101
Karma: 12
Join Date: Apr 2010
Location: Melbourne, Australia
Device: Kobo Sage, Kobo Aura H2O, LG V20
|
Quote:
I really don't care about most of it, but spacing definitions separately from terms as though they're all paragraphs is just stupid. It doesn't make anything more readable, in fact it produces the opposite effect. After this mangling, how would you go about sorting a list of definitions for example? I can't see any sane reason for changing the user's data in this case. So the the general advice is to use Code View (which I'm doing anyway) but Sigil will force your HTML into a form that makes life harder even when you do. And it won't even necessarily show you what's saved. Quote:
Why couldn't Sigil expose some minimal Tidy options? I'd be happy with an obscure config file somewhere. Even being able to switch vertical-space off would be good. And then there's the other issue: is the keyboard shortcut interface broken? I can't find any way of turning the Tidy shortcut off. It always comes back the next time you start Sigil. |
||
05-18-2012, 12:30 AM | #7 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Start Sigil, turn Tidy off, close Sigil. It should be off next time.
Personally I like the job Sigil does on HTML. It helps me to keep overview. Sometimes its annoying, but in general not (for me at least). It also helps to reuse RegEx, since the layout is always the same. |
05-18-2012, 04:17 AM | #8 |
Zealot
Posts: 101
Karma: 12
Join Date: Apr 2010
Location: Melbourne, Australia
Device: Kobo Sage, Kobo Aura H2O, LG V20
|
Tidy can be turned off, but the keyboard shortcut cannot.
|
05-18-2012, 06:46 AM | #9 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@Toxaris - I agree that when it works Tidy does some nice things that save work when doing regexes.
*However* what I suspect many people do not know is that Tidy *will* destroy html content in some circumstances. Or at least that is what user_none is pointing to as the cause when I reported this (and rather more concerning is that it has a status of "CannotFix" and the suggestion is to turn off Tidy as the workaround). So if your document contains some smart tag remnants such as I have seen from LIT conversions like this: <span w:st="on"><span w:st="on">Wash</span></span> Then *all* content on the html page will be removed from that point onwards. Utterly destroyed. Can be entire chapters worth (which you might notice) or subtly small amounts which you likely won't. Tidy either should be off by default, fixed to address this issue, or removed from Sigil in my opinion. This is just way too dangerous a flaw - edit a book in Sigil thinking you are making a small change and end up losing book content forever... |
05-18-2012, 07:02 AM | #10 |
Grand Sorcerer
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I assumed the OP was referring to the "prettifying" of the html--which happens whether Tidy is on or off.
And to the OP: I wasn't making a value judgment, endorsement, or looking for debate concerning the the issue--my post was just a simple statement of fact: Sigil can't currently behave the way you'd like it to (without modifying the source and compiling your own version). Do with that info what you will. Last edited by DiapDealer; 05-18-2012 at 07:09 AM. |
05-18-2012, 08:20 AM | #11 | |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Leaving Tidy out will give other issues. Since there is no real alternative for Tidy (or so both Valloric and user_non specified and I believe them), it is really a lose-lose situation. Last edited by Toxaris; 05-18-2012 at 12:27 PM. |
|
05-18-2012, 09:16 AM | #12 |
Calibre Plugins Developer
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
The problem is you have to intimately know your document *before* you load it in Sigil. Now if you are writing it yourself, hey no problem. If on the other hand you are just doing an ad hoc edit of a book from calibre to fix some margins in the stylesheet and get the TOC sorted - BAM, content is gone and chances are you wouldn't know it until you try to read that book a few months later. And I'm not talking about cosmetic stuff like the sgc styles thats been done to death - this bug literally deletes the entire divs and paragraphs of text off the page from that point. No warnings, no logs, no dialogs - just completely gone from code view or book view. There used to be a similar issue if your pages had javascript on them, but that got fixed along the way.
I know nothing about the internals of Sigil or Tidy to comment on what is or isn't possible to fix or offer an alternative, but now having seen this happen it is to me a complete show-stopper for Sigil with Tidy turned on. |
05-18-2012, 09:19 AM | #13 | |
Guru
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
|
Quote:
I agree that Tidy can cause an awful lot of issues if you've used some strange code but I can't live without it as (for me) it keeps everything laid out in a uniform way, so S&R is much easier to use. As there is a lack of alternatives to Tidy, then we need more control of it available within Sigil, so as to customise it to our specific needs. But if I remember correctly, Valloric had stated that Tidy's code is an unholy mess, so I suspect that any modification to it for this purpose will likely take some time. As an 0.6.0 is looking like a massive rewrite of the codebase, this will have to wait. |
|
05-18-2012, 12:28 PM | #14 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Oeps... That is a stupid mistake...
|
05-19-2012, 04:12 AM | #15 |
Sigil developer
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
|
HTML Tidy is actually used in two different ways and is different to error checking.
The part that you can control with Tidy via the option is whether Tidy tries to clean up your styles/formatting, etc. when you save or switch views. Personally I turn this off as I prefer to use stylesheets and don't want the html modified from what I've set. Tidy is also used to make the code look pretty on save (not always visible until you reload the book) - changing spaces, etc. This is automatic and not user-changeable. This should not change any code, just layout of the code/spacing and I personally find it very useful (even if not perfect). The Well-Formed checking checks for errors in your html when saving/switching away from Code View. It has nothing to do with Tidy. And it should always be left on unless you really know what you are doing - with it off, it will automatically try to fix code when you save/switch from CV without telling you. Personally I always click on Fix Manually when it warns me about issues - although some people like it closing tags, I'd rather find what I forgot to do and fix it - and more importantly know exactly what was changed. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How To Stop It From Splitting HTML Files? | Ransom | Calibre | 8 | 06-12-2011 02:08 PM |
Stop Automatic Code cleaning in Sigil | ericp20 | Sigil | 11 | 05-27-2011 08:52 AM |
How do I stop Calibre from changing my book titles? | HarryT | Calibre | 2 | 12-16-2010 11:41 AM |
Can I stop Sigil from inserting sgc formatting commands? | ramjet1953 | Sigil | 4 | 11-22-2010 11:59 AM |
Why is Sigil changing the font size? | djloewen | Sigil | 6 | 12-25-2009 09:41 AM |