Skip to content

Commit

Permalink
typogrify: Single obscured years should be obscured with a figure dash
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Apr 9, 2024
1 parent ce23524 commit ac72b31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions se/typography.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ def typogrify(xhtml: str, smart_quotes: bool = True) -> str:
# Remove no-break spaces added before etc.
xhtml = regex.sub(fr"{se.NO_BREAK_SPACE}(<abbr[^>]*?>etc\.)", r" \1", xhtml)

# Replace single obscured year digit with figure dash
xhtml = regex.sub(r"\b([0-9]{3})-([^0-9\p{Letter}])(?!abbr)", r"\1‒\2", xhtml)

return xhtml

def hyphenate(xhtml: Union[str, EasyXmlTree], language: Optional[str], ignore_h_tags: bool = False) -> str:
Expand Down

0 comments on commit ac72b31

Please sign in to comment.