[py-svn] r38246 - in py/trunk/py/apigen: . source

guido at codespeak.net guido at codespeak.net
Fri Feb 9 14:01:12 CET 2007


Author: guido
Date: Fri Feb  9 14:01:08 2007
New Revision: 38246

Modified:
   py/trunk/py/apigen/html.py
   py/trunk/py/apigen/source/color.py
   py/trunk/py/apigen/style.css
Log:
Fixed problems with line height in sources, added missing commas to seperate
base classes, added all Python (2.5) keywords.


Modified: py/trunk/py/apigen/html.py
==============================================================================
--- py/trunk/py/apigen/html.py	(original)
+++ py/trunk/py/apigen/html.py	Fri Feb  9 14:01:08 2007
@@ -1,5 +1,6 @@
 
-from py.xml import html
+import py
+html = py.xml.html
 
 # HTML related stuff
 class H(html):
@@ -26,7 +27,9 @@
         def __init__(self, classname, bases, docstring, sourcelink,
                      properties, methods):
             header = H.h1('class %s(' % (classname,))
-            for name, href in bases:
+            for i, (name, href) in py.builtin.enumerate(bases):
+                if i > 0:
+                    header.append(', ')
                 link = name
                 if href is not None:
                     link = H.a(name, href=href)
@@ -132,8 +135,6 @@
             super(H.SourceBlock, self).__init__(lntable, ltable)
 
         def add_line(self, lineno, els):
-            if els == []:
-                els = [u'\xa0']
             self.linenotbody.append(H.tr(H.td(lineno, class_='lineno')))
             self.linetbody.append(H.tr(H.td(class_='code', *els)))
 

Modified: py/trunk/py/apigen/source/color.py
==============================================================================
--- py/trunk/py/apigen/source/color.py	(original)
+++ py/trunk/py/apigen/source/color.py	Fri Feb  9 14:01:08 2007
@@ -7,11 +7,11 @@
     comment = [('#', '\n'), ('#', '$')]
     multiline_string = ['"""', "'''"]
     string = ['"""', "'''", '"', "'"]
-    # XXX not complete
-    keyword = ['for', 'if', 'not', 'then', 'else', 'while', 'from', 'import',
-               'try', 'except', 'finally', 'raise', 'print', 'exec', 'eval',
-               'break', 'in', 'assert', 'None']
-    alt_keyword = ['def', 'class', 'return', 'pass', 'yield']
+    keyword = ['and', 'break', 'continue', 'elif', 'else', 'except',
+               'finally', 'for', 'if', 'in', 'is', 'not', 'or', 'raise',
+               'return', 'try', 'while', 'with', 'yield']
+    alt_keyword = ['as', 'assert', 'class', 'def', 'del', 'exec', 'from',
+                   'global', 'import', 'lambda', 'pass', 'print']
 
 class Token(object):
     data = None

Modified: py/trunk/py/apigen/style.css
==============================================================================
--- py/trunk/py/apigen/style.css	(original)
+++ py/trunk/py/apigen/style.css	Fri Feb  9 14:01:08 2007
@@ -41,6 +41,7 @@
 }
 
 .lineno {
+  line-height: 1.4em;
   text-align: right;
   color: #555;
   width: 3em;
@@ -50,6 +51,7 @@
 }
 
 .code {
+  line-height: 1.4em;
   padding-left: 1em;
   white-space: pre;
   font-family: monospace, Monaco;



More information about the pytest-commit mailing list