From 912ec43f914de31c0e0c08387ef50ba1746877c9 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 22 Jul 2018 01:15:11 +0300 Subject: [PATCH] convert to named sprintf conversions. They are more robust. --- html-src/gen-html.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/html-src/gen-html.py b/html-src/gen-html.py index 694e1f3c..44a95311 100755 --- a/html-src/gen-html.py +++ b/html-src/gen-html.py @@ -70,7 +70,7 @@ wikipedia_files = [ main_header = ''' -%s +%(title)s @@ -134,7 +134,7 @@ def getGameRulesFilename(n): def gen_main_html(): for infile, title in files: outfile = open(os.path.join('html', infile), 'w') - print(main_header % title, file=outfile) + print(main_header % {'title': title}, file=outfile) with open(infile, 'r') as file: print(file.read(), file=outfile) s = 'Back to the index' @@ -164,7 +164,8 @@ def gen_rules_html(): # open file of list of all rules out_rules = open(os.path.join('html', 'rules.html'), 'w') - print(main_header % 'PySol - a Solitaire Game Collection', file=out_rules) + print(main_header % {'title': 'PySol - a Solitaire Game Collection'}, + file=out_rules) with open('rules.html', 'r') as file: print(file.read(), file=out_rules) @@ -218,7 +219,7 @@ def gen_rules_html(): # create file of altnames out_rules_alt = open(os.path.join('html', 'rules_alternate.html'), 'w') - print(main_header % 'PySol - a Solitaire Game Collection', + print(main_header % {'title': 'PySol - a Solitaire Game Collection'}, file=out_rules_alt) with open('rules_alternate.html', 'r') as file: print(file.read(), file=out_rules_alt)