Skip to content

Commit

Permalink
Make sanitycheck.py (WellFormedCheckEpub) look for both missing attr …
Browse files Browse the repository at this point in the history
…quotes like xmlsanity.py does
  • Loading branch information
dougmassay committed Sep 30, 2024
1 parent e1e7280 commit caeb886
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Resource_Files/python3lib/sanitycheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ def parsetag(self, s):
b = p
while s[p:p+1] != qt:
p += 1
if p >= taglen:
# Opening quote with no closing quote
if s[p:p+1] == '=' or p >= taglen: # Don't cross the next '=' boundary when seeking matching quote
error_msg = 'Attribute "' + aname + '" has unmatched quotes on attribute value'
self.errors.append((self.tag_start[0], self.tag_start[1], error_msg))
self.has_error = True
Expand All @@ -170,6 +171,12 @@ def parsetag(self, s):
b = p
while s[p:p+1] not in ('>', '/', ' ') :
p += 1
# Closing quote with no opening quote
if s[p:p+1] in ('"', "'"):
error_msg = 'Attribute "' + aname + '" has unmatched quotes on attribute value'
self.errors.append((self.tag_start[0], self.tag_start[1], error_msg))
self.has_error = True
return None, None, None
if p >= taglen:
error_msg = 'Attribute "' + aname + '" has unterminated attribute value'
self.errors.append((self.tag_start[0], self.tag_start[1], error_msg))
Expand Down

0 comments on commit caeb886

Please sign in to comment.