Skip to content

Commit 98891c9

Browse files
authored
Merge pull request ppannuto#25 from Garrett-R/master
Add various dash types
2 parents 9419f43 + d6789fd commit 98891c9

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

titlecase/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
__version__ = '0.9.0'
1616

1717
SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?'
18-
PUNCT = r"""!"#$%&'‘()*+,\-./:;?@[\\\]_`{|}~"""
18+
PUNCT = r"""!"#$%&'‘()*+,\-–‒—―./:;?@[\\\]_`{|}~"""
1919

2020
SMALL_WORDS = re.compile(r'^(%s)$' % SMALL, re.I)
2121
INLINE_PERIOD = re.compile(r'[a-z][.][a-z]', re.I)
2222
UC_ELSEWHERE = re.compile(r'[%s]*?[a-zA-Z]+[A-Z]+?' % PUNCT)
2323
CAPFIRST = re.compile(r"^[%s]*?([A-Za-z])" % PUNCT)
2424
SMALL_FIRST = re.compile(r'^([%s]*)(%s)\b' % (PUNCT, SMALL), re.I)
2525
SMALL_LAST = re.compile(r'\b(%s)[%s]?$' % (SMALL, PUNCT), re.I)
26-
SUBPHRASE = re.compile(r'([:.;?!\-\—][ ])(%s)' % SMALL)
26+
SUBPHRASE = re.compile(r'([:.;?!\-–‒—―][ ])(%s)' % SMALL)
2727
APOS_SECOND = re.compile(r"^[dol]{1}['‘]{1}[a-z]+(?:['s]{2})?$", re.I)
2828
ALL_CAPS = re.compile(r'^[A-Z\s\d%s]+$' % PUNCT)
2929
UC_INITIALS = re.compile(r"^(?:[A-Z]{1}\.{1}|[A-Z]{1}\.{1}[A-Z]{1})+$")

titlecase/tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@
112112
"Snakes on a Plane — The TV Edit — The Famous Line",
113113
"Snakes on a Plane — The TV Edit — The Famous Line"
114114
),
115+
(
116+
"EPISODE 7 — THE FORCE AWAKENS",
117+
"Episode 7 — The Force Awakens"
118+
),
119+
(
120+
"episode 7 – The force awakens",
121+
"Episode 7 – The Force Awakens"
122+
),
115123
(
116124
'"Nothing to Be Afraid of?"',
117125
'"Nothing to Be Afraid Of?"'

0 commit comments

Comments
 (0)