BBCodeRendererForReview
ClassSource
BBCodeRendererForReview(
configs: BBCodeConfig | None = None,
is_quote_converted: bool = False,
is_codeblock_converted: bool = False,
is_h_converted: bool = True,
)
The BBCode renderer specialized for rendering reviews.
This renderer variant will specialize the format when rendering:
- tables
and provide optional options for rendering:
- quote
- code
- h2/h3...
These features are particularly optimized for the best format when writing Steam Reviews, with all incorrect features replaced by other available features.
Arguments
Requires
| Name | Type | Required | |
|---|---|---|---|
configs | BBCodeConfig | None | The configurations used for customizing the BBCode tags. If not specified, will use | |
is_quote_converted | bool | A flag that enabling the optional feature of converting the format of quote blocks. If enabled, will render the quotes in the following format: | |
is_codeblock_converted | bool | A flag that enabling the optional feature of converting the format of code blocks. If enabled, will render the codes as texts like this: | |
is_h_converted | bool | A flag that enabling the optional feature of converting the section heads. If enabled, will make all h tags formatted as the h1 tag. |
Methods
render_code_block
v_1: str = self.render_code_block(node: CodeBlockNode)
Specific renderring. Render the block code as
> ...
> ...
> ...
Requires
| Name | Type | Required | |
|---|---|---|---|
node | CodeBlockNode | The code block to be rendered. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The rendered code block. |
render_heading
v_1: str = self.render_heading(node: HeadingNode)
Specific renderring. Render the heading (title).
Requires
| Name | Type | Required | |
|---|---|---|---|
node | HeadingNode | The data to be rendered. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The formatted heading/title. |
render_list
v_1: str = self.render_list(node: ListNode)
Specific rendering. Render the ordered or unordered list.
Requires
| Name | Type | Required | |
|---|---|---|---|
node | ListNode | The list to be rendered. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The rendered list bbcode. |
render_quote
v_1: str = self.render_quote(node: QuoteNode)
Specific renderring. Render the quote block.
Requires
| Name | Type | Required | |
|---|---|---|---|
node | QuoteNode | The data to be rendered. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The formatted quote block. |
render_table
v_1: str = self.render_table(node: TableNode)
Specific renderring. Render the table.
This overriden table rendering will convert a table to the following list:
[list]
[*] [b]Header[/b] | [b]Header[/b]
[*] Cell | Cell
[/list]
When the list needs to be replaced by the ordered list, use the following configs:
configs.table = "ordered"
Requires
| Name | Type | Required | |
|---|---|---|---|
node | TableNode | The table to be rendered. |
Returns
| Name | Type | |
|---|---|---|
v_1 | str | The rendered table bbcode. |