[qooxdoo-commit] SF.net SVN: qooxdoo: [6564] trunk/qooxdoo/frontend/framework/tool/make/ makefile_d
Brought to you by:
ecker,
martinwittemann
From: <th...@us...> - 2007-02-28 15:25:47
|
Revision: 6564 http://svn.sourceforge.net/qooxdoo/?rev=6564&view=rev Author: thron7 Date: 2007-02-28 07:25:44 -0800 (Wed, 28 Feb 2007) Log Message: ----------- Set indent width to 4. - Minor comment change. Modified Paths: -------------- trunk/qooxdoo/frontend/framework/tool/make/makefile_doc.py Modified: trunk/qooxdoo/frontend/framework/tool/make/makefile_doc.py =================================================================== --- trunk/qooxdoo/frontend/framework/tool/make/makefile_doc.py 2007-02-28 15:18:46 UTC (rev 6563) +++ trunk/qooxdoo/frontend/framework/tool/make/makefile_doc.py 2007-02-28 15:25:44 UTC (rev 6564) @@ -56,7 +56,7 @@ # # # EXAMPLES -# python makefile_doc.py application.mk | xsltproc makefile_doc.xsl > mak.out +# python makefile_doc.py application.mk | xsltproc makefile_doc.xsl - > mak.out # # # CAVEATES @@ -78,114 +78,114 @@ # - Makefile Parser ------------------------------------------------------- def main(): - impl = xml.dom.minidom.getDOMImplementation() - newdoc = impl.createDocument(None,"mak",None) - topEl = newdoc.documentElement - curr = topEl - file_name = sys.argv[1] - in_comment= 0 - in_ptitle = 0 - f = open(file_name,'r') - for line in f: - line1 = line.rstrip() - if comment.search(line1): - if (not in_comment): - in_comment=1 - if re.search(r'^#{60,}$',line1): # its a part title - if (not in_ptitle): - in_ptitle = 1 - e=newdoc.createElement("part") - topEl.appendChild(e) - de=newdoc.createElement("title") - e.appendChild(de) - curr = e - first_sect = 1 - else: # exit part title - in_ptitle = 0 - else: # its a section descr - if first_sect: - first_sect = 0 - else: - curr = curr.parentNode # leave previous section - e=newdoc.createElement("section") - curr.appendChild(e) - de=newdoc.createElement("descr") - e.appendChild(de) - curr=e - line1 = line1.replace('#','') - if len(line1) > 0: - t=newdoc.createTextNode(line1) - de.appendChild(t) - else: - in_comment=0 - in_ptitle =0 - if include.search(line1): # handle include's - e=newdoc.createElement("incl") - t=newdoc.createTextNode(line1.partition("include ")[2]) - e.appendChild(t) - curr.appendChild(e) - elif var.search(line1): # handle var's - mo = var.search(line1) - s= mo.group(1)+mo.group(2)+"\t(default:"+mo.group(3)+")" - v=newdoc.createElement("var") - curr.appendChild(v) - n=newdoc.createElement("name") - v.appendChild(n) - t=newdoc.createTextNode(mo.group(2)) - n.appendChild(t) - d=newdoc.createElement("default") - v.appendChild(d) - t=newdoc.createTextNode(mo.group(3)) - d.appendChild(t) - f.close() - topEl.writexml(sys.stdout) - #print topEl.toprettyxml(" ") - #output(topEl) + impl = xml.dom.minidom.getDOMImplementation() + newdoc = impl.createDocument(None,"mak",None) + topEl = newdoc.documentElement + curr = topEl + file_name = sys.argv[1] + in_comment= 0 + in_ptitle = 0 + f = open(file_name,'r') + for line in f: + line1 = line.rstrip() + if comment.search(line1): + if (not in_comment): + in_comment=1 + if re.search(r'^#{60,}$',line1): # its a part title + if (not in_ptitle): + in_ptitle = 1 + e=newdoc.createElement("part") + topEl.appendChild(e) + de=newdoc.createElement("title") + e.appendChild(de) + curr = e + first_sect = 1 + else: # exit part title + in_ptitle = 0 + else: # its a section descr + if first_sect: + first_sect = 0 + else: + curr = curr.parentNode # leave previous section + e=newdoc.createElement("section") + curr.appendChild(e) + de=newdoc.createElement("descr") + e.appendChild(de) + curr=e + line1 = line1.replace('#','') + if len(line1) > 0: + t=newdoc.createTextNode(line1) + de.appendChild(t) + else: + in_comment=0 + in_ptitle =0 + if include.search(line1): # handle include's + e=newdoc.createElement("incl") + t=newdoc.createTextNode(line1.partition("include ")[2]) + e.appendChild(t) + curr.appendChild(e) + elif var.search(line1): # handle var's + mo = var.search(line1) + s= mo.group(1)+mo.group(2)+"\t(default:"+mo.group(3)+")" + v=newdoc.createElement("var") + curr.appendChild(v) + n=newdoc.createElement("name") + v.appendChild(n) + t=newdoc.createTextNode(mo.group(2)) + n.appendChild(t) + d=newdoc.createElement("default") + v.appendChild(d) + t=newdoc.createTextNode(mo.group(3)) + d.appendChild(t) + f.close() + topEl.writexml(sys.stdout) + #print topEl.toprettyxml(" ") + #output(topEl) # - Output Control ------------------------------------------------------- def output(topEl): - if (topEl.hasChildNodes()): - for child in topEl.childNodes: - curr = child.tagName - if (curr == "section"): - output_sec() - output(curr) - elif (curr == "part"): - output_part(child) - elif (curr == "var"): - output_var(curr) - elif (curr == "descr"): - output_desc() + if (topEl.hasChildNodes()): + for child in topEl.childNodes: + curr = child.tagName + if (curr == "section"): + output_sec() + output(curr) + elif (curr == "part"): + output_part(child) + elif (curr == "var"): + output_var(curr) + elif (curr == "descr"): + output_desc() def output_part(part): - global first_part - if first_part: - first_part = 0 - return - partname = part.firstChild.firstChild.nodeValue - print "===== ", partname, " =====" - print - #output(part.rest_of_part_without_title) + global first_part + if first_part: + first_part = 0 + return + partname = part.firstChild.firstChild.nodeValue + print "===== ", partname, " =====" + print + #output(part.rest_of_part_without_title) def output_sec(sec): - secname = sec.descr - print "===== ", secname, " =====" - print + secname = sec.descr + print "===== ", secname, " =====" + print def output_var(var): - varname = var.name # geht nicht! <var><name> - print "==== ", varname, " ====" - print - default = var.default - print "[default: \"",default,"\"" + varname = var.name # geht nicht! <var><name> + print "==== ", varname, " ====" + print + default = var.default + print "[default: \"",default,"\"" def output_desc(desc): - text = desc.innerHtml # stimmt bestimmt nicht! - print text - print + text = desc.innerHtml # stimmt bestimmt nicht! + print text + print # - Main ----------------------------------------------------------------- if __name__ == "__main__": - main() + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |