From c3c757cd7ad7792dd1a27e5551c68489400a4923 Mon Sep 17 00:00:00 2001 From: Anders Schau Knatten Date: Sun, 26 May 2024 09:57:48 +0200 Subject: [PATCH 1/3] Update script for porting to C++23 --- quiz/management/commands/text_generator.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/quiz/management/commands/text_generator.py b/quiz/management/commands/text_generator.py index b4b7992..8cc41e6 100644 --- a/quiz/management/commands/text_generator.py +++ b/quiz/management/commands/text_generator.py @@ -28,14 +28,14 @@ def get_result_display(question): template = """ ### Thanks for helping! -Thank you for helping to port this question from C++11 to C++17. +Thank you for helping to port this question from C++17 to C++23. You'll find the source code in [question.cpp]({{QUESTION_PATH}}question.cpp), this should normally not need modification. -In C++11, the correct answer is: +In C++17, the correct answer is: > {{ANSWER}} -Please verify that this is still correct in C++17. If it is, please do the following: +Please verify that this is still correct in C++23. If it is, please do the following: {{BULLET}} Update [explanation.md]({{QUESTION_PATH}}explanation.md): {{BULLET}} Refer to the correct section numbers {{BULLET}} Use updated quotes from those sections (the wording might have changed) @@ -46,7 +46,7 @@ def get_result_display(question): If you get stuck, please describe the problem in detail in a comment to the issue, and a maintainer will add the `help wanted` tag so others can chime in. -If the correct answer has changed from C++11 to C++17, you can either just leave a comment in this issue, or see the instructions for [updating meta data]({{ROOT_PATH}}METADATA_HOWTO.md). +If the correct answer has changed from C++17 to C++23, you can either just leave a comment in this issue, or see the instructions for [updating meta data]({{ROOT_PATH}}METADATA_HOWTO.md). """ meta_data_howto = """ @@ -75,15 +75,15 @@ def get_result_display(question): """ main_readme = """ -## Porting CppQuiz.org questions to C++17 +## Porting CppQuiz.org questions to C++23 CppQuiz.org is an open source C++ quiz site. If you're unfamiliar with it, you can read more in [its "About" section](https://cppquiz.org/quiz/about/). -All the CppQuiz questions are currently targetting C++11. We need to update them for C++17. Most questions will still have the same answers, we just need to update the explanations and references to the standard. A few questions will also have different answers. +All the CppQuiz questions are currently targetting C++17. We need to update them for C++23. Most questions will still have the same answers, we just need to update the explanations and references to the standard. A few questions will also have different answers. Doing this all by myself is going to take months, so I would very much appreciate some help from the community. To make that as simple as possible, I've created this repository containing all the questions. There is a [directory for each question](/questions), named after the question number. That directory contains the source code of the question in a `.cpp` file, the hint and explanation in `.md` files, as well as a `README.md` explaining everything you need to do to port the question. There's also an issue for each question, making it easier to track progress. The issue has the same information as the `README.md` file. -As soon as we've updated all the questions in this repository, I'll import them back into CppQuiz, and from then on CppQuiz will always ask about C++17. +As soon as we've updated all the questions in this repository, I'll import them back into CppQuiz, and from then on CppQuiz will always ask about C++23. ### How to help porting questions There are two ways to contribute, listed below. I prefer the first alternative, but if that prevents you from contributing, the second is also ok. From ae9b05e34fbb531369ed7e3a89a202387ce1047d Mon Sep 17 00:00:00 2001 From: Anders Schau Knatten Date: Sun, 26 May 2024 10:44:39 +0200 Subject: [PATCH 2/3] Fix issue in issue creation script --- quiz/management/commands/create_issues.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quiz/management/commands/create_issues.py b/quiz/management/commands/create_issues.py index 09f15ae..7d29756 100644 --- a/quiz/management/commands/create_issues.py +++ b/quiz/management/commands/create_issues.py @@ -22,7 +22,7 @@ def handle(self, *args, **options): print("Creating issue for " + str(q.id)) title = 'Update question ' + str(q.id) body = text_generator.get_issue(q) - data = json.dumps({'issue': {'title': title, 'body': body}}) + data = json.dumps({'issue': {'title': title, 'body': body}}).encode("utf-8") url = 'https://api.github.com/repos/' + options['user'][0] + '/' + options['repo'][0] + '/import/issues' headers = { 'Authorization': 'token ' + options['token'][0], From 8babfaf57c4faaeb95e5b90cecca6335dee0f680 Mon Sep 17 00:00:00 2001 From: Anders Schau Knatten Date: Sun, 26 May 2024 10:55:09 +0200 Subject: [PATCH 3/3] Document how to port questions to new standard --- docs/porting_to_new_standard.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/porting_to_new_standard.md diff --git a/docs/porting_to_new_standard.md b/docs/porting_to_new_standard.md new file mode 100644 index 0000000..12abc70 --- /dev/null +++ b/docs/porting_to_new_standard.md @@ -0,0 +1,13 @@ +### Porting to new standard + +When porting the questions to a new standard, use the previous issues https://github.com/knatten/cppquiz/issues/77 and https://github.com/knatten/cppquiz/issues/293 for inspiration. + +The main steps are as follows, see previous issues for details: +- Create a porting repository (previously, we've used https://github.com/knatten/cppquiz17 and https://github.com/knatten/cppquiz23) +- Copy the md files from the previous such repository to the new one +- In the main cppquiz repo, export the questions: `python manage.py export_questions_to_repo ` +- Create a [personal access token](https://github.com/settings/tokens?type=beta) with permissions to create issues in the porting repo +- In the main cppquiz repo, auto-generate issues: `python manage.py create_issues ` +- Copy the `.github/pull_request_template.md` pull request template from a previous porting repo to the new one +- Use the porting repo to port all the questions (see previous porting issues) +- In the main cppquiz repo, import the updated questions: `python manage.py update_questions_from_repo `