This repository contain the definition of self-grading quices about OpenStreetMap knowledge.
This project is based on this quiz generator: https://github.com/UrbanInstitute/quick-quiz
In order to modify an existing quiz, you need to:
-
Clone this project.
-
Change to the directory of this project.
cd OSM-quiz
-
Once in your computer, you modify the file:
osm-basic-en.quiz
underquices
directory. This is the file for the basic quiz about OSM in English. You can modify any other quiz, but this guide is made for this file. -
On the command line, you call Python:
python quiz_questions.py quices/osm-basic-en.quiz
quiz_questions.py
is the Python script that converts your questions to a JSON file that can be parsed as a web page.
-
The previous script will generate a
.josm
file:osm-basic-en.osm
under the same directoryquices
. You just need to commit both files (.quiz
and.json
) and push into GitHub.git commit -a -m "Quiz change" git push
If you forked this repository, then you will need to do a pull request. Otherwise, you need to configure your own gh-pages branch.
- Finally, wait a little bit, until GitHub page is refreshed: https://maptimebogota.github.io/OSM-quiz/.
For more information about the syntax, you can see this syntax documentation.
In order to create a new quiz, you need to:
-
Clone this project.
-
Change to the directory of this project.
cd OSM-quiz
-
Create a file with the
.quiz
extension under thequices
directory. The content of the file should follow the syntax explained at the end. Let's suppose you create a quiz calledmyOSMquiz
, then the file should be calledmyOSMquiz.quiz
-
On the command line, you call Python:
python quiz_questions.py quices/myOSMquiz.quiz
quiz_questions.py
is the Python script to convert your questions to a JSON file that can be parsed as a web page.
The previous script will generate a .josm
file: myOSMquiz.quiz
.
-
You need to create a dedicated HTML file for this quiz, calling the function quiz. For example, called
<script>quices/myOSMquiz.html
. You can copy any of the existing HTML files for quices, and just replace this:$(function() { $ ('#quiz').quiz("quices/myOSMquiz.json"); }); </script> -
Then, it is time to add all new files to git tracking:
git add quices/myOSMquiz.*
-
Now, you need to modify the list of quices in the
index.html
file. You just need to add a new line in the corresponding language section: - My OSM quiz
-
You just need to commit myOSMquiz files (
.quiz
,.json
and.html
) and theindex.html
.git commit quices/myOSMquiz.* quices/index.html -m "First commit of my own OSM quiz"
-
And now you can publish into GitHub.
git push
-
Finally, wait a little bit, until GitHub page is refreshed: https://maptimebogota.github.io/OSM-quiz/.
For more information about the syntax, you can see this syntax documentation.
This is the syntax for the quices:
//
double slash is for comments. The text in a line is not processed after these.url:
the parent URL. For quices in this page, the URL ishttps://maptimebogota.github.io/OSM-quiz
.#
This is the title of the quiz.1)
The number of the question. It should start from the beginning of the line. This is the question order.-
An invalid answer. It should have 2 blankspaces from the beginning, and an extra blankspace after the hyphen.*
The valida answer. It should have 2 blankspaces from the beginning, and an extra blankspace after the hyphen.(image) XXX
An image to appear as part of the question. XXX is the name of the image that should be in the same repository.