gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz metacode/pegboard.py doc/gzz.css doc/pegboa...


From: Asko Soukka
Subject: [Gzz-commits] gzz metacode/pegboard.py doc/gzz.css doc/pegboa...
Date: Fri, 01 Nov 2002 05:09:57 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Asko Soukka <address@hidden>    02/11/01 05:09:56

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

Log message:
        pegboard update, can't yet parse metadata from pegs :(

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/pegboard.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/gzz.css.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/pegboard.rst?rev=1.1

Patches:
Index: gzz/doc/gzz.css
diff -u gzz/doc/gzz.css:1.4 gzz/doc/gzz.css:1.5
--- gzz/doc/gzz.css:1.4 Tue Oct  8 19:44:07 2002
+++ gzz/doc/gzz.css     Fri Nov  1 05:09:56 2002
@@ -1,65 +1,101 @@
- body { color: black; background: white; 
-       margin-left: 15%; margin-right: 5%;
-       margin-top: 0.5em; margin-bottom: 0.5em;
+/* Overall */
+body {
+       color: black;
+       background: white; 
+       margin: 0.5em 5% 0.5em 15%;
        text-align: left; 
        font-size: medium;
        font-family: sans-serif;
-       }
- p { 
+}
+
+/* Headings */
+h1, h2, h3, h4, h5 { font-family: serif; font-weight: bold; }
+h1, .footer { margin-left: -15%; }
+h1 { font-size: 220%; }
+h1.title { font-size: 300%; }
+.footer { font-size: 80%; }
+h2 { font-size: 160%; margin-left: -15%; margin-top: 2.0em; margin-bottom: 
0.5em; }
+h3 { font-size: 120%; margin-left: -7%;  margin-top: 0.75em; margin-bottom: 
0.5em; }
+h4 { font-size: 110%; margin-left: -0%;  margin-top: 0.5em; margin-bottom: 
0.25em; }
+h1, h2, h3, h4 {
+       background: #b0e0e0;
+       border-style: solid;
+       border-color: black;
+       border-width: thin;
+       clear: both;
+}
+h5 { font-size: 100%; margin-bottom: -1em; }
+
+/* Bodytext */
+p { 
        text-align: left; 
        font-size: medium;
        font-family: sans-serif;
-       }
- h1, .footer { margin-left: -15%;}
- h2 { margin-left: -15%; margin-top: 2.0em; margin-bottom: 0.5em; }
- h3 { margin-left: -7%;  margin-top: 0.75em; margin-bottom: 0.5em; }
- h4 { margin-left: -0%;  margin-top: 0.5em; }
- h4 { margin-bottom: 0.25em; }
- h5 { margin-bottom: -1em; }
- h1, h2, h3, h4, h5 { font-family: serif; }
- p, ul { font-family: sans-serif; }
- h1, h2, h3, h4, h5 { font-weight: bold; }
- h1, h2, h3, h4 { background: #b0e0e0; border-style: solid; border-color: 
black;
-               border-width: thin;
-               clear: both; }
-/* .docinfo { background: lightgrey; border-style: solid; border-color: black;
-            border-width: thin; clear: both; 
-            margin-top: 2.0em; margin-bottom: 0.5em; } */
- h1.title { font-size: 300% }
- h1 { font-size: 220%; }
- h2 { font-size: 160%; }
- h3 { font-size: 120%; }
- h4 { font-size: 110%; }
- h5 { font-size: 100%; }
- .footer { font-size: 80%; }
- dt { font-weight: bold; }
- dfn { font-weight: bold; }
- code { font-family: monospace; }
-/* .clearup { clear: both; } */
- .figure { clear: both; float: right; padding: 1em; padding-bottom: 0em;
-               border: 1pt solid black; margin-left: 1.5em; 
-               margin-right: -5%;}
- .figureimg { text-align: center; }
- .wideimg { margin-left: -18%; margin-right: -6%; }
- .abstract { width: 60%; text-align: center; }
- .algorithm { font-family: serif; background: #00E0E0; margin-left: 1cm;}
- .docinfo-name { font-weight: bold; }
- span.red { color: red; background: white;}
- span.green { color: green; background: white; }
+}
+
+ul { font-family: sans-serif; }
+dt { font-weight: bold; }
+dfn { font-weight: bold; }
+code { font-family: monospace; }
+
+.figure { clear: both; float: right; padding: 1em; padding-bottom: 0em;
+       border: 1pt solid black; margin-left: 1.5em; margin-right: -5%; }
+.figureimg { text-align: center; }
+.wideimg { margin-left: -18%; margin-right: -6%; }
+.abstract { width: 60%; text-align: center; }
+.algorithm { font-family: serif; background: #00E0E0; margin-left: 1cm;}
+.docinfo-name { font-weight: bold; }
 
- .old { font-size: x-small; color: #a0a0a0; }
+span.red { color: red; background: white;}
+span.green { color: green; background: white; }
+
+.old { font-size: x-small; color: #a0a0a0; }
 
  /* Voices */
- .tjl { color: #006000; font-family: serif; font-size: medium; }
- .rtr { color: #a00000; font-family: serif; font-size: medium; }
- .benja { color: #6633FF; font-family: serif; font-size: medium; }
- .jvk { color: #000080; font-family: serif; font-size: medium; }
- .ajk { color: #EE00EE; font-family: serif; font-size: medium; }
- .tuukka { color: #2ea597; font-family: serif; font-size: medium; }
+.tjl { color: #006000; font-family: serif; font-size: medium; }
+.rtr { color: #a00000; font-family: serif; font-size: medium; }
+.benja { color: #6633FF; font-family: serif; font-size: medium; }
+.jvk { color: #000080; font-family: serif; font-size: medium; }
+.ajk { color: #EE00EE; font-family: serif; font-size: medium; }
+.tuukka { color: #2ea597; font-family: serif; font-size: medium; }
+
+.statement { background: #efa13b; }
+.tjllogo { vertical-align: -50%; }
+
+.csswarn { background: #e0f0f0; border-width: thin; border-style: solid;
+          border-color: black; padding: 2em; font-size: small;}
+
+/* Pegboard */
+table.pegboard { border: thick solid; width: 100%; }
+table.pegboard th { border-bottom: thick solid; }
+table.pegboard td {
+  border: thin solid;
+  vertical-align: top;
+}
+
+.peg-current {}
+.peg-incomplete { background: #ffffff; color: #000000; } 
+.peg-accepted {} 
+.peg-implemented {}
+.peg-rejected {}
+.peg-revising {}
+.peg-irrelevant {}
+
+/* Deprecated
+.docinfo {
+       background: lightgrey;
+       border-style: solid;
+       border-color: black;
+       border-width: thin;
+       clear: both; 
+        margin-top: 2.0em;
+       margin-bottom: 0.5em;
+}
+
+.clearup { clear: both; }
+
+*/
+
 
- .statement { background: #efa13b; }
- .tjllogo { vertical-align: -50%; }
 
- .csswarn { background: #e0f0f0; border-width: thin; border-style: solid;
-           border-color: black; padding: 2em; font-size: small;}
 
Index: gzz/metacode/pegboard.py
diff -u gzz/metacode/pegboard.py:1.4 gzz/metacode/pegboard.py:1.5
--- gzz/metacode/pegboard.py:1.4        Thu Oct 31 04:12:57 2002
+++ gzz/metacode/pegboard.py    Fri Nov  1 05:09:56 2002
@@ -27,17 +27,20 @@
     def __init__(self, **attrs):
         for (k,v) in attrs.items(): setattr(self, k, v)
 
+fails = 'XXX\n'
 pegroot = 'doc/pegboard'
 css = '../gzz.css'
+replace = '<p>INSERT_PEGBOARD</p>\n'
        
-pegdirs = [d for d in os.listdir(pegroot+'/') if os.path.isdir(pegroot+'/'+d)]
+pegdirs = [d for d in os.listdir(pegroot+'/')
+           if os.path.isdir(pegroot+'/'+d) and d != 'CVS']
 
 #loop one: converting pegs
 for pegdir in pegdirs:
     rstfiles = [f for f in os.listdir(pegroot+'/'+pegdir+'/')
                 if os.path.isfile(pegroot+'/'+pegdir+'/'+f) and 
f.endswith('.rst')]
 
-    print "Process PEG %s" % (pegdir)
+    print 'Process PEG %s' % (pegdir)
     for rstfile in rstfiles:
         file = pegroot+'/'+pegdir+'/'+rstfile.rstrip('.rst')
 
@@ -48,29 +51,88 @@
         try:
             docutils.core.publish(writer_name='html', argv=args.split())
         except:
-            print "XXX"
-            print "PEG %s: Docutil raised an exception while converting %s." % 
(pegdir, f)
-            print "Conversion failed and HTML not created."
-
-#    if 0:
-       #config = docutils.frontend.ConfigParser()
-       #defaults = config.get_section('options')
-#      opts = docutils.frontend.OptionParser()
-       #opts.set_defaults(**defaults)
-#      opts.input_encoding = "utf-8"
-#      opts.report_level = "0"
-#      opts.halt_level = "3"
-#      opts.warning_stream = sys.stdout
-#      opts.debug = "0"
-#      opts.language_code = "en"
-
-#      ioobj = docutils.io.FileIO(opts, source_path="%s.rst" % (f,))
-#      reader = docutils.readers.get_reader_class("rst")(None, None)
-       # doc = reader.read(ioobj, "restructuredtext", opts)
-#      reader.set_parser("restructuredtext")
-#      doc = reader.read(ioobj, None, opts)
-#      print doc
+            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(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
+
+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': ''}
+            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 pegfile == 'peg.html' or pegfile == 
'PEG_'+pegdir+'.html':
+                        peg['pegfile'] = pegfile
+                    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'] == '':
+                peg['pegfile'] = peg['files'][0]
+            pegtable.append(peg)
+
+        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 += '</tr>\n'
+        
+        for peg in pegtable:
+            if peg['status'] != '':
+                replace_str += '<tr class=\"'+peg['status']+'\">\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['author'] + '</td>\n'
+            replace_str += '\t<td>' + peg['stakeholders'] + '</td>\n'
+            replace_str += '\t<td>\n'
+            for file in peg['files']:
+                replace_str += '\t\t<a href=\"'+peg['dir']+'/'+file+'\">' \
+                               +file+'</a>\n'
+            replace_str += '\t<td>\n'
+            replace_str += '</tr>\n'
+
+        replace_str += '</table>\n'
+        pegboard_line = pegboard_line.replace(replace, replace_str)
+    pegboard.write(pegboard_line)
+pegboard.close()
+
+
+print fails
 
 
 




reply via email to

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