Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a47349

Browse files
committed
More <link> support for generated pages.
1 parent 8687609 commit 4a47349

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

Doc/tools/mkmodindex

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import os
2929
import re
3030
import sys
3131

32+
from xml.sax.saxutils import quoteattr
33+
3234
import buildindex
3335
import support
3436

@@ -49,6 +51,21 @@ class IndexOptions(support.Options):
4951
program = os.path.basename(sys.argv[0])
5052
print __doc__ % {"program": program}
5153

54+
links = [
55+
('author', 'acks.html', 'Acknowledgements'),
56+
('help', 'about.html', 'About the Python Documentation'),
57+
]
58+
59+
def get_header(self):
60+
header = support.Options.get_header(self)
61+
s = ''
62+
for rel, href, title in self.links:
63+
s += '<link rel="%s" href="%s"' % (rel, href)
64+
if title:
65+
s += ' title=' + quoteattr(title)
66+
s += '>\n '
67+
return header.replace("<link ", s + "<link ", 1)
68+
5269

5370
class Node(buildindex.Node):
5471
def __init__(self, link, str, seqno, platinfo):

Doc/tools/support.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@ def get_header(self):
111111
s = HEAD % self.variables
112112
if self.uplink:
113113
if self.uptitle:
114-
link = ('<link rel="up" href="%s" title="%s">'
115-
% (self.uplink, self.uptitle))
114+
link = ('<link rel="up" href="%s" title="%s">\n '
115+
'<link rel="start" href="%s" title="%s">'
116+
% (self.uplink, self.uptitle,
117+
self.uplink, self.uptitle))
116118
else:
117-
link = '<link rel="up" href="%s">' % self.uplink
119+
link = ('<link rel="up" href="%s">\n '
120+
'<link rel="start" href="%s">'
121+
% (self.uplink, self.uplink))
118122
repl = " %s\n</head>" % link
119123
s = s.replace("</head>", repl, 1)
120124
if self.aesop_type:

0 commit comments

Comments
 (0)