DocumentParser
ClassSource
DocumentParser()
Document Parser.
This parser converts the other document formats (like BBCode, Markdown or HTML) to structured pydantic data.
Arguments
No argument is needed.
Methods
parse_achievements
v_1: Document = self.parse_achievements(
ach_list: AchievementList,
ach_parser: Callable[[str, Achievement], Node] | None = None,
)
Convert the list of achievements into a document.
Requires
| Name | Type | Required | |
|---|---|---|---|
ach_list | AchievementList | The achievement list fetched from the online pages. This data collection can be provided by steaminfo.get_achievement_list | |
ach_parser | Callable[[str, Achievement], Node] | None | An optional achievement data parser. It converts the data of a single achievement to a document node. If not specified, will use the default parser. The first argument is the icon name. The second argument is the achievement information. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Document | The converted structured data of the achievement list. |
parse_bbcode
v_1: Document = self.parse_bbcode(bbcode: str | IO[str])
Parse the BBCode data.
Requires
| Name | Type | Required | |
|---|---|---|---|
bbcode | str | IO[str] | The BBCode text or BBCode file-like object. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Document | The parsed structured data. |
parse_file
v_1: Document = self.parse_file(file_path: str | PathLike[str], encoding: str = "utf-8")
Parse a file.
Requires
| Name | Type | Required | |
|---|---|---|---|
file_path | str | PathLike[str] | The path to the file to be read. | |
encoding | str | The encoding when opening the file. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Document | The parsed structured data. |
parse_html
v_1: Document = self.parse_html(html: str | IO[str])
Parse the HTML data.
Requires
| Name | Type | Required | |
|---|---|---|---|
html | str | IO[str] | The HTML text or HTML file-like object. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Document | The parsed structured data. |
parse_markdown
v_1: Document = self.parse_markdown(md: str | IO[str])
Parse the Markdown data.
Requires
| Name | Type | Required | |
|---|---|---|---|
md | str | IO[str] | The Markdown text or Markdown file-like object. |
Returns
| Name | Type | |
|---|---|---|
v_1 | Document | The parsed structured data. |