CMS 3D CMS Logo

Functions
TableParser Namespace Reference

Functions

def extractPages (configFileFlag=False)
 
def extractPagesForPackage ()
 
def generateTab (items, curr, tabClass='tabs3')
 

Function Documentation

def TableParser.extractPages (   configFileFlag = False)

Definition at line 21 of file TableParser.py.

References mps_setup.append, and pileupCalc.upper.

Referenced by generateTab().

21 def extractPages(configFileFlag = False):
22  # initial page, A
23  pages = {'A':[]}
24  # find all class/namespace talbe rows.
25  table = htmlPage.find('table', {'class' : tableClassName})
26  for row in table.findAll('tr'):
27  # please see the related html file (annotated.html) to understand the
28  # approach here. you will see that, only hidden rows have style
29  # attribute and these hidden rows must be added to pages of their
30  # parents. This is why we need to check whether row has a style
31  # attribute or not.
32  styleFlag = False
33  if 'style' in row: styleFlag = True
34  # change the first letter if row is not hidden (child) one
35  if not styleFlag: firstLetter = row.findAll('td')[0].text[0].upper()
36  # if pages dict doesn't have the page yet..
37  if firstLetter not in pages:
38  pages[firstLetter] = []
39  # insert the row into the related page
40  if configFileFlag:
41  url = row.find('a')['href']
42  if '_cff' in url or '_cfi' in url or '_cfg' in url:
43  pages[firstLetter].append(row)
44  else:
45  pages[firstLetter].append(row)
46  return pages
47 
48 # load rows from the package documentation page. output structure:
49 # pages = {'PackageA' : [..], 'PackageB' : [...]}
def extractPages(configFileFlag=False)
Definition: TableParser.py:21
def TableParser.extractPagesForPackage ( )

Definition at line 50 of file TableParser.py.

References mps_setup.append, and digitizers_cfi.strip.

Referenced by generateTab().

51  # initial page, A
52  pages = {}
53  table = htmlPage.find('table', {'class' : tableClassName})
54  for row in table.findAll('tr'):
55  # first cell contains name of the package...
56  name = row.findAll('td')[0].text
57  # parse package names --please have a look at the pages.html file
58  name = name[name.find(' '):name.find('/')].strip()
59  # if the package is not added yet
60  if name not in pages: pages[name] = []
61  pages[name].append(row)
62  return pages
63 
64 # generate alphabetic tab for html pages that will be generated by this script
def extractPagesForPackage()
Definition: TableParser.py:50
def TableParser.generateTab (   items,
  curr,
  tabClass = 'tabs3' 
)

Definition at line 65 of file TableParser.py.

References extractPages(), extractPagesForPackage(), edm.print(), and str.

65 def generateTab(items, curr, tabClass = 'tabs3'):
66  itemTagMap = {}; tab = ''
67  for item in items:
68  fn = fileNameTemplate % item.replace(' ', '') # generate file name
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)
72 
def generateTab(items, curr, tabClass='tabs3')
Definition: TableParser.py:65