From e3f4552d45df1cad3bb3e46bd0663b7669783413 Mon Sep 17 00:00:00 2001 From: Andrea Ciprietti Date: Sun, 15 Jan 2023 11:36:52 +0100 Subject: [PATCH] Addressed comments --- p2d/parse_polygon_package.py | 10 ++++------ p2d/tex_utilities.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/p2d/parse_polygon_package.py b/p2d/parse_polygon_package.py index 7ee35c2..7280cb0 100644 --- a/p2d/parse_polygon_package.py +++ b/p2d/parse_polygon_package.py @@ -27,7 +27,7 @@ def parse_samples_explanations(notes): exit(1) assert(test_id != -1) assert(test_id not in explanations) - curr = curr[0].upper() + curr[1:] # Capitalize first letter. + curr = curr[0].upper() + curr[1:] # Capitalize first letter. explanations[test_id] = curr curr = '' test_id = -1 @@ -116,11 +116,9 @@ def pol_path(*path): 'statements', 'english', 'problem-properties.json') with open(statement_json_path) as f: statement_json = json.load(f) - problem['statement']['legend'] = statement_json['legend'] - problem['statement']['input'] = statement_json['input'] - problem['statement']['output'] = statement_json['output'] - problem['statement']['interaction'] = statement_json['interaction'] - problem['statement']['tutorial'] = statement_json['tutorial'] + for section in ['legend', 'input', 'output', 'interaction', 'tutorial']: + content = statement_json[section] + problem['statement'][section] = content if content is not None else '' explanations = parse_samples_explanations(statement_json['notes']) sample_id = 1 diff --git a/p2d/tex_utilities.py b/p2d/tex_utilities.py index 7231431..2495937 100644 --- a/p2d/tex_utilities.py +++ b/p2d/tex_utilities.py @@ -85,7 +85,7 @@ def generate_statement_tex(problem, tex_dir): 'LEGEND': problem['statement']['legend'], 'INPUT': problem['statement']['input'], 'OUTPUT': problem['statement']['output'], - 'INTERACTION': '' if problem['statement']['interaction'] is None else problem['statement']['interaction'], + 'INTERACTION': problem['statement']['interaction'], 'SAMPLES': samples_tex } for placeholder in replacements_statement: