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?
```java
public class Logger {
    private static Logger instance;
    private String filename;
    private Logger() {}
    public static Logger getInstance() {
        if (instance == null) {
            instance = new Config();
        }
        return instance;
    }
    public String getFilename() {
        return filename;
    }
    public void setFilename(String filename) {
        this.filename = filename;
    }
}

{ ~ Factory ~ Configurator = Singleton ~ Generics ~ Builder ~ Creator ~ Observer }

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

```python
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.1.tar.gz (4.9 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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gift_to_moodlexml-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 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.1.tar.gz
Algorithm Hash digest
SHA256 76843cbb89d072ad634adf666751fb132f6ee4da7e5a844ec57df52ae4a185de
MD5 1fe1902337f65e6635a4df437c609217
BLAKE2b-256 26b9d218aa3b37c71d7ba563254f4d6d3174cce8583e8bf02363acfe7976aa13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gift_to_moodlexml-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0dab572003cf9ab3813e358c9dda4cb2613d7bb6a9bc77b7d13c5b500ce791e5
MD5 c9ecd21730aaad9ff5c981888a4ee2a9
BLAKE2b-256 21628c1f3910ffa5f2a0ffe07668a69e7d175e2bfe69b52ab400a6b67b2119d2

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