gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz doc/gzz.css doc/pegboard/pegboard.rst metac...


From: Asko Soukka
Subject: [Gzz-commits] gzz doc/gzz.css doc/pegboard/pegboard.rst metac...
Date: Mon, 04 Nov 2002 14:23:20 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/04 14:23:20

Modified files:
        doc            : gzz.css 
        doc/pegboard   : pegboard.rst 
        metacode       : pegboard.py 
        .              : TODO 

Log message:
        Pegboard

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/gzz.css.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/pegboard.rst.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/pegboard.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.364&tr2=1.365&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.364 gzz/TODO:1.365
--- gzz/TODO:1.364      Mon Nov  4 08:45:47 2002
+++ gzz/TODO    Mon Nov  4 14:23:20 2002
@@ -78,15 +78,9 @@
        - porting: make sure all demos etc. work with plain mesa
     humppake:
        - script to generate index for pegboard
-       - make sure "make pegs" works right - currently libraries
-         don't load properly by C-python (need to put stuff in depends.
-         Make sure a plain 2.1 installation works.)
-       - autogenerate the pegboard page from
-         a .rst file and the .rst files of the pegs - currently
-         we need to change several locations.
-         Note the colors in the table: they're very useful (depends
-         only on status).
-       + convert older pegs into current format
+         - converts now almost every rst twice, one should
+           be enough
+         - fix older pegs if necessary
        + more about PEG1018 - generalizing VobVanishingClient
         + rethink interfaces between PlainVanishing and VobScene
            - learn Box
Index: gzz/doc/gzz.css
diff -u gzz/doc/gzz.css:1.5 gzz/doc/gzz.css:1.6
--- gzz/doc/gzz.css:1.5 Fri Nov  1 05:09:56 2002
+++ gzz/doc/gzz.css     Mon Nov  4 14:23:20 2002
@@ -73,13 +73,13 @@
   vertical-align: top;
 }
 
-.peg-current {}
+.peg-current { background: #ff9900; color: #000000; }
 .peg-incomplete { background: #ffffff; color: #000000; } 
-.peg-accepted {} 
-.peg-implemented {}
+.peg-accepted { background: #33ff33; color: #000000; }
+.peg-implemented { background: #666666; color: #000000; }
 .peg-rejected {}
 .peg-revising {}
-.peg-irrelevant {}
+.peg-irrelevant { background: #666666; color: #000000; }
 
 /* Deprecated
 .docinfo {
Index: gzz/doc/pegboard/pegboard.rst
diff -u gzz/doc/pegboard/pegboard.rst:1.1 gzz/doc/pegboard/pegboard.rst:1.2
--- gzz/doc/pegboard/pegboard.rst:1.1   Fri Nov  1 05:09:56 2002
+++ gzz/doc/pegboard/pegboard.rst       Mon Nov  4 14:23:20 2002
@@ -46,11 +46,16 @@
 packages be PEGged first but not required: such changes will not 
 be summarily rejected. 
 
-PEGs should use the python reStructuredText_ markup language. Quick_ reference
-could be handy.
+PEGs should use the python reStructuredText_ markup language. `Quick 
reference`__
+could be handy. See also `PEG 201`__ for current format.
 
 .. _reStructuredText: http://docutils.sourceforge.net
-.. _Quick: http://docutils.sourceforge.net/docs/rst/quickref.html
+.. _QuickRef: http://docutils.sourceforge.net/docs/rst/quickref.html
+.. _PEG201: 201/PEG_201.html
+
+__ QuickRef_
+__ PEG201_
+
 
 Pegboard
 --------
@@ -59,9 +64,6 @@
 
 Explanation of table:
 ---------------------
-
-Date
-       The date PEG is last updated.
  
 Status
        The current status of the PEG.
Index: gzz/metacode/pegboard.py
diff -u gzz/metacode/pegboard.py:1.6 gzz/metacode/pegboard.py:1.7
--- gzz/metacode/pegboard.py:1.6        Mon Nov  4 09:32:56 2002
+++ gzz/metacode/pegboard.py    Mon Nov  4 14:23:20 2002
@@ -19,18 +19,57 @@
 # Must be run in the main directory (the one Makefile is in),
 # because of hardcoded pegroot and css.
 
-import docutils
-import docutils.core
 import sys, os, os.path
-
-class _:
-    def __init__(self, **attrs):
-        for (k,v) in attrs.items(): setattr(self, k, v)
+from docutils.frontend import OptionParser
+from docutils.utils import new_document
+from docutils.parsers.rst import Parser
+from docutils.core import publish_cmdline
 
 fails = 'XXX\n'
 pegroot = 'doc/pegboard'
 css = '../gzz.css'
 replace = '<p>INSERT_PEGBOARD</p>\n'
+priority = {'Current': 1, 'Revising': 2, 'Accepted': 3, 'Incomplete': 4,
+            'Implemented': 5, 'Rejected': 6, 'Irrelevant': 7, 'Undefined': 8}
+
+class _:
+    def __init__(self, **attrs):
+        for (k,v) in attrs.items(): setattr(self, k, v)
+
+def pegcmp(a, b):
+    if priority.has_key(a['status'].capitalize().split(' ')[0]) \
+           and priority.has_key(b['status'].capitalize().split(' ')[0]) \
+           and not a['status'] == b['status']:
+        return priority[a['status'].capitalize().split(' ')[0]] \
+               > priority[b['status'].capitalize().split(' ')[0]] or -1
+    as = a['date'].split('/')
+    bs = b['date'].split('/')
+    if not len(as) == 3 or not len(bs) == 3:
+        return len(as) < len(bs) or (len(bs) < len(as)) * -1 or 0
+    ac = as[0]*356 + as[1]*30 + as[2]
+    bc = bs[0]*356 + bs[1]*30 + bs[2]
+    return ac < bc or (bc < ac) * -1 or 0
+
+def getTagValue(document, tagName):
+    if document.tagname.lower() == tagName.lower():
+        return document.rawsource
+    if hasattr(document, 'children'):
+        for child in document.children:
+            value = getTagValue(child, tagName)
+            if value:
+                return value
+    return ''
+
+def getFieldValue(document, fieldName):
+    if document.tagname.lower() == 'field':
+        if document.children[0].rawsource.lower() == fieldName.lower():
+            return document.children[1].rawsource
+    if hasattr(document, 'children'):
+        for child in document.children:
+            value = getFieldValue(child, fieldName)
+            if value:
+                return value
+    return ''
        
 pegdirs = [d for d in os.listdir(pegroot+'/')
            if os.path.isdir(pegroot+'/'+d) and d != 'CVS']
@@ -42,82 +81,91 @@
 
     print 'Process PEG %s' % (pegdir)
     for rstfile in rstfiles:
-        file = pegroot+'/'+pegdir+'/'+rstfile[0:len(rstfile)-4]#.rstrip('.rst')
+        file = pegroot+'/'+pegdir+'/'+rstfile[0:len(rstfile)-4] #Python2.2: 
.rstrip('.rst')
 
         # Sets docutils' "command line arguments"
         args = '-stg --stylesheet ../'+css+' %s.rst %s.html' % (file,file)
     
         # Generate the HTML
         try:
-            docutils.core.publish_cmdline(writer_name='html', 
argv=args.split())
+            publish_cmdline(writer_name='html', argv=args.split())
         except:
             fails += 'PEG %s: Docutil raised an exception while converting %s. 
' % (pegdir, f)
             fails += 'Conversion failed and HTML not created.\n'
 
-#loop two: creating index
 print 'Generating pegboard2.html...\n'
 args = '-stg --stylesheet '+css+' '+pegroot+'/pegboard.rst 
'+pegroot+'/pegboard2.html'
-docutils.core.publish_cmdline(writer_name='html', argv=args.split())
+publish_cmdline(writer_name='html', argv=args.split())
 
 pegboard = open (pegroot+'/pegboard2.html', 'r')
 pegboard_lines = pegboard.readlines()
 pegboard.close()
 pegboard = open (pegroot+'/pegboard2.html', 'w')
 
-def pegcmp(a, b):
-    as = a['date'].split('-')
-    bs = b['date'].split('-')
-    ac = as[0]*356 + as[1]*31 + as[2]
-    bc = bs[0]*356 + bs[1]*31 + bs[2]
-    return ac > bc or bc < ac * -1 or 0
-
+#loop two: parsing information from pegs
 for pegboard_line in pegboard_lines:
     if pegboard_line.find(replace) != -1:
         pegtable = []
+        
         for pegdir in pegdirs:
-            peg = {'author': '', 'status': '', 'topic': '', 'stakeholders': 
'', 
-                   'date': '0000-00-00', 'dir': pegdir, 'files': '', 
'pegfile': ''}
+            peg = {'author': '', 'status': 'Undefined', 'topic': pegdir, 
'stakeholders': '', 
+                   'date': '', 'dir': pegdir, 
+                   'files': '', 'html': '', 'rst': '' }
             pegfiles = [f for f in os.listdir(pegroot+'/'+pegdir+'/')
                 if os.path.isfile(pegroot+'/'+pegdir+'/'+f) and not 
f.startswith('.')]
             peg['files'] = pegfiles
             for pegfile in pegfiles:
-                if peg['pegfile'] == '':
+                if not peg['html']:
                     if pegfile == 'peg.html' or pegfile == 
'PEG_'+pegdir+'.html':
-                        peg['pegfile'] = pegfile
+                        peg['html'] = pegfile
+                if not peg['rst']:
                     if pegfile == 'peg.rst' or pegfile == 'PEG_'+pegdir+'.rst':
-                        peg['pegfile'] = pegfile
-                        
-                if pegfile == 'peg.rst' or pegfile == 'PEG_'+pegdir+'.rst': 
-                    file = open (pegroot+'/'+pegdir+'/'+pegfile)
-                    lines = file.readlines()
-
-                    for line in lines:
-                        #XXX Parsing PEG here
-                        pass
-
-            if peg['topic'] == '':
-                peg['topic'] = peg['dir']
-            if peg['pegfile'] == '':
-                if peg['files']:
-                    peg['pegfile'] = peg['files'][0]
+                        peg['rst'] = pegfile                        
+            if not peg['html']:
+                peg['html'] = peg['files'][0]
+            if not peg['rst']:
+                for pegfile in peg['files']:
+                    if pegfile.endswith('.rst'):
+                        peg['rst'] = pegfile
             pegtable.append(peg)
-
+            
+        for peg in pegtable:
+            if peg['rst'] and peg['html'].endswith('.html'):
+                inputFile = sys.stdin
+                inputFile = open(pegroot+'/'+peg['dir']+'/'+peg['rst'])
+                settings = 
OptionParser(components=(Parser,)).get_default_values()
+                parser = Parser()
+                input = inputFile.read()
+                document = new_document(inputFile.name, settings)
+                parser.parse(input, document)
+
+                peg['topic'] = getTagValue(document, 'title')
+                peg['topic'] = peg['topic'].replace('`', '')
+                peg['date'] = getFieldValue(document, 'date')
+                if peg['date'].startswith('$Date'):
+                    peg['date'] = peg['date'][7:len(peg['date'])-11]
+                peg['status'] = getFieldValue(document, 'status') or 
'Undefined'
+                peg['stakeholders'] = getFieldValue(document, 'stakeholders')
+                peg['author'] = getFieldValue(document, 'author') or \
+                                getFieldValue(document, 'authors')
+                
         pegtable.sort(pegcmp)
 
         replace_str = '<table class=\"pegboard\">\n<tr>\n'
-        replace_str += '\t<th>Date</th>\n\t<th>Status</th>\n\t<th>Topic</th>\n'
-        replace_str += 
'\t<th>Author</th>\n\t<th>Stakeholders</th>\n\t<th>Files</th>\n'
+#        replace_str += '\t<th>Date</th>\n'
+        replace_str += '\t<th>Status</th>\n\t<th>Topic</th>\n'
+        replace_str += 
'\t<th>Authors</th>\n\t<th>Stakeholders</th>\n\t<th>Files</th>\n'
         replace_str += '</tr>\n'
         
         for peg in pegtable:
             if peg['status'] != '':
-                replace_str += '<tr class=\"'+peg['status']+'\">\n'
+                replace_str += '<tr 
class=\"peg-'+peg['status'].lower().split(' ')[0]+'\">\n'
             else:
                 replace_str += '<tr>\n'
-            replace_str += '\t<td>' + peg['date'] + '</td>\n'
-            replace_str += '\t<td>' + peg['status'] + '</td>\n'
-            replace_str += '\t<td><a 
href=\"'+peg['dir']+'/'+peg['pegfile']+'\">' \
-                           + peg['topic'] + '</a></td>\n'
+#            replace_str += '\t<td>' + peg['date'] + '</td>\n'
+            replace_str += '\t<td><a href=\"'+peg['dir']+'/'+peg['html']+'\">' 
\
+                           + peg['status'] + '</a></td>\n'
+            replace_str += '\t<td>' + peg['topic'] + '</td>\n'
             replace_str += '\t<td>' + peg['author'] + '</td>\n'
             replace_str += '\t<td>' + peg['stakeholders'] + '</td>\n'
             replace_str += '\t<td>\n'
@@ -132,16 +180,7 @@
     pegboard.write(pegboard_line)
 pegboard.close()
 
-
 print fails
-
-
-
-
-
-
-
-
 
 
 




reply via email to

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