More <link> support for generated pages.

This commit is contained in:
Fred Drake 2002-10-30 21:32:40 +00:00
parent 8687609a39
commit 4a4734927d
2 changed files with 24 additions and 3 deletions

View File

@ -29,6 +29,8 @@ import os
import re
import sys
from xml.sax.saxutils import quoteattr
import buildindex
import support
@ -49,6 +51,21 @@ class IndexOptions(support.Options):
program = os.path.basename(sys.argv[0])
print __doc__ % {"program": program}
links = [
('author', 'acks.html', 'Acknowledgements'),
('help', 'about.html', 'About the Python Documentation'),
]
def get_header(self):
header = support.Options.get_header(self)
s = ''
for rel, href, title in self.links:
s += '<link rel="%s" href="%s"' % (rel, href)
if title:
s += ' title=' + quoteattr(title)
s += '>\n '
return header.replace("<link ", s + "<link ", 1)
class Node(buildindex.Node):
def __init__(self, link, str, seqno, platinfo):

View File

@ -111,10 +111,14 @@ class Options:
s = HEAD % self.variables
if self.uplink:
if self.uptitle:
link = ('<link rel="up" href="%s" title="%s">'
% (self.uplink, self.uptitle))
link = ('<link rel="up" href="%s" title="%s">\n '
'<link rel="start" href="%s" title="%s">'
% (self.uplink, self.uptitle,
self.uplink, self.uptitle))
else:
link = '<link rel="up" href="%s">' % self.uplink
link = ('<link rel="up" href="%s">\n '
'<link rel="start" href="%s">'
% (self.uplink, self.uplink))
repl = " %s\n</head>" % link
s = s.replace("</head>", repl, 1)
if self.aesop_type: