Make groups quoted with double quotes bold (including quotes). This is used to highlight types, attribute names etc.
(self, msg: str)
| 817 | return error |
| 818 | |
| 819 | def highlight_quote_groups(self, msg: str) -> str: |
| 820 | """Make groups quoted with double quotes bold (including quotes). |
| 821 | |
| 822 | This is used to highlight types, attribute names etc. |
| 823 | """ |
| 824 | if msg.count('"') % 2: |
| 825 | # Broken error message, don't do any formatting. |
| 826 | return msg |
| 827 | parts = msg.split('"') |
| 828 | out = "" |
| 829 | for i, part in enumerate(parts): |
| 830 | if i % 2 == 0: |
| 831 | out += self.style(part, "none") |
| 832 | else: |
| 833 | out += self.style('"' + part + '"', "none", bold=True) |
| 834 | return out |
| 835 | |
| 836 | def underline_link(self, note: str) -> str: |
| 837 | """Underline a link in a note message (if any). |