Skip to content

Commit aab38da

Browse files
committed
[skel] No longer use verbatim "author" as default value in rights_owner
Rather, if the rights_owner is the problem author, the field should be left out.
1 parent f169e17 commit aab38da

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

bin/skel.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,18 @@ def new_contest():
9696
fatal("--problem does not work for new_contest.")
9797

9898
# Ask for all required infos.
99-
title = _ask_variable_string("name", config.args.contestname)
99+
title = _ask_variable_string("name", config.args.contestname).replace("_", "-")
100100
subtitle = _ask_variable_string("subtitle", "", True).replace("_", "-")
101101
dirname = _ask_variable_string("dirname", _alpha_num(title))
102-
author = _ask_variable_string("author", f"The {title} jury").replace("_", "-")
102+
author = _ask_variable_string("author", f"The {title} Jury").replace("_", "-")
103103
testsession = _ask_variable_bool("testsession", False)
104104
year = _ask_variable_string("year", str(datetime.datetime.now().year))
105105
source_url = _ask_variable_string("source url", "", True)
106106
license = _ask_variable_choice("license", config.KNOWN_LICENSES)
107-
rights_owner = _ask_variable_string("rights owner", "author")
108-
title = title.replace("_", "-")
107+
rights_owner = _ask_variable_string(
108+
"rights owner (if left empty, defaults to problem author)", "", allow_empty=True
109+
)
110+
rights_owner = f"rights_owner: {rights_owner}\n" if rights_owner else ""
109111

110112
skeldir = config.TOOLS_ROOT / "skel/contest"
111113
log(f"Copying {skeldir} to {dirname}.")
@@ -198,7 +200,12 @@ def new_problem():
198200
"license", config.KNOWN_LICENSES, variables.get("license", None)
199201
)
200202
variables["rights_owner"] = _ask_variable_string(
201-
"rights owner", variables.get("rights_owner", "author")
203+
f"rights owner{'' if variables.get('rights_owner', '') else ' (if left empty, defaults to problem author)'}",
204+
variables.get("rights_owner", ""),
205+
allow_empty=True,
206+
)
207+
variables["rights_owner"] = (
208+
f"rights_owner: {variables['rights_owner']}\n" if variables["rights_owner"] else ""
202209
)
203210
variables["uuid"] = generate_problem_uuid()
204211

skel/contest/contest.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ print_time_limit: true
2121
# problem.yaml defaults
2222
source_url: {%source_url%}
2323
license: {%license%}
24-
rights_owner: {%rights_owner%}
25-
24+
{%rights_owner%}
2625
# CCS fields for integration
2726
# URL endpoint of the CCS, e.g. https://www.domjudge.org/demoweb.
2827
#api:

skel/problem/problem.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ uuid: {%uuid%}
99
credits: {%author%}
1010
{%source%}
1111
license: {%license%}
12-
rights_owner: {%rights_owner%}
13-
12+
{%rights_owner%}
1413
# limits:
1514
# time_limit: 1.0

0 commit comments

Comments
 (0)