302 sys.stderr.write("{0}\n".format(e)) |
302 sys.stderr.write("{0}\n".format(e)) |
303 return "" |
303 return "" |
304 |
304 |
305 classesSection = self.__genClassesSection() |
305 classesSection = self.__genClassesSection() |
306 functionsSection = self.__genFunctionsSection() |
306 functionsSection = self.__genFunctionsSection() |
307 if self.module.type == RB_SOURCE: |
307 rbModulesSection = ( |
308 rbModulesSection = self.__genRbModulesSection() |
308 self.__genRbModulesSection() |
309 else: |
309 if self.module.type == RB_SOURCE else |
310 rbModulesSection = "" |
310 "" |
|
311 ) |
311 return "{0}{1}{2}{3}".format( |
312 return "{0}{1}{2}{3}".format( |
312 modBody, classesSection, rbModulesSection, functionsSection) |
313 modBody, classesSection, rbModulesSection, functionsSection) |
313 |
314 |
314 def __genListSection(self, names, sectionDict, kwSuffix=""): |
315 def __genListSection(self, names, sectionDict, kwSuffix=""): |
315 """ |
316 """ |
347 """ |
348 """ |
348 attrNames = [] |
349 attrNames = [] |
349 scope = class_ if class_ is not None else self.module |
350 scope = class_ if class_ is not None else self.module |
350 attrNames = sorted(attr for attr in scope.globals.keys() |
351 attrNames = sorted(attr for attr in scope.globals.keys() |
351 if not scope.globals[attr].isSignal) |
352 if not scope.globals[attr].isSignal) |
352 if attrNames: |
353 s = ( |
353 s = ''.join( |
354 ''.join( |
354 [self.listEntrySimpleTemplate.format(**{'Name': name}) |
355 [self.listEntrySimpleTemplate.format(**{'Name': name}) |
355 for name in attrNames]) |
356 for name in attrNames]) |
356 else: |
357 if attrNames else |
357 s = self.listEntryNoneTemplate |
358 self.listEntryNoneTemplate |
|
359 ) |
358 return self.listTemplate.format(**{'Entries': s}) |
360 return self.listTemplate.format(**{'Entries': s}) |
359 |
361 |
360 def __genClassListSection(self): |
362 def __genClassListSection(self): |
361 """ |
363 """ |
362 Private method to generate the section listing all classes of the |
364 Private method to generate the section listing all classes of the |
1155 elif not inTagSection: |
1157 elif not inTagSection: |
1156 lastItem.append(ditem) |
1158 lastItem.append(ditem) |
1157 |
1159 |
1158 description = self.__genParagraphs(paragraphs) if paragraphs else "" |
1160 description = self.__genParagraphs(paragraphs) if paragraphs else "" |
1159 |
1161 |
1160 if paramList: |
1162 parameterSect = ( |
1161 parameterSect = self.parametersListTemplate.format( |
1163 self.parametersListTemplate.format( |
1162 **{'Parameters': self.__genParamDescriptionListSection( |
1164 **{'Parameters': self.__genParamDescriptionListSection( |
1163 paramList)}) |
1165 paramList)}) |
1164 else: |
1166 if paramList else |
1165 parameterSect = "" |
1167 "" |
1166 |
1168 ) |
1167 if returns: |
1169 |
1168 returnSect = self.returnsTemplate.format( |
1170 returnSect = ( |
|
1171 self.returnsTemplate.format( |
1169 html_uencode('\n'.join(returns))) |
1172 html_uencode('\n'.join(returns))) |
1170 else: |
1173 if returns else |
1171 returnSect = "" |
1174 "" |
1172 |
1175 ) |
1173 if returnTypes: |
1176 |
1174 returnTypesSect = self.returnTypesTemplate.format( |
1177 returnTypesSect = ( |
|
1178 self.returnTypesTemplate.format( |
1175 html_uencode('\n'.join(returnTypes))) |
1179 html_uencode('\n'.join(returnTypes))) |
1176 else: |
1180 if returnTypes else |
1177 returnTypesSect = "" |
1181 "" |
1178 |
1182 ) |
1179 if yields: |
1183 |
1180 yieldSect = self.yieldsTemplate.format( |
1184 yieldSect = ( |
|
1185 self.yieldsTemplate.format( |
1181 html_uencode('\n'.join(yields))) |
1186 html_uencode('\n'.join(yields))) |
1182 else: |
1187 if yields else |
1183 yieldSect = "" |
1188 "" |
1184 |
1189 ) |
1185 if yieldTypes: |
1190 |
1186 yieldTypesSect = self.yieldTypesTemplate.format( |
1191 yieldTypesSect = ( |
|
1192 self.yieldTypesTemplate.format( |
1187 html_uencode('\n'.join(yieldTypes))) |
1193 html_uencode('\n'.join(yieldTypes))) |
1188 else: |
1194 if yieldTypes else |
1189 yieldTypesSect = "" |
1195 "" |
1190 |
1196 ) |
1191 if exceptionDict: |
1197 |
1192 exceptionSect = self.exceptionsListTemplate.format( |
1198 exceptionSect = ( |
|
1199 self.exceptionsListTemplate.format( |
1193 **{'Exceptions': self.__genDescriptionListSection( |
1200 **{'Exceptions': self.__genDescriptionListSection( |
1194 exceptionDict, self.exceptionsListEntryTemplate)}) |
1201 exceptionDict, self.exceptionsListEntryTemplate)}) |
1195 else: |
1202 if exceptionDict else |
1196 exceptionSect = "" |
1203 "" |
1197 |
1204 ) |
1198 if signalDict: |
1205 |
1199 signalSect = self.signalsListTemplate.format( |
1206 signalSect = ( |
|
1207 self.signalsListTemplate.format( |
1200 **{'Signals': self.__genDescriptionListSection( |
1208 **{'Signals': self.__genDescriptionListSection( |
1201 signalDict, self.signalsListEntryTemplate)}) |
1209 signalDict, self.signalsListEntryTemplate)}) |
1202 else: |
1210 if signalDict else |
1203 signalSect = "" |
1211 "" |
1204 |
1212 ) |
1205 if eventDict: |
1213 |
1206 eventSect = self.eventsListTemplate.format( |
1214 eventSect = ( |
|
1215 self.eventsListTemplate.format( |
1207 **{'Events': self.__genDescriptionListSection( |
1216 **{'Events': self.__genDescriptionListSection( |
1208 eventDict, self.eventsListEntryTemplate)}) |
1217 eventDict, self.eventsListEntryTemplate)}) |
1209 else: |
1218 if eventDict else |
1210 eventSect = "" |
1219 "" |
1211 |
1220 ) |
1212 if deprecated: |
1221 |
1213 deprecatedSect = self.deprecatedTemplate.format( |
1222 deprecatedSect = ( |
|
1223 self.deprecatedTemplate.format( |
1214 **{'Lines': html_uencode('\n'.join(deprecated))}) |
1224 **{'Lines': html_uencode('\n'.join(deprecated))}) |
1215 else: |
1225 if deprecated else |
1216 deprecatedSect = "" |
1226 "" |
1217 |
1227 ) |
1218 if authorInfo: |
1228 |
1219 authorInfoSect = self.authorInfoTemplate.format( |
1229 authorInfoSect = ( |
|
1230 self.authorInfoTemplate.format( |
1220 **{'Authors': html_uencode('\n'.join(authorInfo))}) |
1231 **{'Authors': html_uencode('\n'.join(authorInfo))}) |
1221 else: |
1232 if authorInfo else |
1222 authorInfoSect = "" |
1233 "" |
1223 |
1234 ) |
1224 if sinceInfo: |
1235 |
1225 sinceInfoSect = self.sinceInfoTemplate.format( |
1236 sinceInfoSect = ( |
|
1237 self.sinceInfoTemplate.format( |
1226 **{'Info': html_uencode(sinceInfo[0])}) |
1238 **{'Info': html_uencode(sinceInfo[0])}) |
1227 else: |
1239 if sinceInfo else |
1228 sinceInfoSect = "" |
1240 "" |
1229 |
1241 ) |
1230 if seeList: |
1242 |
1231 seeSect = self.seeListTemplate.format( |
1243 seeSect = ( |
|
1244 self.seeListTemplate.format( |
1232 **{'Links': self.__genSeeListSection( |
1245 **{'Links': self.__genSeeListSection( |
1233 seeList, self.seeListEntryTemplate)}) |
1246 seeList, self.seeListEntryTemplate)}) |
1234 else: |
1247 if seeList else |
1235 seeSect = '' |
1248 '' |
|
1249 ) |
1236 |
1250 |
1237 return "".join([ |
1251 return "".join([ |
1238 deprecatedSect, description, parameterSect, returnSect, |
1252 deprecatedSect, description, parameterSect, returnSect, |
1239 returnTypesSect, yieldSect, yieldTypesSect, exceptionSect, |
1253 returnTypesSect, yieldSect, yieldTypesSect, exceptionSect, |
1240 signalSect, eventSect, authorInfoSect, seeSect, sinceInfoSect, |
1254 signalSect, eventSect, authorInfoSect, seeSect, sinceInfoSect, |