Lines 7-15
Link Here
|
7 |
# ---------------------------------------------------------------------- |
7 |
# ---------------------------------------------------------------------- |
8 |
# functions |
8 |
# functions |
9 |
def usage(): |
9 |
def usage(): |
10 |
print """Usage: gen.py file.in [...] |
10 |
print("""Usage: gen.py file.in [...] |
11 |
Substitute placeholders in input files with content |
11 |
Substitute placeholders in input files with content |
12 |
""" |
12 |
""") |
13 |
|
13 |
|
14 |
def gen_html(file): |
14 |
def gen_html(file): |
15 |
"""Replace variables in the file with their content""" |
15 |
"""Replace variables in the file with their content""" |
Lines 49-57
Link Here
|
49 |
vars.sort() |
49 |
vars.sort() |
50 |
|
50 |
|
51 |
# Substitute variables in all input files |
51 |
# Substitute variables in all input files |
52 |
print "Substituting variables", vars |
52 |
print("Substituting variables {0}".format(vars)) |
53 |
for file in input: |
53 |
for file in input: |
54 |
print "Processing", file, "..." |
54 |
print("Processing {0}...".format(file)) |
55 |
text = gen_html(file) |
55 |
text = gen_html(file) |
56 |
file = file.replace(".in", "") |
56 |
file = file.replace(".in", "") |
57 |
open(file, 'w').write(text) |
57 |
open(file, 'w').write(text) |