42 |
""" |
""" |
43 |
UML-directive gets UML source as its content. At first the content |
UML-directive gets UML source as its content. At first the content |
44 |
is split into UML and MP parts. Then those parts are written into |
is split into UML and MP parts. Then those parts are written into |
45 |
tmpdir. At last a comment node "<!-- UML: foo -->" is added into |
tmpdir. At last an image node "<img src=...>" is added into |
46 |
reST document tree. |
reST document tree. |
47 |
""" |
""" |
48 |
attributes = {'name': arguments[0]} |
attributes = {'name': arguments[0]} |
49 |
uml_node = docutils.nodes.comment('', 'UML:'+attributes['name']) |
trans = mputils._slashify(umltool.settings['to_tmpdir']) |
50 |
|
#print trans |
51 |
|
src = trans+attributes['name']+".gen.png" |
52 |
|
uml_node = docutils.nodes.image(uri=src, alt="UML: "+attributes['name'], |
53 |
|
_uml=attributes['name']) |
54 |
if content: |
if content: |
55 |
|
|
56 |
#splits content into uml and mp parts |
#splits content into uml and mp parts |
84 |
mp.write(files[1]) |
mp.write(files[1]) |
85 |
mp.close() |
mp.close() |
86 |
|
|
87 |
|
create_diagram(attributes['name']+'.gen') |
88 |
|
|
89 |
add_refer_context(attributes['name'], 1) |
add_refer_context(attributes['name'], 1) |
90 |
|
|
91 |
return [uml_node] |
return [uml_node] |
122 |
other reST-document. |
other reST-document. |
123 |
""" |
""" |
124 |
attributes = {'name': arguments[0]} |
attributes = {'name': arguments[0]} |
125 |
uml_node = docutils.nodes.comment('', 'UML:'+attributes['name']) |
trans = mputils._slashify(umltool.settings['to_tmpdir']) |
126 |
|
#print trans |
127 |
|
src = trans+attributes['name']+".gen.png" |
128 |
|
uml_node = docutils.nodes.image(_uml=attributes['name'], uri=src) |
129 |
add_refer_context(attributes['name']) |
add_refer_context(attributes['name']) |
130 |
|
|
131 |
return [uml_node] |
return [uml_node] |
143 |
htmlfile = open(path+".gen.html") |
htmlfile = open(path+".gen.html") |
144 |
html = htmlfile.read() |
html = htmlfile.read() |
145 |
htmlfile.close() |
htmlfile.close() |
146 |
insert = html.find("<!-- UML:") |
insert = html.find('<img _uml="') |
147 |
while insert > -1: |
while insert > -1: |
148 |
name = html[insert+9:html.find(" ", insert+9)] |
name = html[insert+11:html.find('"', insert+11)] |
149 |
|
print "NAME: ", name |
150 |
settings['name'] = name |
settings['name'] = name |
151 |
|
|
152 |
#This should work also with non-generated UML-diagrams. Checks first |
#This should work also with non-generated UML-diagrams. Checks first |
178 |
out.write("<img src=\""+mputils._slashify(settings['to_tmpdir'])\ |
out.write("<img src=\""+mputils._slashify(settings['to_tmpdir'])\ |
179 |
+context_name+".gen.png"\ |
+context_name+".gen.png"\ |
180 |
+"\" usemap=\"#"+name+"_map\" alt=\""+name+"\" />\n") |
+"\" usemap=\"#"+name+"_map\" alt=\""+name+"\" />\n") |
181 |
html = html[html.find("-->", insert)+3:len(html)] |
html = html[html.find(">", insert)+1:len(html)] |
182 |
out.write(html) |
out.write(html) |
183 |
out.close() |
out.close() |
184 |
htmlfile = open(path+".gen.html") |
htmlfile = open(path+".gen.html") |