diff options
Diffstat (limited to 'tools/eos-html-extractor')
-rwxr-xr-x | tools/eos-html-extractor | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/eos-html-extractor b/tools/eos-html-extractor index f82afa1..ef8fc54 100755 --- a/tools/eos-html-extractor +++ b/tools/eos-html-extractor @@ -10,6 +10,9 @@ import sys from bs4 import BeautifulSoup from html.parser import HTMLParser +def normalize_string(string): + return re.sub(r'\s+', ' ', string.strip()) + # Parser that adds line numbers to the HTML strings that need translating class TranslatableHTMLParser(HTMLParser): @@ -38,7 +41,7 @@ class TranslatableHTMLParser(HTMLParser): if comment_line + comment_length == code_line: optional_comment = ' '.join(comment_string.split()) - self.all_translatable_data.append((data.strip(), code_line, optional_comment)) + self.all_translatable_data.append((normalize_string(data), code_line, optional_comment)) def handle_comment(self, comment): self._comments_with_line_numbers.append((comment, self.getpos()[0])) |