5454 "Caret 40?" : "" ,
5555 '``"``' : "``" ,
5656 "/_nolinebreak?" : "" ,
57+ "/_nolinebreak ?" : "" ,
5758 "_nolinebreak?" : "" ,
59+ "_nolinebreak ?" : "" ,
5860 "nbsp" : " " ,
5961}
6062
@@ -700,7 +702,7 @@ def find(self, _type, terms=None):
700702 """Find the first type matching a given type string."""
701703 for item in self :
702704 if type (item ).__name__ == _type :
703- if _type == "Refname" or _type == "Refnamediv" :
705+ if _type == "Refname" :
704706 if terms == None :
705707 logging .error ("ERROR: terms are not defined for a 'Refname' class." )
706708 item .terms = terms
@@ -712,7 +714,9 @@ def find_all(self, _type, recursive=False, terms=None):
712714 items = []
713715 for item in self :
714716 if type (item ).__name__ == _type :
715- if _type == "Refname" or _type == "Refnamediv" :
717+ if _type == "Refname" :
718+ if not terms :
719+ logging .error ("ERROR: terms are not defined for a 'Refname' class." )
716720 item .terms = terms
717721 items .append (item )
718722 elif recursive and isinstance (item , Element ):
@@ -3093,7 +3097,21 @@ def arg_desc(self) -> List[Argument]:
30933097 refsyn = self .rec_find ("Refsynopsisdiv" )
30943098 # search by ID
30953099 arguments = None
3096- if refsyn is None :
3100+ if refsyn and "Variablelist" in refsyn .children_types :
3101+ for elem in refsyn :
3102+ if isinstance (elem , Variablelist ):
3103+ if arguments is None :
3104+ arguments = ArgumentList (
3105+ self .py_name , self .url , self ._terms , elem , self .args
3106+ )
3107+ else :
3108+ arguments += ArgumentList (
3109+ self .py_name , self .url , self ._terms , elem , self .args
3110+ )
3111+ if isinstance (elem , Paragraph ):
3112+ self ._is_paragraph_in_arg_desc = True
3113+
3114+ else :
30973115 refsections = self .find_all ("RefSection" )
30983116 for elem in refsections :
30993117 for child in elem :
@@ -3109,19 +3127,14 @@ def arg_desc(self) -> List[Argument]:
31093127 if isinstance (child , Paragraph ):
31103128 self ._is_paragraph_in_arg_desc = True
31113129
3112- else :
3113- for elem in refsyn :
3114- if isinstance (elem , Variablelist ):
3115- if arguments is None :
3116- arguments = ArgumentList (
3117- self .py_name , self .url , self ._terms , elem , self .args
3118- )
3119- else :
3120- arguments += ArgumentList (
3121- self .py_name , self .url , self ._terms , elem , self .args
3122- )
3123- if isinstance (elem , Paragraph ):
3124- self ._is_paragraph_in_arg_desc = True
3130+ # Check whether arguments have been caught
3131+ if not arguments :
3132+ refnamediv = self .find ("Refnamediv" )
3133+ available_arguments = refnamediv [0 ].get_children_by_type ("Replaceable" )
3134+ if available_arguments :
3135+ arguments = ArgumentList (
3136+ self .py_name , self .url , self ._terms , available_arguments , self .args
3137+ )
31253138
31263139 arg_file = Path ("args.txt" )
31273140
0 commit comments