Here is a typical quiz with a question and four alternative answers:
Question:
What is the capital of Norway?
Hover over the choice to see if it is correct or not.
The above quiz can be specified by the compact text
!bquiz
Q: What is the capital of Norway?
Cw: Helsinki
Cw: Drammen
Cr: Oslo
Cw: Denmark
!equiz
!bquiz
("begin quiz") and !equiz
("end quiz") tags.Q:
("question").Cw:
, and right choices with Cr:
.!bquiz
, !equiz
, Q:
, Cw:
, and Cr:
must appear at the beginning of a line.Cr:
) lasts up to the next instruction (like Cw:
, Cr:
, !equiz
).Multiple correct choices are possible. Here is an example with three right choices:
!bquiz
Q: Which of the following cities are capitals?
Cw: Sidney
Cr: Kigali
Cw: Bonn
Cr: Bern
Cr: Ottawa
Cw: New York
!equiz
Question:
Which of the following cities are capitals?
Sometimes it is desirable to give some explanation why certain choices are wrong (or right). If you hover over the choice, the explanation will pop up if it is simple text (otherwise it cannot be formatted).
Question:
What is the capital of Norway?
Helsinki is the capital of Finland.
Drammen is a small city close to Oslo.
The quiz syntax applies E: ...
after the choice to
give an explanation of that choice.
!bquiz
Q: What is the capital of Norway?
Cw: Helsinki
E: Helsinki is the capital of Finland.
Cw: Drammen
E: Drammen is a small city close to Oslo.
Cr: Oslo
Cw: Denmark
!equiz
This time we also added some whitespace for enhanced reading of the text.
It is easy to use emphasize font, boldface, color, hyperlinks, etc., since the text in the specification of questions, choices, and explanations are rendered according to the DocOnce markup language. For simple typesetting (emphasize, boldface, links) DocOnce also accepts Markdown syntax. Here is an example:
Question:
This is a very famous quote:
Premature optimization is the root of all evil.
This quote is attributed to
According to Wikiquote, Donald Knuth wrote this statement in Structured Programming with Goto Statements. Computing Surveys, 6:4, pp. 261-301, 1974.
Ole-Johan Dahl was a famous Norwegian professor of computer science and together with Kristen Nygaard the inventor of object-oriented programming, but he is not the man behind this quote.
The corresponding specification reads
!bquiz
Q: Here is a famous quote:
!bquote
*Premature optimization is the root of all evil.*
!equote
This quote is attributed to
Cw: George W. Bush
Cr: Donald Knuth
E: According to "Wikiquote": "http://en.wikiquote.org/wiki/Donald_Knuth",
Donald Knuth wrote this statement in *Structured Programming with
Goto Statements*. Computing Surveys, _6_:4,
pp. 261-301, _1974_.
Cw: Ole-Johan Dahl
E: Ole-Johan Dahl was a famous Norwegian professor of computer
science and together with Kristen Nygaard the inventor of
object-oriented programming, but he is not the man behind this
quote.
!equiz
Question admonitions may well feature quizzes unless the output
format is reStructuredText (rst
, sphinx
). A plain question
admonition is
What is the capital of Norway?
specified by the DocOnce syntax
!bquestion
What is the capital of Norway?
!equestion
Putting a quiz inside the question admonition looks like
Question:
[] What is the capital of Norway?
Stockholm is the capital of Sweden, Norway's neighboring country.
Some people from Bergen may claim so... It is just the second largest city in Norway.
specified as
!bquestion
!bquiz
Q: [] What is the capital of Norway?
Cw: [Answer:] Stockholm
E: Stockholm is the capital of Sweden, Norway's neighboring country.
Cw: Bergen
E: Some people from Bergen may claim so... It is just the second
largest city in Norway.
Cr: Oslo
Cw: Denmark
!equiz
!equestion
In the above example, we demonstrate the possibility to control
the word preceding the question and the choices.
For the current output format (html
), questions are by default preceded by
Question:
and choices by Choice X:
, where X
is the
letter corresponding to the choice.
The prefix appears inside square brackets. Empty brackets, as those
in the question, leads to no prefix. The choice Stockholm
has
a prefix [Answer:]
, and exactly the text inside the square brackets
precedes the text of this choice in the output.