mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-08 23:04:35 +00:00
269 lines
10 KiB
Python
Executable File
269 lines
10 KiB
Python
Executable File
#!/usr/bin/python
|
|
import sys, string, re, os
|
|
from datetime import date
|
|
|
|
# run within the /folk/ folder:
|
|
# python3 ../scripts/make-folklist.py <folk.csv >index.html
|
|
|
|
# re-run it every time you edit the folk.csv file to add someone you have forgotten
|
|
# it needs to be run on the server too as the file produced is ignored by git
|
|
|
|
# updated to use slugs to recognise people instead of FirstnameSurname
|
|
|
|
headcount = 0
|
|
pics = 0
|
|
allyears = 0
|
|
recordholders = []
|
|
output = {}
|
|
surnames = {}
|
|
n = 0
|
|
years_begin = 6
|
|
|
|
lines = sys.stdin.readlines()
|
|
headcounts_byyear = [0]*(len(lines[0].split(","))-5)
|
|
|
|
yearnow = date.today().year
|
|
|
|
slug_cache = {}
|
|
def troggle_slugify(longname):
|
|
"""Uniqueness enforcement too. Yes we have had two "Dave Johnson"s
|
|
This function copied intact from troggle/parsers/people/py
|
|
"""
|
|
slug = longname.strip().lower().replace(" ","-")
|
|
slug = re.sub(r'\([^\)]*\)','',slug) # remove nickname in brackets
|
|
slug = slug.replace('é', 'e')
|
|
slug = slug.replace('á', 'a')
|
|
slug = slug.replace('ä', 'a')
|
|
slug = slug.replace('&', '') # otherwise just remove the &
|
|
slug = slug.replace(';', '') # otherwise just remove the ;
|
|
slug = re.sub(r'<[^>]*>','',slug) # remove <span-lang = "hu">
|
|
slug=slug.strip("-") # remove spare hyphens
|
|
|
|
if len(slug) > 40: # slugfield is 50 chars
|
|
slug = slug[:40]
|
|
if slug in slug_cache:
|
|
slug_cache[slug] += 1
|
|
slug = f"{slug}_{slug_cache[slug]}"
|
|
sys.stderr.write(f"Slug uniqueness enforced: {slug}\n")
|
|
slug_cache[slug] = 1
|
|
|
|
# t = longname.find("&")
|
|
# s = longname.find(">")
|
|
# if t > -1 or s > -1:
|
|
# sys.stderr.write(f"{t}-{s} '{longname}' {slug}\n")
|
|
return slug
|
|
|
|
bierbook = {}
|
|
for r in lines[1:]:
|
|
n +=1
|
|
try:
|
|
r = r.replace("\n","")
|
|
r = r.replace("\r", "")
|
|
cells = r.split(",") # chomp newline
|
|
(name, surname, guest, vfho, mug, blurb) = cells[:years_begin]
|
|
years = cells[years_begin:]
|
|
except:
|
|
print(f'Exception in line {n}: {r}')
|
|
|
|
namevis = name.replace('""', '"').strip('"')
|
|
nameurl = troggle_slugify(namevis) # unique
|
|
output[nameurl] = ""
|
|
|
|
expos_caving = len([t for t in years if t == "1"])
|
|
expos_notcaving = len([t for t in years if t == "-1"])
|
|
if(expos_caving == 0 and expos_notcaving == 0):
|
|
sys.stderr.write("Warning: processing " + name + ". No attendances found\n")
|
|
# sys.exit(1)
|
|
|
|
if years[-1] == "1" or years[-1] == "-1":
|
|
bierbook[name] = True
|
|
if(expos_caving and name != 'Rover Richardson' and name != 'Bier Tent'): headcount += 1
|
|
if mug: pics +=1
|
|
output[nameurl] += '<tr><td>'
|
|
if expos_caving == 0: output[nameurl] += '<span class="didntcave">'
|
|
|
|
namelink= "<a href='/person/" + nameurl + "'>" + namevis + "</a>"
|
|
output[nameurl] += namelink
|
|
#output[nameurl] += name.replace('""', '"')
|
|
|
|
if expos_caving == 0: output[nameurl] += '</span>'
|
|
output[nameurl] += '</td><td>'
|
|
if guest: output[nameurl] += '§'
|
|
output[nameurl] += '</td><td>'
|
|
if vfho: output[nameurl] += '¤'
|
|
output[nameurl] += '</td><td>'
|
|
if mug:
|
|
if not (os.path.isfile(mug)):
|
|
print("ERROR: --------------- mug file does not exist: ", mug, file=sys.stderr)
|
|
if mug: output[nameurl] += f'<a href={mug}><img alt=":-)" src="i/mug.png" /></a>'
|
|
output[nameurl] += '</td>'
|
|
for y in range(len(years)):
|
|
if(years[y]):
|
|
m = str(76 + y)[-2:]
|
|
if(years[y]=='-1'):
|
|
m = '<span class="didntcave">'+ m + '</span>'
|
|
else:
|
|
try:
|
|
headcounts_byyear[y] += 1
|
|
except IndexError:
|
|
sys.stderr.write(repr(r) +":::"+ str(y) + "\n")
|
|
raise
|
|
output[nameurl] += '<td class="nonempty">' + m + '</td>'
|
|
else:
|
|
output[nameurl] += '<td></td>'
|
|
# print number of expos, non-caving in red. Only print numbers > 0
|
|
output[nameurl] += '<td style="text-align: right; width:36px; font-size:85%">'
|
|
if(expos_notcaving):
|
|
if(expos_caving):
|
|
output[nameurl] += '%d+<span class="didntcave">%d</span>' % (expos_caving, expos_notcaving)
|
|
else:
|
|
output[nameurl] += '<span class="didntcave">%d</span>' % expos_notcaving
|
|
else:
|
|
output[nameurl] += '%d' % expos_caving
|
|
output[nameurl] += '</td></tr>\n'
|
|
recordholders.append((expos_caving, name))
|
|
|
|
def get_surname(key):
|
|
parts = key.split("-")
|
|
return parts[1] if len(parts) == 2 else parts[0] # Use whole key if no dash
|
|
|
|
|
|
def collapse(m):
|
|
n = (m.span()[1]-m.span()[0]) / 9
|
|
if(n == 1): return m.group()
|
|
else: return '<td colspan="%d"></td>' % n
|
|
|
|
#output[nameurl] = re.sub(r'(<td></td>)+',collapse, output[nameurl])
|
|
|
|
lastyear=1976+2+len([t for t in headcounts_byyear if t > 0]) # no expo in 1986 or 2020 or 2021
|
|
|
|
# moved to main.css
|
|
#<style type="text/css">
|
|
#.didntcave { color: #dd0000 }
|
|
|
|
print("""
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>CUCC's Austria expeditions: Members</title>
|
|
<link rel="stylesheet" type="text/css" href="/css/main2.css" />
|
|
<!--
|
|
table.fancy { border-collapse: collapse; border: 2px solid black }
|
|
table.fancy td { border: 1px solid black; padding: 2pt }
|
|
table.fancy td.nonempty { background: #eee }
|
|
-->
|
|
</style>
|
|
<meta name="keywords" content="NOEDIT">
|
|
</head>
|
|
<body>
|
|
""")
|
|
print(f"""
|
|
|
|
<!-- DO NOT EDIT THIS DOCUMENT BY HAND! It is automatically generated by "scripts/make-folklist.py" -->
|
|
<h1>CUCC members and guests in Austria</br> 1976 to {yearnow}</h1>
|
|
""")
|
|
|
|
print("""
|
|
<p>This is a pretty much complete list of all the personnel on %d CUCC
|
|
expeditions (there were no expos in 1986, 2020 or 2021), together with the total number of
|
|
expeditions each has attended and the total number of people on each expedition.</p>
|
|
|
|
<p>Qualification for inclusion involves some active contribution to the
|
|
expedition such as going underground, surface surveying, sherpa-ing, camp-shopping or
|
|
diving for resurgences. Years marked in <span class="didntcave">red</span>
|
|
indicate some certainty that the person didn't go underground that year.
|
|
Persons marked in <span class="didntcave">red</span> are thought to have never
|
|
been underground on expo at all. Note that diving in <span lang="de-at">Altausseer
|
|
See</span> for the resurgence has been counted as underground:- it certainly
|
|
counts as effort expended in the pursuit of speleology!</p>
|
|
|
|
<p>In the table, a section mark (§) indicates someone who was an
|
|
individual guest of CUCC or of a CUCC member, or who was a member of UBSS or ULSA when
|
|
they were present as guest clubs in 1981,1982 or 2008-onwards or any other clubs in more recent years.
|
|
We don't guarantee to have
|
|
got all such people correctly marked. Similarly, the currency symbol (¤)
|
|
marks those who are (or were) individual members of the local Austrian group
|
|
<span lang="de-at">Verein für Höhlenkunde im Obersteier</span>. A
|
|
face icon indicates a link to a mugshot (and brief notes) in our
|
|
Rogues' Gallery. Two of the members listed are inanimate objects - no prizes for
|
|
guessing which without looking at the photos :-)</p>
|
|
|
|
<p>Leaders: while there was there was little or no role for a leader on the earlier expeditions,
|
|
in recent decades we have formalised this: <a href="leaders.html">Expo Leaders through the years</a>
|
|
|
|
<p>The table below does not include the local cavers who have caved with us at various
|
|
times. These include particularly Karl Gaisberger
|
|
<a href="i/karl_gaisberger.jpg"><img alt=":-)" src="i/mug.png" /></a>,
|
|
Gunter Graf, Arndt Karger, Sepp
|
|
Steinberger and Robert Seebacher <a href="i/seebacher2.jpg"><img alt=":-)"
|
|
src="i/mug.png" /></a>.</p>
|
|
""" % len([t for t in headcounts_byyear if t > 0]))
|
|
|
|
y2 = lastyear-2
|
|
y1 = lastyear-1
|
|
print(f"""
|
|
<p>Links to recent expos: <a href="http://expo.survex.com/expedition/{y1}">previous expo</a>. There was no expo in 1986, 2020 or 2021.
|
|
<hr /><table class="fancy">
|
|
""")
|
|
|
|
# This is the main body of the table
|
|
|
|
table_sorted_by_person = dict(sorted(output.items(), key=lambda item: get_surname(item[0])))
|
|
|
|
for person in table_sorted_by_person:
|
|
print(table_sorted_by_person[person])
|
|
|
|
print("<tr><td colspan=4><strong>Expo head count</strong></td>", end=' ')
|
|
for y in headcounts_byyear:
|
|
print(f'<td style="text-align: right">{y}</td>', end=' ')
|
|
|
|
print(f"""
|
|
<td></td></tr>
|
|
</table>
|
|
<hr />
|
|
|
|
<p>{headcount} cavers have
|
|
taken part in expo altogether (not including non-cavers, tents or vehicles),
|
|
of whom {pics} have their pictures on the site so far.</p>
|
|
|
|
<p>Although few take <a href="/people">such statistics</a> seriously, the most dedicated expoers are """)
|
|
|
|
recordholders.sort()
|
|
recordholders.reverse()
|
|
k = 2
|
|
while recordholders[k + 1][0] == recordholders[k][0]:
|
|
k = k + 1
|
|
print("%s (%d expos)," % (recordholders[0][1],recordholders[0][0]))
|
|
for r in recordholders[1:k]:
|
|
print("%s (%d)," % (r[1],r[0]), end=' ')
|
|
|
|
print("""and %s (%d). Julian Todd holds the record for consecutive
|
|
expo attendance (10), (along with Mark Shinwell, but he didn't actually
|
|
go caving on all of those visits). A more obscure record of longest gap between expos has been held by various people since 2004 at 13, and then 17, years, but in 2017 was upped to 34 years by Phil Sargent, which is going to be extremely hard to beat.</p>""" % (recordholders[k][1],recordholders[k][0]))
|
|
|
|
|
|
print("""<p>Outside-expo caving happens from time to time, with Becka Lawson, Neil Pacey, Julian Todd and Wookey
|
|
joining various Arge and VfHO trips since about 2000. However, the much talked-about
|
|
winter expedition/holiday has still not happened, though there is still a lot
|
|
to be said for it. With draughts reversed in the cold, top entrances should
|
|
be more obvious and skiing would make a nice change from sitting watching the
|
|
rain. Some entrances would inevitably be blocked by snow but others seem to
|
|
remain open all winter.</p>
|
|
|
|
<p>Instructions for updating this page are
|
|
in the online systems handbook at <a href="/handbook/computing/folkupdate.html">new year, new folklist</a>.</p>
|
|
|
|
<hr />
|
|
""")
|
|
|
|
print("<details><summary>Click here to see 'names.txt' input data for <a href='/documents/bierbook/index.html'>bierbook generation</a>.</summary><pre>")
|
|
for name in bierbook:
|
|
print(name)
|
|
for i in range(4):
|
|
print(r"\ldots\ldots\ldots")
|
|
print("""</pre></details>
|
|
|
|
</html>
|
|
</body>
|
|
</html>""") |