src/eric7/DocumentationTools/ModuleDocumentor.py

Thu, 07 Jul 2022 11:23:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 07 Jul 2022 11:23:56 +0200
branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
eric7/DocumentationTools/ModuleDocumentor.py@54e42bc2437a
child 9221
bf71ee032bb4
permissions
-rw-r--r--

Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".

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

eric ide

mercurial