From: Fred L. D. <fd...@us...> - 2002-03-26 05:34:39
|
Update of /cvsroot/ht2html/ht2html In directory usw-pr-cvs1:/tmp/cvs-serv30276 Modified Files: Skeleton.py Log Message: More minor changes to the stylesheet support. Figure out the stylesheet language, since some browsers are starting to support XSLT. Index: Skeleton.py =================================================================== RCS file: /cvsroot/ht2html/ht2html/Skeleton.py,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** Skeleton.py 26 Mar 2002 05:18:15 -0000 2.3 --- Skeleton.py 26 Mar 2002 05:34:36 -0000 2.4 *************** *** 7,10 **** --- 7,11 ---- from ht2html import __version__ + import os import sys import time *************** *** 140,147 **** def get_style(self): """Return the style sheet for this document""" ! return 'body { %s }\n' % self.body_style() def body_style(self): ! return 'margin:0;' # Call this method --- 141,156 ---- def get_style(self): """Return the style sheet for this document""" ! s = self.body_style() ! if s: ! return 'body { %s }' % self.body_style() ! else: ! return '' def body_style(self): ! if self.get_stylesheet(): ! # If there's an external stylesheet, rely on that for the body. ! return '' ! else: ! return 'margin: 0px;' # Call this method *************** *** 271,276 **** s = '' if stylesheet and stylesheet.strip(): ! s = '<LINK REL="STYLESHEET" HREF="%s" TYPE="text/css">' \ ! % stylesheet.strip() if localstyle and localstyle.strip(): localstyle = localstyle.strip() --- 280,293 ---- s = '' if stylesheet and stylesheet.strip(): ! stylesheet = stylesheet.strip() ! ext = os.path.splitext(stylesheet)[1] ! if ext == ".css": ! type = "text/css" ! elif ext in (".xsl", ".xslt"): ! type = "text/xslt" ! else: ! raise ValueError("unknown stylesheet language") ! s = '<LINK REL="STYLESHEET" HREF="%s" TYPE="%s">' \ ! % (stylesheet, type) if localstyle and localstyle.strip(): localstyle = localstyle.strip() |