[py-svn] r38652 - in py/trunk/py/apigen: . testing
guido at codespeak.net
guido at codespeak.net
Tue Feb 13 02:01:25 CET 2007
Author: guido
Date: Tue Feb 13 02:01:23 2007
New Revision: 38652
Modified:
py/trunk/py/apigen/html.py
py/trunk/py/apigen/htmlgen.py
py/trunk/py/apigen/style.css
py/trunk/py/apigen/testing/test_htmlgen.py
py/trunk/py/apigen/todo.txt
Log:
Fixed rendering problems in IE, updated todo.txt.
Modified: py/trunk/py/apigen/html.py
==============================================================================
--- py/trunk/py/apigen/html.py (original)
+++ py/trunk/py/apigen/html.py Tue Feb 13 02:01:23 2007
@@ -134,22 +134,32 @@
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):
Modified: py/trunk/py/apigen/htmlgen.py
==============================================================================
--- py/trunk/py/apigen/htmlgen.py (original)
+++ py/trunk/py/apigen/htmlgen.py Tue Feb 13 02:01:23 2007
@@ -247,7 +247,7 @@
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
Modified: py/trunk/py/apigen/style.css
==============================================================================
--- py/trunk/py/apigen/style.css (original)
+++ py/trunk/py/apigen/style.css Tue Feb 13 02:01:23 2007
@@ -12,16 +12,25 @@
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 @@
text-decoration: underline;
}
+.codeblock {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
.code a {
color: blue;
font-weight: bold;
@@ -69,14 +83,20 @@
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 {
Modified: py/trunk/py/apigen/testing/test_htmlgen.py
==============================================================================
--- py/trunk/py/apigen/testing/test_htmlgen.py (original)
+++ py/trunk/py/apigen/testing/test_htmlgen.py Tue Feb 13 02:01:23 2007
@@ -65,56 +65,86 @@
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">"bar"</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">"""\\</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">"""</span>'
+ '</pre>'
'</td></tr>'
'</tbody>'
'</table>'
+ '</td>'
+ '</tr>'
+ '</tbody>'
+ '</table>'
'</div>')
def test_show_property():
Modified: py/trunk/py/apigen/todo.txt
==============================================================================
--- py/trunk/py/apigen/todo.txt (original)
+++ py/trunk/py/apigen/todo.txt Tue Feb 13 02:01:23 2007
@@ -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.
+
More information about the pytest-commit
mailing list