[svn r38246] Fixed problems with line height in sources, added missing commas to seperate

base classes, added all Python (2.5) keywords.

--HG--
branch : trunk
This commit is contained in:
guido 2007-02-09 14:01:08 +01:00
parent d2f11081cb
commit 73281adc5a
3 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,6 @@
from py.xml import html import py
html = py.xml.html
# HTML related stuff # HTML related stuff
class H(html): class H(html):
@ -26,7 +27,9 @@ class H(html):
def __init__(self, classname, bases, docstring, sourcelink, def __init__(self, classname, bases, docstring, sourcelink,
properties, methods): properties, methods):
header = H.h1('class %s(' % (classname,)) 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 link = name
if href is not None: if href is not None:
link = H.a(name, href=href) link = H.a(name, href=href)
@ -132,8 +135,6 @@ class H(html):
super(H.SourceBlock, self).__init__(lntable, ltable) super(H.SourceBlock, self).__init__(lntable, ltable)
def add_line(self, lineno, els): def add_line(self, lineno, els):
if els == []:
els = [u'\xa0']
self.linenotbody.append(H.tr(H.td(lineno, class_='lineno'))) self.linenotbody.append(H.tr(H.td(lineno, class_='lineno')))
self.linetbody.append(H.tr(H.td(class_='code', *els))) self.linetbody.append(H.tr(H.td(class_='code', *els)))

View File

@ -7,11 +7,11 @@ class PythonSchema(object):
comment = [('#', '\n'), ('#', '$')] comment = [('#', '\n'), ('#', '$')]
multiline_string = ['"""', "'''"] multiline_string = ['"""', "'''"]
string = ['"""', "'''", '"', "'"] string = ['"""', "'''", '"', "'"]
# XXX not complete keyword = ['and', 'break', 'continue', 'elif', 'else', 'except',
keyword = ['for', 'if', 'not', 'then', 'else', 'while', 'from', 'import', 'finally', 'for', 'if', 'in', 'is', 'not', 'or', 'raise',
'try', 'except', 'finally', 'raise', 'print', 'exec', 'eval', 'return', 'try', 'while', 'with', 'yield']
'break', 'in', 'assert', 'None'] alt_keyword = ['as', 'assert', 'class', 'def', 'del', 'exec', 'from',
alt_keyword = ['def', 'class', 'return', 'pass', 'yield'] 'global', 'import', 'lambda', 'pass', 'print']
class Token(object): class Token(object):
data = None data = None

View File

@ -41,6 +41,7 @@ ul li {
} }
.lineno { .lineno {
line-height: 1.4em;
text-align: right; text-align: right;
color: #555; color: #555;
width: 3em; width: 3em;
@ -50,6 +51,7 @@ ul li {
} }
.code { .code {
line-height: 1.4em;
padding-left: 1em; padding-left: 1em;
white-space: pre; white-space: pre;
font-family: monospace, Monaco; font-family: monospace, Monaco;