def _(p): yield T.td[T.a(href='../' * self.context.depth + 'packages/%s.html' % p.pkgname)[p.name]] for rn in ggi.releaseNames: if rn in p.releases: yield T.td[T.a( href='%s/%s/index.html' % (p.pkgname, p.releases[rn]))[p.releases[rn]]] else: yield T.td['']
def ggirole_default(self, node): token = node.astext() if hasattr(self.root, 'manpage') and token in self.root.manpage.pages: return T.span(_class='function')[token] cand = self.context.findTerm(token) if not cand: return T.span(_class='default')[self.children(node)] if cand[0].type == 'man': c = cand[0] href = 'documentation/%s/%s/%s.%s.html' % (c.pkgname, c.branch, c.entry, c.volume) return T.a(_class='manpage', href='../' * self.context.depth + href)['%s(%s)' % (token, c.volume)] else: return T.a(_class='term')[self.children(node)]
def ggirole_man(self, node): cand = self.context.findPage(node.manref[0], node.manref[1]) if cand: c = cand[0] href = 'documentation/%s/%s/%s.%s.html' % (c.pkgname, c.branch, c.entry, c.volume) return T.a(_class='manpage', href='../' * self.context.depth + href)['%s(%s)' % (node.manref[0], c.volume)] return T.span(_class='manpage')[self.children(node)]
def node_section(self, node): name = node.get('id', None) tnode = get_children(node)[0] title = tnode.astext() if name is None: name = '-'.join(title.lower().split()) if name[0] in '0123456789': name = '_' + name for i in "':?!/,;.&()[]": name = name.replace(i, '-') yield self.sectionTag[self.sectionLevel](id=name)[T.a( name=name)[self.children(tnode)]] self.sectionLevel += 1 yield T.div(_class='section-%i' % self.sectionLevel)[self.children(node)] self.sectionLevel -= 1
def _(): for i in 'https://', 'ftp://', 'http://': if href.startswith(i): return T.a(href=href, _class='external')[node.astext(), T.span[u'\u25B8']] return T.a(href=href)[node.astext()] # ,T.span[u'\u25C2']]
def getUp(self): n = self.context.navigation.up if n: return T.a(href=n)['up'] return 'up'
def getNext(self): n = self.context.navigation.next if n: return T.a(href=n)['next'] return 'next'
def getPrev(self): n = self.context.navigation.prev if n: return T.a(href=n)['prev'] return 'prev'