|
3 | 3 | import mysetting
|
4 | 4 | import DoxyDocs
|
5 | 5 | import argparse
|
| 6 | +import mysetting |
6 | 7 |
|
7 | 8 | class DoxyDocsClass :
|
8 | 9 | '''
|
@@ -34,6 +35,215 @@ def run(self):
|
34 | 35 | self.runMarkdown()
|
35 | 36 |
|
36 | 37 | def runHtml(self):
|
| 38 | + self.print(0,'<!DOCTYPE html>\n<html>') |
| 39 | + self.print(0,""" |
| 40 | +
|
| 41 | +<head> |
| 42 | + <meta charset="UTF-8"> |
| 43 | + <title>DoxyDocs</title> |
| 44 | + <style> |
| 45 | + body { |
| 46 | + font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, |
| 47 | + Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; |
| 48 | + line-height: 1.4; |
| 49 | + color: #333; |
| 50 | + background-color: #fff; |
| 51 | + padding: 0 5vw; |
| 52 | + } |
| 53 | + |
| 54 | + /* Standard Tables */ |
| 55 | + |
| 56 | + table { |
| 57 | + margin: 1em 0; |
| 58 | + border-collapse: collapse; |
| 59 | + border: 0.1em solid #d6d6d6; |
| 60 | + } |
| 61 | + |
| 62 | + caption { |
| 63 | + text-align: left; |
| 64 | + font-style: italic; |
| 65 | + padding: 0.25em 0.5em 0.5em 0.5em; |
| 66 | + } |
| 67 | + |
| 68 | + th, |
| 69 | + td { |
| 70 | + padding: 0.25em 0.5em 0.25em 1em; |
| 71 | + vertical-align: text-top; |
| 72 | + /* text-align: left; */ |
| 73 | + text-indent: -0.5em; |
| 74 | + } |
| 75 | + |
| 76 | + th { |
| 77 | + vertical-align: top; |
| 78 | + /* background-color: #666; |
| 79 | + color: #fff; */ |
| 80 | + } |
| 81 | + |
| 82 | + tr:nth-child(even) th[scope=row] { |
| 83 | + background-color: #f2f2f2; |
| 84 | + } |
| 85 | + |
| 86 | + tr:nth-child(odd) th[scope=row] { |
| 87 | + background-color: #fff; |
| 88 | + } |
| 89 | + |
| 90 | + tr:nth-child(even) { |
| 91 | + background-color: rgba(0, 0, 0, 0.05); |
| 92 | + } |
| 93 | + |
| 94 | + tr:nth-child(odd) { |
| 95 | + background-color: rgba(255, 255, 255, 0.05); |
| 96 | + } |
| 97 | + |
| 98 | + td:nth-of-type(2) { |
| 99 | + font-style: italic; |
| 100 | + } |
| 101 | + |
| 102 | + th:nth-of-type(1) { |
| 103 | + text-align: left; |
| 104 | + vertical-align: top; |
| 105 | + background-color: #666; |
| 106 | + color: #fff; |
| 107 | + } |
| 108 | + /* |
| 109 | + th:nth-of-type(3), |
| 110 | + td:nth-of-type(3) { |
| 111 | + text-align: right; |
| 112 | + } |
| 113 | + */ |
| 114 | + |
| 115 | + /* Fixed Headers */ |
| 116 | + |
| 117 | + th { |
| 118 | + position: -webkit-sticky; |
| 119 | + position: sticky; |
| 120 | + top: 0; |
| 121 | + z-index: 2; |
| 122 | + } |
| 123 | + |
| 124 | + th[scope=row] { |
| 125 | + position: -webkit-sticky; |
| 126 | + position: sticky; |
| 127 | + left: 0; |
| 128 | + z-index: 1; |
| 129 | + } |
| 130 | + |
| 131 | + th[scope=row] { |
| 132 | + vertical-align: top; |
| 133 | + color: inherit; |
| 134 | + background-color: inherit; |
| 135 | + background: linear-gradient(90deg, transparent 0%, transparent calc(100% - .05em), #d6d6d6 calc(100% - .05em), #d6d6d6 100%); |
| 136 | + } |
| 137 | + |
| 138 | + table:nth-of-type(2) th:not([scope=row]):first-child { |
| 139 | + left: 0; |
| 140 | + z-index: 3; |
| 141 | + background: linear-gradient(90deg, #666 0%, #666 calc(100% - .05em), #ccc calc(100% - .05em), #ccc 100%); |
| 142 | + } |
| 143 | + |
| 144 | + /* Strictly for making the scrolling happen. */ |
| 145 | + |
| 146 | + /* |
| 147 | + th[scope=row] + td { |
| 148 | + min-width: 24em; |
| 149 | + } |
| 150 | + |
| 151 | + th[scope=row] { |
| 152 | + min-width: 20em; |
| 153 | + } |
| 154 | + */ |
| 155 | + |
| 156 | + body { |
| 157 | + padding-bottom: 90vh; |
| 158 | + } |
| 159 | + </style> |
| 160 | +<style> |
| 161 | +* { |
| 162 | + box-sizing: border-box; |
| 163 | +} |
| 164 | +
|
| 165 | +#myTableInput { |
| 166 | + /* background-image: url('/css/searchicon.png'); */ |
| 167 | + background-position: 10px 10px; |
| 168 | + background-repeat: no-repeat; |
| 169 | + width: 100%; |
| 170 | + font-size: 16px; |
| 171 | + padding: 12px 20px 12px 40px; |
| 172 | + border: 1px solid #ddd; |
| 173 | + margin-bottom: 12px; |
| 174 | +} |
| 175 | +
|
| 176 | +#myCbInput { |
| 177 | + /* background-image: url('/css/searchicon.png'); */ |
| 178 | + background-position: 10px 10px; |
| 179 | + background-repeat: no-repeat; |
| 180 | + width: 100%; |
| 181 | + font-size: 16px; |
| 182 | + padding: 12px 20px 12px 40px; |
| 183 | + border: 1px solid #ddd; |
| 184 | + margin-bottom: 12px; |
| 185 | +} |
| 186 | +</style> |
| 187 | +</head> |
| 188 | + """) |
| 189 | + self.print(0,'<body>') |
| 190 | + self.print(0,'<h1>classes</h1>') |
| 191 | + self.print(0,'<table>') |
| 192 | + self.print(1,'<tr><th>Class</th><th>Derived</th><th>Includes</th><th>Brief</th><th>Detailed Description</th></tr>') |
| 193 | + self.cls = {} |
| 194 | + for k,v in self.D['classes'].items(): |
| 195 | + self.cls[k] = {} |
| 196 | + name = v['name'] |
| 197 | + includes = v.get('includes',{}).get('name','') |
| 198 | + self.cls[k]['name'] = name |
| 199 | + self.cls[k]['brief'] = self.getDescription(doc=v.get('brief',{}).get('doc',{})) |
| 200 | + self.cls[k]['detailed'] = self.getDescription(doc=v.get('detailed',{}).get('doc',{})) |
| 201 | + self.cls[k]['derived'] = [] |
| 202 | + for k1,v2 in v.get('derived',{}).items(): |
| 203 | + self.cls[k]['derived'].append(v2.get('name','')) |
| 204 | + self.cls[k]['includes'] = includes |
| 205 | + t = self.cls[k] |
| 206 | + self.print(1,'''<tr><td>{name}</td><td>{drived}</td><td>{includes}</td><td>{brief}</td><td>{detail}</td></tr>'''.format(name=t['name'],brief=t['brief'],drived=' '.join(t['derived']),includes=t['includes'],detail=t['detailed'])) |
| 207 | + self.print(0,'</table>') |
| 208 | + self.print(0,'') |
| 209 | + |
| 210 | + for k,v in self.D['classes'].items(): |
| 211 | + self.print(0,'<h2>Function Lists of {c} class</h2>'.format(c=v['name'])) |
| 212 | + # plantuml |
| 213 | + plantuml = self.getPlantuml(doc=v.get('detailed',{}).get('doc',{})) |
| 214 | + for p in plantuml: |
| 215 | + self.plantumlCnt += 1 |
| 216 | + with open('test-{c}.puml'.format(c=self.plantumlCnt),'w') as f: |
| 217 | + f.write('@startuml test-{c}.png\n'.format(c=self.plantumlCnt)) |
| 218 | + f.write(p) |
| 219 | + f.write('\n@enduml\n') |
| 220 | + proxylink = '{proxy}&src={puml}/{file}'.format(proxy=mysetting.myPlantumlServerProxy , puml=mysetting.mySrcDirHttp , file='test-{c}.puml'.format(c=self.plantumlCnt)) |
| 221 | + self.print(2,'''<img src="{src}" alt="test-{c}.puml">'''.format(src=proxylink,c=self.plantumlCnt)) |
| 222 | + |
| 223 | + # Table |
| 224 | + self.print(2,'<table>') |
| 225 | + self.print(2,'<tr><th>Accessibility</th><th>Function</th><th>Description</th><th>Parameters</th><th>param input</th><th>param output</th><th>Returns</th><th>return Description</th></tr>') |
| 226 | + for accessibility,v2 in v.items(): |
| 227 | + if accessibility == 'public_methods': |
| 228 | + for k3,v3 in v2.get('members',{}).items(): |
| 229 | + t = v2['members'][k3] |
| 230 | + func = t['name'] |
| 231 | + brief = self.getDescription(doc=t.get('brief',{}).get('doc',{})) |
| 232 | + detailed = self.getDescription(doc=t.get('detailed',{}).get('doc',{})) |
| 233 | + returnType = t.get('type','') |
| 234 | + # returnDoc = [] |
| 235 | + returnDoc = self.ret.join(self.getReturnDescription(doc=t.get('detailed',{}).get('doc',{}))) |
| 236 | + # params = { 'parameters': [] , 'in':[] , 'out':[] } |
| 237 | + params = self.getParameters(parameters=t.get('parameters',{}),detailed_doc=t.get('detailed',{}).get('doc',{})) |
| 238 | + #print('a',accessibility,func,detailed) |
| 239 | + #print('r',returnType,returnDoc) |
| 240 | + #print((self.ret).join(params['parameters'])) |
| 241 | + #print((self.ret).join([x for x,y in params['in']])) |
| 242 | + self.print(2,'''<tr><td>{acc}</td><td>{func}</td><td>{desc}</td><td>{param}</td><td>{i}</td><td>{o}</td><td>{r}</td><td>{rdesc}</td></tr>'''.format(acc=accessibility,func=func,desc=detailed,param=self.ret.join(params['parameters']),i=self.ret.join([ x for x,y in params['in']]),o=self.ret.join([x for x,y in params['out']]),r=returnType,rdesc=returnDoc)) |
| 243 | + self.print(2,'</table>') |
| 244 | + self.print(2,'') |
| 245 | + self.print(0,'</body>\n</html>') |
| 246 | + |
37 | 247 | return
|
38 | 248 |
|
39 | 249 | def runMarkdown(self):
|
|
0 commit comments