Anonymous avatar Anonymous committed ff3c3da

add two spaces after sentence-final period

Comments (0)

Files changed (1)

         quote_stack = []
         self.edited_text = u''
         for i, token in enumerate(self._tokens[:-1]):
-            # if we have a paragraph break, insert that and go on to next token
+            # if we have a paragraph break, insert that and go on to
+            # next token
             if token.is_para:
                 self.edited_text += u'\n\n'
                 continue
                 continue
             self.edited_text += token.str
 
-            # now figure out if a space should follow it
-            append_space = True
+            # now figure out how many spaces should follow it
+            append_space = ' '
             next_token = self._tokens[i + 1]
 
             if (token.is_open or
                 next_token.is_close or
                 next_token.is_nonspacing_punc or
                 next_token.is_eof):
-                    append_space = False
+                    append_space = ''
+            elif token.str == '.':
+                append_space = '  '
             elif token.is_quote:
                 if quote_stack and quote_stack[-1] == token.str:
                     # space after close quote
                 else:
                     # no space after open quote
                     quote_stack.append(token.str)
-                    append_space = False
+                    append_space = ''
 
-            if append_space:
-                self.edited_text += u' '
+            self.edited_text += append_space
 
     def _process_tokens(self, infile):
         all_rules = rules.get_rules()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.