/[gzz]/gzz/metacode/umlrst.py
ViewVC logotype

Diff of /gzz/metacode/umlrst.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by humppake, Thu Feb 6 23:01:18 2003 UTC revision 1.25 by benja, Sat Feb 8 23:21:25 2003 UTC
# Line 42  def uml_directive(name, arguments, optio Line 42  def uml_directive(name, arguments, optio
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
# Line 80  def uml_directive(name, arguments, optio Line 84  def uml_directive(name, arguments, optio
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]
# Line 116  def uml_refer_directive(name, arguments, Line 122  def uml_refer_directive(name, arguments,
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]
# Line 134  def embed_diagrams(path): Line 143  def embed_diagrams(path):
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
# Line 168  def embed_diagrams(path): Line 178  def embed_diagrams(path):
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")

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26