185 |
def embed_implicit(oldpath, name, path): |
def embed_implicit(oldpath, name, path): |
186 |
"""Terrible kludge to embed named diagram into path document |
"""Terrible kludge to embed named diagram into path document |
187 |
with correct imagemap.""" |
with correct imagemap.""" |
188 |
|
#global settings |
189 |
#correcting relative paths |
#correcting relative paths |
190 |
path = path.replace(settings['to_javadoc'], |
path = path.replace(settings['to_javadoc'], |
191 |
settings['javadoc']) |
settings['javadoc']) |
196 |
path = (oldpath[0:slash+1] + path).replace("//", "/") |
path = (oldpath[0:slash+1] + path).replace("//", "/") |
197 |
|
|
198 |
#umltool_backup = settings.copy() |
#umltool_backup = settings.copy() |
199 |
global settings |
settings2 = settings.copy() |
|
mputils_backup = settings.copy() |
|
200 |
|
|
201 |
umltool.set_transition_paths(path) |
umltool.set_transition_paths(path) |
202 |
slash = oldpath.rfind("/") |
slash = oldpath.rfind("/") |
203 |
if slash != -1: |
if slash != -1: |
204 |
settings['to_context'] = mputils.transition_path(path, oldpath[0:slash]) |
settings2['to_context'] = mputils.transition_path(path, oldpath[0:slash]) |
205 |
else: settings['to_context'] = mputils.transition_path(path, oldpath) |
else: settings2['to_context'] = mputils.transition_path(path, oldpath) |
206 |
|
|
207 |
#the second pass - adds uml into html |
#the second pass - adds uml into html |
208 |
if path.endswith(".rst"): path = path[0:len(path)-4] |
if path.endswith(".rst"): path = path[0:len(path)-4] |
219 |
|
|
220 |
#This should work also with non-generated UML-diagrams. Checks first |
#This should work also with non-generated UML-diagrams. Checks first |
221 |
#for generated and then if non-generated diagram exists. |
#for generated and then if non-generated diagram exists. |
222 |
if (os.path.isfile(mputils._slashify(settings['tmpdir'])\ |
if (os.path.isfile(mputils._slashify(settings2['tmpdir'])\ |
223 |
+name+".gen.uml")): |
+name+".gen.uml")): |
224 |
old_prefix = name + ".gen" |
old_prefix = name + ".gen" |
225 |
else: old_prefix = name |
else: old_prefix = name |
232 |
create_diagram(old_prefix, context_name, 0.5) |
create_diagram(old_prefix, context_name, 0.5) |
233 |
|
|
234 |
#Cut&Pastes imagemap into html |
#Cut&Pastes imagemap into html |
235 |
imgmap = open(mputils._slashify(settings['tmpdir'])\ |
imgmap = open(mputils._slashify(settings2['tmpdir'])\ |
236 |
+context_name+".gen.html").read() |
+context_name+".gen.html").read() |
237 |
out.write("<map id=\""+name+"\" name=\""+name+"\">\n") |
out.write("<map id=\""+name+"\" name=\""+name+"\">\n") |
238 |
out.write(imgmap[imgmap.find('>',imgmap.find('<map'))+1:\ |
out.write(imgmap[imgmap.find('>',imgmap.find('<map'))+1:\ |
239 |
imgmap.find('</map>')]) |
imgmap.find('</map>')]) |
240 |
out.write("</map>\n") |
out.write("</map>\n") |
241 |
out.write("<div class=\"uml-implicit\">\n") |
out.write("<div class=\"uml-implicit\">\n") |
242 |
if (os.path.isfile(mputils._slashify(settings['tmpdir'])\ |
if (os.path.isfile(mputils._slashify(settings2['tmpdir'])\ |
243 |
+name+".gen.refers")): |
+name+".gen.refers")): |
244 |
refers = open(mputils._slashify(settings['tmpdir'])\ |
refers = open(mputils._slashify(settings2['tmpdir'])\ |
245 |
+name+".gen.refers").readlines() |
+name+".gen.refers").readlines() |
246 |
out.write("<small><strong>"+name+"</strong>: \n") |
out.write("<small><strong>"+name+"</strong>: \n") |
247 |
for refer in refers: |
for refer in refers: |
252 |
|
|
253 |
out.write("<a id=\""+name+"\"></a>\n") |
out.write("<a id=\""+name+"\"></a>\n") |
254 |
out.write("<img "\ |
out.write("<img "\ |
255 |
+"src=\""+mputils._slashify(settings['to_tmpdir'])\ |
+"src=\""+mputils._slashify(settings2['to_tmpdir'])\ |
256 |
+context_name+".gen.png"\ |
+context_name+".gen.png"\ |
257 |
+"\" usemap=\"#"+name+"\" alt=\""+name+"\" />\n") |
+"\" usemap=\"#"+name+"\" alt=\""+name+"\" />\n") |
258 |
out.write("</div>\n") |
out.write("</div>\n") |
262 |
out.close() |
out.close() |
263 |
|
|
264 |
#umltool.settings = umltool_backup |
#umltool.settings = umltool_backup |
265 |
settings = mputils_backup |
#settings = mputils_backup |