#!/usr/bin/env python # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # # Copyright (C) 2005 Holger Hans Peter Freyther # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import optparse, os, sys # bitbake sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__), 'lib')) import bb import bb.parse from string import split, join __version__ = "0.0.2" class HTMLFormatter: """ Simple class to help to generate some sort of HTML files. It is quite inferior solution compared to docbook, gtkdoc, doxygen but it should work for now. We've a global introduction site (index.html) and then one site for the list of keys (alphabetical sorted) and one for the list of groups, one site for each key with links to the relations and groups. index.html all_keys.html all_groups.html groupNAME.html keyNAME.html """ def replace(self, text, *pairs): """ From pydoc... almost identical at least """ while pairs: (a, b) = pairs[0] text = join(split(text, a), b) pairs = pairs[1:] return text def escape(self, text): """ Escape string to be conform HTML """ return self.replace(text, ('&', '&'), ('<', '<' ), ('>', '>' ) ) def createNavigator(self): """ Create the navgiator """ return """
Home | Groups | Keys |
See also:
"
txts = []
for it in item.related():
txts.append("""%(it)s""" % vars() )
return txt + ",".join(txts)
def groups(self, item):
"""
Create HTML to link to related groups
"""
if len(item.groups()) == 0:
return ""
txt = "
See also:
"
txts = []
for group in item.groups():
txts.append( """%s """ % (group, group) )
return txt + ",".join(txts)
def createKeySite(self, item):
"""
Create a site for a key. It contains the header/navigator, a heading,
the description, links to related keys and to the groups.
"""
return """
%s
%s
%s
%s