Skip to content

Commit

Permalink
lint: Don't include noterefs when checking s-041
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Nov 19, 2024
1 parent 8d29717 commit 654a7c1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,8 +1530,13 @@ def _lint_special_file_checks(self, filename: Path, dom: se.easy_xml.EasyXmlTree
# Replace/remove characters that don't appear in alt attributes.
loi_text_to_compare = loi_text_to_compare.replace(se.NO_BREAK_SPACE, ' ').replace(se.WORD_JOINER, '')
elif child.tag == "figcaption":
# Replace tabs and newlines with a single space to better match figcaptions that contain <br/>
figure_text = regex.sub(r"[ \n\t]+", " ", child.inner_text())
# Remove endnotes.
child_copy = deepcopy(child)
for noteref_node in child_copy.xpath("//a[contains(@epub:type, 'noteref')]"):
noteref_node.remove()

# Replace tabs and newlines with a single space to better match figcaptions that contain `<br/>`.
figure_text = regex.sub(r"[ \n\t]+", " ", child_copy.inner_text())

if figure_text is None:
figure_text = ""
Expand Down

0 comments on commit 654a7c1

Please sign in to comment.