mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
More <link> support for generated pages.
This commit is contained in:
parent
8687609a39
commit
4a4734927d
2 changed files with 24 additions and 3 deletions
|
@ -29,6 +29,8 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from xml.sax.saxutils import quoteattr
|
||||||
|
|
||||||
import buildindex
|
import buildindex
|
||||||
import support
|
import support
|
||||||
|
|
||||||
|
@ -49,6 +51,21 @@ class IndexOptions(support.Options):
|
||||||
program = os.path.basename(sys.argv[0])
|
program = os.path.basename(sys.argv[0])
|
||||||
print __doc__ % {"program": program}
|
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):
|
class Node(buildindex.Node):
|
||||||
def __init__(self, link, str, seqno, platinfo):
|
def __init__(self, link, str, seqno, platinfo):
|
||||||
|
|
|
@ -111,10 +111,14 @@ class Options:
|
||||||
s = HEAD % self.variables
|
s = HEAD % self.variables
|
||||||
if self.uplink:
|
if self.uplink:
|
||||||
if self.uptitle:
|
if self.uptitle:
|
||||||
link = ('<link rel="up" href="%s" title="%s">'
|
link = ('<link rel="up" href="%s" title="%s">\n '
|
||||||
% (self.uplink, self.uptitle))
|
'<link rel="start" href="%s" title="%s">'
|
||||||
|
% (self.uplink, self.uptitle,
|
||||||
|
self.uplink, self.uptitle))
|
||||||
else:
|
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
|
repl = " %s\n</head>" % link
|
||||||
s = s.replace("</head>", repl, 1)
|
s = s.replace("</head>", repl, 1)
|
||||||
if self.aesop_type:
|
if self.aesop_type:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue