Skip to content

Commit 7b46703

Browse files
committed
fix: py_term and args with blank
1 parent 7fd2887 commit 7b46703

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/pyconverter/xml2py/ast_tree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ def py_term(self, links=None, base_url=None):
13221322
arg = self.term.to_rst().replace("--", "").strip()
13231323

13241324
# sanity check
1325-
if "blank" in arg.lower():
1325+
if arg.lower() == "blank":
13261326
arg = ""
13271327

13281328
if not is_numeric(arg):
@@ -1383,8 +1383,8 @@ def to_rst(self, indent="", max_length=100, links=None, base_url=None, fcache=No
13831383

13841384
if "``" in py_term:
13851385
py_term = py_term.replace("``", "")
1386-
1387-
if re.finditer(r"`.+`_", py_term) is None:
1386+
1387+
if re.search(r"`.+`_", py_term) is None:
13881388
py_term = f"``{py_term}``"
13891389

13901390
intersection_types = set(NO_RESIZE_LIST).intersection(self.text.children_types)

tests/customized_functions/cmlist.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1+
# Copyright (C) 2025 ANSYS, Inc. and/or its affiliates.
2+
# SPDX-License-Identifier: MIT
3+
#
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
123
from typing import Any, Dict, Literal
224

25+
326
def cmlist(
427
self,
528
name: str = "",
@@ -57,4 +80,4 @@ def cmlist(
5780
Examples of possible usage:
5881
"""
5982
command = f"CMLIST,{name},{key},{entity}"
60-
return self.run(command, **kwargs)
83+
return self.run(command, **kwargs)

0 commit comments

Comments
 (0)