summaryrefslogtreecommitdiff
path: root/smartypants.py
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2013-08-12 10:12:40 +0800
committerYu-Jie Lin <livibetter@gmail.com>2013-08-12 10:12:40 +0800
commit736735b1bcf7c76d1aa9c129d1268841686dd079 (patch)
treea7be773201293a2d4680b58c484a6715493db5ac /smartypants.py
parent37f90e527ef86e7e9af181770ae5e8bba294be2d (diff)
downloadsmartypants-736735b1bcf7c76d1aa9c129d1268841686dd079.tar.gz
refactor condition checks
Diffstat (limited to 'smartypants.py')
-rwxr-xr-xsmartypants.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/smartypants.py b/smartypants.py
index 67f91fe..d4f51b6 100755
--- a/smartypants.py
+++ b/smartypants.py
@@ -145,7 +145,7 @@ def smartyPants(text, attr=default_smartypants_attr):
# self <closing/> tags!
result.append(cur_token[1])
skip_match = tags_to_skip_regex.match(cur_token[1])
- if skip_match is not None:
+ if skip_match:
if not skip_match.group(1):
skipped_tag_stack.append(skip_match.group(2).lower())
in_pre = True
@@ -170,7 +170,7 @@ def smartyPants(text, attr=default_smartypants_attr):
if convert_quot != "0":
t = re.sub('&quot;', '"', t)
- if do_dashes != 0:
+ if do_dashes:
if do_dashes == 1:
t = educateDashes(t)
if do_dashes == 2:
@@ -178,17 +178,17 @@ def smartyPants(text, attr=default_smartypants_attr):
if do_dashes == 3:
t = educateDashesOldSchoolInverted(t)
- if do_ellipses != 0:
+ if do_ellipses:
t = educateEllipses(t)
# Note: backticks need to be processed before quotes.
- if do_backticks != 0:
+ if do_backticks:
t = educateBackticks(t)
if do_backticks == 2:
t = educateSingleBackticks(t)
- if do_quotes != 0:
+ if do_quotes:
if t == "'":
# Special case: single-character ' token
if re.match("\S", prev_token_last_char):
@@ -476,7 +476,7 @@ def _tokenize(text):
token_match = tag_soup.search(text)
previous_end = 0
- while token_match is not None:
+ while token_match:
if token_match.group(1):
tokens.append(['text', token_match.group(1)])