The list of notifications is diplayed with each item enclosed within an
horizontal line as for timeline. When a status is involved (when
notification type is "reblog" or "favourite"), we also display the full
status.
Closes#81.
When the left column contains wide characters (which occupy more than
one cell when printed to screen), padding to 30-characters with
"{:30}".format() does not work well. This happens for instance when the
display name contains unicode characters such as emojis.
We fix this by introducing a pad() function in utils module which uses
the wcwidth library (https://pypi.org/project/wcwidth/) to compute the
length of the text for the column. trunc() function is also adjusted to
optionally compute the length of the text to be truncated since, when
called from pad(), we now pre-compute this value.
We update test for timeline rendering so that the display name now
includes an emoji. (Without the fix, the test would not pass as left
column would be misaligned.)
Beautiful will does not parse HTML entities like `'` as we expect
and the previous logic of replacing this *after* HTML parsing occurred
did not produced expected results.
To illustrate this, we change data in "test_timeline" to include a
literal `'` as it sometimes occur in data returned by Mastodon API.
New HTML content is:
<p>The computer can't tell you the emotional story [...] </p>
Beautiful will parse this as as:
<p>The computer can&apost tell you the emotional story [...] </p>
which is not what we expect.
We fix this by replacing `'` *before* HTML parsing by Beautiful.
Since test data in "test_timeline" got updated we also add an extra
assertion checking that part of the content with a literal "'" is
(still) properly rendered.