Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pynliner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ def _unsubstitute_output(self):
"""
Put substitutions back into the output
"""
self.output = re.sub(
SUBSTITUTION_PATTERN,
lambda m: self._substitutions[int(m.group(1))],
self.output
)
if self._substitutions:
self.output = re.sub(
SUBSTITUTION_PATTERN,
lambda m: self._substitutions[int(m.group(1))],
self.output
)

def _get_soup(self):
"""Convert source string to BeautifulSoup object. Sets it to self.soup.
Expand Down