Update of /cvsroot/ht2html/ht2html
In directory usw-pr-cvs1:/tmp/cvs-serv16570
Modified Files:
Skeleton.py
Log Message:
Add support for an XML-style stylesheet link as well as the HTML-style
stylesheet link.
Index: Skeleton.py
===================================================================
RCS file: /cvsroot/ht2html/ht2html/Skeleton.py,v
retrieving revision 2.7
retrieving revision 2.8
diff -C2 -d -r2.7 -r2.8
*** Skeleton.py 28 Mar 2002 17:24:21 -0000 2.7
--- Skeleton.py 29 Mar 2002 05:59:40 -0000 2.8
***************
*** 141,145 ****
def get_stylesheet(self):
"""Return filename of CSS stylesheet."""
! return None
def get_style(self):
--- 141,162 ----
def get_stylesheet(self):
"""Return filename of CSS stylesheet."""
! return ''
!
! def get_stylesheet_pi(self):
! s = self.get_stylesheet()
! if s:
! return '<?xml-stylesheet href="%s" type="%s"?>\n' \
! % (s, self.get_stylesheet_type(s))
! else:
! return ''
!
! def get_stylesheet_type(self, filename):
! ext = os.path.splitext(filename)[1]
! if ext == ".css":
! return "text/css"
! elif ext in (".xsl", ".xslt"):
! return "text/xslt"
! else:
! raise ValueError("unknown stylesheet language")
def get_style(self):
***************
*** 253,257 ****
print '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
! <html>
<!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->
<!-- %(time)s -->
--- 270,274 ----
print '''\
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
! %(xmlstyle)s<html>
<!-- THIS PAGE IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->
<!-- %(time)s -->
***************
*** 268,278 ****
%(meta)s
%(style)s
! </head>''' % {'title' : self.get_title(),
! 'headers': self.get_headers(),
! 'meta' : self.get_meta(),
! 'time' : time.ctime(time.time()),
! 'version': __version__,
! 'charset': self.get_charset(),
! 'style' : self.__do_styles()
}
--- 285,296 ----
%(meta)s
%(style)s
! </head>''' % {'title' : self.get_title(),
! 'headers' : self.get_headers(),
! 'meta' : self.get_meta(),
! 'time' : time.ctime(time.time()),
! 'version' : __version__,
! 'charset' : self.get_charset(),
! 'style' : self.__do_styles(),
! 'xmlstyle': self.get_stylesheet_pi(),
}
***************
*** 285,295 ****
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)
--- 303,307 ----
if stylesheet and stylesheet.strip():
stylesheet = stylesheet.strip()
! type = self.get_stylesheet_type(stylesheet)
s = '<link rel="STYLESHEET" href="%s" type="%s">' \
% (stylesheet, type)
|