Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-30-2024, 05:08 PM   #16
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,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by BeckyEbook View Post
2. Possible real detect missing quotes.
In sanitycheck.py after line 185:
Code:
                    ...
                    val = s[b:p]
                    error_msg = 'Attribute "' + aname + '" has missing quotes surrounding the value'
                    self.errors.append((self.tag_start[0], self.tag_start[1], error_msg))
                    self.has_error = True
                    return None, None, None
                tattr[aname] = val
                ...
I feel that this is sufficient to catch missing quotes, as the previous conditions catch other cases.
Of course, this is worth checking. Fortunately, the sanitycheck.py file is available for editing directly (C:\Program Files\SigilBE\python3lib\sanitycheck.py), so the tests don't require rebuilding Sigil, just restarting it.

Of course, it's better to test it; I've only done about a dozen trials.
You mean line 185 after my proposed PR changes, right? If so, I agree.
DiapDealer is offline   Reply With Quote
Old 09-30-2024, 05:11 PM   #17
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
Of course, after your last PR.
BeckyEbook is offline   Reply With Quote
Old 09-30-2024, 05:45 PM   #18
philja
Groupie
philja began at the beginning.
 
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
Quote:
Originally Posted by DiapDealer View Post
Not that hard to believe. **shrug**

It's not the first time that one error will move the goalpost to a different error in a validation routine. And it won't be the last. Not one of them are perfect in detecting all the various ways a user can mess code up.
I didn't make that part as clear as I thought. The epub file I was using for these checks has been clean on Epubcheck for years until I tried interfering with the quotes. Each type of interference I tried, and I only tried a single instance at any one time, caused Epubcheck to flag a load of "Fragment identifier not defined" errors in multiple chapters.

The fragments I looked at were all footnote links in the text body linking to a reference at the end of the chapter. Only one footnote/chapter. The footnote had a return link to the text. These fragments had all worked fine for years and had never been flagged as undefined by Epubcheck over multiple checks.

As soon as the quotes error was corrected, the next Epubcheck was completely clean with no reference to any fragments in any chapter.

I haven't understood the possible connections between a single missing or mismatched quote and unidentified fragments elsewhere. It seems a most unlikely scenario.
philja is offline   Reply With Quote
Old 09-30-2024, 06:32 PM   #19
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
The connection is simple.
Parsing encounters erroneous incompatible quotes, which results in the inability to check the rest of the text where the footnote text is located, hence the message about the unidentified fragments.

Incompatible quotes are dangerous and I don't understand where they would come from in Sigil, which takes great care to ensure that the code is well-formed. You simply have to be careful when editing your code to avoid such situations.

Here is another example of a file that, when you run the "Mend" option, causes the contents to be cleared.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Test</title>
</head>
<body>
<div class='badclass">
  <h1>Chapter</h1>
  <p class="first">Blah</p>
  <p>Blah<a id="fn1" href="#fntext">[1]</a></p>
  <div class="footnotes">
    <div class="footnote">
      <p><a id="fntext" href="#fn1">[1]</a> Footnote 1</p>
    </div>
  </div>
  </div>
</body>
</html>
BeckyEbook is offline   Reply With Quote
Old 10-01-2024, 03:07 AM   #20
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,470
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For what it may be worth, I edited sanitycheck.py to include DiapDealer's and BeckyEbook changes and it seemed to catch all the missing/mismatched quotes I threw at it.
DNSB is offline   Reply With Quote
Old 10-01-2024, 06:45 AM   #21
philja
Groupie
philja began at the beginning.
 
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
Quote:
Originally Posted by BeckyEbook View Post
The connection is simple.
Parsing encounters erroneous incompatible quotes, which results in the inability to check the rest of the text where the footnote text is located, hence the message about the unidentified fragments.

Incompatible quotes are dangerous and I don't understand where they would come from in Sigil, which takes great care to ensure that the code is well-formed. You simply have to be careful when editing your code to avoid such situations.[/CODE]
OK, thanks Becky, that's an explanation.

Of course these errors come from editing and my concern is with author friends learning to use Sigil. I wouldn't advise them to use Mend and Prettify to correct for an accidentally erased quote. They wouldn't understand the result.

Further checking of my quotes and missing angle brackets cases found that all resulting fragment errors were down to nav links in that xhtml file and their correspondents in the HTML Contents and NCX files. Since my test document was a non-fiction epub with h1, h2, h3 levels of contents, that explained the number of fragment problems.

Your comment about the parsing encountering an error and being unable to check the rest of the file explains all. Perhaps it would be better to ignore the rest of the file or just the links, once an error has been encountered rather than listing 'errors' that do not or may not exist.

In any case, we have to rerun the plugin after fixing the real error and if there are really unidentified fragments they could be listed in a subsequent run.

Last edited by philja; 10-01-2024 at 07:14 AM.
philja is offline   Reply With Quote
Old 10-01-2024, 07:24 PM   #22
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,470
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Hmmm... ran into one ebook today where the modified sanity check throws an error. The line reads:

Code:
<p class="center"><a href="https://alsoby.me/r/amazon/B07BZM62LQ?fc=us&amp;ds=1"><span class="underline">THE UNBELIEVABLE MR. BROWNSTONE</span></a></p>
Removing the equal signs from '?fc=us&amp;ds=1' stops the error from occurring. Just removing the entire string seems to have no effect on opening the URL.

Edit: Also add this line as one that triggers an error message from sanity check:

Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Last edited by DNSB; 10-01-2024 at 08:01 PM.
DNSB is offline   Reply With Quote
Old 10-01-2024, 08:53 PM   #23
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,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I think that's my fault. I copied a bit too much from xmlsanitycheck.py.
DiapDealer is offline   Reply With Quote
Old 10-01-2024, 08:55 PM   #24
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,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Try this one: my fixed changes with Becky's addition included.
Attached Files
File Type: py sanitycheck.py (16.0 KB, 24 views)
DiapDealer is offline   Reply With Quote
Old 10-01-2024, 10:25 PM   #25
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,470
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
A quick test against a couple of files that were triggering the errors went well with no errors reported.
DNSB is offline   Reply With Quote
Old 10-01-2024, 10:33 PM   #26
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,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Thanks for getting back. I think I'm going to let this stew a bit to allow for more testing. I don't want to end up just kicking the can further down the road.
DiapDealer is offline   Reply With Quote
Old 10-03-2024, 06:47 PM   #27
philja
Groupie
philja began at the beginning.
 
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
Quote:
Originally Posted by DiapDealer View Post
Try this one: my fixed changes with Becky's addition included.
I've just changed my system from US 22.04 to 24.04.1 and with all the supplementary changes that implies, I've just rebuilt Sigil to 2.3.1 (and it works fine).

To try your sanitycheck.py file, I suppose I need to swap it with the file that is in the source and then rebuild. Is that a correct assumption?
philja is offline   Reply With Quote
Old 10-03-2024, 06:50 PM   #28
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,470
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by philja View Post
I've just changed my system from US 22.04 to 24.04.1 and with all the supplementary changes that implies, I've just rebuilt Sigil to 2.3.1 (and it works fine).

To try your sanitycheck.py file, I suppose I need to swap it with the file that is in the source and then rebuild. Is that a correct assumption?
You should be able to just replace the sanitycheck.py file in the installed Sigil. No need to rebuild.
DNSB is offline   Reply With Quote
Old 10-03-2024, 07:11 PM   #29
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,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
David is correct. No rebuild required. If you built Sigil using the default install prefix, sanitycheck.py will be installed in /usr/local/share/sigil/python3lib/

Last edited by DiapDealer; 10-03-2024 at 07:15 PM.
DiapDealer is offline   Reply With Quote
Old 10-04-2024, 10:11 AM   #30
philja
Groupie
philja began at the beginning.
 
Posts: 177
Karma: 10
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6
Quote:
Originally Posted by DNSB
You should be able to just replace the sanitycheck.py file in the installed Sigil. No need to rebuild.
Quote:
Originally Posted by DiapDealer View Post
David is correct. No rebuild required. If you built Sigil using the default install prefix, sanitycheck.py will be installed in /usr/local/share/sigil/python3lib/
Thank you both. Job done and all seems to be working fine.
philja is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sigil Font use without error messages qkiazd Sigil 16 11-18-2023 12:04 PM
Copying error messages AlanHK Sigil 1 09-27-2017 03:07 PM
About translation and error messages hermida Development 12 05-05-2016 05:34 PM
What's with the DRM error messages? AndyElk Calibre 3 02-28-2016 09:14 PM
error messages on new PC huskerruth Devices 1 02-16-2011 12:56 PM


All times are GMT -4. The time now is 10:45 PM.


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