8000 [TIGER-32249] support html · cheoljoo/doxygen_perlmod_python@a02de65 · GitHub
[go: up one dir, main page]

Skip to content

Commit a02de65

Browse files
author
charles.lee
committed
[TIGER-32249] support html
- set src/mysetting.py to use http server as plantuml server - make testserver - output - test-server/output/perlmod/output.html
1 parent fad0884 commit a02de65

File tree

4 files changed

+233
-9
lines changed

4 files changed

+233
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ doxygen-ver-check:
1515

1616
testserver:
1717
make doxygen-ver-check
18-
cd test-server; touch plantuml.jar
18+
cd test-server; rm -f plantuml.jar ; touch plantuml.jar
1919
-cd test-server; doxygen
2020
cd test-server/output/perlmod; rm -f mysetting.py sample-server.py
2121
cd test-server/output/perlmod; ln -s ../../../src/mysetting.py mysetting.py

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
- `make test1`
1111
- source : test-1
1212
- Doxyfile
13-
- PLANTUML_JAR_PATH = ./plantuml.jar
13+
- GENERATE_PERLMOD = YES
14+
- PERLMOD_PYTHON = YES
15+
- INPUT = ../doxygen-test-src
16+
- PLANTUML_JAR_PATH = ./plantuml.jar
1417
- but we do not copy proper plantuml.jar. we use 'touch plantuml.jar' to remove java running time.
1518
- output
1619
- test-1/output/perlmod/output.md : show markdown including plantuml with vscode (useful extension : markdown preview enhanced)
@@ -21,10 +24,19 @@
2124
- above all you set plantuml server in your accessing server with docker
2225
- $ ```docker run -d -p 18080:8080 plantuml/plantuml-server:tomcat```
2326
- you can change into your port # instead of 18080. we will use like http://[yourhostname]:18080/.
24-
- you need to install and run docker image. then you should set your hostname and port # in mysetting.py
25-
- `make test-server`
27+
- you need to install and run docker image. then you should set your hostname and port # in src/mysetting.py
28+
- `make testserver`
2629
- source : test-server
27-
- make alternative url in html : we can use png file when we have some error to connect to plantuml server
30+
- Doxyfile
31+
- GENERATE_PERLMOD = YES
32+
- PERLMOD_PYTHON = YES
33+
- INPUT = ../doxygen-test-src
34+
- PLANTUML_JAR_PATH = ./plantuml.jar
35+
- but we do not copy proper plantuml.jar. we use 'touch plantuml.jar' to remove java running time.
36+
- if you find some Error when you run doxygen , it is no problem.
37+
- show [link](test-server/README.md) to know the reason
38+
- todo
39+
- make alternative url in html : we can use png file when we have some error to connect to plantuml server
2840

2941
## make plantuml with hpp2plantuml
3042

src/mysetting.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# when you run ```docker run -d -p 18080:8080 plantuml/plantuml-server:tomcat```
22
# you can show the service after connecting http://mylife.better.com:18080 if plantuml server works well.
33
# http proxy is hostname : mylife.better.com port : 18080
4-
# ex) http://mylife.better.com:18080/proxy?fmt=svg&
5-
# ex) http://mylife.better.com:18080/proxy?fmt=png&
6-
myPlantumlServerProxy = 'http://tiger02.lge.com:18080/proxy?fmt=svg&'
4+
# ex) http://mylife.better.com:18080/proxy?fmt=svg
5+
# ex) http://mylife.better.com:18080/proxy?fmt=png
6+
myPlantumlServerProxy = 'http://mylife.better.com:18080/proxy?fmt=svg'
77

88
# http path for your directory ex) 'http://mylife.better.com/user/code/doxygen_perlmod_python/test-server/output/perlmod/test-1.puml'
9-
mySrcHttp = 'http://tiger02.lge.com/cheoljoo.lee/code/doxygen_perlmod_python/test-server/output/perlmod'
9+
mySrcDirHttp = 'http://mylife.better.com/user/code/doxygen_perlmod_python/test-server/output/perlmod'
10+
11+
# whole link : http://mylife.better.com:18080/proxy?fmt=svg&src=http://mylife.better.com/user/code/doxygen_perlmod_python/test-server/output/perlmod/test-1.puml

src/sample.py

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import mysetting
44
import DoxyDocs
55
import argparse
6+
import mysetting
67

78
class DoxyDocsClass :
89
'''
@@ -34,6 +35,215 @@ def run(self):
3435
self.runMarkdown()
3536

3637
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+
37247
return
38248

39249
def runMarkdown(self):

0 commit comments

Comments
 (0)
0