Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the problematic heading on roman error #641

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions se/se_epub_generate_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def process_a_heading(node: EasyXmlElement, textf: str, is_toplevel: bool, singl
try:
roman.fromRoman(toc_item.roman)
except roman.InvalidRomanNumeralError as err:
raise se.InvalidInputException(f"Heading tagged as roman numeral is invalid: [path][link=file://{textf}]{textf}[/][/].") from err
raise se.InvalidInputException(f"Heading tagged as roman numeral is invalid: {toc_item.roman} in [path][link=file://{textf}]{textf}[/][/].") from err
toc_item.title = f"<span epub:type=\"z3998:roman\">{toc_item.roman}</span>"
return toc_item
if "ordinal" in epub_type: # but not a roman numeral (eg in Nietzche's Beyond Good and Evil)
Expand Down Expand Up @@ -639,7 +639,7 @@ def evaluate_descendants(node: EasyXmlElement, toc_item: TocItem, textf: str) ->
try:
roman.fromRoman(toc_item.roman)
except roman.InvalidRomanNumeralError as err:
raise se.InvalidInputException(f"Heading tagged as roman numeral is invalid: [path][link=file://{textf}]{textf}[/][/].") from err
raise se.InvalidInputException(f"Heading tagged as roman numeral is invalid: {toc_item.roman} in [path][link=file://{textf}]{textf}[/][/].") from err
if not toc_item.title:
toc_item.title = f"<span epub:type=\"z3998:roman\">{toc_item.roman}</span>"
elif "ordinal" in epub_type: # but not a roman numeral or a labelled item, cases caught caught above
Expand Down