Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2019-06-17 01:18:24 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2019-06-20 11:25:31 +0300
commit3a2efe206ea6879cdf0dfac252a9f1f70d6e9638 (patch)
treec7f906e318ac839049e3d70d1d2419c836d793c2 /calm/pkg2html.py
parent5a0661fd16b9af1663ab6b8676df0b35616604ae (diff)
Add alphabetic shortcuts to package list
Diffstat (limited to 'calm/pkg2html.py')
-rwxr-xr-xcalm/pkg2html.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index 43de89e..a8056bf 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -46,6 +46,7 @@ import itertools
import logging
import os
import re
+import string
import sys
import tarfile
import textwrap
@@ -236,9 +237,21 @@ def update_package_listings(args, packages):
if not args.dryrun:
with open(packages_inc, 'w') as index:
os.fchmod(index.fileno(), 0o644)
+
+ jumplist = set()
+ for p in package_list:
+ c = p[0].lower()
+ if c in string.ascii_lowercase:
+ jumplist.add(c)
+
+ print('<p class="center">', file=index)
+ print(' - \n'.join(['<a href="#%s">%s</a>' % (c, c) for c in sorted(jumplist)]), file=index)
+ print('</p>', file=index)
+
print('<table class="pkglist">', file=index)
first = ' class="pkgname"'
+ jump = ''
for p in sorted(package_list, key=package.sort_key):
if p.endswith('-debuginfo'):
continue
@@ -255,8 +268,14 @@ def update_package_listings(args, packages):
bv = arch_packages[p].best_version
header = sdesc(arch_packages, p, bv)
- print('<tr><td%s><a href="summary/%s.html">%s</a></td><td>%s</td></tr>' %
- (first, p, p, html.escape(header, quote=False)),
+ anchor = ''
+ if jump != p[0].lower():
+ jump = p[0].lower()
+ if jump in jumplist:
+ anchor = ' id="%s"' % (jump)
+
+ print('<tr%s><td%s><a href="summary/%s.html">%s</a></td><td>%s</td></tr>' %
+ (anchor, first, p, p, html.escape(header, quote=False)),
file=index)
first = ''