Skip to content

Commit

Permalink
fix for_ebooks condition
Browse files Browse the repository at this point in the history
  • Loading branch information
gambhiro committed Mar 15, 2024
1 parent bfc9691 commit aa258ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions simsapa/app/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ def normalize_sutta_ref(ref: str, for_ebooks = False) -> str:
ref = re.sub(r'th *(\d)', r'thag \1', ref)

if for_ebooks:
ref = re.sub(r'[\. ]*([ivx]+)[\. ]*', r' \1 ', ref)
else:
# FIXME: the pattern below breaks PTS linking in Buddhadhamma, but the
# pattern above breaks Mil. uid query lookup.

# M.III.24 -> M I 24
ref = re.sub(r'[\. ]([ivx]+)[\. ]', r' \1 ', ref)
else:
# FIXME: the above pattern breaks PTS linking in Buddhadhamma, but the
# pattern below breaks Mil. uid query lookup.
ref = re.sub(r'[\. ]*([ivx]+)[\. ]*', r' \1 ', ref)

ref = re.sub(r'^d ', 'dn ', ref)
ref = re.sub(r'^m ', 'mn ', ref)
Expand Down

0 comments on commit aa258ce

Please sign in to comment.