A bash script for converting a plain-text file of multiple-choice questions to H5P
This repository contains a bash script for creating an H5P of multiple-choice questions (with a single correct answer; possibly with tips and right/wrong answer feedbacks) using the H5P Question Set template via the linux command line. Simply:
./mcq2h5p-FDBCK.sh control-fb.txt myMCQ-fb.txt
where myMCQ-fb.txt
(it may be named in some other way) is a plain-text input file that contains your multiple-choice questions and corresponding answers (possibly with tips and feedbacks) written in H5P Question Set template markup (see tutorial), e.g.,
1. Which of the following is a letter?
10:Is this in the alphabet?:Try again.:In letters, this is TEN.
9:Is this in the alphabet?:Not quite.:In letters, this is NINE.
*A:Is this in the alphabet?:Yes, A is a letter.:A is a letter.
2. Which of the following is a number?
*35
a
q
z
3. 15 + 1 + 3 = _____
16::15 + 1 = 16. Try something bigger.:This is short by 3.
21::15 + 3 + 3 = 21. Try something smaller.: The correct sum is 2 less than this.
*19:: Right!: 15 + 1 + 3 = 16 + 3 = 19.
11:: 15 - 4 = 11. A bit too small.: This is 8 smaller than the right sum.
(Note: Tips, correct- and wrong-answer feedbacks are given in item 1. Item 2 has neither tips nor right/wrong answer feedbacks. Item 3 has not tips but has right/wrong answer feedbacks.)
The H5P is created in the main directory and is called NAME_H5P_DIR.h5p
based on the value of H5P_NAME
in your control-fb.txt
file. There are a number of ways to view/play this newly created H5P:
To use:
git clone https://github.com/justineuro/h5p-mcq-maker-fb.git
.myMCQ-fb.txt
(it may be some other filename), containing your MC questions and answers written in H5P Question Set template markup (see the H5P Question Set Tutorial for additional information), and save it under the h5p-mcq-maker-fb
directory that you just cloned.control-fb.txt
file to set the parameters for your new H5P (includes NAME_H5P
, TITLE
, AUTHOR
, LICENSE
, INTRODUCTION
, PASS_PERCENTAGE
, DISABLE_BACKWARDS_NAVIGATION
, RANDOM_QUESTIONS
, and POOL_SIZE
; see mcq2h5p-FDBCK.sh
for a description of these parameters).h5p-mcq-maker-fb
directory, issue the command:
./mcq2h5p-FDBCK.sh control-fb.txt myMCQ-fb.txt
where myMCQ-fb.txt
may be some other file containing your MC questions and answers (possibly with tips and/or right/wrong answer feedbacks). (Note: This file must end in two blank lines.)
The h5p.json
and content.json
files will be created in the appropriate locations inside the NAME_H5P_DIR
(based on the value of NAME_H5P
in the contro-fb.txt
) directory; the NAME_H5P_DIR
directory will be zipped-up to create your new H5P). Your newly created Question Set H5P, filename: NAME_H5P_DIR.h5p,
will be found in the h5p-mcq-maker
directory.
[… section omitted …]
This folder includes (among others):
mcq2h5p-FDBCK.sh
- a bash script that converts to a Question Set H5P a plain text file containing mutiple-choice questions and answers .h5p-mcq-616_libs
- a folder that contains the libraries inside the question-set-616.h5p
re-use template that’s available from the Examples & downloads section at https://h5p.org; the h5p.json
and content/content.json
files will be over-written to produce your new H5P. Among other libraries, this folder contains: H5P.QuestionSet-1.20
, H5P.MultiChoice-1.16
, and H5P.Question-1.5
. In addition, this folder also contains the library from the H5P.MathDisplay-1.0.7.h5p
(add support for math content rendering).control-fb.txt
- a plain text file containing the control parameters for your new H5P (e.g., NAME_H5P
, TITLE
, AUTHOR
, LICENSE
, INTRODUCTION
, PASS_PERCENTAGE
, DISABLE_BACKWARDS_NAVIGATION
, RANDOM_QUESTIONS
, and POOL_SIZE
; these are used for creating the h5p.json
and content.json
of your new H5P). You would want to edit this to suit your own specifications.myMCQ-fb.txt
- an example of 3 multiple-choice questions, 2 of which are selected each time the H5P is viewed/played. (Note that the MathJax
symbol “\
” has to be triply escaped. Thus, \(
should be written as \\\\(
and \sqrt{2}
should be written as \\\\sqrt{2}
.)myMCQ-fb.h5p
- the H5P created by mcq2h5p-FDBCK.sh
based on questions in myMCQ-fb.txt
and using the values of control parameters in control-fb.txt
.The repository also contains the files for two other examples.
myMCQ-fb-1.h5p
: control-fb-1.txt
and myMCQ-fb-1.txt
(5 questions); 3 randomly chosen questions are shown each time the H5P is playedmyMCQ.h5p
: control.txt
and myMCQ.txt
(10 questions w/o tips or feebbacks); 5 randomly chosen questions are shown each time the H5P is played
h5p-mcq-maker-fb by Justine Leon A. Uro is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/justineuro/h5p-mcq-maker-fb.