Skip to content

Commit

Permalink
🔧 corrected CLI instructions for editing a quiz; improved type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
gy-mate committed Aug 24, 2024
1 parent 245efeb commit a120dd0
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/moodle_to_vikwikiquiz/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def main() -> None:
quiz_title,
quiz_wikitext,
wiki_domain,
wikitext_instructions,
wiki_modifier_keys,
wiki_editor_keys,
operating_system,
)
logging.getLogger(__name__).debug("Program finished!")

Expand Down Expand Up @@ -223,11 +225,13 @@ def get_grading() -> GradingType:

def create_article(
args: Namespace,
parameters_for_opening_edit: dict,
parameters_for_opening_edit: dict[str, str],
quiz_title: str,
quiz_wikitext: str,
wiki_domain: str,
wikitext_instructions: str,
wiki_modifier_keys: dict[str, str],
wiki_editor_keys: dict[str, str],
operating_system: str,
) -> None:
if args.new:
parameters_for_opening_edit_with_paste = parameters_for_opening_edit.copy()
Expand All @@ -251,9 +255,16 @@ def create_article(
print("The wikitext of the quiz has been copied to the clipboard!")
url = f"{wiki_domain}/{quote(quiz_title)}?{urlencode(parameters_for_opening_edit)}"
if not args.new:
print("The existing article will now be opened for editing.")
print(wikitext_instructions)
input("Please press Enter then follow these instructions...")
print(
f"""
The existing article will now be opened for editing. After that, please...
• scroll to the bottom of the wikitext in the editor
• paste the content of the clipboard in the second line below the existing wikitext
• click on the 'Előnézet megtekintése' button ({wiki_modifier_keys[operating_system]}-{wiki_editor_keys["Show preview"]})
• correct the spelling and formatting (if necessary), especially the formulas
• click on the 'Lap mentése' button ({wiki_modifier_keys[operating_system]}-{wiki_editor_keys["Publish page"]})"""
)
input("\nPlease press Enter then follow these instructions...")
clear_terminal()
webbrowser.open_new_tab(url)
print(
Expand All @@ -279,7 +290,9 @@ def open_article_paste_text(args: Namespace, quiz_wikitext: str, url: str) -> No
return


def open_article(args: Namespace, parameters_for_opening_edit: dict, url: str) -> None:
def open_article(
args: Namespace, parameters_for_opening_edit: dict[str, str], url: str
) -> None:
logging.getLogger(__name__).warning(
"I can't create the article automatically "
"because the URL would be too long for some browsers (or the server)."
Expand Down

0 comments on commit a120dd0

Please sign in to comment.