Normalize gen.py scripts across directories
This commit is contained in:
parent
79cf402d86
commit
0ead233940
|
|
@ -1,7 +1,7 @@
|
|||
background/[0-9]*.shtml
|
||||
comic/[0-9]*.html
|
||||
credits/[0-9]*.html
|
||||
guide/#*
|
||||
*/#*
|
||||
guide/[0-9]*.html
|
||||
synops/[0-9]*.html
|
||||
novels/[0-9]*.html
|
||||
|
|
|
|||
|
|
@ -26,21 +26,11 @@ for epnum in sys.argv[1:]:
|
|||
input = open('story.html', 'r')
|
||||
output = open(cureplong + '.shtml', 'w')
|
||||
|
||||
output.write("""<html>
|
||||
<head>
|
||||
<title>Background: """ + '"' + epname + '"' + """</title>
|
||||
<link rev=made href="mailto:koreth@midwinter.com">
|
||||
<link rel=parent href="../guide/""" + cureplong + """.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
""" + otros.pageheader(curepno, 'background', 1) + """
|
||||
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
""")
|
||||
page_name = 'Background: "' + epname + '"'
|
||||
output.write(otros.head(page_name))
|
||||
output.write("<body>\n")
|
||||
output.write(otros.pageheader(curepno, 'background', 1))
|
||||
output.write("\n<pre>\n\n</pre>\n")
|
||||
|
||||
printing = 1
|
||||
|
||||
|
|
|
|||
85
comic/gen.py
85
comic/gen.py
|
|
@ -1,85 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys,string,time,os
|
||||
sys.path.append('../internal')
|
||||
import otros
|
||||
|
||||
months = [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||
'August', 'September', 'October', 'November', 'December']
|
||||
|
||||
for epnum in sys.argv[1:]:
|
||||
curep = string.atoi(epnum[:3])
|
||||
|
||||
pix = open('../internal/comicnames', 'r')
|
||||
for i in range(0, curep + 1):
|
||||
epname = pix.readline()[:-1]
|
||||
pix.close()
|
||||
if epname == '':
|
||||
epname = 'XXX'
|
||||
|
||||
cureplong = '%03d' % curep
|
||||
|
||||
which = 'comic'
|
||||
|
||||
input = open(epnum, 'r')
|
||||
mtime = time.localtime(os.stat(epnum)[8]);
|
||||
mtime_str = '%s %d, %d' % (months[mtime[1]], mtime[2], mtime[0])
|
||||
|
||||
output = open(epnum + '.html', 'w')
|
||||
|
||||
output.write("""<html>
|
||||
<head>
|
||||
<title>Comic: """ + '"' + epname + '"')
|
||||
if which == 'extra':
|
||||
output.write(' (scene in detail)')
|
||||
|
||||
output.write("""</title>
|
||||
<link rev=made href="mailto:koreth@midwinter.com">
|
||||
<link rel=parent href="../eplist.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
""" + otros.pageheader(curep, which))
|
||||
|
||||
if which == 'guide':
|
||||
output.write("""
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#OV">Overview</a> -
|
||||
<a href="#BP">Backplot</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">JMS</a>
|
||||
|
||||
<p>
|
||||
<hr>
|
||||
|
||||
""")
|
||||
else:
|
||||
output.write("""
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
|
||||
""")
|
||||
|
||||
output.write(input.read())
|
||||
|
||||
output.write('<pre>\n\n</pre>\n' + otros.pagefooter(curep) + """
|
||||
|
||||
<h5>
|
||||
Last update:
|
||||
""" + mtime_str + """
|
||||
|
||||
</h5>
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
|
||||
input.close()
|
||||
output.close()
|
||||
|
||||
print epnum
|
||||
|
|
@ -0,0 +1 @@
|
|||
../guide/gen.py
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Per-directory values for /lurk/comic
|
||||
#
|
||||
def get_type():
|
||||
return 'comic'
|
||||
|
||||
def get_episode_names_file():
|
||||
return '../internal/comicnames'
|
||||
|
||||
def get_page_name_prefix():
|
||||
return 'Comic'
|
||||
|
||||
def get_table_of_contents():
|
||||
return """
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#OV">Overview</a> -
|
||||
<a href="#BP">Backplot</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">JMS</a>
|
||||
|
||||
"""
|
||||
|
||||
def get_do_jpeg():
|
||||
return 0
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys,string,time,os
|
||||
sys.path.append('../internal')
|
||||
import otros
|
||||
|
||||
months = [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||
'August', 'September', 'October', 'November', 'December']
|
||||
|
||||
for epnum in sys.argv[1:]:
|
||||
curep = string.atoi(epnum[:3])
|
||||
|
||||
pix = open('../internal/epnames', 'r')
|
||||
for i in range(0, curep + 1):
|
||||
epname = pix.readline()[:-1]
|
||||
pix.close()
|
||||
if epname == '':
|
||||
epname = 'XXX'
|
||||
|
||||
if len(epnum) > 3:
|
||||
cureplong = epnum
|
||||
else:
|
||||
cureplong = '%03d' % curep
|
||||
|
||||
input = open(cureplong, 'r')
|
||||
output = open(cureplong + '.html', 'w')
|
||||
|
||||
mtime = time.localtime(os.stat(cureplong)[8]);
|
||||
mtime_str = '%s %d, %d' % (months[mtime[1]], mtime[2], mtime[0])
|
||||
|
||||
output.write("""<html>
|
||||
<head>
|
||||
<title>Credits: """ + '"' + epname + '"' + """</title>
|
||||
<link rev=made href="mailto:koreth@midwinter.com">
|
||||
<link rel=parent href="../guide/""" + cureplong + """.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
""" + otros.pageheader(curep, 'credits', 1) + '</p>\n\n')
|
||||
|
||||
try:
|
||||
special = open(cureplong + '-head', 'r')
|
||||
output.write(special.read())
|
||||
special.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
output.write('<pre>\n\n')
|
||||
output.write(input.read())
|
||||
|
||||
output.write("""
|
||||
|
||||
</pre>
|
||||
""" + otros.pagefooter(curep) + """
|
||||
|
||||
<h5>
|
||||
Last update:
|
||||
""" + mtime_str + """
|
||||
|
||||
</h5>
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
|
||||
input.close()
|
||||
output.close()
|
||||
|
||||
print epnum
|
||||
|
|
@ -0,0 +1 @@
|
|||
../guide/gen.py
|
||||
57
guide/gen.py
57
guide/gen.py
|
|
@ -3,17 +3,19 @@
|
|||
import sys,string,time,os
|
||||
sys.path.append('../internal')
|
||||
import otros
|
||||
sys.path.insert(0, '.')
|
||||
import perdir
|
||||
|
||||
months = [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||
'August', 'September', 'October', 'November', 'December']
|
||||
|
||||
do_jpeg = 1
|
||||
do_jpeg = perdir.get_do_jpeg()
|
||||
args = sys.argv
|
||||
|
||||
for epnum in args[1:]:
|
||||
curep = string.atoi(epnum[:3])
|
||||
|
||||
pix = open('../internal/epnames', 'r')
|
||||
pix = open(perdir.get_episode_names_file(), 'r')
|
||||
for i in range(0, curep + 1):
|
||||
epname = pix.readline()[:-1]
|
||||
pix.close()
|
||||
|
|
@ -23,7 +25,7 @@ for epnum in args[1:]:
|
|||
cureplong = '%03d' % curep
|
||||
|
||||
if len(epnum) == 3:
|
||||
which = 'guide'
|
||||
which = perdir.get_type()
|
||||
else:
|
||||
which = 'extra'
|
||||
|
||||
|
|
@ -42,44 +44,37 @@ for epnum in args[1:]:
|
|||
|
||||
output = open(epnum + '.html', 'w')
|
||||
|
||||
output.write("""<html>
|
||||
<head>
|
||||
<title>Guide page: """ + '"' + epname + '"')
|
||||
page_name = perdir.get_page_name_prefix() + ': "' + epname + '"'
|
||||
if which == 'extra':
|
||||
output.write(' (scene in detail)')
|
||||
page_name = page_name + ' (scene in detail)'
|
||||
|
||||
output.write("""</title>
|
||||
<link rev=made href="mailto:koreth@midwinter.com">
|
||||
<link rel=parent href="../eplist.html">
|
||||
</head>
|
||||
output.write(otros.head(page_name))
|
||||
|
||||
<body>
|
||||
output.write("<body>\n")
|
||||
|
||||
""" + otros.pageheader(curep, which, do_jpeg))
|
||||
try:
|
||||
special = open(epnum + '-head', 'r')
|
||||
output.write(special.read())
|
||||
special.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
if which == 'guide':
|
||||
output.write("""
|
||||
output.write(otros.pageheader(curep, which, do_jpeg))
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#OV">Overview</a> -
|
||||
<a href="#BP">Backplot</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">JMS</a>
|
||||
|
||||
<p>
|
||||
<hr>
|
||||
|
||||
""")
|
||||
else:
|
||||
if which == 'extra':
|
||||
output.write("""
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
|
||||
""")
|
||||
elif perdir.get_type() == 'credits':
|
||||
output.write("\n<pre>\n")
|
||||
else:
|
||||
toc = perdir.get_table_of_contents()
|
||||
if len(toc) > 0:
|
||||
output.write(toc)
|
||||
output.write("\n<p>\n<hr>\n")
|
||||
|
||||
wholefile = input.read()
|
||||
input.close()
|
||||
|
|
@ -126,6 +121,10 @@ for epnum in args[1:]:
|
|||
if do_jpeg:
|
||||
final = otros.mungeimages(final, do_jpeg)
|
||||
output.write(final)
|
||||
|
||||
if perdir.get_type() == 'credits':
|
||||
output.write("</pre>\n")
|
||||
|
||||
output.write('<pre>\n\n</pre>\n' + otros.pagefooter(curep) + """
|
||||
|
||||
<h5>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/csh
|
||||
gen.py `/bin/ls [012]* | fgrep -v .html`
|
||||
gen.py `/bin/ls [012345]* | fgrep -v .html`
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Per-directory values for /lurk/guide
|
||||
#
|
||||
def get_type():
|
||||
return 'guide'
|
||||
|
||||
def get_episode_names_file():
|
||||
return '../internal/epnames'
|
||||
|
||||
def get_page_name_prefix():
|
||||
return 'Guide Page'
|
||||
|
||||
def get_table_of_contents():
|
||||
return """
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#OV">Overview</a> -
|
||||
<a href="#BP">Backplot</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">JMS</a>
|
||||
"""
|
||||
|
||||
def get_do_jpeg():
|
||||
return 1
|
||||
|
|
@ -288,8 +288,11 @@ align=bottom
|
|||
# Given an image path, generate the full path to the corresponding file.
|
||||
#
|
||||
def normalize_path(path):
|
||||
if path[0:4] == '/lurk/':
|
||||
path = '/home/koreth/lurk' + path[5:]
|
||||
if path[0:6] == '/lurk/':
|
||||
curdir = os.getcwd()
|
||||
if (not os.path.exists(curdir + '/lurker.html')):
|
||||
curdir = curdir + '/..'
|
||||
path = os.path.abspath(curdir) + path[5:]
|
||||
elif path[0] == '/':
|
||||
path = '/home/midwinter/docroot' + path
|
||||
return path
|
||||
|
|
@ -326,3 +329,15 @@ def mungeimages(text, do_jpeg):
|
|||
|
||||
return result
|
||||
|
||||
|
||||
#
|
||||
# Returns the <head> section for a page, including image maps.
|
||||
#
|
||||
def head(title):
|
||||
result = "<html><head>\n<title>" + title + "</title>\n"
|
||||
mapsfile = open('../maps/maps.html', 'r')
|
||||
result = result + mapsfile.read()
|
||||
mapsfile.close()
|
||||
result = result + "</head>\n"
|
||||
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys,string,time,os
|
||||
sys.path.append('../internal')
|
||||
import otros
|
||||
|
||||
months = [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||
'August', 'September', 'October', 'November', 'December']
|
||||
|
||||
for epnum in sys.argv[1:]:
|
||||
curep = string.atoi(epnum[:3])
|
||||
|
||||
pix = open('../internal/novelnames', 'r')
|
||||
for i in range(0, curep + 1):
|
||||
epname = pix.readline()[:-1]
|
||||
pix.close()
|
||||
if epname == '':
|
||||
epname = 'XXX'
|
||||
|
||||
cureplong = '%03d' % curep
|
||||
|
||||
which = 'novels'
|
||||
|
||||
input = open(epnum, 'r')
|
||||
mtime = time.localtime(os.stat(epnum)[8]);
|
||||
mtime_str = '%s %d, %d' % (months[mtime[1]], mtime[2], mtime[0])
|
||||
|
||||
output = open(epnum + '.html', 'w')
|
||||
|
||||
page_name = 'Novel: "' + epname + '"'
|
||||
if which == 'extra':
|
||||
page_name = page_name + ' (scene in detail)'
|
||||
|
||||
output.write(otros.head(page_name))
|
||||
output.write("<body>\n")
|
||||
output.write(otros.pageheader(curep, which))
|
||||
|
||||
output.write("""
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#BC">Back Cover</a> -
|
||||
<a href="#SY">Synopsis</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">Author</a>
|
||||
|
||||
<p>
|
||||
<hr>
|
||||
|
||||
""")
|
||||
|
||||
output.write(input.read())
|
||||
|
||||
output.write('<pre>\n\n</pre>\n' + otros.pagefooter(curep) + """
|
||||
|
||||
<h5>
|
||||
Last update:
|
||||
""" + mtime_str + """
|
||||
|
||||
</h5>
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
|
||||
input.close()
|
||||
output.close()
|
||||
|
||||
print epnum
|
||||
|
|
@ -0,0 +1 @@
|
|||
../guide/gen.py
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Per-directory values for /lurk/novels
|
||||
#
|
||||
def get_type():
|
||||
return 'novels'
|
||||
|
||||
def get_episode_names_file():
|
||||
return '../internal/novelnames'
|
||||
|
||||
def get_page_name_prefix():
|
||||
return 'Novel'
|
||||
|
||||
def get_table_of_contents():
|
||||
return """
|
||||
|
||||
<p>
|
||||
<b>Contents:</b>
|
||||
<a href="#BC">Back Cover</a> -
|
||||
<a href="#SY">Synopsis</a> -
|
||||
<a href="#UQ">Questions</a> -
|
||||
<a href="#AN">Analysis</a> -
|
||||
<a href="#NO">Notes</a> -
|
||||
<a href="#JS">Author</a>
|
||||
|
||||
"""
|
||||
|
||||
def get_do_jpeg():
|
||||
return 0
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys,string,time,os
|
||||
sys.path.append('../internal')
|
||||
import otros
|
||||
|
||||
months = [ '', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
||||
'August', 'September', 'October', 'November', 'December']
|
||||
|
||||
for epnum in sys.argv[1:]:
|
||||
curep = string.atoi(epnum[:3])
|
||||
|
||||
pix = open('../internal/epnames', 'r')
|
||||
for i in range(0, curep + 1):
|
||||
epname = pix.readline()[:-1]
|
||||
pix.close()
|
||||
if epname == '':
|
||||
epname = 'XXX'
|
||||
|
||||
cureplong = '%03d' % curep
|
||||
|
||||
which = 'synopsis'
|
||||
|
||||
input = open(epnum, 'r')
|
||||
mtime = time.localtime(os.stat(epnum)[8]);
|
||||
mtime_str = '%s %d, %d' % (months[mtime[1]], mtime[2], mtime[0])
|
||||
|
||||
output = open(epnum + '.html', 'w')
|
||||
|
||||
output.write("""<html>
|
||||
<head>
|
||||
<title>Synopsis: """ + '"' + epname + '"' + """</title>
|
||||
<link rev=made href="mailto:koreth@midwinter.com">
|
||||
<link rel=parent href="../eplist.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
""" + otros.pageheader(curep, which, 1) + """
|
||||
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
|
||||
""")
|
||||
|
||||
output.write(otros.mungeimages(input.read(), 1))
|
||||
|
||||
output.write('\n<pre>\n\n</pre>' +
|
||||
otros.pagefooter(curep, 'synopsis') + """
|
||||
|
||||
<h5>
|
||||
<a href="/lurk/lastmod.html">Last update:</a>
|
||||
""" + mtime_str + """
|
||||
|
||||
</h5>
|
||||
</body>
|
||||
</html>
|
||||
""")
|
||||
|
||||
input.close()
|
||||
output.close()
|
||||
|
||||
print epnum
|
||||
|
|
@ -0,0 +1 @@
|
|||
../guide/gen.py
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Per-directory values for /lurk/synops
|
||||
#
|
||||
def get_type():
|
||||
return 'synopsis'
|
||||
|
||||
def get_episode_names_file():
|
||||
return '../internal/epnames'
|
||||
|
||||
def get_page_name_prefix():
|
||||
return 'Synopsis'
|
||||
|
||||
def get_table_of_contents():
|
||||
return ''
|
||||
|
||||
def get_do_jpeg():
|
||||
return 1
|
||||
Loading…
Reference in New Issue