1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
"""
Many places in prompt_toolkit can take either plain text, or formatted text.
For instance the :func:`~prompt_toolkit.shortcuts.prompt` function takes either
plain text or formatted text for the prompt. The
:class:`~prompt_toolkit.layout.FormattedTextControl` can also take either plain
text or formatted text.
In any case, there is an input that can either be just plain text (a string),
an :class:`.HTML` object, an :class:`.ANSI` object or a sequence of
`(style_string, text)` tuples. The :func:`.to_formatted_text` conversion
function takes any of these and turns all of them into such a tuple sequence.
"""
from .ansi import ANSI
from .base import (
AnyFormattedText,
FormattedText,
StyleAndTextTuples,
Template,
is_formatted_text,
merge_formatted_text,
to_formatted_text,
)
from .html import HTML
from .pygments import PygmentsTokens
from .utils import (
fragment_list_len,
fragment_list_to_text,
fragment_list_width,
split_lines,
to_plain_text,
)
__all__ = [
# Base.
"AnyFormattedText",
"to_formatted_text",
"is_formatted_text",
"Template",
"merge_formatted_text",
"FormattedText",
"StyleAndTextTuples",
# HTML.
"HTML",
# ANSI.
"ANSI",
# Pygments.
"PygmentsTokens",
# Utils.
"fragment_list_len",
"fragment_list_width",
"fragment_list_to_text",
"split_lines",
"to_plain_text",
]
|