From eba2928f1f969aa9e6538b87c24535382a1c6c95 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sat, 2 Nov 2024 21:38:12 -0500 Subject: [PATCH] typogrify: Add a period after Messrs --- se/typography.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/se/typography.py b/se/typography.py index 773073dc..9cc4ac63 100644 --- a/se/typography.py +++ b/se/typography.py @@ -179,6 +179,9 @@ def typogrify(xhtml: str, smart_quotes: bool = True) -> str: # Replace Mr., Mrs., and other abbreviations, and include a non-breaking space xhtml = regex.sub(r"\b(Mr|Mr?s|Drs?|Profs?|Lieut|Fr|Lt|Capt|Pvt|Esq|Mt|St|MM|Mmes?|Mlles?|Hon|Mdlle)\.?()?\s+", fr"\1.\2{se.NO_BREAK_SPACE}", xhtml) + # Add a period to Messrs, without a non-breaking space + xhtml = regex.sub(r"\bMessrs\.?()?\s+", r"Messrs.\1 ", xhtml) + # Include a non-breaking space after Mon. We can't include it in the above regex because `Mon` may appear as running French language (i.e. `Mon Dieu`) xhtml = regex.sub(r"\bMon\.()?\s+", fr"Mon.\1{se.NO_BREAK_SPACE}", xhtml)