-
Notifications
You must be signed in to change notification settings - Fork 15
New Format Spec
jotux edited this page Mar 1, 2013
·
9 revisions
[[variable_name=initial_value]]
Var is [[v=1]].
Var is <span data-var="v"></span>.
{
initialize:
function ()
{
this.v = 1;
},
update:
function ()
{
}
}
[[variable_name=initial_value,_]]
Box value is [[b=2,_]]. Box value plus one is [[bp=b+1]].
Box value is <span data-var="b" class="TKNumberField"></span>. Box value plus one is <span data-var="bp"></span>.
{
initialize:
function ()
{
this.b = 2;
},
update:
function ()
{
this.bp = this.b + 1;
}
}
[[variable_name=initial_value,(range_min..range_max,step),text]]
There are [[a=10,(10..30,1), items]]. If each item costs $5 the total cost would be $[[ac=a*5]].
Thre are <span data-var="a" class="TKAdjustableNumber" data-min="10" data-max="30" data-step="1">items</span>. If each item costs $5 the total cost would be $<span data-var="ac"></span>.
{
initialize:
function ()
{
this.a = 10;
},
update:
function ()
{
this.ac = this.a * 5;
}
}
[[variabe_name=initial_value,text_0,text_1]]
The value is [[t=0,reasonable,unreasonable]].
The value is <span data-var="t" class="TKToggle TKSwitch"><span>reasonable</span><span>unreasonable</span></span>.
{
initialize:
function ()
{
this.t = 0;
},
update:
function ()
{
}
}
[[variable_name,expression,format_specifier]]
If you get [[rs=75,(0..100,1),%]] on the test your final grade will be [[r,52 + rs/3,%0.0]]%.
If you get <span data-var="rs" class="TKAdjustableNumber" data-min="0" data-max="100" data-step="1">%</span> on the test your final grade will be <span data-var="r" data-format="%0.0f"></span>%.
{
initialize:
function ()
{
this.rs = 75;
},
update:
function ()
{
this.r = 52 + rs / 3;
}
}
[[variabe_name,(condition_1,condition_2,...),(text_1,text_2,...)]]
With a score of [[sc=75,(0..100,1),%]] you will [[sf,(sc <= 60,sc > 60),(fail,pass)]].
With a score of <span data-var="sc" class="TKAdjustableNumber" data-min="0" data-max="100" data-step="1"></span> you will <span data-var="sf" class="TKSwitch"><span>fail</span><span>pass</span></span>
{
initialize:
function ()
{
this.sc=75;
},
update:
function ()
{
if (this.sc <= 60)
{
this.sf = 0;
}
else if (this.sc > 60)
{
this.sf = 1;
}
}
}