View Single Post
Old 09-30-2024, 03:14 PM   #15
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: 874
Karma: 3501146
Join Date: Jan 2017
Location: Poland
Device: Various
Hmmm… My two cents:

1. Missing quotes are fixed by Mend & Prettify, not matched quotes are removed (if one occurrence) or shredded (if two or more).

1a.
<p class='test">Blah</p>
Single occurrence -> will be removed after Mend

1b.
<p class='test">Blah</p>
<p class='test">Blah</p>

Double occurrences -> will be "fixed" by Mend to:
<p class='test"&gt;Blah&lt;/p&gt;
&lt;p class=' test"="">Blah</p>


1c.
Other case (unmatched inverted quotes):
<p class='test">Blah</p>
<p class="test'>Blah</p>

will be "fixed" by Mend to:
<p class='test"&gt;Blah&lt;/p&gt;
&lt;p class="test'>Blah</p>



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\Sigil\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.

Last edited by BeckyEbook; 09-30-2024 at 04:12 PM.
BeckyEbook is offline   Reply With Quote