1 from __future__
import print_function
2 from __future__
import absolute_import
9 from .BeautifulSoup
import *
15 fileNameTemplate =
None 17 tableClassName =
'directory' 25 table = htmlPage.find(
'table', {
'class' : tableClassName})
26 for row
in table.findAll(
'tr'):
33 if 'style' in row: styleFlag =
True 35 if not styleFlag: firstLetter = row.findAll(
'td')[0].text[0].
upper()
37 if firstLetter
not in pages:
38 pages[firstLetter] = []
41 url = row.find(
'a')[
'href']
42 if '_cff' in url
or '_cfi' in url
or '_cfg' in url:
43 pages[firstLetter].
append(row)
45 pages[firstLetter].
append(row)
53 table = htmlPage.find(
'table', {
'class' : tableClassName})
54 for row
in table.findAll(
'tr'):
56 name = row.findAll(
'td')[0].text
58 name = name[name.find(
' '):name.find(
'/')].
strip()
60 if name
not in pages: pages[name] = []
66 itemTagMap = {}; tab =
'' 68 fn = fileNameTemplate % item.replace(
' ',
'')
69 if item != curr: tab +=
'<li><a href="%s">%s</a></li>' % (fn, item)
70 else: tab +=
'<li class="current"><a href="%s">%s</a></li>'%(fn, item)
71 return '<div class="%s"><ul class="tablist">%s</ul></div>' % (tabClass,tab)
73 if __name__ ==
"__main__":
75 sys.stderr.write(
"not enough parameter!\n")
79 htmlFullPath = sys.argv[1]
80 htmlFilePath = os.path.split(htmlFullPath)[0]
81 htmlFileName = os.path.split(htmlFullPath)[1]
82 fileNameTemplate = htmlFileName.replace(
'.html',
'_%s.html')
85 with open(htmlFullPath)
as f:
95 if htmlFileName ==
'packageDocumentation.html':
97 destTabClassName =
'tabs' 98 elif htmlFileName ==
'configfiles.html':
100 destTabClassName =
'tabs2' 103 destTabClassName =
'tabs2' 106 pageNames = pages.keys(); pageNames.sort()
107 for page
in pageNames:
108 allRows = allRows + pages[page]
109 pages[
'All'] = allRows
110 pageNames.append(
'All')
113 table = htmlPage.find(
'table', {
'class' : tableClassName})
115 for row
in table.findAll(
'tr'):
119 for page
in pageNames:
120 print(
'generating %s...' % (fileNameTemplate % page))
122 table = temp.find(
'table', {
'class' : tableClassName})
123 oldTab = temp.find(
'div', {
'class' : destTabClassName})
126 for row
in pages[page]:
130 page = page.replace(
' ',
'_')
131 with open(
'%s/%s'%(htmlFilePath, fileNameTemplate % page),
'w')
as f:
S & print(S &os, JobReport::InputFile const &f)
def extractPagesForPackage()
def extractPages(configFileFlag=False)
def generateTab(items, curr, tabClass='tabs3')