gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/metacode latex2e.py umldoc.py umlrst.py


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/metacode latex2e.py umldoc.py umlrst.py
Date: Sat, 08 Feb 2003 18:21:25 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/02/08 18:21:25

Modified files:
        metacode       : latex2e.py umldoc.py umlrst.py 

Log message:
        Hmmm. Make uml in LaTeX work in theory; in practice, nothing's shown
        (though the \includegraphics{}'s in the .latex alright, and the .png's 
there also)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/latex2e.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umldoc.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umlrst.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: gzz/metacode/latex2e.py
diff -u gzz/metacode/latex2e.py:1.2 gzz/metacode/latex2e.py:1.3
--- gzz/metacode/latex2e.py:1.2 Wed Feb  5 02:19:46 2003
+++ gzz/metacode/latex2e.py     Sat Feb  8 18:21:25 2003
@@ -1,10 +1,10 @@
 #! /usr/bin/env python
 
 """
-:Author: Engelbert Gruber
+:Author: Engelbert Gruber (hacked by the Gzz project)
 :Contact: address@hidden
-:Revision: $Revision: 1.2 $
-:Date: $Date: 2003/02/05 07:19:46 $
+:Revision: $Revision: 1.3 $
+:Date: $Date: 2003/02/08 23:21:25 $
 :Copyright: This module has been placed in the public domain.
 
 LaTeX2e document tree Writer.
@@ -215,6 +215,7 @@
     def __init__(self, document):
         nodes.NodeVisitor.__init__(self, document)
         self.settings = settings = document.settings
+        self.d_class = settings.documentclass
         self.use_latex_toc = settings.use_latex_toc
         # language: labels, bibliographic_fields, and author_separators.
         # to allow writing labes for specific languages.
Index: gzz/metacode/umldoc.py
diff -u gzz/metacode/umldoc.py:1.20 gzz/metacode/umldoc.py:1.21
--- gzz/metacode/umldoc.py:1.20 Thu Feb  6 16:57:42 2003
+++ gzz/metacode/umldoc.py      Sat Feb  8 18:21:25 2003
@@ -111,7 +111,14 @@
     settings['context'] = path
     #the first pass - converts rst into latex
     if path.endswith(".rst"): path = path[0:len(path)-4]
-    args = path+'.rst '+path+'.gen.latex'
+    dir = os.path.dirname(path)
+    classes = [f for f in os.listdir(dir) if os.path.splitext(f)[1] == '.cls']
+    if classes:
+        documentclass = '--documentclass %s ' % 
(os.path.splitext(classes[0])[0])
+    else:
+        documentclass = ''
+    args = documentclass+path+'.rst '+path+'.gen.latex'
+    ##print classes, args
     docutils.core.publish_cmdline(writer_name='latex', argv=args.split())
 
 
Index: gzz/metacode/umlrst.py
diff -u gzz/metacode/umlrst.py:1.24 gzz/metacode/umlrst.py:1.25
--- gzz/metacode/umlrst.py:1.24 Thu Feb  6 18:01:18 2003
+++ gzz/metacode/umlrst.py      Sat Feb  8 18:21:25 2003
@@ -42,11 +42,15 @@
     """
     UML-directive gets UML source as its content. At first the content
     is split into UML and MP parts. Then those parts are written into
-    tmpdir. At last a comment node "<!-- UML: foo -->" is added into
+    tmpdir. At last an image node "<img src=...>" is added into
     reST document tree.
     """
     attributes = {'name': arguments[0]}
-    uml_node = docutils.nodes.comment('', 'UML:'+attributes['name'])
+    trans = mputils._slashify(umltool.settings['to_tmpdir'])
+    #print trans
+    src = trans+attributes['name']+".gen.png"
+    uml_node = docutils.nodes.image(uri=src, alt="UML: "+attributes['name'],
+                                    _uml=attributes['name'])
     if content:
 
         #splits content into uml and mp parts
@@ -80,6 +84,8 @@
         mp.write(files[1])
         mp.close()
 
+        create_diagram(attributes['name']+'.gen')
+
     add_refer_context(attributes['name'], 1)
 
     return [uml_node]
@@ -116,7 +122,10 @@
     other reST-document.
     """
     attributes = {'name': arguments[0]}
-    uml_node =  docutils.nodes.comment('', 'UML:'+attributes['name'])
+    trans = mputils._slashify(umltool.settings['to_tmpdir'])
+    #print trans
+    src = trans+attributes['name']+".gen.png"
+    uml_node =  docutils.nodes.image(_uml=attributes['name'], uri=src)
     add_refer_context(attributes['name'])
 
     return [uml_node]
@@ -134,9 +143,10 @@
         htmlfile = open(path+".gen.html")
         html = htmlfile.read()
         htmlfile.close()
-        insert = html.find("<!-- UML:")
+        insert = html.find('<img _uml="')
         while insert > -1:
-            name = html[insert+9:html.find(" ", insert+9)]
+            name = html[insert+11:html.find('"', insert+11)]
+            print "NAME: ", name
             settings['name'] = name
             
             #This should work also with non-generated UML-diagrams. Checks 
first
@@ -168,7 +178,7 @@
             out.write("<img src=\""+mputils._slashify(settings['to_tmpdir'])\
                       +context_name+".gen.png"\
                       +"\" usemap=\"#"+name+"_map\" alt=\""+name+"\" />\n")
-            html = html[html.find("-->", insert)+3:len(html)]
+            html = html[html.find(">", insert)+1:len(html)]
             out.write(html)
             out.close()
             htmlfile = open(path+".gen.html")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]