bella-openapi 1.0.3__py3-none-any.whl → 1.0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -129,7 +129,7 @@ class StandardDomTree(BaseModel):
129
129
  # 添加表格名称
130
130
  if node.element.name:
131
131
  markdown_res += f"**{node.element.name}**\n\n"
132
- table_md = self._list_to_html_table(node.element.rows)
132
+ table_md = self._list_to_markdown_table(node.element.rows)
133
133
  markdown_res += f"{table_md}\n\n"
134
134
  # 添加表格描述
135
135
  if node.element.description:
@@ -168,28 +168,25 @@ class StandardDomTree(BaseModel):
168
168
  quoted_lines = ['> ' + line for line in lines]
169
169
  return '\n'.join(quoted_lines)
170
170
 
171
- def _list_to_html_table(self, rows: List[StandardRow]) -> str:
172
- """将表格行转换为HTML表格"""
171
+ def _list_to_markdown_table(self, rows: List[StandardRow]) -> str:
172
+ """将表格行转换为 markdown 表格格式"""
173
173
  if not rows:
174
174
  return ""
175
175
 
176
- html_text = "<table>"
176
+ markdown_table = ""
177
+
178
+ # 添加表头
179
+ if rows:
180
+ header_cells = [cell.text or "" for cell in rows[0].cells]
181
+ markdown_table += "| " + " | ".join(header_cells) + " |\n"
182
+ markdown_table += "| " + " | ".join(["---"] * len(header_cells)) + " |\n"
183
+
184
+ # 添加数据行
177
185
  for row in rows:
178
- html_text += "<tr>"
179
- for cell in row.cells:
180
- # 从path中提取rowspan和colspan信息
181
- if len(cell.path) >= 4:
182
- start_row, end_row, start_col, end_col = cell.path[:4]
183
- rowspan = end_row - start_row + 1
184
- colspan = end_col - start_col + 1
185
- else:
186
- rowspan = colspan = 1
186
+ cells = [cell.text or "" for cell in row.cells]
187
+ markdown_table += "| " + " | ".join(cells) + " |\n"
187
188
 
188
- cell_text = cell.text or ""
189
- html_text += f"<td rowspan='{rowspan}' colspan='{colspan}'>{cell_text}</td>"
190
- html_text += "</tr>"
191
- html_text += "</table>"
192
- return html_text
189
+ return markdown_table
193
190
 
194
191
  @classmethod
195
192
  def from_domtree_dict(cls, domtree: dict, file_info):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bella-openapi
3
- Version: 1.0.3
3
+ Version: 1.0.3.1
4
4
  Summary: client for openapi service.
5
5
  Home-page:
6
6
  Author: ['tangxiaolong', 'fanqiangwei', 'zhangxiaojia', 'liumin', 'wangyukun']
@@ -12,6 +12,7 @@ License-File: LICENSE
12
12
  Requires-Dist: httpx<=0.26.0,>=0.10.0
13
13
  Requires-Dist: Werkzeug==3.0.1
14
14
  Requires-Dist: tiktoken>=0.5.0
15
+ Requires-Dist: pydantic==2.11.7
15
16
  Dynamic: author
16
17
  Dynamic: classifier
17
18
  Dynamic: description
@@ -14,11 +14,11 @@ bella_openapi/bella_trace/trace_requests.py,sha256=ADA8J_gbC3TwUo5LWQ3c_yTmCSZRa
14
14
  bella_openapi/console/__init__.py,sha256=uSfr5v6JLRSqTlftjK_ZU1pnbkEyxAPbuQbMyYX_phk,64
15
15
  bella_openapi/console/models.py,sha256=Hh1UuYHIxFtF9r5QK-pSJPFrSqbZUHv6spLvPbCeX08,1274
16
16
  bella_openapi/entity/__init__.py,sha256=zzsYYg859pzPSgx1Py2kxB2ozQ0tt4OtTatBtpm2bAw,512
17
- bella_openapi/entity/standard_domtree.py,sha256=oN2z_t5uTzO01szVSEnsN_GWYtxKkgvQPgJuOnOOaFs,20270
17
+ bella_openapi/entity/standard_domtree.py,sha256=yJ2FN3xwhT_SPbQSuvMlIvESmjNdQgcu2hzalDq9Gcs,20099
18
18
  bella_openapi/middleware/__init__.py,sha256=XWvZG1xO30ZXIn10YVYthmT1BV-9fonMEP_jVRZbAlQ,157
19
19
  bella_openapi/middleware/context_middleware.py,sha256=YawQyKAxMzvlDs_MxcuQKh90pP6VoMKzCBDS94qmlzQ,3870
20
- bella_openapi-1.0.3.dist-info/licenses/LICENSE,sha256=O-0zMbcEi6wXz1DiSdVgzMlQjJcNqNe5KDv08uYzqR0,1055
21
- bella_openapi-1.0.3.dist-info/METADATA,sha256=DauqWLJgwkWy0eSl-l_HISwuvEQ1t3NScpBmkZ9qa6c,9375
22
- bella_openapi-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- bella_openapi-1.0.3.dist-info/top_level.txt,sha256=EZuq3F6tKeF-vmZQi6_S2XzmES7SPW7HAbGN1Uv9vN8,14
24
- bella_openapi-1.0.3.dist-info/RECORD,,
20
+ bella_openapi-1.0.3.1.dist-info/licenses/LICENSE,sha256=O-0zMbcEi6wXz1DiSdVgzMlQjJcNqNe5KDv08uYzqR0,1055
21
+ bella_openapi-1.0.3.1.dist-info/METADATA,sha256=9td_a-VIyt3wOFv03zo5b_reHr8qLleSxGM9wJflCno,9409
22
+ bella_openapi-1.0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ bella_openapi-1.0.3.1.dist-info/top_level.txt,sha256=EZuq3F6tKeF-vmZQi6_S2XzmES7SPW7HAbGN1Uv9vN8,14
24
+ bella_openapi-1.0.3.1.dist-info/RECORD,,