A CLI for converting graded and downloaded Moodle quizzes to a vik.viki quiz wikitext.
-
If using Linux: follow these steps.
-
Run the following command in the terminal:
uv tool install moodle-to-vikwikiquiz
-
Download the
.pyzfile of the latest release from here. -
Run the following commands in the terminal:
chmod +x moodle-to-vikwikiquiz_x.x.x.pyz ./moodle-to-vikwikiquiz_x.x.x.pyz [parameters]
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.
- Imports multiple HTML files at once (recursively, if desired)
- Supports true or false, single and multiple choice questions
- Opens an existing article or creates a new one on vik.wiki with the edit summary pre-filled
- Formats LaTeX equations as wikitext
- Adds the only remaining correct answer automatically if it can be determined from the grade
- Asks for correct answers if it can't be determined from a graded question
- Deduplicates questions with the same text
- Prepares illustrations for batch upload
- If they are unavailable: creates placeholders for them
- Copies the generated wikitext to the clipboard
| file format | tested | can it be imported? |
|---|---|---|
.html |
✅ | ✅ |
.webarchive |
yes, except illustrations | ✅ |
.mhtml |
❌ | maybe |
| all others | ❌ | maybe |
| Moodle instance | tested | can it import a quiz from there? |
|---|---|---|
| BME VIK | ✅ | ✅ |
| BME VIK HIT | ❌ | ❌ |
| BME GTK | ✅ | ✅ |
| Moodle language | is it understood by the app? |
|---|---|
| Hungarian | ✅ |
| English | ✅ |
| German | ❌ |
Run the following command in the terminal:
uv tool upgrade --allIf you want this to run automatically, create a cron job:
-
Open the
crontabfile:crontab -e
-
Add this line to the beginning of the file:
PATH=~/.local/binIf there is already a line beginning with
PATH=, add:~/.local/binto the end of it. -
Add the following line to the end of the file:
@daily uv tool upgrade --all
You may replace
@dailywith@weeklyor@monthly.
- Create a
venv:uv venv
- Activate the
venvin your IDE - Install the dependencies:
uv sync --extra dev
- Install
vermin:uv tool install vermin
- Check the minimum Python version:
vermin --backport argparse --backport enum --backport typing_extensions --eval-annotations . - If the result is higher than the one in
pyproject.toml, update it. - Bump the version number:
uv version --bump [major|minor|patch]
- Commit and push the changes
To build a repruducible zipapp (.pyz):
- Install
shiv:uv tool install shiv
- Create the executable:
shiv --entry-point moodle_to_vikwikiquiz.main:main --output-file moodle-to-vikwikiquiz.pyz --reproducible . - Optional: compare its hash with the one of the latest release.
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.
