Moodle GIFT Tools

This page contains the software/tools I developed to work easily with (the popular learning management system) Moodle's GIFT (General Import Format Template) file format.

Logo Vim Syntax Highlighting and Vim SnipMate Snippets for GIFT

Prepare your Moodle quiz questions (in GIFT format on Vim editor) in style!
Get your quiz questions colored in real time as you are editing them. A sample screenshot is shown below.
Use snippets for all types of questions supported by the GIFT format to work from detailed templates.

Download (Contains all 3 files below)   :
Vim Syntax Coloring1,2  :  gift.vim
Vim Filetype Detection   :  gift.vim
Vim SnipMate Snippets   :  gift.snippets

[1] You can also download this file on VimLogo website.

[2] Moodle GIFT syntax highlighting has already been included in Vim GitHub repository (filetype detection commit on December 24, 2020, and syntax file commit on January 2, 2021). Therefore, if you install Vim after January 2, 2021, your installer package might already contain Moodle GIFT syntax coloring.

Here is a colored multiple-choice type question. Scroll down for more examples and other useful resources.


Logo GIFT Escaper v1.00

There are 6 special characters that control the GIFT format: ~, =, #, {, }, and :
If you need to use them as regular characters in your quiz questions, they need to be escaped (preceded by \ character).
You can use GIFT Escaper to automatically and properly escape any piece of regular text or LaTeX equation for you.
GIFT Escaper is written in Java Programming Language, and can run on almost all operating systems.
A screenshot of the GIFT Escaper software is shown below.

GIFT Escaper (zipped Java archive)  :
GIFT Escaper Icon (24 x 24 pixels)   :  GiftEscaperIcon

Screenshot of GIFT Escaper properly escaping the GIFT control characters inside a LaTeX equation.


Other GIFT Resources

Some other GIFT resources that I prepared, and links to some useful public GIFT resources are listed below.

Detailed GIFT Samples (Snippets)   :
Detailed GIFT Samples - Colored   :
Moodle 3.10 GIFT Samples   :
Moodle 3.10 GIFT Samples - Colored   :
Moodle 3.10 Parser - Base Class   :  Moodle310_qformat_default.php
Moodle 3.10 Parser - Child Class   :  Moodle310_qformat_gift.php
Moodle 3.10 Parser - Class Diagram   :  Moodle310_ClassDiagram.png

About GIFT Format   :  Moodle 3.10 Document
About UTF-8   :  Moodle 3.10 Document
GIFT Grammar3   :  GIFT PEG Grammar
GIFT Grammar Diagram   :  Railroad Diagram for GIFT PEG Grammar
GIFT for Visual Studio Code   :  Contains Good Documentation

[3] Note that the beautiful GIFT PEG Grammar seems to be developed separately from Moodle's own code, and it also seems to contain some idealized/beautified grammar constructs that are not 100% compatible with the Moodle's PHP code that actually does the parsing of the input GIFT files. While I was working on the regular expressions of the syntax coloring rules, I first carefully studied the parser code (down to every single detail, such that I claim to know more about this code than its actual developers). Then I reverse-engineered the PHP code in order to come up with the regular expressions that best reflect the internal workings of the parser code. I collected some of my interesting observations about the parser code as comments inside the file. Nevertheless, I think that it would be great if Moodle, in a future release, improves its PHP parser by switching from the ad hoc PHP code to a more formal grammar (such as the one listed above). That would make it a lot easier for developers to work with the GIFT capabilities of Moodle.

Last modified on January 5, 2021. Copyright © 2020 - 2023 Selim Temizer. All rights reserved.
Published on December 23, 2020. 3973 total hits and 3 hits per day since publication.


Powered by Temizer SiteBuilder v1.0. Copyright © 2017 - 2023 Selim Temizer. All rights reserved.