Clash Data Export

Overview

File clash_detect_export.py contains code for exporting clash data to HTML and JSON file formats.

ExportColumnDef Class

class ExportColumnDef

Represents a column definition for export purposes.

The alignment parameter determines the text alignment in the column (False for left, True for right).

Constructor

__init__(order: int, name: str, alignment: bool = False)

Initializes a new instance of the ExportColumnDef class.

Properties

order: int

Specifies the order of the column.

name: str

The name of the column.

alignment: bool

The alignment of the column. False for left alignment, True for right alignment.

Functions

export_to_json

export_to_json(column_defs: Sequence[ExportColumnDef], rows: Sequence[Sequence[str]]) str

Exports the given column definitions and rows to a JSON string.

Parameters
  • column_defs – A sequence of ExportColumnDef instances defining the columns.

  • rows – A sequence of row data, where each row is a sequence of strings.

Returns

A JSON string representing the exported data, encoded in UTF-8.

export_to_html

export_to_html(title: str, subtitle: str, column_defs: Sequence[ExportColumnDef], rows: Sequence[Sequence[str]]) str

Exports the given column definitions and rows to an HTML table.

Parameters
  • title – The title of the HTML document.

  • subtitle – The subtitle of the HTML document.

  • column_defs – A sequence of ExportColumnDef instances defining the columns.

  • rows – A sequence of row data, where each row is a sequence of strings.

Returns

An HTML string representing the exported data, including a title, subtitle, and a table. The string is encoded in UTF-8.