//*************************************************************************************************************************************************** // // Sample GIFT File // // Author : Selim Temizer (http://selimtemizer.com) // Language : Moodle GIFT (General Import Format Template) // Latest Revision : December 21, 2020 // // Copyright (C) 2020 Selim Temizer. // //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** // // General Info: // // - Any GIFT file must be correctly encoded in UTF-8. See: https://docs.moodle.org/310/en/Converting_files_to_UTF-8 // // - At least one blank line (which might contain optional whitespaces) must be left between each question (question block). // // - A comment line may start with optional whitespaces, and then continues with '//' token followed by any text until the end of line. // // - If a comment contains any of the following keywords, they will be highlighted: FIXME TODO NOTE FIX XXX // // - Any entity can contain comment line(s) inside it. // // - Comments within a question block may contain one id number (if more than one, the first one will be used), and multiple tags for that question. // Examples: An ID [id:16], one tag [tag:t1] and another tag [tag:Tag with escaped \] char]. // // - During parsing of a GIFT question block, first, comment lines are removed from the block, then ESCAPED GIFT special characters, :#={}~ (escaped) // are replaced with some placeholder strings (pre-processed). After the result is partitioned into appropriate entities, the placeholders in most // (not all) entities are replaced back with the corresponding UNESCAPED GIFT special characters (post-processed) in the end. // // - If the question text has a format applied, like [html], it will be used as the default format for the other entities in the question block // (such as the choices in the answer part, the feedback(s) and the general feedback). // // - Every question type can have an optional single general feedback at the end of its answer block (as the last entity). General feedback starts // with the '####' token, and lasts until the end of the answer block. If a format will be applied to the general feedback, the format token // '[...]' should immediately follow the '####' token (there should be NO whitespaces in between). // // - If the question text continues after the answer part, the answer part will be replaced with a fill-in-the-blank line as "_____" in the question // text when presented to students (the question will be a "missing word" type question). All question types can be written in Missing Word format. // // - For answer weights, note that Moodle uses 5 decimal places to do its math, so if you wish to divide percentages in thirds, use %33.33333% // instead of %33% or %33.33%. // // - Normally, the feedback (if exists), or a message "correct/incorrect" will be displayed to the student upon answering each question. If you do // NOT want this (default) feedback message to be displayed, then enter your own feedback message (i.e. "continue", "---", etc.). In case you want // NO visible message displayed, then enter a non-breaking space as feedback. Moodle will not put its automatic response because it sees the blank // space. To do this, put a feedback, '#', after the answer and write ' ' (without spaces between these characters). // //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** // // - A category line may start with optional whitespaces, then '$CATEGORY:' token followed by any text until the end of line. // // - Escaped special characters in the category text are pre-processed, but they are NOT post-processed later! // // - Note that a category line also needs to be followed by at least one blank line to be considered as an individual question block. // // - You can change the category as many times as you wish within the file. All questions after the modifier up to the next modifier or the end of // the file will be added to the specified category. // // - The categories are created if they do not exist. $CATEGORY: $course$/top/GIFT Examples $CATEGORY: Also/a/category/with/many/levels //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** // // - A question name is post-processed, "cleaned" (possibly something is done about HTML characters), trimmed (whitespaces at the beginning and end // are removed) and then shortened to a certain size to fit in the database (if too long). // // - If the question name contains newline characters inside, they will be preserved when the question is exported back from Moodle, and this might // create a problem, because the exported question will have the name in a comment above it, but the comment will occupy multiple lines (hence, it // will be an invalid comment block). // // - Even if no question block follows a question name, it will be considered as a question block (if at least one blank line follows it). Then, the // import process will also create a question with an empty body for that question name. ::Question name // Comment with escaped entities :#={}~ and <>&_ in it:: //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Description:: [html] This is a description question. Escaped entities :#={}~ and <>&_. // // If there is no answer part, the question is a description question. // A description question can be used to give information about following questions in an exam. // Example: "You can use your pencil and paper for these next math questions." //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Essay:: [html] This is an essay question. Escaped entities :#={}~ and <>&_. { // If the answer part is empty (possibly including whitespaces, comments and a general feedback), the question is an essay question. // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::True/False:: [html] This is a true/false question. Escaped entities :#={}~ and <>&_. { TRUE // Valid tokens are 'T', 'TRUE', 'F', and 'FALSE'. // # [html] Optional FIRST feedback is shown if the student gives the WRONG answer. Escaped entities :#={}~ and <>&_. # Optional SECOND feedback is shown if the student gives the RIGHT answer. Escaped entities :#={}~ and <>&_. // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Short answer:: [html] This is a short answer question. Escaped entities :#={}~ and <>&_. { = %50% [html] Selim # [html] All answers are prefixed by '=' token. There CANNOT be a negative answer (CANNOT have '~' token in it). = Temizer # There should be at least 1 answer. If there is only a single answer, there is no need for the '=' token, as long as it cannot be confused as true/false. // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Numerical answer:: [html] This is a numerical answer question. Escaped entities :#={}~ and <>&_. { # // Starts with '#' token (possibly preceded by whitespaces). // = 100 # [html] If there is only a single answer, there is no need for the '=' token. = %75% 100:5 # Answer can also be a value with a +/- tolerance. = %50% [html] 90..110 # Answer can also be a min/max range. ~ Any text (ignored, will be replaced by '*') # [html] A single optional last negative answer just to contain a negative feedback (if any). // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Multiple choice:: [html] This is a multiple choice question. Escaped entities :#={}~ and <>&_. { = [html] Correct choice. Escaped entities :#={}~ and <>&_. # [html] The single correct choice CANNOT have a weight. ~ Wrong choice. Escaped entities :#={}~ and <>&_. # [html] There should be at least 2 choices. ~ %50% [html] Partially correct choice. # Escaped entities :#={}~ and <>&_. // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Multiple answer:: [html] This is a multiple answer question. Escaped entities :#={}~ and <>&_. { ~ %50% [html] Choice 1 # [html] CANNOT contain a correct answer (CANNOT contain '='). ~ %50% Choice 2 # [html] There should be at least 2 choices. ~ %-100% Choice 3 # The answers should total no more than 100%, otherwise Moodle will return an error. ~ Choice 4 # If there is no explicit weight, that choice will have a default zero (0) weight. ~ %-100% Choice 5 # To avoid the problem of students automatically getting 100% by simply checking all of the answers (thereby adding up all weights as the final score for the question), it is best to include negative answer weights for wrong answers. // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //*************************************************************************************************************************************************** //*************************************************************************************************************************************************** ::Matching:: [html] This is a matching question. Escaped entities :#={}~ and <>&_. { = [html] Key 1 with scaped entities :#={}~ and <>&_ -> Value 1 with escaped entities :#={}~ and <>&_ = Key 2 -> Value 2 with an arrow -> in it (considered as regular text) = Key 3 -> Value 3 // // - The first occurance of '->' token separates key from value (value part can also contain arrow(s) as regular text with no special meaning). // - There CANNOT be a wrong choice (all choices start with '='). // - Choices CANNOT have weights. // - Choices CANNOT have feedbacks. // - The value parts (after the arrows) CANNOT have formats. // - There should be at least 2 choices (according to parsing PHP code). // - There should be at least 3 choices (according to Moodle v3.10 documentation). // ####[html] Optional general feedback. Escaped entities :#={}~ and <>&_. } //***************************************************************************************************************************************************