![]() |
#1 | |||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Tag mismatch error reporting
Tag mismatch error reporting.
Example: editing lines 424-6 file chapter-01.htm Code:
<blockquote> <p class="noindent"><i>Intellect may fail you, but the killer instinct is invincible.</i></p> </blockquote> Quote:
Quote:
-- line 437 is the </body> at the end of the file. In Calibre editor if I do the same thing and run "Checkbook" it tells me: Quote:
When I have a missing tag, which happens to me at least quite a lot, what I need to know is where the OPENING tag is. Then I can usually see immediately where the missing tag should go. Sigil just says it didn't find the end tag in the file. So I have to scan through the whole file and check every tag pair of that type. Or what I usually, is open it in Calibre and find and fix it at once. Can Sigil report the location of the opening tag like this? (And also allow text from the validation to be copied?) Last edited by AlanHK; 04-27-2015 at 10:16 PM. |
|||
![]() |
![]() |
![]() |
#2 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Seems to me it would be faster to glance up at Line 434 and find the opening tag than to fire up Calibre!
I'm interested in the italics following the paragraph class. Does Sigil create a new class for such combinations, in your experience? It seems normal coding to me, but in my experience it gets overridden. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | ||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
I simplified the example. Plenty of times when I'm cleaning up some awful converted file I've waste minutes searching up and down the file through a forest of redundant nested codes looking for one orphaned tag. I'm sure Sigil knows where it is, I want it to tell me where the start tag is and not just that the end tag isn't in the file. Quote:
Sigil editor doesn't change CSS by itself. If you have HTMLTidy active, it probably would. That's why people who edit code themselves never use it. (Edit/preferences/Clean Source -- Pretty print just makes cosmetic changes (white space) and is quite safe. The full on HTMLTidy rewrites your code.) One of the first things I do when I get a file is convert any CSS italic, bold spans to <i> and <b> using Diap's Editing Toolbag https://www.mobileread.com/forums/sho...d.php?t=251365 (again in Calibre, sorry). Last edited by AlanHK; 04-28-2015 at 09:27 AM. |
||
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
If you set the Clean Source setting to Pretty Print only, no new css classes will be created. Likewise; if you leave HTML Tidy enabled, no classes will be created if the italic/bold tags only encompass portions of the parent block-level tag's content. In short: if you don't want Sigil to create classes, then switch to pretty-print only (Clean Source). |
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,483
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Try the Sanity Checker plugin for Sigil. It should tell you which tag it was expecting when the mismatch happened and print the queue of open tags.
KevinH |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#7 | |||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Using the same example text as my first post, tells me Quote:
Quote:
They are interchangeable 90% of the time, but each has a few features that the other lacks. I just have to be careful to save and then reload when I switch between them. -- Would be helpful if Sigil and Calibre noticed if the file had been changed and did it itself as some text editors do. Last edited by AlanHK; 04-29-2015 at 12:41 AM. |
|||
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,042
Karma: 18821071
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
I'm curious to know whether it is theoretically possible to know where the start tag with the missing end tag always is. I'm thinking about nested tags, and whether you can always know which start tag is missing the end tag. For example:
Code:
<tag> <tag> <\tag> |
![]() |
![]() |
![]() |
#9 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Yeah, it's ambiguous.
That's why I never let Sigil automatically fix code. You need to work out the intent to fix it. Last edited by AlanHK; 04-29-2015 at 03:02 AM. |
![]() |
![]() |
![]() |
#10 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@rkomar: It is not possible for unstructured XML. However, the HTML 5 parsing algorithm, which is the standard algorithm browsers use to parse "tag soup" has various well defined rules for closing mismatched tags that cover most of these. calibre uses this algorithm to autofix html when you ask it too, and I believe Sigil will start doing so in the future as well.
Last edited by kovidgoyal; 04-29-2015 at 03:33 AM. |
![]() |
![]() |
![]() |
#11 | |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Quote:
Thanks for the explanation. |
|
![]() |
![]() |
![]() |
#12 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,483
Karma: 5703586
Join Date: Nov 2009
Device: many
|
FYI,
As Kovid said, the upcoming Sigil 0.9.0 has replaced Tidy with the gumbo-parser which is now a fully compliant html5 parser which will auto-fix these following the official html5 parsing rules. FlightCrew will become a plugin, and something like SanityCheck will become the internal tool to catch not well-formed errors. I will modify SanityCheck to keep a queue of line-column info similar to the path info it keeps now so that you can see the line-col of the last opening tag and the line-col of the non-matching end tag. KevinH |
![]() |
![]() |
![]() |
#13 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
|
![]() |
![]() |
![]() |
#14 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Ain't Sigil great? Imagine complaining to the boffins at Microsoft about their products and getting an assurance that it will be taken care of!
|
![]() |
![]() |
![]() |
#15 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,483
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi,
I am finally back from my travels. There is a new version of the SanityChecker v0.1.0 which should provide line and column information for the last start tag that was unmatched when tag mismatches happen. Please let me know if this now does what you want. Thanks, Kevin Code:
<html> <head> <title>testing & entities</title> </head> <body> <p>this is*the*<b><i>copyright</i></b> symbol "©"</p> </html> [(7, 0, 'Improperly nested tags: parsing end tag "html" but current parse path is "html.body". See line 5 col 0')] KevinH Last edited by KevinH; 05-07-2015 at 03:38 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reporting an error when running Sigil 0.8.2 | turbulent | Sigil | 2 | 12-13-2014 10:23 PM |
V1.23: error when entering a tag | DrChiper | Editor | 6 | 02-07-2014 08:14 AM |
Plugin version reporting during error | Sabardeyn | Development | 0 | 10-12-2013 12:24 AM |
Calibre 0.8.7: Error when editing a tag | DrChiper | Calibre | 2 | 06-30-2011 06:23 PM |
Possible bug in 7.4 Tag Editor error | FizzyWater | Calibre | 3 | 06-20-2010 06:11 AM |