diff options
| author | JensDiemer <git@jensdiemer.de> | 2020-01-19 10:59:00 +0100 |
|---|---|---|
| committer | JensDiemer <git@jensdiemer.de> | 2020-01-19 10:59:00 +0100 |
| commit | ec6e9f5999997a6e02caa49a324ab7b49dc0ab53 (patch) | |
| tree | dbdee65c83d47292db7abf0273d4ba7cddf724e6 /creole/html_tools | |
| parent | 02b095a123013f115e5b8501388954c8dc497dd7 (diff) | |
| download | creole-ec6e9f5999997a6e02caa49a324ab7b49dc0ab53.tar.gz | |
Fix code style with autopep8
Diffstat (limited to 'creole/html_tools')
| -rw-r--r-- | creole/html_tools/deentity.py | 3 | ||||
| -rw-r--r-- | creole/html_tools/strip_html.py | 6 | ||||
| -rw-r--r-- | creole/html_tools/text_tools.py | 3 |
3 files changed, 6 insertions, 6 deletions
diff --git a/creole/html_tools/deentity.py b/creole/html_tools/deentity.py index b22a17c..23a6190 100644 --- a/creole/html_tools/deentity.py +++ b/creole/html_tools/deentity.py @@ -17,7 +17,7 @@ entities_rules = '|'.join([ r"(&\#x(?P<hex>[a-fA-F0-9]+);)", r"(&(?P<named>[a-zA-Z]+);)", ]) -#print(entities_rules) +# print(entities_rules) entities_regex = re.compile( entities_rules, re.VERBOSE | re.UNICODE | re.MULTILINE ) @@ -41,6 +41,7 @@ class Deentity(object): >>> d.replace_named("amp") '&' """ + def replace_number(self, text): """ unicode number entity """ unicode_no = int(text) diff --git a/creole/html_tools/strip_html.py b/creole/html_tools/strip_html.py index b6729b3..11a2f91 100644 --- a/creole/html_tools/strip_html.py +++ b/creole/html_tools/strip_html.py @@ -12,7 +12,6 @@ """ - import re from creole.parser.html_parser_config import BLOCK_TAGS @@ -32,7 +31,6 @@ strip_html_regex = re.compile( ) - def strip_html(html_code): """ Delete whitespace from html code. Doesn't recordnize preformatted blocks! @@ -87,10 +85,10 @@ def strip_html(html_code): elif startend_tag: # It's a closed start tag e.g.: <br /> - if space_start: # there was space before the tag + if space_start: # there was space before the tag result = " " + result - if space_end: # there was space after the tag + if space_end: # there was space after the tag result += " " else: # a start tag e.g.: <strong> diff --git a/creole/html_tools/text_tools.py b/creole/html_tools/text_tools.py index d42985a..16487a5 100644 --- a/creole/html_tools/text_tools.py +++ b/creole/html_tools/text_tools.py @@ -12,10 +12,11 @@ """ - import re space_re = re.compile(r"^(\s*)(.*?)(\s*)$", re.DOTALL) + + def clean_whitespace(txt): """ Special whitespaces cleanup |
