1 from BeautifulSoup
import *
9 def __init__(self, path, fileName, prefix):
26 file = open(path + fileName,
'r')
43 """This method returns footer of the input page"""
47 """This method returns content of the input page"""
51 f = open(self.
filePath + fileName,
"w")
65 return node.a.contents[0]
67 return node.b.contents[0]
72 if node.findAll(
"td", {
"class":
"desc"}):
73 return node.findAll(
"td", {
"class":
"desc"})[0].text
78 """This method returns true if it has link."""
79 if(node.a):
return True
83 """This method returns node link."""
87 """This method returns depth of the node. To determine this, '_' character is used."""
96 header =
'<div class="tabs3" align="center">\n<ul class="tablist">\n'
98 all_ =
'<li class="current"><a href="%s"><span>All</span></a></li>\n' % (self.
prefix +
'_ALL.html')
100 all_ =
'<li><a href="%s"><span>All</span></a></li>\n' % (self.
prefix +
'_ALL.html')
101 footer =
'</ul>\n</div>\n'
107 tab = tab +
u'<li><a href="%s"><span>%s</span></a></li>\n' % (
"%s%s.html" % (self.
prefix, i), i)
109 tab = tab +
u'<li class="current"><a href="%s"><span>%s</span></a></li>\n' % (
"%s%s.html" % (self.
prefix, current), i)
111 tab = tab + all_ + footer
113 return tab.encode(
"ascii")
116 """This method creates web page."""
121 data = data +
'<div class="contents"><table width="100%">'
124 data = data +
'<tr><td class="indexkey"><a class="el" href="%s">%s</a></td><td class="indexvalue">%s</td></tr>\n' % i
126 data = data +
'</table></div>'
136 for i
in self.parsedSource.keys():
150 tr = bs.findAll(
"tr", {})
195 if len(sys.argv) > 3:
200 print "pages are creating..."
203 print "Not enough parameters: file.py PATH FILE PREFIX"
204 print "Example: python Splitter.py CMSSW/doc/html/ annotated.html annotated_"
Splitter class is used for splitting class and namespace web pages to reduce access time...