Git Product home page Git Product logo

moodle-mcq's Introduction

Moodle MCQ

Comvert a simple YAML file to a Moodle question bank.

Dependancies

All dependancies are handled by run-in-venv. Just run the python script normaly, pypi dependancies will automaticly be installed in a venv.

Usage

$ ./main.py -o out.xml input.yml

YAML format

---
questions:
  - text: This is a shortanswer
    shortanswer:
      - bird
      - cat

  - text: Mamals
    multichoice:
      - true: cat
      - true: cow
      - bird
      - snake
      - fish

  - text: fish
    multichoice:
      - cat
      - cow
      - bird
      - snake
      - true: fish

  - text: Essay question
    essay: "do not put anything here"

Outputed XML

The output format is XML Moodle format.

<?xml version='1.0' encoding='utf-8'?>
<quiz>
	<question type="shortanswer">
		<name>
			<text>Question 01</text>
		</name>
		<questiontext format="markdown">
			<text>This is a shortanswer</text>
		</questiontext>
		<usecase>0</usecase>
		<answer fraction="100">
			<text>bird</text>
		</answer>
		<answer fraction="100">
			<text>cat</text>
		</answer>
	</question>
	<question type="multichoice">
		<name>
			<text>Question 02</text>
		</name>
		<questiontext format="markdown">
			<text>Mamals</text>
		</questiontext>
		<answer fraction="50.0">
			<text>cat</text>
		</answer>
		<answer fraction="50.0">
			<text>cow</text>
		</answer>
		<answer fraction="-50.0">
			<text>bird</text>
		</answer>
		<answer fraction="-50.0">
			<text>snake</text>
		</answer>
		<answer fraction="-50.0">
			<text>fish</text>
		</answer>
		<single>false</single>
		<single>false</single>
		<shuffleanswers>1</shuffleanswers>
		<answernumbering>abc</answernumbering>
	</question>
	<question type="multichoice">
		<name>
			<text>Question 03</text>
		</name>
		<questiontext format="markdown">
			<text>fish</text>
		</questiontext>
		<answer fraction="0">
			<text>cat</text>
		</answer>
		<answer fraction="0">
			<text>cow</text>
		</answer>
		<answer fraction="0">
			<text>bird</text>
		</answer>
		<answer fraction="0">
			<text>snake</text>
		</answer>
		<answer fraction="100">
			<text>fish</text>
		</answer>
		<single>true</single>
		<shuffleanswers>1</shuffleanswers>
		<answernumbering>abc</answernumbering>
	</question>
	<question type="essay">
		<name>
			<text>Question 04</text>
		</name>
		<questiontext format="markdown">
			<text>Essay question</text>
		</questiontext>
		<answer fraction="0">
			<text>do not put anything here</text>
		</answer>
	</question>
</quiz>

moodle-mcq's People

Contributors

mthfrr avatar

Stargazers

Paul Legé avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.