| 61 | return "Type help(object) for help about object." |
| 62 | |
| 63 | def __call__(self, topic: t.Any | None = None) -> None: |
| 64 | if topic is None: |
| 65 | sys.stdout._write(f"<span class=help>{self!r}</span>") # type: ignore |
| 66 | return |
| 67 | import pydoc |
| 68 | |
| 69 | pydoc.help(topic) |
| 70 | rv = sys.stdout.reset() # type: ignore |
| 71 | paragraphs = _paragraph_re.split(rv) |
| 72 | if len(paragraphs) > 1: |
| 73 | title = paragraphs[0] |
| 74 | text = "\n\n".join(paragraphs[1:]) |
| 75 | else: |
| 76 | title = "Help" |
| 77 | text = paragraphs[0] |
| 78 | sys.stdout._write(HELP_HTML % {"title": title, "text": text}) # type: ignore |
| 79 | |
| 80 | |
| 81 | helper = _Helper() |