Skip to content

Commit

Permalink
docs: Update docstrings
Browse files Browse the repository at this point in the history
- Change: Update docstrings of `TextEmbed` and `parse_text()`.
  • Loading branch information
AnonymouX47 committed Feb 16, 2024
1 parent 707ce3c commit 98ff42a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/urwidgets/text_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ class TextEmbed(urwid.Text):
Going a step further, embeddded widgets can be swapped by using
``urwid.WidgetPlaceholder`` but their widths will remain the same.
NOTE:
- Every embedded widget must be a box widget and is always rendered with
size ``(width, 1)``. :py:class:`urwid.Filler` can be used to wrap flow
widgets.
- Each embedded widgets are treated as a single WORD (i.e containing no
whitespace). Therefore, consecutive embedded widgets are also treated as
a single WORD. This affects the "space" wrap mode.
- After updating or swapping an embedded widget, this widget's canvases
should be invalidated to ensure it re-renders.
.. note::
- Every embedded widget must be a box widget and is always rendered with
size ``(width, 1)``. :py:class:`urwid.Filler` can be used to wrap flow
widgets.
- As regards the "space" wrap mode, each embedded widget is treated as a
single WORD (i.e containing no whitespace). In other words, whitespace
within embedded widgets do not influence wrapping.
- After updating or swapping an embedded widget, the containing
:py:class:`TextEmbed` widget's canvases should be invalidated to ensure
it re-renders.
Raises:
TypeError: A widget markup element has a non-integer display attribute.
Expand Down Expand Up @@ -490,15 +492,15 @@ def parse_text(
Whenever any of the given RegEx patterns matches a **non-empty** substring of
*text*, *repl* is called with the following arguments (in the given order):
- the :py:class:`re.Pattern` object that matched the substring
- the :py:class:`~re.Pattern` object that matched the substring
- a tuple containing the match groups
- starting with the whole match,
- followed by the all the subgroups of the match, from 1 up to however many
groups are in the pattern, if any (``None`` for each group that didn't
participate in the match)
- a tuple containing the indexes of the start and end of the substring
- a tuple containing the span (start and end indexes) of the substring
- *repl_args* unpacked
- *repl_kwargs* unpacked
Expand Down

0 comments on commit 98ff42a

Please sign in to comment.