Skip to main content

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")

Metadata

Release files for gift-to-moodlexml 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gift-to-moodlexml 0.1.2
File Size Uploaded
gift_to_moodlexml-0.1.2.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gift-to-moodlexml 0.1.2
File Interpreter ABI Platform
gift_to_moodlexml-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / gift_to_moodlexml-0.1.2.tar.gz

Download URL gift_to_moodlexml-0.1.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c255988813d19c92731d99cb24d92e050f36b6a18f7f05004fb72ec4cc59288d
BLAKE2b-256 checksum
How to use checksums
9f8a8639b815236ee5ba05d52d98073abd626ff474a74e5074e6cee3fcbaee1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.9 Darwin/24.6.0

Release files / gift_to_moodlexml-0.1.2-py3-none-any.whl

Download URL gift_to_moodlexml-0.1.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84a777c06e70adb94b083b9f904a836b71c489cfdd843936cdc66d3daa8e82b1
BLAKE2b-256 checksum
How to use checksums
f09bb83e80ee4e726a6d703d84a15ad5d85dda8b03ac3bb23d66321321dea253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.9 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page