CMS 3D CMS Logo

Functions | Variables

packageDocSplitter Namespace Reference

Functions

def addMenuToHeader
def addTagToPackageDoc
def createHTMLFiles
def extractList
def parseTagList

Variables

list filename = sys.argv[1]
tuple html = addMenuToHeader(html, "")
tuple output = open(PROJECT_PATH+filename, "w")
list PROJECT_PATH = sys.argv[2]
dictionary SUBSYSTEMS = {}
dictionary TAGLIST = {}
list tagList = sys.argv[2]

Detailed Description

Created on Oct 27, 2011

@author: MantYdze

Function Documentation

def packageDocSplitter::addMenuToHeader (   header,
  subsys 
)

Definition at line 75 of file packageDocSplitter.py.

00076                                    :
00077     menu  = "<div class=\"tabs3\">\n"
00078     menu += "<ul class=\"tablist\">\n"
00079     
00080     for subsystem in sorted(SUBSYSTEMS.keys()):
00081         current = ""
00082         if subsystem == subsys:
00083             current = " class=\"current\""
00084         menu += "<li"+current+"><a href=\"packageDocumentation_"+subsystem+".html\"><span>"+subsystem+"</span></a></li>\n"
00085     
00086     menu += "</ul>\n"
00087     menu += "</div>\n"
00088     
00089     soap = BeautifulSoup(header)
00090     div = soap.find("div", {"class":"tabs"})
00091     
00092     div.append(NavigableString(menu))
00093     
00094     return soap.renderContents()
    
def packageDocSplitter::addTagToPackageDoc (   line,
  subsystem,
  package 
)

Definition at line 24 of file packageDocSplitter.py.

00025                                                 :
00026     if (TAGLIST.has_key(subsystem+"/"+package)):
00027         tag = TAGLIST[subsystem+"/"+package]
00028     
00029         path = line[line.find("href=\"")+6:line.find("\">")]
00030         
00031         input = open(PROJECT_PATH+path, "r")
00032         source = input.read()
00033         input.close()
00034         
00035         output = open(PROJECT_PATH+path, "w")
00036         output.write(source.replace("@CVS_TAG@", tag).replace("Source code (CVS tag: @)", "Source code (CVS tag: "+tag+" )"))
00037         output.close()

def packageDocSplitter::createHTMLFiles (   header,
  footer,
  PROJECT_PATH 
)

Definition at line 95 of file packageDocSplitter.py.

00096                                                  :
00097     for subsystem in sorted(SUBSYSTEMS.keys()):
00098         html = addMenuToHeader(header, subsystem)
00099         html += "<ul>"
00100         
00101         for package in sorted(SUBSYSTEMS[subsystem].keys()):
00102             html+="<li>"+SUBSYSTEMS[subsystem][package]+"</li>"
00103         html+="</ul>"
00104         
00105         output = open(PROJECT_PATH+"packageDocumentation_"+subsystem+".html", "w")
00106         output.write(html)
00107         output.close()
00108         
        
def packageDocSplitter::extractList (   filename)

Definition at line 38 of file packageDocSplitter.py.

00039                          :
00040     input = open(filename, "r")
00041     source = input.read()
00042     input.close()
00043     
00044     header = ""
00045     headerFull = False
00046     footer = ""
00047     footerStarted = False
00048     
00049     lines = source.split("\n")
00050     
00051     for line in lines:
00052                 
00053         if (line.find("<li><a class=\"el\"") != -1) and (line.find("Package ") != -1):
00054             headerFull = True
00055             title = line[line.find("Package ")+8:-4]
00056             subsystem = title.split("/")[0]
00057             package = "/".join(title.split("/")[1:])
00058             if not SUBSYSTEMS.has_key(subsystem):
00059                 SUBSYSTEMS[subsystem] = {}
00060             SUBSYSTEMS[subsystem][package] = line.replace("<li>","")
00061             
00062             addTagToPackageDoc(line, subsystem, package)
00063         
00064         if not headerFull:
00065             header += line+"\n"
00066         
00067         if line.find("<hr class=\"footer\"/>") != -1:
00068             footerStarted = True
00069         
00070         if footerStarted:
00071             footer += line+"\n"
00072 
00073     return header, footer, source
00074 

def packageDocSplitter::parseTagList (   tagList)

Definition at line 12 of file packageDocSplitter.py.

00013                          :
00014     input = open(tagList, "r")
00015     source = input.read()
00016     input.close()
00017     lines = source.split("\n")
00018     
00019     for line in lines[4:-3]:        
00020         items = line.strip().split(" ")
00021         package = items[0]
00022         tag = items[-1]
00023         TAGLIST[package] = tag
        

Variable Documentation

list packageDocSplitter::filename = sys.argv[1]

Definition at line 110 of file packageDocSplitter.py.

tuple packageDocSplitter::html = addMenuToHeader(html, "")

Definition at line 117 of file packageDocSplitter.py.

Definition at line 118 of file packageDocSplitter.py.

Definition at line 111 of file packageDocSplitter.py.

Definition at line 9 of file packageDocSplitter.py.

dictionary packageDocSplitter::TAGLIST = {}

Definition at line 10 of file packageDocSplitter.py.

list packageDocSplitter::tagList = sys.argv[2]

Definition at line 112 of file packageDocSplitter.py.