gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] navidoc ./Makefile ./config.py ./docutils.conf ...


From: Asko Soukka
Subject: [Gzz-commits] navidoc ./Makefile ./config.py ./docutils.conf ...
Date: Fri, 21 Mar 2003 05:36:28 -0500

CVSROOT:        /cvsroot/navidoc
Module name:    navidoc
Changes by:     Asko Soukka <address@hidden>    03/03/21 05:36:28

Modified files:
        .              : Makefile config.py docutils.conf rst2any.py 
        navidoc        : __init__.py 
        navidoc/directives: pegboard.py 
        navidoc/modules: metalink.py navbar.py 
        navidoc/utils  : debug.py path.py 

Log message:
        pegboard transf

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/Makefile.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/config.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/docutils.conf.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/rst2any.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/__init__.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/pegboard.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/metalink.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/navbar.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/utils/debug.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/utils/path.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: navidoc/Makefile
diff -u navidoc/Makefile:1.5 navidoc/Makefile:1.6
--- navidoc/Makefile:1.5        Wed Mar 19 10:39:58 2003
+++ navidoc/Makefile    Fri Mar 21 05:36:27 2003
@@ -1,3 +1,5 @@
+#$Id: Makefile,v 1.6 2003/03/21 10:36:27 humppake Exp $
+
 ##########################################################################
 CLASSPATH =$(NAVIDOC_DEPENDS)/jython.jar:$(shell echo $$CLASSPATH)
 export CLASSPATH
Index: navidoc/config.py
diff -u navidoc/config.py:1.4 navidoc/config.py:1.5
--- navidoc/config.py:1.4       Wed Mar 19 04:23:26 2003
+++ navidoc/config.py   Fri Mar 21 05:36:27 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+# $Id: config.py,v 1.5 2003/03/21 10:36:27 humppake Exp $
+
 __docformat__ = 'reStructuredText'
 
 import os.path
Index: navidoc/docutils.conf
diff -u navidoc/docutils.conf:1.2 navidoc/docutils.conf:1.3
--- navidoc/docutils.conf:1.2   Wed Mar 19 04:23:26 2003
+++ navidoc/docutils.conf       Fri Mar 21 05:36:27 2003
@@ -1,3 +1,5 @@
+#$Id: docutils.conf,v 1.3 2003/03/21 10:36:27 humppake Exp $
+
 [options]
 
 # These entries affect all processing:
Index: navidoc/navidoc/__init__.py
diff -u navidoc/navidoc/__init__.py:1.3 navidoc/navidoc/__init__.py:1.4
--- navidoc/navidoc/__init__.py:1.3     Wed Mar 19 10:34:02 2003
+++ navidoc/navidoc/__init__.py Fri Mar 21 05:36:27 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+#$Id: __init__.py,v 1.4 2003/03/21 10:36:27 humppake Exp $
+
 #
 # Written by Asko Soukka
 #
Index: navidoc/navidoc/directives/pegboard.py
diff -u navidoc/navidoc/directives/pegboard.py:1.3 
navidoc/navidoc/directives/pegboard.py:1.4
--- navidoc/navidoc/directives/pegboard.py:1.3  Wed Mar 19 10:34:02 2003
+++ navidoc/navidoc/directives/pegboard.py      Fri Mar 21 05:36:28 2003
@@ -27,14 +27,18 @@
 
 
 import os, string
-import docutils
+
+from docutils import Component
+from docutils import frontend, io, readers, parsers, writers, nodes
+from docutils.core import publish_cmdline, Publisher
+from docutils.frontend import OptionParser, ConfigParser
 
 import config
 
-from navidoc.utils.path import *
+from navidoc.utils.path import _slashify
 
 dbg = config.dbg.shorthand('pegboard')
-
+dbg_fail = config.dbg.shorthand('pegboard.fail')
 
 def pegcmp(a, b):
     """
@@ -106,79 +110,68 @@
 
     pegtable = []
 
-    pegdirs = [d for d in os.listdir(_slashify(config.working_directory))
+    pegdirs = [d for d in os.listdir(config.working_directory)
            if os.path.isdir(_slashify(config.working_directory)+d) and d != 
'CVS']
 
+    init_working_directory = config.working_directory
 
     for pegdir in pegdirs:
         dbg('processing PEG ' + pegdir)
+        config.working_directory = _slashify(init_working_directory)+pegdir
         
         peg = {'authors': [], 'status': undefined, 'topic': pegdir, 
'stakeholders': [], 
                'last-modified': '', 'dir': pegdir, 'files': '', 'html': '', 
'rst': '',
                'rstfiles': [], 'cvsignore': [] }
+        
+        peg['files'] = [f for f in os.list(config.working_directory) \
+                        if 
os.path.isfile(_slashify(config.working_directory)+f)
+                        and not f.startswith('.') and '#' not in f and '~' not 
in f]
 
-    pegfiles = [f for f in os.listdir(pegroot+'/'+pegdir+'/') \
-               if os.path.isfile(pegroot+'/'+pegdir+'/'+f) and not 
f.startswith('.')
-                  and '#' not in f and '~' not in f]
-
-    peg['files'] = pegfiles
-
-    try:
-        index = pegfiles.index('peg.rst')
-        peg['rst'] = pegfiles[index]
-    except ValueError:
-        for pegfile in peg['files']:
-            if pegfile.endswith('.rst'):
-                peg['rst'] = pegfile
-
-    rstfiles = [f for f in peg['files'] if f.endswith('.rst')]
-
-    for rstfile in rstfiles:
-        #creates and setups a new docutils.core.Publisher, which seems to be
-        #easy interface to use docutils
-        pub = Publisher()
-        pub.set_reader('standalone', None, 'restructuredtext')
-        pub.set_writer('html')
-        file = pegroot+'/'+pegdir+'/'+rstfile[0:len(rstfile)-4]
-        args = '-stg --stylesheet ../'+css+' %s.rst %s.gen.html' % (file,file)
-
-        #saves using contexts for diagrams
-        settings['context'] = pegroot+'/'+pegdir+'/'+rstfile
-        umltool.set_transition_paths(settings['context'])
-        pub.process_command_line(argv=args.split())
-
-        #conversion may fail because of bad restructuredtext
-        try:
-            pub.set_io()
-            document = pub.reader.read(pub.source, pub.parser, pub.settings)
-            pub.apply_transforms(document)
-            output = pub.writer.write(document, pub.destination)
-            peg['cvsignore'].append(rstfile[0:len(rstfile)-4]+'.gen.html')
-
-            #conversion have succeeded so far, parsing peg's metadata
-            #from its document tree
-            if rstfile == peg['rst']:
-               peg['html'] = rstfile[0:len(rstfile)-4]+'.gen.html'
-                peg['topic'] = getTagValue(document, 'title', always_raw=1)
-                peg['topic'] = peg['topic']
-                peg['last-modified'] = getFieldTagValue(document, 
'last-modified')
-                #we may have got 'rawsource', which needs some tidying
-                if peg['last-modified'].startswith('$Date'):
-                    peg['last-modified'] = 
peg['last-modified'][7:len(peg['last-modified'])-11].replace('/', '-')
-                peg['status'] = getTagValue(document, 'status') or undefined
-                stakeholders = getFieldTagValue(document, 'stakeholder')
-                if not stakeholders:
-                    stakeholders = getFieldTagValue(document, 'stakeholders')
-                peg['stakeholders'] = [s.strip() for s in 
stakeholders.split(',')]
-                peg['authors'] = getTagValue(document, 'author', all=1)
-            else:
-                status = getTagValue(document, 'status')
-                if status:
-                    peg['rstfiles'].append({'filename': rstfile, 'status': 
status})
+        if peg['files'].find('peg.rst') != -1: peg['rst'] = 'peg.rst'
+        else:
+            for pegfile in peg['files']:
+                if pegfile.endswith('.rst'):
+                    peg['rst'] = pegfile
+
+        rstfiles = [f for f in peg['files'] if f.endswith('.rst')]
+
+        for rstfile in rstfiles:
+            pub = Publisher()
+            pub.set_reader('standalone', None, 'restructuredtext')
+            filename = _slashify(config.working_directory)+rstfile
+            pub.process_command_line(argv="--config "+config.docutils+" 
"+filename+"".split())
+            
+            #conversion may fail because of bad restructuredtext
+            try:
+                pub.set_io()
+                document = pub.reader.read(pub.source, pub.parser, 
pub.settings)
+                pub.apply_transforms(document)
+                peg['cvsignore'].append(rstfile[0:len(rstfile)-4]+'.gen.html')
+
+               #conversion have succeeded so far, parsing peg's metadata
+               #from its document tree
+               if rstfile == peg['rst']:
+                   peg['html'] = rstfile[0:len(rstfile)-4]+'.gen.html'
+                   peg['topic'] = getTagValue(document, 'title', always_raw=1)
+                   peg['topic'] = peg['topic']
+                   peg['last-modified'] = getFieldTagValue(document, 
'last-modified')
+                   #we may have got 'rawsource', which needs some tidying
+                   if peg['last-modified'].startswith('$Date'):
+                       peg['last-modified'] = 
peg['last-modified'][7:len(peg['last-modified'])-11].replace('/', '-')
+                   peg['status'] = getTagValue(document, 'status') or undefined
+                   stakeholders = getFieldTagValue(document, 'stakeholder')
+                   if not stakeholders:
+                       stakeholders = getFieldTagValue(document, 
'stakeholders')
+                   peg['stakeholders'] = [s.strip() for s in 
stakeholders.split(',')]
+                   peg['authors'] = getTagValue(document, 'author', all=1)
+               else:
+                   status = getTagValue(document, 'status')
+                   if status:
+                       peg['rstfiles'].append({'filename': rstfile, 'status': 
status})
                 
-        except:
-            fails += 'PEG %s: Docutil raised an exception while converting %s. 
' % (pegdir, rstfile)
-            fails += 'Conversion failed and HTML not created.\n'
+            except:
+                dbg_fail('PEG %s: Docutil raised an exception while converting 
%s. ' % (pegdir, rstfile))
+                dbg_fail('Conversion failed and HTML not created.\n')
 
     if not peg['html']:
         for file in peg['files']:
@@ -192,10 +185,7 @@
     #finally adds peg's metadata into pegtable
     pegtable.append(peg)
 
-
 #create the ``.. pegboard::`` directive
-
-
 def pegboard_directive(*args):
 
     pegtable = build_pegtable()
Index: navidoc/navidoc/modules/metalink.py
diff -u navidoc/navidoc/modules/metalink.py:1.1 
navidoc/navidoc/modules/metalink.py:1.2
--- navidoc/navidoc/modules/metalink.py:1.1     Wed Mar 19 10:34:02 2003
+++ navidoc/navidoc/modules/metalink.py Fri Mar 21 05:36:28 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+#$Id: metalink.py,v 1.2 2003/03/21 10:36:28 humppake Exp $
+
 #
 # Written by Asko Soukka
 #
Index: navidoc/navidoc/modules/navbar.py
diff -u navidoc/navidoc/modules/navbar.py:1.2 
navidoc/navidoc/modules/navbar.py:1.3
--- navidoc/navidoc/modules/navbar.py:1.2       Wed Mar 19 10:34:02 2003
+++ navidoc/navidoc/modules/navbar.py   Fri Mar 21 05:36:28 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+#$Id: navbar.py,v 1.3 2003/03/21 10:36:28 humppake Exp $
+
 #
 # Written by Benja Fallenstein
 #
Index: navidoc/navidoc/utils/debug.py
diff -u navidoc/navidoc/utils/debug.py:1.5 navidoc/navidoc/utils/debug.py:1.6
--- navidoc/navidoc/utils/debug.py:1.5  Wed Mar 19 04:23:26 2003
+++ navidoc/navidoc/utils/debug.py      Fri Mar 21 05:36:28 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+#$Id: debug.py,v 1.6 2003/03/21 10:36:28 humppake Exp $
+
 #
 # Written by Asko Soukka
 #
@@ -35,6 +37,7 @@
     all = ["-d", "-D"] + long
 
     output_enabled = {}
+    buffer = {}
 
     def __init__(self):
         pass
@@ -45,7 +48,16 @@
     def out(self, dbg_name, dbg_str):
         if self.output_enabled.has_key(dbg_name):
             print "[", dbg_name, "]", dbg_str
+        else:
+            if not buffer.haskey(dbg_name): buffer['dbg_name'] = []
+            buffer['dbg_name'].append(dbg_str)
 
     def shorthand(self, dbg_name):
         return lambda dbg_string, self=self, dbg_name=dbg_name: \
                                         self.out(dbg_name, dbg_string)
+
+    def flush(self, dbg_name):
+        if buffer.haskey(dbg_name):
+            for line in buffer['dbg_name']:
+                print "[", dbg_name, "]", line
+             buffer['dbg_name'] = []
Index: navidoc/navidoc/utils/path.py
diff -u navidoc/navidoc/utils/path.py:1.3 navidoc/navidoc/utils/path.py:1.4
--- navidoc/navidoc/utils/path.py:1.3   Wed Mar 19 10:34:02 2003
+++ navidoc/navidoc/utils/path.py       Fri Mar 21 05:36:28 2003
@@ -19,6 +19,8 @@
 # MA  02111-1307  USA
 # 
 
+#$Id: path.py,v 1.4 2003/03/21 10:36:28 humppake Exp $
+
 #
 # Written by Asko Soukka
 #
Index: navidoc/rst2any.py
diff -u navidoc/rst2any.py:1.8 navidoc/rst2any.py:1.9
--- navidoc/rst2any.py:1.8      Wed Mar 19 10:34:02 2003
+++ navidoc/rst2any.py  Fri Mar 21 05:36:27 2003
@@ -21,6 +21,8 @@
 # MA  02111-1307  USA
 # 
 
+#$id:$
+
 #
 # Written by Asko Soukka
 #




reply via email to

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