Skip to content

Commit

Permalink
docs: Correct and Update examples in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymouX47 committed Aug 31, 2024
1 parent f8c83af commit e0b64f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/urwidgets/hyperlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ class Hyperlink(urwid.WidgetWrap):
>>>
>>> # Raw URI
>>> link = Hyperlink(url)
>>> canv = link.render(len(url))
>>> canv = link.render(())
>>> print(canv.text[0].decode())
https://urwid.org
>>>
>>> # Clipped (with an ellipsis appended) when the render width (maxcols) is
>>> # shorter than the link text
>>> canv = link.render(len(url) - 4)
>>> canv = link.render((len(url) - 4,))
>>> print(canv.text[0].decode())
https://urwid…
>>>
>>> # URI with custom text
>>> hyperlink = Hyperlink(url, text="Urwid Website")
>>> canv = hyperlink.render(hyperlink.pack()[:1])
>>> canv = hyperlink.render(())
>>> print(canv.text[0].decode())
Urwid Website
Expand Down
4 changes: 2 additions & 2 deletions src/urwidgets/text_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class TextEmbed(urwid.Text):
... ]
... )
>>>
>>> canv = text_embed.render(text_embed.pack()[:1])
>>> canv = text_embed.render(())
>>> # The hyperlinks (`This` and `https://urwid.org`) should be highlighted
>>> # on mouse hover and clickable (in the terminal), if supported.
>>> print(canv.text[0].decode())
Expand Down Expand Up @@ -573,7 +573,7 @@ def parse_text(
]
>>>
>>> text_widget = TextEmbed(markup)
>>> canv = text_widget.render(text_widget.pack()[:1])
>>> canv = text_widget.render(())
>>> # The hyperlinks (`This` and `https://urwid.org`) should be highlighted
>>> # on mouse hover and clickable (in the terminal), if supported.
>>> print(canv.text[0].decode())
Expand Down

0 comments on commit e0b64f7

Please sign in to comment.