Skip to content

gy-mate/moodle-to-vikwikiquiz

Repository files navigation

🎓 moodle-to-vikwikiquiz

Lines of code Build status Code quality Type hinting used Code style: Black PRs welcome

📖 About

A CLI for converting graded Moodle quizzes saved as HTML files to a vik.viki quiz wikitext.

📥 Installation

✨ Easy

  1. Install pipx

  2. If using Linux: follow these steps.

  3. Run the following command in the terminal:

    pipx install moodle-to-vikwikiquiz

🛠️ Executable zipapp

  1. Download the .pyz file of the latest release from here.

  2. Run the following command in the terminal:

    ./moodle-to-vikwikiquiz_x.x.x.pyz [parameters]

🧑‍💻 Usage

moodle-to-vikwikiquiz [--verbose|-v] [--new|-n] [--recursive|-r] source_path

Parameters:

  • --new: Create a new quiz on vik.wiki by automatically opening an edit page for the new article.
  • --recursive: Import HTML files from the current directory recursively.
  • source_path: The absolute or relative path of the file or directory where the Moodle quiz HTML files are located. These HTML files should contain the Review page of the quizzes.

Always check and correct the output before submitting it to the wiki! This includes uploading all images and adding their filenames to the quiz manually.

📋 Features

  • Imports multiple HTML files at once (recursively, if desired)
  • Can open an existing article or create a new one on vik.wiki with the edit summary pre-filled
  • Copies the generated wikitext to the clipboard
  • Supports true or false, single and multiple choice questions
  • Deduplicates questions with the same text
  • Asks for correct answers if it can't be determined from a graded question
  • Adds the only remaining correct answer automatically if it can be determined from the grade
  • Formats LaTeX equations as wikitext
  • Creates placeholders for illustrations

⏫ Updating

Run the following command in the terminal:

pipx upgrade-all

If you want this to run automatically, create a cron job:

  1. Open the crontab file:

    crontab -e
  2. Add this line to the beginning of the file:

    PATH=~/.local/bin

    If there is already a line beginning with PATH=, add :~/.local/bin to the end of it.

  3. Add the following line to the end of the file:

    @daily		pipx upgrade-all

    You may replace @daily with @weekly or @monthly.

🧑‍💻 Development

🏗️ Building

  • Wheels (.whl):

    1. Install build:
      python3 -m pip install --upgrade pip
      pip install build
    2. Create the wheels:
      python3 -m build
  • zipapp (.pyz):

    1. Install pipx
    2. Install shiv:
      pipx install shiv
    3. Create the executable:
      shiv --entry-point moodle_to_vikwikiquiz.main:main --output-file moodle-to-vikwikiquiz.pyz --reproducible .

📜 License

This project is licensed under the GNU General Public License v3.0. See the license file (or the GPL-3.0 license tab on GitHub) for its full text.