Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 04-27-2015, 10:11 PM   #1
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: 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>
If I delete the </blockquote> Sigil's Preview window shows :

Quote:
This page contains the following errors:
error on line 437 at column 7: Opening and ending tag mismatch.
or if I do an F7 validation:
Quote:
OEBPS/Text/chapter-01.htm Line 437 expected end of tag "blockquote"
(why can't I copy the text from this report? I had to manually retype it.)

-- 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:
ERROR: Parsing failed: Opening and ending tag mismatch: blockquote line 424 and body, line 437, column 9****[OEBPS/Text/chapter-01.htm]

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.
AlanHK is offline   Reply With Quote
Old 04-28-2015, 06:29 AM   #2
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
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.
Notjohn is offline   Reply With Quote
Advert
Old 04-28-2015, 08:43 AM   #3
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: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Notjohn View Post
Seems to me it would be faster to glance up at Line 434 and find the opening tag than to fire up Calibre!.
Yes. IF I knew to look on line 434. Calibre tells me that. Sigil doesn't.

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:
Originally Posted by Notjohn View Post
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.
(revised)

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.
AlanHK is offline   Reply With Quote
Old 04-28-2015, 08:47 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: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Notjohn View Post
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.
In my experience, a new class is only created when 1) the italic/bold tag encompasses the entire contents of the parent block-level tag (in this case <p>) and 2) when the Clean Source preference is is set to HTML Tidy.

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).
DiapDealer is online now   Reply With Quote
Old 04-28-2015, 03:03 PM   #5
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: 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
KevinH is offline   Reply With Quote
Advert
Old 04-28-2015, 06:22 PM   #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: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by AlanHK View Post
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).
Don't be sorry. I just need to get off my lazy butt and port my calibre Toolbag plugin to work with Sigil!
DiapDealer is online now   Reply With Quote
Old 04-28-2015, 11:38 PM   #7
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: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by KevinH View Post
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
Thanks, but doesn't tell me where the start tag is.

Using the same example text as my first post, tells me
Quote:
Line 434 (end of the file)
Improperly nested tags: parsing end tag "body" but current parse path is "html.body.blockquote". near column 0


Quote:
Originally Posted by DiapDealer View Post
Don't be sorry. I just need to get off my lazy butt and port my calibre Toolbag plugin to work with Sigil!
Currently I often have the same Epub open in both Calibre and Sigil.
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.
AlanHK is offline   Reply With Quote
Old 04-29-2015, 02:25 AM   #8
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
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>
Which one has the missing end tag?
rkomar is offline   Reply With Quote
Old 04-29-2015, 02:59 AM   #9
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: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by rkomar View Post
Which one has the missing end tag?
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.
AlanHK is offline   Reply With Quote
Old 04-29-2015, 03:28 AM   #10
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 04-29-2015, 05:22 AM   #11
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by DiapDealer View Post
In short: if you don't want Sigil to create classes, then switch to pretty-print only (Clean Source).
Well, that's been my situation for some time now (Pretty Print), but perhaps I was getting those on-the-fly Sigil classes before I made the change. (And yes, it well could have been an entire paragraph, in a list.)

Thanks for the explanation.
Notjohn is offline   Reply With Quote
Old 04-29-2015, 10:40 AM   #12
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: 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
KevinH is offline   Reply With Quote
Old 04-29-2015, 01:52 PM   #13
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: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by KevinH View Post
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
Thanks, that's what I was hoping for.
AlanHK is offline   Reply With Quote
Old 04-30-2015, 06:20 AM   #14
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
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!
Notjohn is offline   Reply With Quote
Old 05-07-2015, 10:02 AM   #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: 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&nbsp;is*the*<b><i>copyright</i></b> symbol "&copy;"</p>
</html>
Now should generate this output

[(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.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 03:38 PM.


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