5454 "Caret 40?" : "" ,
5555 '``"``' : "``" ,
5656 "/_nolinebreak?" : "" ,
57+ "/_nolinebreak ?" : "" ,
5758 "_nolinebreak?" : "" ,
59+ "_nolinebreak ?" : "" ,
5860 "nbsp" : " " ,
5961}
6062
@@ -696,7 +698,7 @@ def find(self, _type, terms=None):
696698 """Find the first type matching a given type string."""
697699 for item in self :
698700 if type (item ).__name__ == _type :
699- if _type == "Refname" or _type == "Refnamediv" :
701+ if _type == "Refname" :
700702 if terms == None :
701703 logging .error ("ERROR: terms are not defined for a 'Refname' class." )
702704 item .terms = terms
@@ -708,7 +710,9 @@ def find_all(self, _type, recursive=False, terms=None):
708710 items = []
709711 for item in self :
710712 if type (item ).__name__ == _type :
711- 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." )
712716 item .terms = terms
713717 items .append (item )
714718 elif recursive and isinstance (item , Element ):
@@ -3085,7 +3089,21 @@ def arg_desc(self) -> List[Argument]:
30853089 refsyn = self .rec_find ("Refsynopsisdiv" )
30863090 # search by ID
30873091 arguments = None
3088- if refsyn is None :
3092+ if refsyn and "Variablelist" in refsyn .children_types :
3093+ for elem in refsyn :
3094+ if isinstance (elem , Variablelist ):
3095+ if arguments is None :
3096+ arguments = ArgumentList (
3097+ self .py_name , self .url , self ._terms , elem , self .args
3098+ )
3099+ else :
3100+ arguments += ArgumentList (
3101+ self .py_name , self .url , self ._terms , elem , self .args
3102+ )
3103+ if isinstance (elem , Paragraph ):
3104+ self ._is_paragraph_in_arg_desc = True
3105+
3106+ else :
30893107 refsections = self .find_all ("RefSection" )
30903108 for elem in refsections :
30913109 for child in elem :
@@ -3101,19 +3119,14 @@ def arg_desc(self) -> List[Argument]:
31013119 if isinstance (child , Paragraph ):
31023120 self ._is_paragraph_in_arg_desc = True
31033121
3104- else :
3105- for elem in refsyn :
3106- if isinstance (elem , Variablelist ):
3107- if arguments is None :
3108- arguments = ArgumentList (
3109- self .py_name , self .url , self ._terms , elem , self .args
3110- )
3111- else :
3112- arguments += ArgumentList (
3113- self .py_name , self .url , self ._terms , elem , self .args
3114- )
3115- if isinstance (elem , Paragraph ):
3116- self ._is_paragraph_in_arg_desc = True
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+ )
31173130
31183131 arg_file = Path ("args.txt" )
31193132
0 commit comments