From 46f8c56c9b5e135961582e131cf3c95d124af531 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 8 Feb 2007 14:54:38 +0100 Subject: [PATCH] [svn r38144] 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). --HG-- branch : trunk --- py/apigen/html.py | 9 +++++---- py/apigen/linker.py | 12 ++++++++++-- py/apigen/style.css | 4 ---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/py/apigen/html.py b/py/apigen/html.py index de0aee9f7..be27fbcd9 100644 --- a/py/apigen/html.py +++ b/py/apigen/html.py @@ -22,16 +22,17 @@ class H(html): 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, diff --git a/py/apigen/linker.py b/py/apigen/linker.py index 6930441b3..9655467e5 100644 --- a/py/apigen/linker.py +++ b/py/apigen/linker.py @@ -2,6 +2,12 @@ import py 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 @@ class TempLinker(object): 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'): diff --git a/py/apigen/style.css b/py/apigen/style.css index cc5366e29..65b2bc303 100644 --- a/py/apigen/style.css +++ b/py/apigen/style.css @@ -34,10 +34,6 @@ ul li { list-style-type: none; } -.classdoc { - font-size: 0.8em; -} - .code a { color: blue; font-weight: bold;