Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1a939c8

Browse files
committed
Make question wizard links open in new tab
1 parentfeccf96 commit1a939c8

File tree

4 files changed

+75
-6
lines changed

4 files changed

+75
-6
lines changed

‎core/generate_static_files.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
fromcore.checkerimportcheck_entry
3333
fromcore.runner.utilsimportsite_packages
3434
fromcore.textimportget_pages,step_test_entries,load_chapters
35-
fromcore.utilsimportunwrapped_markdown
35+
fromcore.utilsimportunwrapped_markdown,new_tab_links
3636

3737
str("import sentry_sdk after core.utils for stubs")
3838
importsentry_sdk# noqa imported lazily
@@ -87,11 +87,17 @@ def tarfile_filter(tar_info):
8787
deffrontend_terms():
8888
forkey,valueinfile_to_json(frontend_src/"english_terms.json").items():
8989
translation=t.get(f"frontend.{key}",value)
90+
9091
if"\n"intranslation:
9192
value=markdown(translation)
9293
else:
9394
value=unwrapped_markdown(translation)
94-
yieldkey,value
95+
96+
result=new_tab_links(value)
97+
ifvalue!=result:
98+
assertkey.startswith("question_wizard_")
99+
100+
yieldkey,result
95101

96102

97103
defmain():
@@ -100,7 +106,7 @@ def main():
100106

101107
json_to_file(list(load_chapters()),frontend_src/"chapters.json")
102108
json_to_file(get_pages(),frontend_src/"book/pages.json.load_by_url")
103-
json_to_file(dict(frontend_terms()),frontend_src/"terms.json")
109+
json_to_file(dict(frontend_terms()),frontend_src/"terms.json",indent=4)
104110

105111
birdseye_dest=frontend/"public/birdseye"
106112
shutil.rmtree(birdseye_dest,ignore_errors=True)

‎core/question_wizard.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
fromlittleutilsimportonly
77

88
fromcore.lintingimportlint
9-
fromcore.utilsimporthighlighted_markdown
9+
fromcore.utilsimporthighlighted_markdown,new_tab_links
1010

1111

1212
definput_messages(input_nodes):
@@ -82,5 +82,5 @@ def question_wizard_check(entry, output, runner):
8282
else:
8383
messages.append(t.Terms.q_wiz_debugger)
8484

85-
messages= [highlighted_markdown(message)formessageinmessages]
85+
messages= [new_tab_links(highlighted_markdown(message))formessageinmessages]
8686
returnmessages

‎core/utils.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ def markdown_codes(text):
164164
returnhighlighted_markdown_and_codes(text)[1]
165165

166166

167+
defnew_tab_links(s):
168+
returns.replace("<a href=",'<a target="_blank" rel="noreferrer" href=')
169+
170+
167171
defshuffled(it):
168172
result=list(it)
169173
shuffle(result)

‎frontend/src/terms.json‎

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
{"stop": "Stop", "run": "Run", "ask_for_help": "Ask for Help", "question_wizard": "Question Wizard", "previous": "Previous", "next": "Next", "table_of_contents": "Table of Contents", "skip_step": "Skip step", "reverse_step": "Reverse step", "sign_out": "Sign out", "settings": "Settings", "feedback": "Feedback", "developer_mode": "Developer mode", "developer_mode_description": "Enables the \"Reverse step\" and \"Skip step\" buttons.", "loading_wait": "Loading...", "login_or_sign_up": "Login / Sign up", "error_traceback": "Error traceback:", "did_you_mean": "Did you mean...", "similar_frames_skipped": "Similar frames skipped:", "report_error": "Report error", "report_error_instructions": "Oops, something went wrong! Please describe what you were just doing and what steps someone can take to reproduce the problem, then click Submit. Or click Cancel to not send a report.", "click_for_error_details": "Click for error details", "give_feedback": "Give feedback", "feedback_email_placeholder": "Email (optional, publicly visible)", "title": "Title", "description": "Description", "submit": "Submit", "cancel": "Cancel", "contact_directly": "Alternatively, you can contact us directly:", "send_email_to": "Email", "open_github_issue": "Open an issue on GitHub", "chat_on_slack": "Chat on Slack", "copying_solution_not_allowed": "Copying from the hints/solution area is not allowed!", "get_hint": "Get a hint", "get_another_hint": "Get another hint", "show_solution": "Show solution", "show_unscrambled_solution": "Show unscrambled solution", "show_shuffled_solution": "Show shuffled solution", "parsons_solution_instructions": "Above is an example solution with the lines out of order. You can drag them around to reorder them. Finding a correct order is up to you, and we won't will tell you if you get it right. Experimenting and running partial solutions in the editor may help you figure it out. You still need to type a correct solution into the editor and run it to continue.", "are_you_sure": "Are you sure?", "yes": "Yes", "no": "No", "hidden_solution_instructions": "Above is an example solution, but it's hidden. Click the Reveal button repeatedly to reveal the solution bit by bit. Try to stop when you think you've revealed enough and can fill in the remaining gaps yourself. Then type a solution in the editor and run it. Your solution doesn't have to be the same as the one above.", "reveal": "Reveal", "output_prediction_question": "What do you think the result will be?", "output_prediction_wrong_once": "Oops, that's not right. You can try one more time!", "output_prediction_wrong_twice": "Sorry, wrong answer. Try again next time!", "output_prediction_correct": "Correct!", "output_prediction_error_choice": "Error", "ok": "OK", "current_page": "(current)", "question_wizard_intro": "<p>If you need help, there are many sites like <a href=\"https://stackoverflow.com/\">Stack Overflow</a> and <a href=\"https://www.reddit.com/r/learnpython/\">reddit</a> where you can ask questions. This is a tool to help you write a good quality question that is likely to get answers.</p>\n<p>Enter and run your code on the right. If you don't have any code because you don't know where to get started, I'm afraid this tool can't help you. You can still ask for help, but it might be good to first read <a href=\"https://stackoverflow.com/help/dont-ask\">What types of questions should I avoid asking?</a></p>\n<p>If your question is about servers (e.g. Django or Flask), web requests, databases, or a package that can't be imported here, then this tool won't work. However, just because your current code <em>involves</em> those things, that doesn't mean that's what your question is <em>about</em>. If you're having a general Python/programming/logic problem, then extract that problem from the other stuff. Python with Django is still Python. If you can't do that, then read <a href=\"https://stackoverflow.com/help/minimal-reproducible-example\">How to create a Minimal, Reproducible Example</a> before asking your question.</p>", "question_wizard_expected_output": "<p>Good, now enter the output you expect/want from your program below. What would it show if it worked correctly? If it's not supposed to output anything, then add some <code>print()</code> calls to your code so that it would output something useful.</p>\n<p>When you're done, click 'Run' again to generate your question.</p>", "give_feedback_instructions": "<p>Tell us what you like or don't like! If you're reporting a bug, give a detailed description of the problem:</p>\n<ul>\n<li>What were you doing before and when the problem occurred?</li>\n<li>What steps can someone take to reproduce it?</li>\n<li>What do you observe happening, and what do you expect to happen instead?</li>\n</ul>", "toc_instructions": "<p>Below are links to different pages in the course. You can start anywhere and go in any order, and your progress on each page will be recorded.</p>\n<p>If you're completely new to programming, or you have doubts, just start at the beginning and click Next as you finish each page.</p>", "hints_progress": "Shown ${numHints} of ${totalHints} hints", "repeated_frames_description": "${name} at line ${lineno} (${count} times)", "copy_warning": "<p><strong>STOP!</strong></p>\n<p>Try to avoid copy pasting code. You will learn, absorb, and remember better if you type in the code yourself.</p>\n<p>When copying is appropriate, there will be a button to click to make it easy. If there's no button, try typing.</p>\n<p>Having said that, we're not going to force you. Copy if you really want to.</p>"}
1+
{
2+
"stop":"Stop",
3+
"run":"Run",
4+
"ask_for_help":"Ask for Help",
5+
"question_wizard":"Question Wizard",
6+
"previous":"Previous",
7+
"next":"Next",
8+
"table_of_contents":"Table of Contents",
9+
"skip_step":"Skip step",
10+
"reverse_step":"Reverse step",
11+
"sign_out":"Sign out",
12+
"settings":"Settings",
13+
"feedback":"Feedback",
14+
"developer_mode":"Developer mode",
15+
"developer_mode_description":"Enables the\"Reverse step\" and\"Skip step\" buttons.",
16+
"loading_wait":"Loading...",
17+
"login_or_sign_up":"Login / Sign up",
18+
"error_traceback":"Error traceback:",
19+
"did_you_mean":"Did you mean...",
20+
"similar_frames_skipped":"Similar frames skipped:",
21+
"report_error":"Report error",
22+
"report_error_instructions":"Oops, something went wrong! Please describe what you were just doing and what steps someone can take to reproduce the problem, then click Submit. Or click Cancel to not send a report.",
23+
"click_for_error_details":"Click for error details",
24+
"give_feedback":"Give feedback",
25+
"feedback_email_placeholder":"Email (optional, publicly visible)",
26+
"title":"Title",
27+
"description":"Description",
28+
"submit":"Submit",
29+
"cancel":"Cancel",
30+
"contact_directly":"Alternatively, you can contact us directly:",
31+
"send_email_to":"Email",
32+
"open_github_issue":"Open an issue on GitHub",
33+
"chat_on_slack":"Chat on Slack",
34+
"copying_solution_not_allowed":"Copying from the hints/solution area is not allowed!",
35+
"get_hint":"Get a hint",
36+
"get_another_hint":"Get another hint",
37+
"show_solution":"Show solution",
38+
"show_unscrambled_solution":"Show unscrambled solution",
39+
"show_shuffled_solution":"Show shuffled solution",
40+
"parsons_solution_instructions":"Above is an example solution with the lines out of order. You can drag them around to reorder them. Finding a correct order is up to you, and we won't will tell you if you get it right. Experimenting and running partial solutions in the editor may help you figure it out. You still need to type a correct solution into the editor and run it to continue.",
41+
"are_you_sure":"Are you sure?",
42+
"yes":"Yes",
43+
"no":"No",
44+
"hidden_solution_instructions":"Above is an example solution, but it's hidden. Click the Reveal button repeatedly to reveal the solution bit by bit. Try to stop when you think you've revealed enough and can fill in the remaining gaps yourself. Then type a solution in the editor and run it. Your solution doesn't have to be the same as the one above.",
45+
"reveal":"Reveal",
46+
"output_prediction_question":"What do you think the result will be?",
47+
"output_prediction_wrong_once":"Oops, that's not right. You can try one more time!",
48+
"output_prediction_wrong_twice":"Sorry, wrong answer. Try again next time!",
49+
"output_prediction_correct":"Correct!",
50+
"output_prediction_error_choice":"Error",
51+
"ok":"OK",
52+
"current_page":"(current)",
53+
"question_wizard_intro": "<p>If you need help, there are many sites like <a target=\"_blank\" rel=\"noreferrer\" href=\"https://stackoverflow.com/\">Stack Overflow</a> and <a target=\"_blank\" rel=\"noreferrer\" href=\"https://www.reddit.com/r/learnpython/\">reddit</a> where you can ask questions. This is a tool to help you write a good quality question that is likely to get answers.</p>\n<p>Enter and run your code on the right. If you don't have any code because you don't know where to get started, I'm afraid this tool can't help you. You can still ask for help, but it might be good to first read <a target=\"_blank\" rel=\"noreferrer\" href=\"https://stackoverflow.com/help/dont-ask\">What types of questions should I avoid asking?</a></p>\n<p>If your question is about servers (e.g. Django or Flask), web requests, databases, or a package that can't be imported here, then this tool won't work. However, just because your current code <em>involves</em> those things, that doesn't mean that's what your question is <em>about</em>. If you're having a general Python/programming/logic problem, then extract that problem from the other stuff. Python with Django is still Python. If you can't do that, then read <a target=\"_blank\" rel=\"noreferrer\" href=\"https://stackoverflow.com/help/minimal-reproducible-example\">How to create a Minimal, Reproducible Example</a> before asking your question.</p>",
54+
"question_wizard_expected_output":"<p>Good, now enter the output you expect/want from your program below. What would it show if it worked correctly? If it's not supposed to output anything, then add some <code>print()</code> calls to your code so that it would output something useful.</p>\n<p>When you're done, click 'Run' again to generate your question.</p>",
55+
"give_feedback_instructions":"<p>Tell us what you like or don't like! If you're reporting a bug, give a detailed description of the problem:</p>\n<ul>\n<li>What were you doing before and when the problem occurred?</li>\n<li>What steps can someone take to reproduce it?</li>\n<li>What do you observe happening, and what do you expect to happen instead?</li>\n</ul>",
56+
"toc_instructions":"<p>Below are links to different pages in the course. You can start anywhere and go in any order, and your progress on each page will be recorded.</p>\n<p>If you're completely new to programming, or you have doubts, just start at the beginning and click Next as you finish each page.</p>",
57+
"hints_progress":"Shown ${numHints} of ${totalHints} hints",
58+
"repeated_frames_description":"${name} at line ${lineno} (${count} times)",
59+
"copy_warning":"<p><strong>STOP!</strong></p>\n<p>Try to avoid copy pasting code. You will learn, absorb, and remember better if you type in the code yourself.</p>\n<p>When copying is appropriate, there will be a button to click to make it easy. If there's no button, try typing.</p>\n<p>Having said that, we're not going to force you. Copy if you really want to.</p>"
60+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp