Render the datatable with the given context, but avoid replacing text inside angle brackets if context is missing. Args: datatable (DataTable): The datatable to render. context (Mapping[str, Any]): The context for rendering the datatable. Re
(datatable: DataTable, context: Mapping[str, object])
| 323 | |
| 324 | @staticmethod |
| 325 | def render_datatable(datatable: DataTable, context: Mapping[str, object]) -> DataTable: |
| 326 | """ |
| 327 | Render the datatable with the given context, |
| 328 | but avoid replacing text inside angle brackets if context is missing. |
| 329 | |
| 330 | Args: |
| 331 | datatable (DataTable): The datatable to render. |
| 332 | context (Mapping[str, Any]): The context for rendering the datatable. |
| 333 | |
| 334 | Returns: |
| 335 | datatable (DataTable): The rendered datatable with parameters replaced only if they exist in the context. |
| 336 | """ |
| 337 | rendered_datatable = copy.deepcopy(datatable) |
| 338 | for row in rendered_datatable.rows: |
| 339 | for cell in row.cells: |
| 340 | cell.value = render_string(cell.value, context) |
| 341 | return rendered_datatable |
| 342 | |
| 343 | |
| 344 | @dataclass(eq=False) |