32 lines
691 B
Python
32 lines
691 B
Python
#! /usr/bin/python
|
|
#-- coding: GBK --
|
|
import sys,os,string
|
|
|
|
def is_embeded( html, code ):
|
|
return html.rfind( code ) >= 0
|
|
|
|
|
|
def embed_uml_to_html( ):
|
|
fhtml = "asdoc-output/package-summary.html"
|
|
embedcode = "<img src=\"yyuml.jpg\"/>"
|
|
htmlContent = ""
|
|
|
|
try:
|
|
fl = open( fhtml, "r" )
|
|
htmlContent = fl.read( );
|
|
fl.close()
|
|
except IOError as e:
|
|
print fhtml + e.strerror;
|
|
return
|
|
|
|
if not is_embeded( htmlContent, embedcode ):
|
|
if htmlContent.find( "<center" ) >= 0:
|
|
htmlContent = htmlContent.replace( "<center", embedcode + "<center" )
|
|
fl = open( fhtml, "w" )
|
|
fl.write(htmlContent);
|
|
print "success!"
|
|
fl.close()
|
|
|
|
if __name__ == "__main__":
|
|
embed_uml_to_html()
|
|
|