eric6/DocumentationTools/ModuleDocumentor.py

Sun, 14 Apr 2019 15:09:21 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 14 Apr 2019 15:09:21 +0200
changeset 6942
2602857055c5
parent 6645
DocumentationTools/ModuleDocumentor.py@ad476851d7e0
child 7229
53054eb5b15a
permissions
-rw-r--r--

Major restructuring of the source tree to get prepared for a setup.py based installation.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2003 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the builtin documentation generator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 The different parts of the module document are assembled from the parsed
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 Python file. The appearance is determined by several templates defined within
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 this module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
14 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2401
diff changeset
15
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import re
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from Utilities import html_uencode
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
20 from Utilities.ModuleParser import RB_SOURCE, Function
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
22 _signal = re.compile(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4667
diff changeset
23 r"""
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
24 ^@signal [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 (?P<SignalName1>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 [a-zA-Z_] \w* [ \t]* \( [^)]* \)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 [ \t]* (?P<SignalDescription1> .*)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 |
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
30 ^@signal [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 (?P<SignalName2>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 [a-zA-Z_] \w*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 [ \t]+ (?P<SignalDescription2> .*)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
35 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
37 _event = re.compile(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4667
diff changeset
38 r"""
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
39 ^@event [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 (?P<EventName1>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 [a-zA-Z_] \w* [ \t]* \( [^)]* \)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 [ \t]* (?P<EventDescription1> .*)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 |
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
45 ^@event [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 (?P<EventName2>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 [a-zA-Z_] \w*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 [ \t]+ (?P<EventDescription2> .*)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
50 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
52
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 class TagError(Exception):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Exception class raised, if an invalid documentation tag was found.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
57 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
59
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 class ModuleDocument(object):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 Class implementing the builtin documentation generator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
64 def __init__(self, module, colors, stylesheet=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 @param module the information of the parsed Python file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @param colors dictionary specifying the various colors for the output
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 (dictionary of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 @param stylesheet the style to be used for the generated pages (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.module = module
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.empty = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.stylesheet = stylesheet
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 if self.stylesheet:
2401
4f428de32b69 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
79 from . import TemplatesListsStyleCSS
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.headerTemplate = TemplatesListsStyleCSS.headerTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.footerTemplate = TemplatesListsStyleCSS.footerTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.moduleTemplate = TemplatesListsStyleCSS.moduleTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.rbFileTemplate = TemplatesListsStyleCSS.rbFileTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.classTemplate = TemplatesListsStyleCSS.classTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.methodTemplate = TemplatesListsStyleCSS.methodTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
86 self.constructorTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
87 TemplatesListsStyleCSS.constructorTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.rbModuleTemplate = TemplatesListsStyleCSS.rbModuleTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
89 self.rbModulesClassTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
90 TemplatesListsStyleCSS.rbModulesClassTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.functionTemplate = TemplatesListsStyleCSS.functionTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.listTemplate = TemplatesListsStyleCSS.listTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.listEntryTemplate = TemplatesListsStyleCSS.listEntryTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
94 self.listEntryNoneTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
95 TemplatesListsStyleCSS.listEntryNoneTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.listEntryDeprecatedTemplate = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 TemplatesListsStyleCSS.listEntryDeprecatedTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
98 self.listEntrySimpleTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
99 TemplatesListsStyleCSS.listEntrySimpleTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 self.paragraphTemplate = TemplatesListsStyleCSS.paragraphTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
101 self.parametersListTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
102 TemplatesListsStyleCSS.parametersListTemplate
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
103 self.parameterTypesListEntryTemplate = \
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
104 TemplatesListsStyleCSS.parameterTypesListEntryTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.parametersListEntryTemplate = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 TemplatesListsStyleCSS.parametersListEntryTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 self.returnsTemplate = TemplatesListsStyleCSS.returnsTemplate
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
108 self.returnTypesTemplate = \
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
109 TemplatesListsStyleCSS.returnTypesTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
110 self.exceptionsListTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
111 TemplatesListsStyleCSS.exceptionsListTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.exceptionsListEntryTemplate = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 TemplatesListsStyleCSS.exceptionsListEntryTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
114 self.signalsListTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
115 TemplatesListsStyleCSS.signalsListTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.signalsListEntryTemplate = \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 TemplatesListsStyleCSS.signalsListEntryTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self.eventsListTemplate = TemplatesListsStyleCSS.eventsListTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
119 self.eventsListEntryTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
120 TemplatesListsStyleCSS.eventsListEntryTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.deprecatedTemplate = TemplatesListsStyleCSS.deprecatedTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.authorInfoTemplate = TemplatesListsStyleCSS.authorInfoTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.seeListTemplate = TemplatesListsStyleCSS.seeListTemplate
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
124 self.seeListEntryTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
125 TemplatesListsStyleCSS.seeListEntryTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.seeLinkTemplate = TemplatesListsStyleCSS.seeLinkTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 self.sinceInfoTemplate = TemplatesListsStyleCSS.sinceInfoTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 else:
2401
4f428de32b69 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
129 from . import TemplatesListsStyle
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
130 self.headerTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
131 TemplatesListsStyle.headerTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
132 self.footerTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
133 TemplatesListsStyle.footerTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
134 self.moduleTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
135 TemplatesListsStyle.moduleTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
136 self.rbFileTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
137 TemplatesListsStyle.rbFileTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
138 self.classTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
139 TemplatesListsStyle.classTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
140 self.methodTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
141 TemplatesListsStyle.methodTemplate.format(**colors)
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
142 self.constructorTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
143 TemplatesListsStyle.constructorTemplate.format(**colors)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
144 self.rbModuleTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
145 TemplatesListsStyle.rbModuleTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self.rbModulesClassTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
147 TemplatesListsStyle.rbModulesClassTemplate.format(**colors)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
148 self.functionTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
149 TemplatesListsStyle.functionTemplate.format(**colors)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
150 self.listTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
151 TemplatesListsStyle.listTemplate.format(**colors)
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
152 self.listEntryTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
153 TemplatesListsStyle.listEntryTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 self.listEntryNoneTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
155 TemplatesListsStyle.listEntryNoneTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 self.listEntryDeprecatedTemplate = \
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
157 TemplatesListsStyle.listEntryDeprecatedTemplate.format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
158 **colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.listEntrySimpleTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
160 TemplatesListsStyle.listEntrySimpleTemplate.format(**colors)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
161 self.paragraphTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
162 TemplatesListsStyle.paragraphTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 self.parametersListTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
164 TemplatesListsStyle.parametersListTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 self.parametersListEntryTemplate = \
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
166 TemplatesListsStyle.parametersListEntryTemplate.format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
167 **colors)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
168 self.parameterTypesListEntryTemplate = \
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
169 TemplatesListsStyle.parameterTypesListEntryTemplate.format(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
170 **colors)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
171 self.returnsTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
172 TemplatesListsStyle.returnsTemplate.format(**colors)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
173 self.returnTypesTemplate = \
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
174 TemplatesListsStyle.returnTypesTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self.exceptionsListTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
176 TemplatesListsStyle.exceptionsListTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 self.exceptionsListEntryTemplate = \
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
178 TemplatesListsStyle.exceptionsListEntryTemplate.format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
179 **colors)
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
180 self.signalsListTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
181 TemplatesListsStyle.signalsListTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 self.signalsListEntryTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
183 TemplatesListsStyle.signalsListEntryTemplate.format(**colors)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
184 self.eventsListTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
185 TemplatesListsStyle.eventsListTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.eventsListEntryTemplate = \
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
187 TemplatesListsStyle.eventsListEntryTemplate.format(**colors)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
188 self.deprecatedTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
189 TemplatesListsStyle.deprecatedTemplate.format(**colors)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
190 self.authorInfoTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
191 TemplatesListsStyle.authorInfoTemplate.format(**colors)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
192 self.seeListTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
193 TemplatesListsStyle.seeListTemplate.format(**colors)
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
194 self.seeListEntryTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
195 TemplatesListsStyle.seeListEntryTemplate.format(**colors)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
196 self.seeLinkTemplate = \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
197 TemplatesListsStyle.seeLinkTemplate.format(**colors)
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
198 self.sinceInfoTemplate = \
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
199 TemplatesListsStyle.sinceInfoTemplate.format(**colors)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
201 self.keywords = []
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
202 # list of tuples containing the name (string) and
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
203 # the ref (string). The ref is without the filename part.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.generated = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 def isEmpty(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
208 Public method to determine, if the module contains any classes or
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
209 functions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 @return Flag indicating an empty module (i.e. __init__.py without
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 any contents)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 return self.empty
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 def name(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 Public method used to get the module name.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 @return The name of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 return self.module.name
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 def description(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 Public method used to get the description of the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 @return The description of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 return self.__formatDescription(self.module.description)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 def shortDescription(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 Public method used to get the short description of the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 The short description is just the first line of the modules
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 @return The short description of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 return self.__getShortDescription(self.module.description)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 def genDocument(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 Public method to generate the source code documentation.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @return The source code documentation. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 """
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
249 doc = self.headerTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
250 **{'Title': self.module.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
251 'Style': self.stylesheet}) + \
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
252 self.__genModuleSection() + \
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
253 self.footerTemplate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 self.generated = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 return doc
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 def __genModuleSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 Private method to generate the body of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 @return The body of the document. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 globalsList = self.__genGlobalsListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 classList = self.__genClassListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 functionList = self.__genFunctionListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 if self.module.type == RB_SOURCE:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 rbModulesList = self.__genRbModulesListSection()
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
269 modBody = self.rbFileTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
270 **{'Module': self.module.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
271 'ModuleDescription':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 self.__formatDescription(self.module.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
273 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
274 'ClassList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
275 'RbModulesList': rbModulesList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
276 'FunctionList': functionList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
277 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 else:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
279 modBody = self.moduleTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
280 **{'Module': self.module.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
281 'ModuleDescription':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 self.__formatDescription(self.module.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
283 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
284 'ClassList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
285 'FunctionList': functionList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
286 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
287 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
288 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
289 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
290 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
291 "Error in tags of description of module {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
292 self.module.name))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
293 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 return ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 classesSection = self.__genClassesSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 functionsSection = self.__genFunctionsSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 if self.module.type == RB_SOURCE:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 rbModulesSection = self.__genRbModulesSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 rbModulesSection = ""
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
302 return "{0}{1}{2}{3}".format(
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
303 modBody, classesSection, rbModulesSection, functionsSection)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
305 def __genListSection(self, names, sectionDict, kwSuffix=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 Private method to generate a list section of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 @param names The names to appear in the list. (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
310 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
311 (dict)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 @param kwSuffix suffix to be used for the QtHelp keywords (string)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
313 @return list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
317 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
318 **{'Link': "{0}".format(name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
319 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
320 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
321 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
322 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
323 self.__checkDeprecated(sectionDict[name].description) and
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
325 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 if kwSuffix:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
327 n = "{0} ({1})".format(name, kwSuffix)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 else:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
329 n = "{0}".format(name)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
330 self.keywords.append((n, "#{0}".format(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
333 def __genGlobalsListSection(self, class_=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 Private method to generate the section listing all global attributes of
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 @param class_ reference to a class object (Class)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @return The globals list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 """
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
341 attrNames = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 if class_ is not None:
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
343 scope = class_
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 else:
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
345 scope = self.module
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
346 attrNames = sorted(attr for attr in scope.globals.keys()
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
347 if not scope.globals[attr].isSignal)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 if attrNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 s = ''.join(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
350 [self.listEntrySimpleTemplate.format(**{'Name': name})
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
351 for name in attrNames])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
354 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 def __genClassListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
358 Private method to generate the section listing all classes of the
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
359 module.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 @return The classes list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
363 names = sorted(list(self.module.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 s = self.__genListSection(names, self.module.classes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
369 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 def __genRbModulesListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
373 Private method to generate the section listing all modules of the file
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 (Ruby only).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 @return The modules list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
378 names = sorted(list(self.module.modules.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 s = self.__genListSection(names, self.module.modules)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
384 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 def __genFunctionListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
388 Private method to generate the section listing all functions of the
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
389 module.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 @return The functions list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
393 names = sorted(list(self.module.functions.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 s = self.__genListSection(names, self.module.functions)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
399 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 def __genClassesSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
403 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
404 classes.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 @return The classes details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
408 classNames = sorted(list(self.module.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 classes = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 for className in classNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 _class = self.module.classes[className]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 supers = _class.super
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 if len(supers) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 supers = ', '.join(supers)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 supers = 'None'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 globalsList = self.__genGlobalsListSection(_class)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
419 classMethList, classMethBodies = \
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
420 self.__genMethodSection(_class, className, Function.Class)
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
421 methList, methBodies = \
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
422 self.__genMethodSection(_class, className, Function.General)
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
423 staticMethList, staticMethBodies = \
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
424 self.__genMethodSection(_class, className, Function.Static)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
427 clsBody = self.classTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
428 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
429 'Class': _class.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
430 'ClassSuper': supers,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
431 'ClassDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
432 self.__formatDescription(_class.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
433 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
434 'ClassMethodList': classMethList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
435 'MethodList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
436 'StaticMethodList': staticMethList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
437 'MethodDetails':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
438 classMethBodies + methBodies + staticMethBodies,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
439 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
440 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
441 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
442 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
443 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
444 "Error in tags of description of class {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
445 className))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
446 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 clsBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 classes.append(clsBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 return ''.join(classes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
453 def __genMethodsListSection(self, names, sectionDict, className, clsName,
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
454 includeInit=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 Private method to generate the methods list section of a class.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
458 @param names names to appear in the list (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
459 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
460 (dict)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
461 @param className class name containing the names
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
462 @param clsName visible class name containing the names
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
463 @param includeInit flag indicating to include the __init__ method
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
464 (boolean)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
465 @return methods list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 lst = []
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
468 if includeInit:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
469 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
470 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
471 **{'Link': "{0}.{1}".format(className, '__init__'),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
472 'Name': clsName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
473 'Description': self.__getShortDescription(
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
474 sectionDict['__init__'].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
475 'Deprecated': self.__checkDeprecated(
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
476 sectionDict['__init__'].description) and
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
477 self.listEntryDeprecatedTemplate or "",
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
478 }))
2991
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
479 self.keywords.append(
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
480 ("{0} (Constructor)".format(className),
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
481 "#{0}.{1}".format(className, '__init__')))
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
482 except KeyError:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
483 pass
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
484
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
486 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
487 **{'Link': "{0}.{1}".format(className, name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
488 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
489 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
490 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
491 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
492 self.__checkDeprecated(sectionDict[name].description) and
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
493 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
494 }))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
495 self.keywords.append(("{0}.{1}".format(className, name),
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
496 "#{0}.{1}".format(className, name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
499 def __genMethodSection(self, obj, className, modifierFilter):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 Private method to generate the method details section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
503 @param obj reference to the object being formatted
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
504 @param className name of the class containing the method (string)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
505 @param modifierFilter filter value designating the method types
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
506 @return method list and method details section (tuple of two string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 methList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 methBodies = []
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
510 methods = sorted(k for k in obj.methods.keys()
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
511 if obj.methods[k].modifier == modifierFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 if '__init__' in methods:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 methods.remove('__init__')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
515 methBody = self.constructorTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
516 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
517 'Class': obj.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
518 'Method': '__init__',
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
519 'MethodDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
520 self.__formatDescription(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
521 obj.methods['__init__'].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
522 'Params':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
523 ', '.join(obj.methods['__init__'].parameters[1:]),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
524 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
525 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
526 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
527 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
528 sys.stderr.write(
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
529 "Error in tags of description of method {0}.{1}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
530 className, '__init__'))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
531 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 methBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 methBodies.append(methBody)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
534
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
535 if modifierFilter == Function.Class:
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
536 methodClassifier = " (class method)"
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
537 elif modifierFilter == Function.Static:
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
538 methodClassifier = " (static)"
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
539 else:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
540 methodClassifier = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 for method in methods:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
543 methBody = self.methodTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
544 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
545 'Class': obj.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
546 'Method': obj.methods[method].name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
547 'MethodClassifier': methodClassifier,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
548 'MethodDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
549 self.__formatDescription(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
550 obj.methods[method].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
551 'Params': ', '.join(obj.methods[method].parameters[1:]),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
552 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
553 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
554 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
555 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
556 sys.stderr.write(
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
557 "Error in tags of description of method {0}.{1}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
558 className, method))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
559 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 methBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 methBodies.append(methBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
563 methList = self.__genMethodsListSection(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
564 methods, obj.methods, className, obj.name,
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
565 includeInit=modifierFilter == Function.General)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 if not methList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 methList = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
569 return (self.listTemplate.format(**{'Entries': methList}),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
570 ''.join(methBodies))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 def __genRbModulesSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
574 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
575 Ruby modules.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 @return The Ruby modules details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
579 rbModulesNames = sorted(list(self.module.modules.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 rbModules = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 for rbModuleName in rbModulesNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 rbModule = self.module.modules[rbModuleName]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 globalsList = self.__genGlobalsListSection(rbModule)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
584 methList, methBodies = self.__genMethodSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
585 rbModule, rbModuleName, Function.General)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
586 classList, classBodies = self.__genRbModulesClassesSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
587 rbModule, rbModuleName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
590 rbmBody = self.rbModuleTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
591 **{'Anchor': rbModuleName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
592 'Module': rbModule.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
593 'ModuleDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
594 self.__formatDescription(rbModule.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
595 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
596 'ClassesList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
597 'ClassesDetails': classBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
598 'FunctionsList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
599 'FunctionsDetails': methBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
600 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
601 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
602 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
603 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
604 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
605 "Error in tags of description of Ruby module {0}.\n"
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
606 .format(rbModuleName))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
607 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 rbmBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 rbModules.append(rbmBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 return ''.join(rbModules)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 def __genRbModulesClassesSection(self, obj, modName):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 Private method to generate the Ruby module classes details section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618 @param obj Reference to the object being formatted.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 @param modName Name of the Ruby module containing the classes. (string)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
620 @return The classes list and classes details section.
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
621 (tuple of two string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
623 classNames = sorted(list(obj.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 classes = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 for className in classNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 _class = obj.classes[className]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 supers = _class.super
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 if len(supers) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 supers = ', '.join(supers)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 supers = 'None'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
633 methList, methBodies = \
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
634 self.__genMethodSection(_class, className, Function.General)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
637 clsBody = self.rbModulesClassTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
638 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
639 'Class': _class.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
640 'ClassSuper': supers,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
641 'ClassDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
642 self.__formatDescription(_class.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
643 'MethodList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
644 'MethodDetails': methBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
645 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
646 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
647 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
648 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
649 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
650 "Error in tags of description of class {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
651 className))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
652 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 clsBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 classes.append(clsBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
657 classesList = self.__genRbModulesClassesListSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
658 classNames, obj.classes, modName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 if not classesList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 classesList = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
662 return (self.listTemplate.format(**{'Entries': classesList}),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
663 ''.join(classes))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
665 def __genRbModulesClassesListSection(self, names, sectionDict, moduleName):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 Private method to generate the classes list section of a Ruby module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 @param names The names to appear in the list. (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
670 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
671 (dict)
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
672 @param moduleName name of the Ruby module containing the classes
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
673 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
678 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
679 **{'Link': "{0}.{1}".format(moduleName, name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
680 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
681 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
682 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
683 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
684 self.__checkDeprecated(sectionDict[name].description) and
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
685 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
686 }))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
687 self.keywords.append(("{0}.{1}".format(moduleName, name),
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
688 "#{0}.{1}".format(moduleName, name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 def __genFunctionsSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
693 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
694 functions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 @return The functions details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 funcBodies = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
699 funcNames = sorted(list(self.module.functions.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 for funcName in funcNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
702 funcBody = self.functionTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
703 **{'Anchor': funcName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
704 'Function': self.module.functions[funcName].name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
705 'FunctionDescription': self.__formatDescription(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
706 self.module.functions[funcName].description),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
707 'Params':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
708 ', '.join(self.module.functions[funcName].parameters),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
709 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
710 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
711 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
712 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
713 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
714 "Error in tags of description of function {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
715 funcName))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
716 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717 funcBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 funcBodies.append(funcBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 return ''.join(funcBodies)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 def __getShortDescription(self, desc):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 Private method to determine the short description of an object.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727 The short description is just the first non empty line of the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 documentation string.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730 @param desc The documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 @return The short description. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 dlist = desc.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 sdlist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 descfound = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 for desc in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 desc = desc.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 if desc:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 descfound = 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 dotpos = desc.find('.')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 sdlist.append(desc.strip())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 else:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
744 while dotpos + 1 < len(desc) and \
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
745 not desc[dotpos + 1].isspace():
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
746 # don't recognize '.' inside a number or word as
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
747 # stop condition
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
748 dotpos = desc.find('.', dotpos + 1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
749 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
750 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
751 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 sdlist.append(desc.strip())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
754 sdlist.append(desc[:dotpos + 1].strip())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 break # break if a '.' is found
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 if descfound:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 break # break if an empty line is found
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 if sdlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 return html_uencode(' '.join(sdlist))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 return ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 def __checkDeprecated(self, descr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
766 Private method to check, if the object to be documented contains a
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 deprecated flag.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
769 @param descr documentation string (string)
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
770 @return flag indicating the deprecation status (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 dlist = descr.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 for desc in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 desc = desc.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 if desc.startswith("@deprecated"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 def __genParagraphs(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 Private method to assemble the descriptive paragraphs of a docstring.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 A paragraph is made up of a number of consecutive lines without
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 an intermediate empty line. Empty lines are treated as a paragraph
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 delimiter.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 @param lines A list of individual lines. (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 @return Ready formatted paragraphs. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 linelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 for line in lines:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 if line.strip():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 if line == '.':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 linelist.append("")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 linelist.append(html_uencode(line))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 else:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
799 lst.append(self.paragraphTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
800 **{'Lines': '\n'.join(linelist)}))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 linelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 if linelist:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
803 lst.append(self.paragraphTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
804 **{'Lines': '\n'.join(linelist)}))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 def __genDescriptionListSection(self, dictionary, template):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 Private method to generate the list section of a description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 @param dictionary Dictionary containing the info for the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 list section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 @param template The template to be used for the list. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 lst = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
817 keys = sorted(list(dictionary.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 for key in keys:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
819 lst.append(template.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
820 **{'Name': key,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
821 'Description': html_uencode('\n'.join(dictionary[key])),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
822 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
825 def __genParamDescriptionListSection(self, _list):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827 Private method to generate the list section of a description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
829 @param _list list containing the info for the parameter description
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
830 list section (list of lists with three elements)
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
831 @return formatted list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 lst = []
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
834 for name, type_, lines in _list:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
835 if type_:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
836 lst.append(self.parameterTypesListEntryTemplate.format(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
837 **{'Name': name,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
838 'Type': type_,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
839 'Description': html_uencode('\n'.join(lines)),
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
840 }))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
841 else:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
842 lst.append(self.parametersListEntryTemplate.format(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
843 **{'Name': name,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
844 'Description': html_uencode('\n'.join(lines)),
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
845 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 def __formatCrossReferenceEntry(self, entry):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 Private method to format a cross reference entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 This cross reference entry looks like "package.module#member label".
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 @param entry the entry to be formatted (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 @return formatted entry (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 if entry.startswith('"'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 return entry
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 elif entry.startswith('<'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 entry = entry[3:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 reference, label = entry.split(None, 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 except ValueError:
96
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
865 reference = entry
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
866 label = entry
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
868 path, anchor = reference.split('#', 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
869 except ValueError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 path = reference
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 anchor = ''
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
872 reference = path and "{0}.html".format(path) or ''
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 if anchor:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
874 reference = "{0}#{1}".format(reference, anchor)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
875 entry = 'href="{0}">{1}</a>'.format(reference, label)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
877 return self.seeLinkTemplate.format(**{'Link': entry})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
878
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879 def __genSeeListSection(self, _list, template):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
880 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
881 Private method to generate the "see also" list section of a
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
882 description.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
884 @param _list List containing the info for the section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
885 @param template The template to be used for the list. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 for seeEntry in _list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 seeEntryString = ''.join(seeEntry)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
891 lst.append(template.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
892 **{'Link': html_uencode(self.__formatCrossReferenceEntry(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
893 seeEntryString)),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
894 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 return '\n'.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897 def __processInlineTags(self, desc):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 Private method to process inline tags.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 @param desc One line of the description (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 @return processed line with inline tags expanded (string)
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
903 @exception TagError raised to indicate an invalid tag
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 start = desc.find('{@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
906 while start != -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 stop = desc.find('}', start + 2)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 if stop == -1:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
909 raise TagError("Unterminated inline tag.\n{0}".format(desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 tagText = desc[start + 1:stop]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 if tagText.startswith('@link'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 parts = tagText.split(None, 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
915 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
916 "Wrong format in inline tag {0}.\n{1}".format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
917 parts[0], desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 formattedTag = self.__formatCrossReferenceEntry(parts[1])
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
920 desc = desc.replace("{{{0}}}".format(tagText), formattedTag)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 tag = tagText.split(None, 1)[0]
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
923 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
924 "Unknown inline tag encountered, {0}.\n{1}".format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
925 tag, desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 start = desc.find('{@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 return desc
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 def __formatDescription(self, descr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 Private method to format the contents of the documentation string.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 @param descr The contents of the documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 @exception TagError A tag doesn't have the correct number
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 of arguments.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 @return The formated contents of the documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 if not descr:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 return ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 paragraphs = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 paramList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 returns = []
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
946 returnTypes = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 exceptionDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 signalDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 eventDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 deprecated = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 authorInfo = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 sinceInfo = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 seeList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 lastItem = paragraphs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 inTagSection = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 dlist = descr.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 while dlist and not dlist[0]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 del dlist[0]
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
960 lastTag = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 for ditem in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 ditem = self.__processInlineTags(ditem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 desc = ditem.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 if desc:
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
965 if desc.startswith(("@param", "@keyparam")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 parts = desc.split(None, 2)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
968 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
970 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
971 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 paramName = parts[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 if parts[0] == "@keyparam":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 paramName += '='
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 try:
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
976 paramList.append([paramName, "", [parts[2]]])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 except IndexError:
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
978 paramList.append([paramName, "", []])
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
979 lastItem = paramList[-1][2]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
980 elif desc.startswith("@type"):
4667
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
981 parts = desc.split(None, 1)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
982 if lastTag not in ["@param", "@keyparam"]:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
983 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
984 "{0} line must be preceded by a parameter line\n"
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
985 .format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
986 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
987 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
988 if len(parts) < 2:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
989 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
990 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
991 paramList[-1][1] = parts[1]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
992 elif desc.startswith("@ptype"):
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
993 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
994 parts = desc.split(None, 2)
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
995 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
996 if len(parts) < 3:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
997 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
998 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
999 param, type_ = parts[1:]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1000 for index in range(len(paramList)):
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1001 if paramList[index][0] == param:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1002 paramList[index][1] = type_
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1003 break
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1004 else:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1005 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1006 "Unknow parameter name '{0}' in {1} line.\n"
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1007 .format(param, parts[0]))
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1008 elif desc.startswith(("@return", "@ireturn")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1009 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010 parts = desc.split(None, 1)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1011 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1013 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1014 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 returns = [parts[1]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1016 lastItem = returns
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1017 elif desc.startswith("@rtype"):
4667
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1018 parts = desc.split(None, 1)
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1019 if lastTag not in ["@return", "@ireturn"]:
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1020 raise TagError(
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1021 "{0} line must be preceded by a return line\n"
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1022 .format(parts[0]))
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1023 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1024 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1025 if len(parts) < 2:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1026 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1027 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1028 returnTypes = [parts[1]]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1029 lastItem = returnTypes
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1030 elif desc.startswith(("@exception", "@throws", "@raise")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 parts = desc.split(None, 2)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1033 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1035 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1036 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 excName = parts[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 exceptionDict[excName] = [parts[2]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 except IndexError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 exceptionDict[excName] = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 lastItem = exceptionDict[excName]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 elif desc.startswith("@signal"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 inTagSection = True
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1045 lastTag = desc.split(None, 1)[0]
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1046 m = _signal(desc, 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 if m is None:
2174
6c0e26b9df7b Fixed an error in the documentation generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1048 raise TagError("Wrong format in @signal line.\n")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 signalName = 1 and m.group("SignalName1") \
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1050 or m.group("SignalName2")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1051 signalDesc = 1 and m.group("SignalDescription1") \
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
1052 or m.group("SignalDescription2")
0