gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/metacode pegboard.py


From: Asko Soukka
Subject: [Gzz-commits] gzz/metacode pegboard.py
Date: Tue, 05 Nov 2002 12:08:39 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/05 12:08:38

Modified files:
        metacode       : pegboard.py 

Log message:
        Hrr... pegboard's table to show multiple authors (and stakeholders)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/pegboard.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: gzz/metacode/pegboard.py
diff -u gzz/metacode/pegboard.py:1.9 gzz/metacode/pegboard.py:1.10
--- gzz/metacode/pegboard.py:1.9        Tue Nov  5 11:19:53 2002
+++ gzz/metacode/pegboard.py    Tue Nov  5 12:08:38 2002
@@ -67,9 +67,10 @@
     bc = bs[0]*356 + bs[1]*30 + bs[2]
     return ac < bc or (bc < ac) * -1 or 0
 
-#returns the value of the first occurrense of
-#given tagName in docutils' document tree
-def getTagValue(document, tagName):
+#returns the value of the first occurrense or all of the occurrences
+#of given tagName in docutils' document tree
+def getTagValue(document, tagName, all=0):
+    values = []
     if document.tagname.lower() == tagName.lower():
         if hasattr(document.children[0], 'data'):
             return document.children[0].data
@@ -77,10 +78,18 @@
             return document.rawsource
     if hasattr(document, 'children'):
         for child in document.children:
-            value = getTagValue(child, tagName)
-            if value:
+            value = getTagValue(child, tagName, all)
+            if value and not all:
                 return value
-    return ''
+            elif value:
+                if type(value) == type([]):
+                    values.extend(value)
+                else:
+                    values.append(value)
+    if len(values) > 0:
+        return values
+    else:
+        return ''
        
 pegdirs = [d for d in os.listdir(pegroot+'/')
            if os.path.isdir(pegroot+'/'+d) and d != 'CVS']
@@ -96,7 +105,7 @@
 for pegdir in pegdirs:
     print 'Process PEG %s' % (pegdir)
 
-    peg = {'author': '', 'status': undefined, 'topic': pegdir, 'stakeholders': 
'', 
+    peg = {'authors': '', 'status': undefined, 'topic': pegdir, 
'stakeholders': '', 
            'date': '', 'dir': pegdir, 'files': '', 'html': '', 'rst': '' }
 
     pegfiles = [f for f in os.listdir(pegroot+'/'+pegdir+'/') \
@@ -144,9 +153,8 @@
                 if peg['date'].startswith('$Date'):
                     peg['date'] = 
peg['date'][7:len(peg['date'])-11].replace('/', '-')
                 peg['status'] = getTagValue(document, 'status') or undefined
-                peg['stakeholders'] = getTagValue(document, 'stakeholders')
-                peg['author'] = getTagValue(document, 'author') or \
-                                getTagValue(document, 'authors')
+                peg['stakeholders'] = getTagValue(document, 'stakeholder', 
all=1)
+                peg['authors'] = getTagValue(document, 'author', all=1)
         except:
             fails += 'PEG %s: Docutil raised an exception while converting %s. 
' % (pegdir, rstfile)
             fails += 'Conversion failed and HTML not created.\n'
@@ -194,8 +202,18 @@
             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>'
+            for author in peg['authors']:
+                if peg['authors'].index(author) > 0:
+                    replace_str += ','
+                replace_str += '\n\t\t' + author
+            replace_str += '\n\t</td>\n'
+            replace_str += '\t<td>'
+            for stakeholder in peg['stakeholders']:
+                if peg['stakeholders'].index(stakeholder) > 0:
+                    replace_str += ','
+                replace_str += '\n\t\t' + stakeholder
+            replace_str += '\n\t</td>\n'
             replace_str += '\t<td>\n'
             for file in peg['files']:
                 replace_str += '\t\t<a href=\"'+peg['dir']+'/'+file+'\">' \




reply via email to

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