Skip to content

Commit

Permalink
Merge pull request #102 from QualiSystems/bug/output_text_in_activity…
Browse files Browse the repository at this point in the history
…_feed_white

remove hardwired white font since interferes with our CSS in activity…
  • Loading branch information
nahumtimerman committed Apr 19, 2021
2 parents c275e17 + fb4e7f8 commit e7b045e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class UnixToHtmlColorConverter(object):
def __init__(self):
self.unixToHtml = dict([
(re.escape('\033[0m'), 'white'),
(re.escape('\033[0m'), ''),

(re.escape('\033[0;30m'), '#B0B0B0'), # Black (gray)
(re.escape('\033[0;31m'), '#C75646'), # Red
Expand All @@ -31,7 +31,7 @@ def _add_font_tag(self, x):
return '</font><font color=' + self.unixToHtml[re.escape(x.group(0))] + '>'

def convert(self, text):
result = '<html><body><font color=white>'
result = '<html><body><font>'
p_object = re.compile('|'.join(list(self.unixToHtml.keys())))
result += p_object.sub(lambda x: self._add_font_tag(x), text)
result += '</font></body></html>'
Expand Down
6 changes: 3 additions & 3 deletions package/tests/test_unixToHtml_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def setUp(self):

def test_convert_all_colors(self):
text = 'i am white'
expectedText = '<html><body><font color=white>i am white'
expectedText = '<html><body><font>i am white'
for key,value in self.color_converter.unixToHtml.items():
representing_text = 'i am '
text += key.replace("\\","") + representing_text + value
Expand All @@ -18,10 +18,10 @@ def test_convert_all_colors(self):

def test_convert_no_color(self):
text='i am text with no colors'
expectedText = '<html><body><font color=white>' + text + '</font></body></html>'
expectedText = '<html><body><font>' + text + '</font></body></html>'
self.assertEqual(self.color_converter.convert(text), expectedText)

def test_convert_empty_text(self):
text = ''
expectedText = '<html><body><font color=white></font></body></html>'
expectedText = '<html><body><font></font></body></html>'
self.assertEqual(self.color_converter.convert(text), expectedText)

0 comments on commit e7b045e

Please sign in to comment.