[py-svn] r38144 - py/trunk/py/apigen

guido at codespeak.net guido at codespeak.net
Thu Feb 8 14:54:39 CET 2007


Author: guido
Date: Thu Feb  8 14:54:38 2007
New Revision: 38144

Modified:
   py/trunk/py/apigen/html.py
   py/trunk/py/apigen/linker.py
   py/trunk/py/apigen/style.css
Log:
Fixed a problem with the linker which on building api/source docs found matches
in its own source code, moved some elements in the apigen docs out of a header
where they shouldn't have been (making the font too large).


Modified: py/trunk/py/apigen/html.py
==============================================================================
--- py/trunk/py/apigen/html.py	(original)
+++ py/trunk/py/apigen/html.py	Thu Feb  8 14:54:38 2007
@@ -22,16 +22,17 @@
     class ClassDescription(Description):
         pass
 
-    class ClassDef(html.h1):
+    class ClassDef(html.div):
         def __init__(self, classname, bases, docstring, sourcelink,
                      properties, methods):
-            super(H.ClassDef, self).__init__('class %s(' % classname,)
+            header = H.h1('class %s(' % (classname,))
             for name, href in bases:
                 link = name
                 if href is not None:
                     link = H.a(name, href=href)
-                self.append(H.BaseDescription(link))
-            self.append('):')
+                header.append(H.BaseDescription(link))
+            header.append('):')
+            super(H.ClassDef, self).__init__(header)
             self.append(H.div(H.Docstring(docstring or
                                           '*no docstring available*'),
                               sourcelink,

Modified: py/trunk/py/apigen/linker.py
==============================================================================
--- py/trunk/py/apigen/linker.py	(original)
+++ py/trunk/py/apigen/linker.py	Thu Feb  8 14:54:38 2007
@@ -2,6 +2,12 @@
 import os
 html = py.xml.html
 
+# this here to serve two functions: first it makes the proto part of the temp
+# urls (see TempLinker) customizable easily (for tests and such) and second
+# it makes sure the temp links aren't replaced in generated source code etc.
+# for this file (and its tests) itself.
+TEMPLINK_PROTO = 'apigen.temp'
+
 def getrelfspath(dotted_name):
     # XXX need to make sure its imported on non-py lib 
     return eval(dotted_name, {"py": py})
@@ -58,20 +64,22 @@
         self._linkid2target = {}
 
     def get_lazyhref(self, linkid):
-        return 'apigen.linker://%s' % (linkid,)
+        return '%s://%s' % (TEMPLINK_PROTO, linkid)
 
     def set_link(self, linkid, target):
         assert linkid not in self._linkid2target
         self._linkid2target[linkid] = target
 
     def get_target(self, tempurl, fromlocation=None):
+        assert tempurl.startswith('%s://' % (TEMPLINK_PROTO,))
         linkid = '://'.join(tempurl.split('://')[1:])
         linktarget = self._linkid2target[linkid]
         if fromlocation is not None:
             linktarget = relpath(fromlocation, linktarget)
         return linktarget
 
-    _reg_tempurl = py.std.re.compile('"(apigen.linker:\/\/[^"\s]*)"')
+    _reg_tempurl = py.std.re.compile('["\'](%s:\/\/[^"\s]*)["\']' % (
+                                      TEMPLINK_PROTO,))
     def replace_dirpath(self, dirpath, stoponerrors=True):
         """ replace temporary links in all html files in dirpath and below """
         for fpath in dirpath.visit('*.html'):

Modified: py/trunk/py/apigen/style.css
==============================================================================
--- py/trunk/py/apigen/style.css	(original)
+++ py/trunk/py/apigen/style.css	Thu Feb  8 14:54:38 2007
@@ -34,10 +34,6 @@
   list-style-type: none;
 }
 
-.classdoc {
-  font-size: 0.8em;
-}
-
 .code a {
   color: blue;
   font-weight: bold;



More information about the pytest-commit mailing list