parse_tags_from_content

parse_tags_from_content(tag: str, content: str | list[dict[str, typing.Any]]) -> list[dict[str, dict[str, str]]]

Parses HTML style tags from message contents.

The parsing is done by looking for patterns in the text that match the format of HTML tags. The tag to be parsed is specified as an argument to the function. The function looks for this tag in the text and extracts its content. The content of a tag is everything that is inside the tag, between the opening and closing angle brackets. The content can be a single string or a set of attribute-value pairs.

Examples: <img http://example.com/image.png> -> [\{"tag": "img", "attr": \{"src": "http://example.com/image.png"}, "match": re.Match}]

text="Hello I'm a robot" prompt="whisper"> ->
        [\{"tag": "audio", "attr": \{"text": "Hello I'm a robot", "prompt": "whisper"}, "match": re.Match}]```

<b>Parameters:</b>
| Name | Description |
|--|--|
| `tag` | The HTML style tag to be parsed.<br/><br/>**Type:** `str` |
| `content` | The message content to parse.<br/><br/>Can be a string or a list of content items.<br/><br/>**Type:** `str \| list[dict[str, typing.Any]]` |

<b>Returns:</b>
| Type | Description |
|--|--|
| `list[dict[str, dict[str, str]]]` | List[Dict[str, str]]: A list of dictionaries, where each dictionary represents a parsed tag. Each dictionary contains three key-value pairs: 'type' which is the tag, 'attr' which is a dictionary of the parsed attributes, and 'match' which is a regular expression match object. |

<br />