Skip to main content

A CLI for converting graded Moodle quiz HTMLs to a vik.wiki quiz wikitext

Project description

🎓 moodle-to-vikwikiquiz

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

Recent activity Commits since latest release PRs welcome

📖 About

A CLI for converting graded and downloaded Moodle quizzes to a vik.viki quiz wikitext.

📥 Installation

🌍 Global

  1. Install pipx

  2. If using Linux: follow these steps.

  3. Run the following command in the terminal:

    pipx install moodle-to-vikwikiquiz
    

🏠 Local

🛠️ Executable zipapp

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

  2. Run the following commands in the terminal:

    chmod +x moodle-to-vikwikiquiz_x.x.x.pyz
    ./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)
  • 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

🏫 Compatibility

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

⏫ 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

⌨️ Developing

After you make changes to the Python codebase, please check whether the supported minimum Python version has changed. Run the following command in the terminal:

vermin --backport argparse --backport enum --backport typing_extensions --eval-annotations .

If it has changed, please update pyproject.toml accordingly.

🏗️ Building

  • Repruducible 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 .
      
    4. Optional: compare its hash with the one of the latest release.
  • Wheels (.whl):
    1. Install build:
      python3 -m pip install --upgrade pip
      pip install build
      
    2. Create the wheels:
      python3 -m build
      

📜 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moodle_to_vikwikiquiz-2.0.3.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moodle_to_vikwikiquiz-2.0.3-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file moodle_to_vikwikiquiz-2.0.3.tar.gz.

File metadata

  • Download URL: moodle_to_vikwikiquiz-2.0.3.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for moodle_to_vikwikiquiz-2.0.3.tar.gz
Algorithm Hash digest
SHA256 be6681823ac443fc93c4766ba1899bff7e4ca9e5d614b4d678f8169843839fac
MD5 de7071a16d6e29cecbbb657a34f8387f
BLAKE2b-256 40cab655ff0a06d6af144d921115010d71b10dcabe495f8ad229d614fe79491e

See more details on using hashes here.

Provenance

The following attestation bundles were made for moodle_to_vikwikiquiz-2.0.3.tar.gz:

Publisher: release.yaml on gy-mate/moodle-to-vikwikiquiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moodle_to_vikwikiquiz-2.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for moodle_to_vikwikiquiz-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5305c84d49ed4e9c82b898809d5e38bd82ad92de246750885a1dd5a7b27862b1
MD5 fd37e39e1d1d6182fc4c6ff1d8f23b7a
BLAKE2b-256 0aa8d6f638e7986aed1614539d40533d341f87ec462003b5b2dfbfec2b3b8353

See more details on using hashes here.

Provenance

The following attestation bundles were made for moodle_to_vikwikiquiz-2.0.3-py3-none-any.whl:

Publisher: release.yaml on gy-mate/moodle-to-vikwikiquiz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page