mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-08 06:45:00 +00:00
remaking area pages to make static
This commit is contained in:
463
noinfo/CAVETAB2.CSV
Normal file
463
noinfo/CAVETAB2.CSV
Normal file
File diff suppressed because one or more lines are too long
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user