MCPcopy Create free account
hub / github.com/BIT-DataLab/Edit-Banana / _create_mxcell_xml

Method _create_mxcell_xml

modules/base.py:150–181  ·  view source on GitHub ↗

生成mxCell XML字符串 - 供子模块使用 Args: cell_id: 临时ID(合并时会被重新分配) style: DrawIO样式字符串 x, y: 位置 width, height: 尺寸 value: 单元格值(通常为空或文本内容) parent: 父元素ID Returns: mxCell XML字符串

(self, 
                           cell_id: int,
                           style: str,
                           x: int, 
                           y: int, 
                           width: int, 
                           height: int,
                           value: str = "",
                           parent: str = "1")

Source from the content-addressed store, hash-verified

148 # ======================== XML生成辅助方法 ========================
149
150 def _create_mxcell_xml(self,
151 cell_id: int,
152 style: str,
153 x: int,
154 y: int,
155 width: int,
156 height: int,
157 value: str = "",
158 parent: str = "1") -> str:
159 """
160 生成mxCell XML字符串 - 供子模块使用
161
162 Args:
163 cell_id: 临时ID(合并时会被重新分配)
164 style: DrawIO样式字符串
165 x, y: 位置
166 width, height: 尺寸
167 value: 单元格值(通常为空或文本内容)
168 parent: 父元素ID
169
170 Returns:
171 mxCell XML字符串
172 """
173 # 转义特殊字符
174 value = value.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
175 style = style.replace('"', '&quot;')
176
177 xml = f''&#x27;<mxCell id="{cell_id}" parent="{parent}" vertex="1" value="{value}" style="{style}">
178 <mxGeometry x="{x}" y="{y}" width="{width}" height="{height}" as="geometry"/>
179</mxCell>''&#x27;
180
181 return xml
182
183
184class ModelWrapper:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected