From 340835163624600e80be34150c8cb7c49f8ad8fa Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 15 Dec 2018 20:51:52 +0900 Subject: [PATCH] Remove a hack for py2 from TextWrapper --- sphinx/writers/text.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index bf424e015..e6ef3438b 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -273,7 +273,6 @@ class TextWrapper(textwrap.TextWrapper): The original _wrap_chunks uses len() to calculate width. This method respects wide/fullwidth characters for width adjustment. """ - drop_whitespace = getattr(self, 'drop_whitespace', True) # py25 compat lines = [] # type: List[unicode] if self.width <= 0: raise ValueError("invalid width %r (must be > 0)" % self.width) @@ -291,7 +290,7 @@ class TextWrapper(textwrap.TextWrapper): width = self.width - column_width(indent) - if drop_whitespace and chunks[-1].strip() == '' and lines: + if self.drop_whitespace and chunks[-1].strip() == '' and lines: del chunks[-1] while chunks: @@ -307,7 +306,7 @@ class TextWrapper(textwrap.TextWrapper): if chunks and column_width(chunks[-1]) > width: self._handle_long_word(chunks, cur_line, cur_len, width) - if drop_whitespace and cur_line and cur_line[-1].strip() == '': + if self.drop_whitespace and cur_line and cur_line[-1].strip() == '': del cur_line[-1] if cur_line: