mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Merged changes from the 1.5.2p2 release.
This commit is contained in:
parent
a22b576d05
commit
ba82878a3b
11 changed files with 118 additions and 28 deletions
|
@ -11,6 +11,8 @@ import sys
|
|||
class Node:
|
||||
__rmjunk = re.compile("<#\d+#>")
|
||||
|
||||
continuation = 0
|
||||
|
||||
def __init__(self, link, str, seqno):
|
||||
self.links = [link]
|
||||
self.seqno = seqno
|
||||
|
@ -77,7 +79,7 @@ def split_entry(str, which):
|
|||
return stuff
|
||||
|
||||
|
||||
_rmtt = re.compile(r"(.*)<tt(?: class=[a-z0-9]+)?>(.*)</tt>(.*)$",
|
||||
_rmtt = re.compile(r"""(.*)<tt(?: class=['"][a-z0-9]+["'])?>(.*)</tt>(.*)$""",
|
||||
re.IGNORECASE)
|
||||
_rmparens = re.compile(r"\(\)")
|
||||
|
||||
|
@ -175,6 +177,22 @@ def split_columns(nodes, columns=1):
|
|||
start = i * colheight
|
||||
end = start + colheight
|
||||
cols.append(nodes[start:end])
|
||||
#
|
||||
# If items continue across columns, make sure they are marked
|
||||
# as continuations so the user knows to look at the previous column.
|
||||
#
|
||||
for i in range(len(cols) - 1):
|
||||
try:
|
||||
prev = cols[i][-1]
|
||||
next = cols[i + 1][0]
|
||||
except IndexError:
|
||||
return cols
|
||||
else:
|
||||
n = min(len(prev.key), len(next.key))
|
||||
for j in range(n):
|
||||
if prev.key[j] != next.key[j]:
|
||||
break
|
||||
next.continuation = j + 1
|
||||
return cols
|
||||
|
||||
|
||||
|
@ -204,8 +222,12 @@ def format_column(nodes):
|
|||
for i in range(count, len(current) - 1):
|
||||
term = node.text[i]
|
||||
level = level + 1
|
||||
append("\n<dt>%s\n<dd>\n%s<dl compact>"
|
||||
% (term, level * DL_LEVEL_INDENT))
|
||||
if node.continuation > i:
|
||||
extra = " (continued)"
|
||||
else:
|
||||
extra = ""
|
||||
append("\n<dt>%s%s\n<dd>\n%s<dl compact>"
|
||||
% (term, extra, level * DL_LEVEL_INDENT))
|
||||
append("\n%s<dt>%s%s</a>"
|
||||
% (level * DL_LEVEL_INDENT, node.links[0], node.text[-1]))
|
||||
for link in node.links[1:]:
|
||||
|
|
|
@ -43,13 +43,26 @@ class PageCounter:
|
|||
PREFIX = """\
|
||||
This is the PostScript version of the standard Python documentation.
|
||||
If you plan to print this, be aware that some of the documents are
|
||||
long. The following manuals are included:
|
||||
long. It is formatted for printing on two-sided paper; if you do plan
|
||||
to print this, *please* print two-sided if you have a printer capable
|
||||
of it! To locate published copies of the larger manuals, or other
|
||||
Python reference material, consult the PSA Online Bookstore at:
|
||||
|
||||
http://www.python.org/psa/bookstore/
|
||||
|
||||
The following manuals are included:
|
||||
"""
|
||||
SUFFIX = """\
|
||||
|
||||
|
||||
If you have any questions, comments, or suggestions regarding these
|
||||
documents, please send them via email to python-docs@python.org.
|
||||
|
||||
If you would like to support the development and maintenance of
|
||||
documentation for Python, please consider joining the Python Software
|
||||
Activity (PSA; see http://www.python.org/psa/), or urging your
|
||||
organization to join the PSA or the Python Consortium (see
|
||||
http://www.python.org/consortium/).
|
||||
"""
|
||||
|
||||
def count_pages(filename):
|
||||
|
|
|
@ -34,7 +34,7 @@ fi
|
|||
|
||||
part=$1; shift 1
|
||||
|
||||
TEXINPUTS=$srcdir/$part:$TEXINPUTS
|
||||
TEXINPUTS=.:$srcdir/$part:$TEXINPUTS
|
||||
export TEXINPUTS
|
||||
|
||||
echo $srcdir'/tools/newind.py >'$part'.ind'
|
||||
|
|
|
@ -330,6 +330,8 @@ class Job:
|
|||
if texfile[:2] == os.curdir + os.sep:
|
||||
texfile = texfile[2:]
|
||||
# build the command line and run LaTeX2HTML:
|
||||
if not os.path.isdir(builddir):
|
||||
os.mkdir(builddir)
|
||||
args = [LATEX2HTML_BINARY,
|
||||
"-init_file", L2H_INIT_FILE,
|
||||
"-init_file", self.l2h_aux_init_file,
|
||||
|
|
|
@ -27,12 +27,16 @@ export TEXINPUTS
|
|||
|
||||
if [ -d $part ] ; then
|
||||
rm -f $part/*.html
|
||||
else
|
||||
mkdir $part
|
||||
fi
|
||||
|
||||
echo "latex2html -init_file $srcdir/perl/l2hinit.perl -dir $part" \
|
||||
"${1:+$@} $srcdir/$part/$part.tex"
|
||||
latex2html \
|
||||
-no_auto_link \
|
||||
-up_url '../index.html' \
|
||||
-up_title 'Documentation Index' \
|
||||
-init_file $srcdir/perl/l2hinit.perl \
|
||||
-address '<hr>See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.' \
|
||||
-dir $part \
|
||||
|
|
|
@ -47,8 +47,9 @@ def error(msg, rc=2):
|
|||
|
||||
|
||||
_rx = re.compile(
|
||||
'<dt><a href="(module-.*\.html)">'
|
||||
'([a-zA-Z_][a-zA-Z0-9_.]*(\s*<em>\(.*\)</em>)?)</a>')
|
||||
"<dt><a href='(module-.*\.html)#l2h-\d+'><tt class='module'>"
|
||||
"([a-zA-Z_][a-zA-Z0-9_.]*</tt>(\s*<em>"
|
||||
"\(<span class='platform'>.*</span>\)</em>)?)</a>")
|
||||
|
||||
def main():
|
||||
outputfile = "-"
|
||||
|
|
|
@ -105,7 +105,9 @@ def main():
|
|||
run("tar cf - Python-%s | gzip -9 >%s.tgz"
|
||||
% (release, archive))
|
||||
elif format == "zip":
|
||||
run("zip -r9 %s.zip Python-%s"
|
||||
if os.path.exists(archive + ".zip"):
|
||||
os.unlink(archive + ".zip")
|
||||
run("zip -q -r9 %s.zip Python-%s"
|
||||
% (archive, release))
|
||||
|
||||
# clean up the work area:
|
||||
|
|
|
@ -32,16 +32,16 @@ foreach $label (keys %internal_labels) {
|
|||
while (<>) {
|
||||
# don't want to do one s/// per line per node
|
||||
# so look for lines with hrefs, then do s/// on nodes present
|
||||
if (/(HREF|href)=\"([^\#\"]*)html[\#\"]/) {
|
||||
@parts = split(/(HREF|href)\=\"/);
|
||||
if (/(HREF|href)=[\"\']([^\#\"\']*)html[\#\"\']/) {
|
||||
@parts = split(/(HREF|href)\=[\"\']/);
|
||||
shift @parts;
|
||||
for $node (@parts) {
|
||||
$node =~ s/[\#\"].*$//g;
|
||||
$node =~ s/[\#\"\'].*$//g;
|
||||
chop($node);
|
||||
if (defined($nodes{$node})) {
|
||||
$label = $nodes{$node};
|
||||
if (s/(HREF|href)=\"$node([\#\"])/$1=\"$label.html$2/g) {
|
||||
s/(HREF|href)=\"$label.html#(l2h-)?SECTION\d+/$1=\"$label.html/g;
|
||||
if (s/(HREF|href)=([\"\'])$node([\#\"\'])/href=$2$label.html$3/g) {
|
||||
s/(HREF|href)=([\"\'])$label.html/href=$2$label.html/g;
|
||||
$newnames{$node} = "$label.html";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue