diff options
author | Fred Drake <fdrake@acm.org> | 2002-10-30 17:05:03 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-10-30 17:05:03 (GMT) |
commit | b07216b43ad3e375e2a4a80c726bae618c329553 (patch) | |
tree | 1e0fa8e00b81c1069a72da5261d2a15ace5962f8 /Doc | |
parent | 56c8c27b27c883bcec8975c0b742d1b534468662 (diff) | |
download | cpython-b07216b43ad3e375e2a4a80c726bae618c329553.zip cpython-b07216b43ad3e375e2a4a80c726bae618c329553.tar.gz cpython-b07216b43ad3e375e2a4a80c726bae618c329553.tar.bz2 |
Added support for --favicon.
Fix support for the Aesop Meta Type.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tools/support.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Doc/tools/support.py b/Doc/tools/support.py index b96c4dd..30d4575 100644 --- a/Doc/tools/support.py +++ b/Doc/tools/support.py @@ -8,6 +8,7 @@ __version__ = '$Revision$' import getopt +import os.path import sys @@ -18,7 +19,7 @@ class Options: "columns=", "help", "output=", # content components - "address=", "iconserver=", + "address=", "iconserver=", "favicon=", "title=", "uplink=", "uptitle="] outputfile = "-" @@ -26,6 +27,7 @@ class Options: letters = 0 uplink = "index.html" uptitle = "Python Documentation Index" + favicon = None # The "Aesop Meta Tag" is poorly described, and may only be used # by the Aesop search engine (www.aesop.com), but doesn't hurt. @@ -89,6 +91,8 @@ class Options: self.uptitle = val.strip() elif opt == "--iconserver": self.variables["iconserver"] = val.strip() or "." + elif opt == "--favicon": + self.favicon = val.strip() else: self.handle_option(opt, val) if self.uplink and self.uptitle: @@ -114,11 +118,20 @@ class Options: repl = " %s\n</head>" % link s = s.replace("</head>", repl, 1) if self.aesop_type: - meta = '\n <meta name="aesop" content="%s">' + 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 def get_footer(self): |