[svn r38763] overriding the new a_docref and a_apigenref Page helper methods,

getting rid of update_menubar_links

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-13 23:20:05 +01:00
parent 8efaf88364
commit f643f601c6
1 changed files with 16 additions and 11 deletions

View File

@ -27,19 +27,24 @@ class LayoutPage(confrest.PyPage):
def fill(self): def fill(self):
super(LayoutPage, self).fill() super(LayoutPage, self).fill()
self.update_menubar_links(self.menubar)
self.body.insert(0, self.nav) self.body.insert(0, self.nav)
def update_menubar_links(self, node): def _getdocrelpath(self, default="../py/doc"):
docrelpath = py.std.os.environ.get('APIGEN_DOCRELPATH', '../py/doc') docrel = py.std.os.environ.get("APIGEN_DOCRELPATH", default)
if not docrelpath.endswith('/'): return docrel.rstrip("/") + "/"
docrelpath += '/'
for item in node: def a_docref(self, name, relhtmlpath):
if not isinstance(item, py.xml.Tag): docrelpath = self._getdocrelpath()
continue relnew = self.relpath + docrelpath + relhtmlpath
if (item.__class__.__name__ == 'a' and hasattr(item.attr, 'href') return super(LayoutPage, self).a_docref(name, relnew)
and not item.attr.href.startswith('http://')):
item.attr.href = self.relpath + docrelpath + item.attr.href def a_apigenref(self, name, relhtmlpath):
# XXX the path construction is probably rather too complicated
# but i reused the same logic that was there
# before.
docrelpath = self._getdocrelpath()
relnew = self.relpath + docrelpath + relhtmlpath
return super(LayoutPage, self).a_apigenref(name, relnew)
def setup_scripts_styles(self, copyto=None): def setup_scripts_styles(self, copyto=None):
for path, name in self.stylesheets: for path, name in self.stylesheets: