mirror of
https://github.com/ihabunek/toot.git
synced 2025-02-02 15:07:51 -05:00
Better function name
This commit is contained in:
parent
a9ef96c31b
commit
d91c73520e
@ -6,7 +6,7 @@ import textwrap
|
||||
from functools import lru_cache
|
||||
from toot import settings
|
||||
from toot.entities import Instance, Notification, Poll, Status
|
||||
from toot.utils import get_text, parse_html
|
||||
from toot.utils import get_text, html_to_paragraphs
|
||||
from toot.wcstring import wc_wrap
|
||||
from typing import List
|
||||
from wcwidth import wcswidth
|
||||
@ -321,7 +321,7 @@ def print_status(status: Status, width: int = 80):
|
||||
|
||||
def print_html(text, width=80):
|
||||
first = True
|
||||
for paragraph in parse_html(text):
|
||||
for paragraph in html_to_paragraphs(text):
|
||||
if not first:
|
||||
print_out("")
|
||||
for line in paragraph:
|
||||
|
@ -36,7 +36,7 @@ def get_text(html):
|
||||
return unicodedata.normalize('NFKC', text)
|
||||
|
||||
|
||||
def parse_html(html):
|
||||
def html_to_paragraphs(html):
|
||||
"""Attempt to convert html to plain text while keeping line breaks.
|
||||
Returns a list of paragraphs, each being a list of lines.
|
||||
"""
|
||||
@ -55,7 +55,7 @@ def format_content(content):
|
||||
Returns a generator yielding lines of content.
|
||||
"""
|
||||
|
||||
paragraphs = parse_html(content)
|
||||
paragraphs = html_to_paragraphs(content)
|
||||
|
||||
first = True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user