Skip to content

Commit

Permalink
changed ampm to have regex variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mpacer committed Jun 27, 2016
1 parent f146ca7 commit 36b7313
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions proselint/checks/dates_times/am_pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ def check_lowercase_periods(text):
"""Check the text."""
err = "dates_times.am_pm.lowercase_periods"
msg = u"With lowercase letters, the periods are standard."
regex = "\d{1,2} ?[ap]m"

return existence_check(text, ["\d{1,2} ?[ap]m"], err, msg)
return existence_check(text, [regex], err, msg)


@memoize
def check_spacing(text):
"""Check the text."""
err = "dates_times.am_pm.spacing"
msg = u"It's standard to put a space before 'a.m.' or 'p.m.'."
regex = "\d{1,2}[ap]\.?m\.?"

return existence_check(text, ["\d{1,2}[ap]\.?m\.?"], err, msg)
return existence_check(text, [regex], err, msg)


@memoize
Expand All @@ -38,8 +40,9 @@ def check_midnight_noon(text):
err = "dates_times.am_pm.midnight_noon"
msg = (u"12 a.m. and 12 p.m. are wrong and confusing."
" Use 'midnight' or 'noon'.")
regex = "12 ?[ap]\.?m\.?"

return existence_check(text, ["12 ?[ap]\.?m\.?"], err, msg)
return existence_check(text, [regex], err, msg)


@memoize
Expand Down

0 comments on commit 36b7313

Please sign in to comment.