1 from BeautifulSoup
import *
10 def __init__(self, path, outputFile, prefix = "configfilesList_"):
23 """This method reads file directly or from path."""
25 print "Read:", self.
path + fileName
26 f = open(self.
path + fileName)
28 f = open(os.path.split(__file__)[0] +
'/' + fileName)
29 print "Read:", fileName
35 """This method writes data"""
36 print "Write:", self.
path + fileName
37 f = open(self.
path + fileName,
"w")
44 contents = soup.find(
"div", {
"class" :
"contents" })
45 navBar = soup.find(
"div", {
"id" :
"navrow2",
"class" :
"tabs2"})
46 for child
in contents.findChildren():
51 print "Template created..."
62 contents = soup.find(
"div", {
"class" :
"contents" })
63 td = contents.findAll(
"td", {})
67 if i.a
and self.
Check(i.a.text):
68 if not self.data.has_key(i.a.text[0].
upper()):
70 self.
data[i.a.text[0].
upper()][i.a.text] = i.a[
"href"]
71 parsedITemCounter += 1
72 print "Config files parsed(%d)..." % parsedITemCounter
75 tabHTML =
'<div class="tabs3">\n<ul class="tablist">\n'
76 keys = self.data.keys()
80 tabHTML +=
'<li class="current"><a href="%s"><span>%s</span></a></li>\n' % (
'#', i)
82 tabHTML +=
'<li><a href="%s"><span>%s</span></a></li>\n' % (self.
FileName(i), i)
83 tabHTML +=
'</ul>\n</div>\n'
87 tableHTML =
'<table width="100%">\n<tbody>\n'
89 tableHTML +=
'<tr><td class="indexkey"><a class="el" href="%s"> %s </a></td><td class="indexvalue"></td></tr>' % (self.
data[current][i], i)
90 tableHTML +=
'</tbody>\n</table>\n'
94 return self.
prefix + current +
".html"
100 keys = self.data.keys()
106 if i ==
'A': self.
WriteFile(
'configfiles.html', page)
109 if len(sys.argv) == 3:
115 l.CreateConfigFilePage()
117 print "parameter error. It must be like this: python ConfigFiles.py CMSSW/doc/html/ output.html"
def __init__
Constructor method.
ConfigFiles class is used for generating 'config files' html page.