remaking area pages to make static

This commit is contained in:
Philip Sargent
2020-05-01 16:43:07 +01:00
parent 485144f9a2
commit 79444f3c10
17 changed files with 2175 additions and 11 deletions

463
noinfo/CAVETAB2.CSV Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,9 @@
import re, sys, os
from string import join
import csv
"""Unused since 7 Jan.2016 when Wookey deleted CAVETAB2.CSV
resurrected 1 May 2020 in order to make the 'are' pages static.
"""
areas = []
caves = []
@@ -41,19 +43,26 @@ def create_indices():
create_one_index(f)
def create_one_index(filename):
if(filename[-1]!="l"): return
if(filename[-1]!="l"):
print "IGNORING ", filename
return
else:
print "\nprocessing... ", filename,
template = file("noinfo/areapage_skeletons/"+filename).read()
try:
destination = re.search(r'<destination\s*dest="([^"]*)"\s*/>', template, re.IGNORECASE).group(1)
except:
print "Error on: ", filename
print " Error on destination: ", filename
return
outfile = file(destination, "w")
template = re.sub(r'(?i)<head>', '<head>' + (WARNING_MESSAGE % filename), template)
outfile.write(re.sub(r'(?i)<areatable\s*areacode="([^"]*)"\s*/>', formatted_table, template))
# re.sub doesn't support re.IGNORECASE, so use (?i) escape code
try:
print " Writing to: ", filename,
outfile.write(re.sub(r'(?i)<areatable\s*areacode="([^"]*)"\s*/>', formatted_table, template))
# re.sub doesn't support re.IGNORECASE, so use (?i) escape code
except:
print "Error writing to: ", filename
def formatted_table(area_matchobj):
area = area_matchobj.group(1)