Skip to content

Commit 54c7ca9

Browse files
committed
renamed functions that return boolean
1 parent 1978083 commit 54c7ca9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

markdownify/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _todict(obj):
6767
return dict((k, getattr(obj, k)) for k in dir(obj) if not k.startswith('_'))
6868

6969

70-
def remove_whitespace_inside(el):
70+
def should_remove_whitespace_inside(el):
7171
"""Return to remove whitespace immediately inside a block-level element."""
7272
if not el or not el.name:
7373
return False
@@ -79,9 +79,9 @@ def remove_whitespace_inside(el):
7979
'tr', 'td', 'th')
8080

8181

82-
def remove_whitespace_outside(el):
82+
def should_remove_whitespace_outside(el):
8383
"""Return to remove whitespace immediately outside a block-level element."""
84-
return remove_whitespace_inside(el) or (el and el.name == 'pre')
84+
return should_remove_whitespace_inside(el) or (el and el.name == 'pre')
8585

8686

8787
class MarkdownConverter(object):
@@ -139,17 +139,17 @@ def process_tag(self, node, convert_as_inline, children_only=False):
139139

140140
# Remove whitespace-only textnodes just before, after or
141141
# inside block-level elements.
142-
remove_inside = remove_whitespace_inside(node)
142+
should_remove_inside = should_remove_whitespace_inside(node)
143143
for el in node.children:
144144
# Only extract (remove) whitespace-only text node if any of the
145145
# conditions is true:
146146
# - el is the first element in its parent (block-level)
147147
# - el is the last element in its parent (block-level)
148148
# - el is adjacent to a block-level node
149-
can_extract = (remove_inside and (not el.previous_sibling
150-
or not el.next_sibling)
151-
or remove_whitespace_outside(el.previous_sibling)
152-
or remove_whitespace_outside(el.next_sibling))
149+
can_extract = (should_remove_inside and (not el.previous_sibling
150+
or not el.next_sibling)
151+
or should_remove_whitespace_outside(el.previous_sibling)
152+
or should_remove_whitespace_outside(el.next_sibling))
153153
if (isinstance(el, NavigableString)
154154
and six.text_type(el).strip() == ''
155155
and can_extract):
@@ -195,12 +195,12 @@ def process_text(self, el):
195195
# remove leading whitespace at the start or just after a
196196
# block-level element; remove traliing whitespace at the end
197197
# or just before a block-level element.
198-
if (remove_whitespace_outside(el.previous_sibling)
199-
or (remove_whitespace_inside(el.parent)
198+
if (should_remove_whitespace_outside(el.previous_sibling)
199+
or (should_remove_whitespace_inside(el.parent)
200200
and not el.previous_sibling)):
201201
text = text.lstrip()
202-
if (remove_whitespace_outside(el.next_sibling)
203-
or (remove_whitespace_inside(el.parent)
202+
if (should_remove_whitespace_outside(el.next_sibling)
203+
or (should_remove_whitespace_inside(el.parent)
204204
and not el.next_sibling)):
205205
text = text.rstrip()
206206

0 commit comments

Comments
 (0)