Skip to main content

Extended GIFT format to Moodle XML question parser

Project description

gift-to-moodlexml

Creating Moodle XML Questions from extended GIFT format

Features

  • Parse GIFT files more robustly compared to moodle
  • Supports full markdown syntax (incl. Code highlighting!)
  • Points are automatically inferred OR can be set!
    • Deducts -50% for single choice, -100% for T/F question
  • Supports:
  • True/False Question (will be converted to Multichoice to allow point deduction)
  • Multichoice
  • Single Choice
  • Fill-the Blank

Install

pip install gift-to-moodlexml

Usage

Assume you have some (extended) GIFT file:

$CATEGORY: OOP2/Intro

[markdown]Java supports use of `varargs` (variable arguments) for parameter passing {T}

[markdown] What pattern does this Code use?
`Logger logger=Logger.getInstance();`
{
    ~ Factory
    ~ Configurator
    = Singleton
    ~ Generics
    ~ Builder
    ~ Creator
    ~ Observer
}

Then you can parse it to an XML to upload to moodle:

import gift_to_moodlexml
from pathlib import Path
questions_files= list(Path("./").glob("*.gift"))
all_questions = []
for q_file in questions_files:
    with open(q_file, "r") as file:
        content = file.read()
        questions = content.split("\n\n")
        questions = [q for q in questions]
        question = questions[0]
        all_questions.extend(questions)
gift_to_moodlexml.generate_xml_from_questions(all_questions, output_file="quiz_package.xml")

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

gift_to_moodlexml-0.1.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

gift_to_moodlexml-0.1.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file gift_to_moodlexml-0.1.2.tar.gz.

File metadata

  • Download URL: gift_to_moodlexml-0.1.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.9 Darwin/24.6.0

File hashes

Hashes for gift_to_moodlexml-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c255988813d19c92731d99cb24d92e050f36b6a18f7f05004fb72ec4cc59288d
MD5 d874d0a0beb451b1df23738f6556aac9
BLAKE2b-256 9f8a8639b815236ee5ba05d52d98073abd626ff474a74e5074e6cee3fcbaee1d

See more details on using hashes here.

File details

Details for the file gift_to_moodlexml-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gift_to_moodlexml-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.9 Darwin/24.6.0

File hashes

Hashes for gift_to_moodlexml-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84a777c06e70adb94b083b9f904a836b71c489cfdd843936cdc66d3daa8e82b1
MD5 96c513c966634378e210ec1611519bfb
BLAKE2b-256 f09bb83e80ee4e726a6d703d84a15ad5d85dda8b03ac3bb23d66321321dea253

See more details on using hashes here.

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