[py-svn] r35333 - py/dist/py/apigen/source
fijal at codespeak.net
fijal at codespeak.net
Tue Dec 5 20:45:12 CET 2006
Author: fijal
Date: Tue Dec 5 20:45:11 2006
New Revision: 35333
Modified:
py/dist/py/apigen/source/html.py
Log:
Fixed style a bit.
Modified: py/dist/py/apigen/source/html.py
==============================================================================
--- py/dist/py/apigen/source/html.py (original)
+++ py/dist/py/apigen/source/html.py Tue Dec 5 20:45:11 2006
@@ -7,7 +7,7 @@
from py.__.apigen.source.color import Tokenizer, PythonSchema
class HtmlEnchanter(object):
- reserved_words = {}
+ reserved_words = ['if', 'for', 'return', 'yield']
def __init__(self, mod):
self.mod = mod
@@ -20,13 +20,6 @@
linecache[item.firstlineno] = item
self.linecache = linecache
- def colors(self, text):
- words = text.split()
- for num, word in enumerate(words):
- if word in self.reserved_words:
- pass
- return [text]
-
def enchant_row(self, num, row):
# add some informations to row, like functions defined in that
# line, etc.
@@ -37,21 +30,11 @@
pos = row.find(item.name)
assert pos != -1
end = len(item.name) + pos
- chunk = [html.a(row[pos:end], href="#" + item.name,
- name=item.name)]
- return self.colors(row[:pos]) + chunk + self.colors(row[end:])
+ chunk = html.a(row[pos:end], href="#" + item.name,
+ name=item.name)
+ return [row[:pos], chunk, row[end:]]
except KeyError:
- return self.colors(row) # no more info
-
-def make_code(lst):
- # I HATE HTML, I HATE HTML
- output = []
- for elem in lst:
- if isinstance(elem, str):
- output.append(html.code(elem))
- else:
- output.append(elem)
- return output
+ return [row] # no more info
class HTMLDocument(object):
def __init__(self, tokenizer=None):
@@ -72,7 +55,7 @@
html.title('source view'),
html.style("""
body, td {
- background-color: #FFC;
+ background-color: #FFF;
color: black;
font-family: monospace;
}
@@ -85,18 +68,23 @@
a {
color: blue;
+ font-weight: bold;
text-decoration: none;
}
+ a:hover {
+ color: #005;
+ }
+
.lineno {
text-align: right;
- color: blue;
+ color: #555;
width: 3em;
padding-right: 1em;
border: 0px solid black;
border-right-width: 1px;
}
-
+
.code {
padding-left: 1em;
white-space: pre;
@@ -107,7 +95,7 @@
}
.string {
- color: red;
+ color: #777;
}
.keyword {
More information about the py-svn
mailing list