Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
adbar committed Nov 17, 2023
1 parent bc21947 commit bc093d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trafilatura/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ def sanitize(text, preserve_space=False, trailing_space=False):
'''Convert text and discard incompatible and invalid characters'''
# consider all text as a single line
if trailing_space:
return line_processing(text, preserve_space, trailing_space)
return line_processing(text, preserve_space, True)
# process line by line
try:
return '\n'.join(filter(None, (line_processing(l, preserve_space, trailing_space) for l in text.splitlines())))
return '\n'.join(filter(None, (line_processing(l, preserve_space) for l in text.splitlines())))
except AttributeError:
return None

Expand Down

0 comments on commit bc093d6

Please sign in to comment.