ConversionTable
This class manages the generation and formatting of conversion data into Markdown tables. It provides functionality to sort, filter, and transform row data into structured strings with specific column headers and HTML-wrapped styling for nowrap display. The class is primarily used to represent field type mappings and input conditions in a human-readable table format.
Attributes
| Attribute | Type | Description |
|---|---|---|
| rows | list[[Row](row.md?sid=docs_plugins_conversion_table_row)] | A list of Row objects representing the data entries to be displayed in the conversion table. |
| col_names | list[str] = ['Field Type', 'Input', 'Strict', 'Input Source', 'Conditions'] | A list of strings defining the header labels for the markdown table columns. |
| open_nowrap_span | string = < span style="white-space: nowrap;" > | The opening HTML span tag used to prevent text wrapping within table cells. |
| close_nowrap_span | string = < /span > | The closing HTML span tag used to terminate the non-wrapping text style in table cells. |
Constructor
Signature
def ConversionTable(
rows: list[[Row](row.md?sid=docs_plugins_conversion_table_row)]
)
Parameters
| Name | Type | Description |
|---|---|---|
| rows | list[[Row](row.md?sid=docs_plugins_conversion_table_row)] | A list of Row objects that represent the data rows of the conversion table. |
Methods
col_values()
@classmethod
def col_values(
row: [Row](row.md?sid=docs_plugins_conversion_table_row)
) - > list[str]
Extracts and formats the data from a Row into a list of strings suitable for table display. Wraps specific fields in HTML spans to prevent text wrapping and applies Markdown formatting to type strings.
Parameters
| Name | Type | Description |
|---|---|---|
| row | [Row](row.md?sid=docs_plugins_conversion_table_row) | The data object containing the conversion details to be formatted. |
Returns
| Type | Description |
|---|---|
list[str] | A list of formatted strings representing the columns: Field Type, Input, Strict, Input Source, and Conditions. |
row_as_markdown()
@classmethod
def row_as_markdown(
cols: list[str]
) - > str
Formats a list of column values into a single Markdown table row string.
Parameters
| Name | Type | Description |
|---|---|---|
| cols | list[str] | The list of string values to be joined into the table row. |
Returns
| Type | Description |
|---|---|
str | A string formatted as a Markdown table row with pipe separators. |
as_markdown()
@classmethod
def as_markdown() - > str
Generates a complete Markdown representation of the conversion table, including headers and separators.
Returns
| Type | Description |
|---|---|
str | The full Markdown table string containing all rows and headers. |
row_sort_key()
@classmethod
def row_sort_key(
row: [Row](row.md?sid=docs_plugins_conversion_table_row)
) - > Any
Generates a sort key for a Row based on field type, input type, and input source. Prioritizes lowercase items to appear before uppercase items in the sort order.
Parameters
| Name | Type | Description |
|---|---|---|
| row | [Row](row.md?sid=docs_plugins_conversion_table_row) | The row object for which to generate a sorting key. |
Returns
| Type | Description |
|---|---|
Any | A tuple of values used by sorting algorithms to order rows. |
sorted()
@classmethod
def sorted() - > [ConversionTable](conversiontable.md?sid=docs_plugins_conversion_table_conversiontable)
Creates a new ConversionTable instance with rows ordered according to the row_sort_key logic.
Returns
| Type | Description |
|---|---|
[ConversionTable](conversiontable.md?sid=docs_plugins_conversion_table_conversiontable) | A new table instance containing the sorted rows. |
filtered()
@classmethod
def filtered(
predicate: Callable[[[Row](row.md?sid=docs_plugins_conversion_table_row)], bool]
) - > [ConversionTable](conversiontable.md?sid=docs_plugins_conversion_table_conversiontable)
Creates a new ConversionTable containing only the rows that satisfy the provided predicate function.
Parameters
| Name | Type | Description |
|---|---|---|
| predicate | Callable[[[Row](row.md?sid=docs_plugins_conversion_table_row)], bool] | A function that accepts a Row and returns True if the row should be included in the result. |
Returns
| Type | Description |
|---|---|
[ConversionTable](conversiontable.md?sid=docs_plugins_conversion_table_conversiontable) | A new table instance containing the subset of rows that matched the filter. |