[Python-checkins] python/dist/src/Doc/tools support.py,1.7,1.8
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Wed, 30 Oct 2002 09:05:07 -0800
Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv31717
Modified Files:
support.py
Log Message:
Added support for --favicon.
Fix support for the Aesop Meta Type.
Index: support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/support.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** support.py 16 Oct 2002 15:30:17 -0000 1.7
--- support.py 30 Oct 2002 17:05:03 -0000 1.8
***************
*** 9,12 ****
--- 9,13 ----
import getopt
+ import os.path
import sys
***************
*** 19,23 ****
# content components
! "address=", "iconserver=",
"title=", "uplink=", "uptitle="]
--- 20,24 ----
# content components
! "address=", "iconserver=", "favicon=",
"title=", "uplink=", "uptitle="]
***************
*** 27,30 ****
--- 28,32 ----
uplink = "index.html"
uptitle = "Python Documentation Index"
+ favicon = None
# The "Aesop Meta Tag" is poorly described, and may only be used
***************
*** 90,93 ****
--- 92,97 ----
elif opt == "--iconserver":
self.variables["iconserver"] = val.strip() or "."
+ elif opt == "--favicon":
+ self.favicon = val.strip()
else:
self.handle_option(opt, val)
***************
*** 115,123 ****
s = s.replace("</head>", repl, 1)
if self.aesop_type:
! meta = '\n <meta name="aesop" content="%s">'
# Insert this in the middle of the head that's been
# generated so far, keeping <meta> and <link> elements in
# neat groups:
s = s.replace("<link ", meta + "<link ", 1)
return s
--- 119,136 ----
s = s.replace("</head>", repl, 1)
if self.aesop_type:
! meta = '<meta name="aesop" content="%s">\n ' % self.aesop_type
# Insert this in the middle of the head that's been
# generated so far, keeping <meta> and <link> elements in
# neat groups:
s = s.replace("<link ", meta + "<link ", 1)
+ if self.favicon:
+ ext = os.path.splitext(self.favicon)[1]
+ if ext in (".gif", ".png"):
+ type = ' type="image/%s"' % ext[1:]
+ else:
+ type = ''
+ link = ('<link rel="SHORTCUT ICON" href="%s"%s>\n '
+ % (self.favicon, type))
+ s = s.replace("<link ", link + "<link ", 1)
return s