helpers
¶
Helper functions for parsing FFmpeg filter documentation.
Functions:
Name | Description |
---|---|
convert_html_to_markdown |
Convert HTML to Markdown. |
parse_filter_document |
Parse filter document from HTML body content. |
parse_parameters |
Parse parameters from a filter document. |
convert_html_to_markdown
¶
convert_html_to_markdown(html: str) -> str
Convert HTML to Markdown.
This function converts HTML content to Markdown format, making special handling for definition lists and other structures to ensure they're properly formatted in the resulting Markdown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
html
|
str
|
The HTML content to convert to Markdown |
required |
Returns:
Type | Description |
---|---|
str
|
The converted Markdown text |
parse_filter_document
¶
parse_filter_document(body: str) -> FilterDocument
Parse filter document from HTML body content.
This function extracts structured filter information from the HTML body content of a filter documentation section. It identifies the filter title, names (as some filters have multiple names/aliases), section reference identifiers, and cross-references.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
str
|
The HTML body of the filter document section |
required |
Returns:
Type | Description |
---|---|
FilterDocument
|
A FilterDocument object containing the structured filter information |
parse_parameters
¶
parse_parameters(soup: Tag) -> dict[str, str]
Parse parameters from a filter document.
This function extracts parameter information from a BeautifulSoup representation of a filter document. It specifically looks for definition lists (dt/dd tags) where parameters are defined, extracts parameter names from the elements in definition terms, and their descriptions from the corresponding definition descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
soup
|
Tag
|
The BeautifulSoup Tag object containing the filter document |
required |
Returns:
Type | Description |
---|---|
dict[str, str]
|
A dictionary mapping parameter names to their HTML descriptions |