1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-09-22 04:25:55 -04:00

Merge branch 'ihabunek:master' into asyncfix

This commit is contained in:
Daniel Schwarz 2023-01-30 13:42:43 -05:00 committed by GitHub
commit c30657dc24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ import re
import sys import sys
import textwrap import textwrap
from textwrap import wrap
from toot.tui.utils import parse_datetime from toot.tui.utils import parse_datetime
from wcwidth import wcswidth from wcwidth import wcswidth
@ -167,11 +166,9 @@ def print_instance(instance):
def print_account(account): def print_account(account):
print_out(f"<green>@{account['acct']}</green> {account['display_name']}") print_out(f"<green>@{account['acct']}</green> {account['display_name']}")
note = get_text(account['note']) if account["note"]:
if note:
print_out("") print_out("")
print_out("\n".join(wrap(note))) print_html(account["note"])
print_out("") print_out("")
print_out(f"ID: <green>{account['id']}</green>") print_out(f"ID: <green>{account['id']}</green>")
@ -180,6 +177,15 @@ def print_account(account):
print_out(f"Followers: <yellow>{account['followers_count']}</yellow>") print_out(f"Followers: <yellow>{account['followers_count']}</yellow>")
print_out(f"Following: <yellow>{account['following_count']}</yellow>") print_out(f"Following: <yellow>{account['following_count']}</yellow>")
print_out(f"Statuses: <yellow>{account['statuses_count']}</yellow>") print_out(f"Statuses: <yellow>{account['statuses_count']}</yellow>")
if account["fields"]:
for field in account["fields"]:
name = field["name"].title()
print_out(f'\n<yellow>{name}</yellow>:')
print_html(field["value"])
if field["verified_at"]:
print_out("<green>✓ Verified</green>")
print_out("") print_out("")
print_out(account["url"]) print_out(account["url"])
@ -244,11 +250,8 @@ def print_status(status, width):
f"<yellow>{time}</yellow>", f"<yellow>{time}</yellow>",
) )
for paragraph in parse_html(content): print_out("")
print_out("") print_html(content, width)
for line in paragraph:
for subline in wc_wrap(line, width):
print_out(highlight_hashtags(subline))
if media_attachments: if media_attachments:
print_out("\nMedia:") print_out("\nMedia:")
@ -268,6 +271,17 @@ def print_status(status, width):
) )
def print_html(text, width=80):
first = True
for paragraph in parse_html(text):
if not first:
print_out("")
for line in paragraph:
for subline in wc_wrap(line, width):
print_out(highlight_hashtags(subline))
first = False
def print_poll(poll): def print_poll(poll):
print_out() print_out()
for idx, option in enumerate(poll["options"]): for idx, option in enumerate(poll["options"]):