[svn r38652] Fixed rendering problems in IE, updated todo.txt.

--HG--
branch : trunk
This commit is contained in:
guido 2007-02-13 02:01:23 +01:00
parent cb8041a34a
commit 63c2a8f62f
5 changed files with 100 additions and 25 deletions

View File

@ -134,22 +134,32 @@ class H(html):
super(H.PythonSource, self).__init__(
H.div(*sourceels))
class SourceBlock(html.div):
style = html.Style(margin_top='1em', margin_bottom='1em')
class SourceBlock(html.table):
def __init__(self):
self.linenotable = lntable = H.table(style='float: left')
tbody = H.tbody()
row = H.tr()
tbody.append(row)
linenocell = H.td(style='width: 1%')
row.append(linenocell)
linecell = H.td()
row.append(linecell)
self.linenotable = lntable = H.table()
self.linenotbody = lntbody = H.tbody()
lntable.append(lntbody)
linenocell.append(lntable)
self.linetable = ltable = H.table()
self.linetbody = ltbody = H.tbody()
ltable.append(ltbody)
super(H.SourceBlock, self).__init__(lntable, ltable)
linecell.append(ltable)
super(H.SourceBlock, self).__init__(tbody, class_='codeblock')
def add_line(self, lineno, els):
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(H.pre(class_='code', *els),
class_='codecell')))
class NonPythonSource(Content):
def __init__(self, *args):

View File

@ -247,7 +247,7 @@ class SourcePageBuilder(AbstractPageBuilder):
enc = source_html.get_module_encoding(fspath.strpath)
source = fspath.read()
sep = get_linesep(source)
colored = enumerate_and_color(source.split(sep), 0, enc)
colored = [enumerate_and_color(source.split(sep), 0, enc)]
tag = H.PythonSource(colored)
nav = self.build_navigation(fspath)
return tag, nav

View File

@ -12,16 +12,25 @@ div.sidebar {
font-size: 0.9em;
width: 155px;
vertical-align: top;
margin-top: 0.5em;
position: absolute;
position: fixed;
top: 130px;
left: 4px;
bottom: 4px;
overflow: auto;
}
div.sidebar .selected a {
/* trick to not make IE ignore something (>) */
body > .sidebar {
position: fixed;
}
div.sidebar a, div.sidebar a:visited, div.sidebar a:hover {
color: blue;
text-decoration: none;
}
div.sidebar .selected a, div.sidebar .selected a:visited,
div.sidebar .selected a:hover {
color: white;
background-color: #3ba6ec;
}
@ -52,6 +61,11 @@ h2.funcdef:hover {
text-decoration: underline;
}
.codeblock {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.code a {
color: blue;
font-weight: bold;
@ -69,14 +83,20 @@ h2.funcdef:hover {
border-right-width: 1px;
}
.code {
.codecell {
line-height: 1.4em;
height: 1.4em;
padding-left: 1em;
white-space: pre;
}
pre.code {
line-height: 1.3em;
height: 1.3em;
background-color: white;
margin: 0px;
padding: 0px;
border: 0px;
font-family: monospace, Monaco;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.comment {

View File

@ -65,56 +65,86 @@ def test_deindent():
def test_enumerate_and_color():
colored = htmlgen.enumerate_and_color(['def foo():', ' print "bar"'], 0,
'ascii')
div = py.xml.html.div(*colored).unicode(indent=0)
div = py.xml.html.div(colored).unicode(indent=0)
print repr(div)
assert_eq_string(div,
assert_eq_string(div,
u'<div>'
'<table style="float: left">'
'<table class="codeblock">'
'<tbody>'
'<tr>'
'<td style="width: 1%">'
'<table>'
'<tbody>'
'<tr><td class="lineno">1</td></tr>'
'<tr><td class="lineno">2</td></tr>'
'</tbody>'
'</table>'
'</td>'
'<td>'
'<table>'
'<tbody>'
'<tr><td class="code">'
'<tr><td class="codecell">'
'<pre class="code">'
'<span class="alt_keyword">def</span> foo():'
'</pre>'
'</td></tr>'
'<tr><td class="code">'
'<tr><td class="codecell">'
'<pre class="code">'
' <span class="alt_keyword">print</span>'
' <span class="string">&quot;bar&quot;</span>'
'</pre>'
'</td></tr>'
'</tbody>'
'</table>'
'</td>'
'</tr>'
'</tbody>'
'</table>'
'</div>')
def test_enumerate_and_color_multiline():
colored = htmlgen.enumerate_and_color(['code = """\\', 'foo bar', '"""'],
0, 'ascii')
div = py.xml.html.div(*colored).unicode(indent=0)
div = py.xml.html.div(colored).unicode(indent=0)
print repr(div)
assert_eq_string (div,
assert_eq_string (div,
u'<div>'
'<table style="float: left">'
'<table class="codeblock">'
'<tbody>'
'<tr>'
'<td style="width: 1%">'
'<table>'
'<tbody>'
'<tr><td class="lineno">1</td></tr>'
'<tr><td class="lineno">2</td></tr>'
'<tr><td class="lineno">3</td></tr>'
'</tbody>'
'</table>'
'</td>'
'<td>'
'<table>'
'<tbody>'
'<tr><td class="code">'
'<tr><td class="codecell">'
'<pre class="code">'
'code = <span class="string">&quot;&quot;&quot;\\</span>'
'</pre>'
'</td></tr>'
'<tr><td class="code">'
'<tr><td class="codecell">'
'<pre class="code">'
'<span class="string">foo bar</span>'
'</pre>'
'</td></tr>'
'<tr><td class="code">'
'<tr><td class="codecell">'
'<pre class="code">'
'<span class="string">&quot;&quot;&quot;</span>'
'</pre>'
'</td></tr>'
'</tbody>'
'</table>'
'</td>'
'</tr>'
'</tbody>'
'</table>'
'</div>')
def test_show_property():

View File

@ -15,6 +15,12 @@
* get konqueror to display indents in source code better?
(currently it doesn't look like more than a single space)
Hrmph, fonts look just fine to me :( what machine is this (new laptop btw?)?
you seem to have a font problem... If you really want me to fix it for your
machine, please give me access...
I also made sure IE looks (somewhat) good...
* function view:
def __init__(self, rawcode):
@ -44,3 +50,12 @@
note that both relpath's are related to how we map docs and
apigen into the URL namespace.
Currently handled by using an env var (APIGEN_DOCRELPATH), since
to make it possible to run py.test --apigen on the full py lib _and_
set the option, it would have to be global (yuck), and apigen used
an env var already anyway... Of course it can easily be changed to an
option if you like that better...
There's now also a script bin/_docgen.py that runs all the tests
and builds the py lib docs + api ones in one go.