Skip to content

Commit 73cab27

Browse files
committed
fix: an3d, list, macopt and pri2 arguments
1 parent ccbb8ca commit 73cab27

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/pyconverter/xml2py/ast_tree.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ def find(self, _type, terms=None):
698698
"""Find the first type matching a given type string."""
699699
for item in self:
700700
if type(item).__name__ == _type:
701-
if _type == "Refname" or _type == "Refnamediv":
701+
if _type == "Refname":
702702
if terms == None:
703703
logging.error("ERROR: terms are not defined for a 'Refname' class.")
704704
item.terms = terms
@@ -710,7 +710,9 @@ def find_all(self, _type, recursive=False, terms=None):
710710
items = []
711711
for item in self:
712712
if type(item).__name__ == _type:
713-
if _type == "Refname" or _type == "Refnamediv":
713+
if _type == "Refname":
714+
if not terms:
715+
logging.error("ERROR: terms are not defined for a 'Refname' class.")
714716
item.terms = terms
715717
items.append(item)
716718
elif recursive and isinstance(item, Element):
@@ -3117,6 +3119,15 @@ def arg_desc(self) -> List[Argument]:
31173119
if isinstance(child, Paragraph):
31183120
self._is_paragraph_in_arg_desc = True
31193121

3122+
# Check whether arguments have been caught
3123+
if not arguments:
3124+
refnamediv = self.find("Refnamediv")
3125+
available_arguments = refnamediv[0].get_children_by_type("Replaceable")
3126+
if available_arguments:
3127+
arguments = ArgumentList(
3128+
self.py_name, self.url, self._terms, available_arguments, self.args
3129+
)
3130+
31203131
arg_file = Path("args.txt")
31213132

31223133
if arguments is not None:

0 commit comments

Comments
 (0)