Skip to content

Commit

Permalink
lint: Don't trigger s-011 if element is in a blockquote
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Feb 5, 2024
1 parent 6fe6b4a commit 496803e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,9 @@ def _lint_xhtml_syntax_checks(self, filename: Path, dom: se.easy_xml.EasyXmlTree
messages.append(LintMessage("s-010", "Empty element. Use [xhtml]<hr/>[/] for thematic breaks if appropriate.", se.MESSAGE_TYPE_ERROR, filename, [node.to_string() for node in nodes]))

# Check for <section> and <article> without ID attribute
nodes = dom.xpath("/html/body//*[self::section or self::article][not(@id)]")
# Ignore items within <blockquote> as that is a new sectioning root and we don't need to address
# sectioning elements in quotations.
nodes = dom.xpath("/html/body//*[self::section or self::article][not(@id)][not(ancestor::blockquote)]")
if nodes:
messages.append(LintMessage("s-011", "Element without [attr]id[/] attribute.", se.MESSAGE_TYPE_ERROR, filename, [node.to_tag_string() for node in nodes]))

Expand Down

0 comments on commit 496803e

Please sign in to comment.