Mallard Extended HTML
List of Mallard Tags
A MallardTM question file consists of
standard
HTML, with a few simple extensions (additional markup tags):
- The
input tag.
- Tells Mallard to provide the student with a way to enter an
answer.
- The
answer tag.
- Tells Mallard the correct solution(s) for the immediately
preceding
input tag.
- The
display tag.
- Tells Mallard to display something using a Mallard display type.
- The
param tag.
- Similar to the tag of the same name in the Java
applet
tag syntax. Used as a standard way of communicating information to
Mallard$
- The
random tag.
- Used to create random valued variables within a Mallard question.
- The
eval tag.
- Used to evaluate an arithmetic expression within a Mallard
question.
- The
var tag.
- Used to refer to or display a previously evaluated or randomly
generated variable.
- The
if, else, and
elseif tag.
- Used to conditionally display information based on a student's
response.
- The
hint tag.
- Used to display additional hint information for a student in a
separate
pop-up window.
- The
question tag.
- Used to group
input tags together in hints or
additional c$
- The
insert tag.
- Used to insert other Mallard material (either course material
or questions) into the current page.
- The
link tag.
- Used to create links to other pages from the current page.
- The
output_messages tag.
- Used inside questions to indicate where question feedback
should be printed.
The following goes into more detail on the use of each of the Mallard
tags
and provides several examples.
Input
Input Synopsis |
<input type=input_type>
Input type Specific information
</input>
|
This tag is used to tell Mallard when to let a student enter some
information.
The sort of information entered and the way in which it is entered is
specified by the input type. These input types
are
pre-defined extensions to Mallard that specify exactly how information is
to
be entered and graded. Example input types include multiple-choice, fill
in the
blank, true/false, and arithmetic. The syntax of the information between
the
<input> and </input> tags depends on which
input
type you use and
is discussed with the individual input types.
Here is a simple example
of the use of the input tag. Suppose you wanted to ask a true/false
question:
"It is easy to write Mallard questions." In this case, the input
type
is true_false, and no input type specific information is
needed:
It is easy to write Mallard questions.
<input type=true_false>
</input>
Answer
Answer Synopsis |
<answer>
Input type Specific information
</answer>
|
The answer tag is the complement to the <input> tag; instead
of providing the
information necessary to ask a student to enter an answer, it provides the
information needed to correct the student's response. The
<answer> tag is always
associated with an <input> tag and provides the answer to
the question asked. If,
however, an input type does not need answer information (e.g., it randomly
generates the question and the solution), then the answer
tag may be omitted.
Note: Any text placed between an input tag and its
corresponding answer tag will not be displayed, but
variables
in this area (using the <random>, <var>, and
<eval> tags) will be evaluated.
In the example
above, we still need to specify what the answer is. For the
true/false input type, the answer is either true or
false. In this case, the correct answer is
true:
<answer>
true
</answer>
Thus, if we put the input and answer tags together we have a complete
(although
short) question:
It is easy to write Mallard questions.
<input type=true_false>
</input>
<answer>
true
</answer>
Display
Display Synopsis |
<display type=display_type>
Display type Specific information
</display>
|
The <display> tag is similar to the <input>
tag, except that it is used to display
rather than request information. This tag is generally used as a
short-cut
to display commonly used, but complex HTML constructs. The
<display> tag
references a display type module, which is similar to an input type in
that
it can be user defined.
Param
Param Synopsis |
<param name=name value=value>
<param name=value>
<param name1=value1
name2=value2>
|
The <param> tag is used within the
<input>...</input>,
<answer>...</answer>, or
<display>...</display> constructs
to give parameters
for the specified input or display type. The possible names and values of
the parameters depend on the particular input or display type used.
Random
Random Synopsis |
<random name=name range=low-high type=(int|float)>
|
This tag is used to generate a random variable. The range of
possible random values is inclusive and can be positive or negative. The
type
of number generated may be either integer (int) or floating
point (float).
For example, if you wished to generate a random integer called
x
between -10 and 10 (inclusive), you would use the following:
<random name=x range=-10-10 type=int>
You can also exclude 0 from the possible range of numbers. In the above
example, we could ensure that 0 would not be chosen by adding
nonzero to the tag:
<random name=x range=-10-10 type=int nonzero>
Floating point random numbers can also be generated; simply specify the
type
as float or float.n, where
n is the number of digits to the right of the decimal
point you wish. For example:
<random name=x type=float.1 range=1-10>
This would generate a random number like 3.4.
The value of the newly generated random variable will be displayed in
place
of the <random> tag when the file is viewed in
Mallard. If you
do NOT wish for the variable to display, add the noshow flag
to the tag as follows:
<random name=x range=-10-10 type=int nonzero noshow>
Eval
Eval Synopsis |
<eval name=name>
Numerical expression to evaluate
</eval>
|
This tag is used to evaluate a numerical expression of variables within a
question. This tag is intended as a means to generate numbers that while
not
completely random, depend on numbers generated using the
<random> tag.
The following operators are supported:
- * or x ==> multiplication
- ^ or ** ==> exponentiation
- - ==> subtraction
- + ==> addition
- () ==> grouping
- e or E ==> scientific notation
The following arithmetic functions are supported:
- abs() ==> absolute value function
- sin() ==> sine function (radians)
- cos() ==> cosine function (radians)
- exp() ==> returns e to the power of the given expression
- log() ==> natural log
- sqrt() ==> square root
- atan2(x,y) ==> returns the arctangent of x/y in range -pi to pi
The following constant is also supported:
- pi ==> 3.14159265358979
Suppose we want to generate 2 random numbers, x1 and x2, and we need to
generate a third number, z, that is the sum of x1 and x2. Using the
<random> and <eval> tags, we can do this:
x1 is: <random name=x1 range=1-10 type=int>
x2 is: <random name=x2 range=1-10 type=int>
z is:
<eval name=z>
<var name=x1> + <var name=x2>
</eval>
You can also use the <eval> tag to compute a number for
later use without
printing the computed value by adding noshow at the end of
the
<eval> tag:
<eval name=z noshow>
<var name=x1> + <var name=x2>
</eval>
Var
Var Synopsis |
<var name=name>
|
The <var> tag is used to redisplay or reference a variable
previously generated
by the random or <eval> tags.
This is useful for specifying variables inside an expression to be
evaluated
inside <eval> tags.
The above example uses the <var> tag as follows:
x1 is: <random name=x1 range=1-10 type=int>
x2 is: <random name=x2 range=1-10 type=int>
z is:
<eval name=z>
<var name=x1> + <var name=x2>
</eval>
If, Else, and Elseif
If, Else, and Elseif Synopsis |
<if cond=value>
Text to be displayed
<elseif cond operator value>
Text to be displayed
<else>
Text to be displayed
</if>
|
These tags are used to conditionally display text, depending on the
student's
answer. They can be used to give the student help after missing a problem
or
to explain why a given answer is correct or incorrect. These tags are
always
placed between the <answer> and
</answer>
tags that they are referring to. Most conditions depend
on which input type was used, but score is always defined as
the
student's score on that particular input. For detailed information about
which
conditions are available for each input type, refer to the
information on
the individual input types.
The comparison operator can be any of the following:
- equal to (= == EQ)
- not equal to (!= ne)
- greater than (GT)
- less than (LT)
- greater than or equal to (GTE)
- less than or equal to (LTE)
Here is a (trivial) example of their use:
<answer>
...
<if score==100>
Congratulations!! Great Job!
<elseif score GTE 80>
You did pretty well. Keep trying!
<else>
You did not do too well on this one.
Perhaps you should review some of the material.
</if>
</answer>
Hint
Hint Synopsis |
<hint>
Hint Information
</hint>
|
- <hint>
</hint>
- This is a pair of tags used to surround a hint embedded in
the current document.
Fields:
All fields behave identically to those in the
<link> tag where window = hint.
- title
- link_text
- link_image
- height
- width
Usage tips:
- Hints may now be placed in any Mallard document,
including questions, course material, other hints, and even
the introductory text at the beginning of quizzes. You may do
this using the <hint> </hint> tags
presented
here (for inline hints which you write directly into the
parent
document) or the <link window=hint> tag
introduced
in the section on creating links to other documents
(for material previously uploaded to Mallard).
- Warning: The old
<title="title">
and
<link_text="link!"> tags which were included
inside
the <hint> </hint> tags in version 2.5
no longer work.
They will be ignored and your hint will
receive the defaults for those fields.
- Warning: The old hint numbering
(<hint1>
<hint2> etc) to indicate nesting no longer
works.
Nested hints should be typed into the parent document using
nested <hint> </hint> tags as desired.
- Hints are not permitted in the following locations:
- between <input> and </input>
tags
- between <answer> and
</answer> tags
(unless inside an <if> clause)
- between <display> and
</display>
- between <eval> and </eval>
tags
- between </input> and <answer>
tags
Example:
- <hint title="My Hint" link_text="Try this
hint.">
This is the text of my hint.
</hint>
Question
Question Synopsis |
<question>
input group
</question>
|
- <question>
</question>
- In order to write a question in Mallard course material,
<question> </question> tags must be used
to surround the <input> </input>
and <answer> </answer> blocks.
Fields:
- box [no,yes]
Same as the box field in the <insert> tag.
- title
Same as the title field in the <insert> tag.
Usage tips:
- Questions are not permitted in the following
locations:
- between <input> and </input>
tags
- between <answer> and
</answer> tags
- between <display> and
</display>
tags
- between <eval> and </eval>
tags
- between </input> and
<answer> tags
- It is not necessary to use
<question> </question> tags when inserting
a
question with the <insert type=question> tag, as
they perform a similar function - alerting Mallard that what
they surround or refer to should be read as a question.
The <question> </question> pair of tags
should be used to surround a question (containing
<input> </input> and
<answer> </answer> blocks) which is written
out directly inside a document. The
<insert type=question> tag, on the other hand, is
used to insert into the document a question that has been
previously uploaded to Mallard.
- It is similarly not necessary to include
<question> </question> inside question
files
that you upload to Mallard, as these will be inserted into
documents using the <insert type=question> tag.
- Redundant usage of tags as described above will not,
however, cause an error in Mallard.
Insert
Insert Synopsis |
<insert src=insert_material>
|
- <insert>
- This is a single-line tag, used to insert other
Mallard material (either
course material or questions) into the current page. The
result is a single seamless document with no indication
that
the <insert> tag was used in its creation.
Fields:
- src
The Mallard ID (source) of the question or material to be
included.
- type=[material,question]
The type of material to be inserted. Either material or
questions may be inserted. The default is material.
Note: If a question is
inserted inside another question, the input items
of the inserted question are added to those of the current
question, forming one large question with many input
items.
It is not suggested that you do this.
box=[no,yes]
- no: A box will not
be drawn around an inserted question.
- yes: A box will be drawn around an inserted
question.
Note: A question inserted inside a question (see
above) becomes part of the surrounding question
and thus cannot have a box drawn around it. (I.e., a box
can be drawn only around a "top-level" question.)
title=[no, yes]
- no: If box=no, the title will be ignored.
- yes: This displays a title in the box drawn
around the question.
Usage tips:
- The <insert> tag should be used to create a
single page by combining previously uploaded
Mallard material or questions with any other text on the
page. To create a link to previously uploaded Mallard
material on a separate page, the
<link> tag
should be used.
- For a comparison of the <insert
type=question>
tag and the <question> </question> tag
pair, refer to the section about the
<question> </question> tags.
- Inserts are not permitted in the following
locations:
- between <input> and </input>
tags
- between <answer> and
</answer> tags
- between <display> and
</display>
tags
- between <eval> and </eval>
tags
- between </input> and <answer>
tags
- Inserting a file inside itself, or creating a chain of
insertions where a file at a lower level in the insertion
chain attempts to insert a file higher in the chain (which
again inserts the lower level file, creating a loop)
is not permitted. Should you accidentally create
such a loop, Mallard will catch it and issue an error
message in place of the erroneous insert.
Examples:
- <insert src=my_material>
Inserts previously uploaded material with the ID
"my_material" into the document
- <insert src=my_question type=question
title="Sample
Question" box=yes>
Inserts a previously uploaded question with the ID
"my_question" into the document, surrounded by a box, with
the title "Sample Question"
- <insert src=my_question
type=question>
Inserts a previously uploaded question with the ID
"my_question" into the document, with no box around it.
Link
Link Synopsis |
<link src=link_material>
|
- <link>
- This is a single-line tag, used to create links to other
pages from the current page.
Fields:
- src
The Mallard ID (source) of the material to be linked to.
Note t$
cannot link directly to questions - you must link to
material
which contains questions.
To link to a named anchor in the material, you can
append the name of the anchor to the src name with a
#
character. src=tennis#serving will link to the
location of the named anchor "serving" in the file
"tennis."
(Note: This use of the # character overrides any anchor
names later specified with the explicit field "anchor"
as given below.)
- anchor [<anchor
name>]
Specifies a named anchor in the material being linked
to.
Note that this value is overridden by use of the #
character to append an anchor name to the src field,
as described above.
- window
[self,popup,hint]
Should the link appear inside another window?
self: The material linked to appears in the
current
window. This is the default.
popup: The material linked to appears in a pop-up
window. You may specify the size (see below).
hint: The material linked to appears in a pop-up
hint
window. You may specify the size (see below).
Hint windows have two main advantages: (1) hint windows
inherit the values of any random variables from the
parent window, and (2) links using hint windows, unlike
the other two types of links, may be used inside
<if>
clauses in the answer.
- type
[default,lect,ex]
What sort of Mallard material should the material be
displayed
as? These settings, which are stored in the
material registry
file, determine the default title, background color, and
icons
to be used in displaying the material.
- title
The title to be given to the linked page and its contents.
If you do not specify any title, the title will default to
the full name of the given type specified in
the material registry. The exception is for links
with window = hint, which have a default title of
"Hint" regardless of the type value.
- link_text
The text that will form the link to the new page. Defaults
are as follows:
window = self> (or no window field): "LINK"
window = popup: "POP-UP WINDOW"
window = hint: "HINT"
- link_image
A Mallard image which you wish to use as the link to the
new
page. Note that link_text takes precedence over
link_image. If you specify link_text, the
image will be ignored.
- height
[full,half,fourth,<number>]
The height of the new window. You may specify either a
number
of pixels or a fraction of the standard browser window
height
as given above. The default is to pop up a window the same
height as a standard browser window.
- width
[full,half,fourth,<number>]
The width of the new window. You may specify either a
number
of pixels or a fraction of the standard browser window
width
as given above. The default is to pop up a window the same
width as a standard browser window.
Usage tips:
- The <link> tag should be used to create a
a link to previously uploaded Mallard material on
a separate page. To combine previously uploaded
Mallard
material with other such questions, material, or text on
the
current page to create a single document, the
<insert> tag should be
used.
- You may include links to hint windows
(<link window=hint>) inside <if>
clauses, but not to either other documents to appear in
the
current window (<link window=self> or plain
<link>) or to regular pop-up windows
(<link window=popup>).
- You cannot link directly to a question on another page.
You must first create and save Mallard material which
contains the question in it, and then create a link to
this
new Mallard material.
- Links are not permitted in the following locations:
- between <input> and </input>
tags
- between <answer> and
</answer> tags
(aside from hint links in <if> clauses, as
explained above)
- between <display> and
</display>
tags
- between <eval> and </eval>
tags
- between </input> and <answer>
tags
- Linking to a file inside itself, or creating a chain of
links where a file at a lower level in the link
chain attempts to link to a file higher in the chain
(which
again links to the lower level file, creating a loop)
is not permitted. Should you accidentally create
such a loop, Mallard will catch it and issue an error
message in place of the erroneous link.
Examples:
- <link src=my_material#part5 window=hint
link_text="hint" height=half title="nice hint">
Creates a link with the word "hint," which pops up a
hint
window with height
half that of a standard browser window (width is standard
by
default), containing the material "my_material" with a
title
"nice hint". The material is opened scrolled to location
labelled with anchor "part5".
- <link window=popup src=my_material
title="Reference Table" link_text="this table" type=ex>
Creates a link with the words "this table" which pops up a
pop-up window with standard size, containing the material
"my_material," titled "Reference Table," and taking the
background color and icons from the
material registry entry for type "ex"
- <link src=my_material type=lecture
link_text="a review">
Creates a link with the words "a review" to material
"my_material" which will be displayed in the current
browser
window. The title, background color, and icons will be
read from the material entry for type "lect."
Output_messages
Output_messages Synopsis |
<output_messages>
|
- <output_messages>
- This is a single-line tag, used inside questions to
to indicate where the feedback for the question should be
printed
out. Upon reaching the <output_messages> tag, all
the feedback stored from the individual input blank grading
is formatted into a table and output. If no
<output_messages> tag is encountered before the
end of the question, the feedback will be printed out at the
end
of the question by default.
Usage tips:
- By default, question feedback is printed at the end of a
question. If you prefer it to be printed elsewhere - e.g.
after
each input blank - you specify the locations by using the
<output_messages> tags.
- When Mallard encounters an <output_messages>
tag, all
feedback stored from preceding input blanks encountered since
the last <output_messages> tag will be output.
Feedback will be output one time only, as the
<output_message$
Example:
- <output_messages>
Outputs at this location all feedback stored - and
not yet output - from all preceding input blanks within this
question.
Comments? Questions? General harassment? Mail it to
maiko@wocket.csl.uiuc.edu