WIMS commands can be used in variable processing files and phtml files.
A command is a word preceeded by the character !.
Commands has two types:
Execution commands, which are placed as the first word of a line.
Variable commands, which are placed at the beginning of a definition of
a variable.
Some commands can be used both as execution command and as variable command.
Commands may accept parameters which are words following it. Parameter
fields are separated by white spaces or special words (depending on the command).
Meaning:
String manipulation: append object s1 to the string str; object may be item, word,
line, colon or semicolon. The object s1 should not be empty before evaluation.
bound
Type:
execution command
Syntax:
!bound vname between [integer] v1 and v2 [default defaultvalue] !bound vname within list [default defaultvalue]
Meaning:
bound the range of the variable vname. Usually this is used on user-submitted variables.
The first syntax is usually for numerical variables (integer or real,
defaults to real). In this case v1 and v2 supplies the lower and
upper bounds for the value of vname.
In the second syntax, the value of vname is compared with
each item of list. If no occurrence is found, the value of
vname is replaced either by defaultvalue or the first item of list,
according to whether defaultvalue is defined.
In any case, defaultvalue is optional.
nocache
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!nocache
changeto
Type:
execution command
Syntax:
!changeto file [parm]
Meaning:
Abandon the current file, changing processing to file. file is as in read.
The parameter parm can be accessed from within
the new file under the variable name wims_read_parm.
char
Type:
both execution and variable command
Syntax:
!char numlist of string
Aliases:
chars
Meaning:
Outputs selected characters of string, according to numlist.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of character in string
counted from the beginning,
with 1 corresponding to the first
character. A negative integer denotes the number of character from
the end of string: -1
means the last character, -2 means
the next-to-last character, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole string except the first
and the last characters.
charcnt
Type:
variable command
Syntax:
!charcnt string
Aliases:
charcount, charno, charnum, lengthof
Meaning:
Returns the number of characters in string.
checkallpar
Type:
only for trusted modules (in particular administrative modules).
Syntax:
!checkallpar string
Meaning:
check if parentheses (all types) are balanced in string and return yes
if it is the case and no if not.
checkdata
Type:
variable command
Syntax:
!checkdata
Aliases:
checkdatamodule
Meaning:
This command is used to check whether datamodules required by
the present module are installed on the server. It returns "yes" if every
required datamodule is installed or if no datamodule is required. Otherwise
it returns the address of the first missing datamodule.
If your module depends on datamodules to run, declare them in the INDEX
file, then use this command to check the presence of the datamodules. If
the answer is "no", you can take actions to lock further access to your
module and/or show error messages.
checkhost
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!checkhost
column
Type:
both execution and variable command
Syntax:
!column numlist of string
Aliases:
columns
Meaning:
Outputs selected (comma-separated) columns of a matrix string,
according to numlist. Rows of the matrix can be separated either
by new lines or by semi-colon ;.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of column in string
counted from the beginning,
with 1 corresponding to the first
column. A negative integer denotes the number of column from
the end of string: -1
means the last column, -2 means
the next-to-last column, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole string except the first
and the last columns.
The output is separated by commas if only one column is selected, or
separated in the same way as the matrix string otherwise.
comment
Type:
only for trusted modules (in particular administrative modules).
Syntax:
!comment
Aliases:
rem remark
date
Type:
both execution and variable command
Syntax:
!date parm
Meaning:
This is simply an interface to the Linux date utility. parm is the parameter
string to the Linux command date, please refer to the man page of date for its syntax.
The command returns the output of the date utility.
deaccent
Type:
both execution and variable command
Syntax:
!deaccent string
Meaning:
Returns string with all accented letters (such as é, à, ï) folded to
their unaccented counterparts.
debug
Type:
both execution and variable command
Syntax:
!debug parms
Meaning:
This command is for debugging purposes: it substitutes the parameter parms,
and stops the execution with a module error sent to the user. The content of the
error message contains the result of the substitution.
declosing
Type:
both execution and variable command
Syntax:
!declosing string
Meaning:
Strips off enclosing pair of parentheses ((),[],{}) in string.
Useful for treatment of user-input vectors or sets,
where some users use enclosing parentheses and other do not.
default
Type:
execution command
Syntax:
!default name=value
Meaning:
put value into the variable name, if name is not already defined.
value may be a variable command (together with optional parameters).
defof
Type:
both execution and variable command
Syntax:
!defof vname in fname
Aliases:
definitionof, getdef
Meaning:
Returns the definition of variables vname in the file fname.
When vname contains several names, the values of each will
be returned with the same separators as for the names.
detag
Type:
both execution and variable command
Syntax:
!detag string
Meaning:
Removes html tags in string. It is very rudimentary and should be used with care.
Very useful for security enhancement in some occasions (apply to user-supplied strings).
detrust
Type:
only for trusted modules (in particular administrative modules).
Syntax:
!detrust
Aliases:
distrust
distribute
Type:
execution command
Syntax:
!distribute type string into namelist
Meaning:
Distribute the content of string into variables namelist. The distribution
can be done word by word, item by item, character by character or line by line,
according to the word type where type can be one of the following: words, items,
lines, chars.
For example, if type is words,
then the first (resp. second, etc.) variable in namelist will be set
to the first (resp. second, etc.) word of string.
embraced
Type:
both execution and variable command
Syntax:
!embraced opword string
Meaning:
executes an operation opword in each substring of string enclosed in a pair
of curly braces.
The curly braces in string can be nested, but the execution runs from outmost pair
to innermost pair.
Available opword:
randitem. Random item in every embraced text.
randrow. Random row in every embraced text.
linkedranditem. Random item in every embraced text such that
for each level of curly braces, the position of the choosen item is the same.
extract. Extracts the first (outmost) embraced text.
delete. Deletes all embraced contents (encluding the curly braces).
eval
Type:
variable command
Syntax:
!eval expr
Aliases:
evalue
Meaning:
Returns the numerical value of the expression expr. expr must evaluate to
a real number (under the current version of wims). The evaluation is internally done in double
precision, but the print precision can be changed by setting the variable
wims_print_precision (whose default value is 8).
If an error is found in the expression expr, 0 is returned.
(I know that this is very bad; I just have no time to make everything right.)
Meaning:
Manipulation of mathematical expressions: substitute variable name by val in expr,
then evaluate the expression to a real number. No regular expression is allowed in name.
See also the commands
!mathsubst,
!replace.
examscore
Type:
both execution and variable command
Syntax:
!examscore
exchange
Type:
execution command
Syntax:
!exchange var1 and var2 !exchange var1, var2
Meaning:
Exchanges the values of the variables var1 and var2.
exec
Type:
both execution and variable command
Syntax:
!exec command parms
Aliases:
execute, run, call
Meaning:
execute external command command with optional parameters parms.
command must be a valid program name in the wims-public directory bin.
When used as variable command, returns the output of the called program.
exit
Type:
execution command
Syntax:
!exit
Aliases:
return
Meaning:
Abandon the current file. If current file is called by another file, return to the latter.
fileappend
Type:
execution command
Syntax:
!fileappend fname content
Aliases:
appendfile
Meaning:
Append content to file fname. fname is a file residing in directory of the module,
under the subdirectory writable. A new line will be added at the end of the content.
Special case: if the file name starts with getfile/, the file is written to the getfile
subdirectory of the session. This file is then accessible via the command
Meaning:
return yes if file is a file in the base directory public_html
in the case of a non trusted module.
If the command is executed from a trusted module, file
may be of the form wimshome/address. For example,
!fileexists themes/standard/_procs/tt.phtml
or for a trusted module,
!fileexists wimshome/log/classes/2001/Exindex
filewrite
Type:
execution command
Syntax:
!filewrite fname content
Aliases:
writefile
Meaning:
Write content to file fname. fname is a file residing in the module's directory,
under the subdirectory writable.
A new-line character will be added at the end of the content.
Special case: if the file name starts with getfile, the file is written to the getfile
subdirectory of the session. This file is then accessible via the command
Syntax:
!for var = start to end [step st ] !for var from start to end [step st ] !for var in list
... (multi-line content)
!next
Meaning:
For loop. In the first two forms, var goes from start to end, with optional step st.
In the last form, var takes successively items in the list
list. list is a list of items separated by commas.
The command
!break
within the for loop breaks it. continue is not yet implemented in this version.
It is recommended that the variable name var be added to the
!next line. This has no effect for the time being, but may be
used in future versions of wims.
form
Type:
execution command
Syntax:
!form cmdvar
Meaning:
Creates a html form pointing to the wims server.
Whenever possible, this command should be used instead of a direct use of
html tag <form>.
This command will create a <form> tag pointing to the wims server, adding
<input> fields to pass session number (and other reserved things in the
future). In lines which follow, other input (or select) fields may be
added to the form. A final !formend must also be added by the
programmer. cmdvar is an optional parameter. Its value should be a valid
value for the variable cmd. In this case the value cmdvar will
be automatically submitted to the variable cmd. If this parameter is missing
or is invalid, then the programmer should add a
<input type="hidden" name="cmd" value="..." /> tag before the
final </form>.
The target of the form can be controlled by the variable wims_ref_target.
It can also be defined via an optional word target=.... Note that in this case
the target must start with wims_.
The variable wims_form_method which must be either get or post controls the method
of the form. This method defaults to post for tool modules, and to get for all
other modules.
formbar
Type:
execution command
Syntax:
!formbar name from n1 to n2 !formbar name list selectlist
Aliases:
formradiobar, htmlbar, htmlradiobar
Meaning:
Creates a bar of radio buttons under a previously defined html form.
This bar should be arranged to represent values from small to big. No prompt is given
to the user, except the indication that left is smaller. In the parameters, name defines the
name field of the menu, and the values of the menu are either integers going from n1 to n2
(in the first syntax), or items in the list selectlist.
The default of the menu will be the current value of the variable $name.
formcheckbox
Type:
execution command
Syntax:
!formcheckbox name from n1 to n2 prompt promptlist !formcheckbox name list selectlist prompt promptlist
Aliases:
htmlcheckbox
Meaning:
Creates a checkbox list menu under a previously defined html form.
This command speeds up the creation of checkboxed menus (limited to MAX_MENU_ITEMS), as well as simplifies
the source files. In the parameters, name defines the name field of the menu,
and the values of the menu are either integers going from n1 to n2 (in the first syntax),
or items in the list selectlist.
The optional parameter promptlist can be used to generate user prompts for each items in the list.
If promptlist is empty or is shorter than selectlist, the undefined prompts
will be replaced by the value. If it is longer, the rest will be ignored.
An id is created automatically, except if the variable
wims_ref_id is specified just before. If the variable
wims_html_mode has a value as div, li, td, the different items of
the html form will be in the corresponding html environmment. If the
variable wims_ref_class is non empty, the class of this html environment is the value
of this variable. The default of the menu will be the current value of the variable
$name.
The variables wims_ref_id and wims_html_mode are reinitialized after the html form.
Sample(s):
Command
Result
!formcheckbox varCHK1 from 1 to 3 prompt txt1,txt2,txt3
,
,
!formcheckbox varCHK2 list a,b,c prompt txtA,txtB,txtC
,
,
<ol> !set wims_html_mode=li
!formcheckbox varCHK3 list apple,pear prompt 🍎,🍐
</ol>
<ul> !set wims_html_mode=li
!formcheckbox varCHK4 list apple,pear prompt 🍎,🍐
</ul>
formend
Type:
execution command
Syntax:
!formend
Meaning:
Creates the balise which closes the form created by !form
formradio
Type:
execution command
Syntax:
!formradio name from n1 to n2 prompt promptlist !formradio name list selectlist prompt promptlist
Aliases:
htmlradio
Meaning:
Creates a radio button list menu under a previously defined html form.
This command speeds up the creation of radio buttoned menus, as well as simplifies
the source files (limited to MAX_MENU_ITEMS). In the parameters, name defines the name field of the menu,
and the values of the menu are either integers going from n1 to n2 (in the first syntax),
or items in the list selectlist.
The optional parameter promptlist can be used to generate user prompts for each items in the list.
If promptlist is empty or is shorter than selectlist, the undefined prompts
will be replaced by the value. If it is longer, the rest will be ignored.
The default of the menu will be the current value of the variable $name.
An id is created automatically, except if the variable
wims_ref_id is specified just before. If the variable
wims_html_mode has a value as div, li, td, the different items of
the html form will be in the corresponding html environmment. If the
variable wims_ref_class is non empty, the class of this html environment is the value
of this variable. The default of the menu will be the current value of the variable
$name.
The variables wims_ref_id and wims_html_mode are reinitialized after the html form.
Sample(s):
Command
Result
!formradio quest1 list 0,1,2 prompt zero,one,two
,
,
!formradio quest2 from 0 to 2 prompt A,B,C
,
,
!set wims_ref_id=quest3_0 !formradio quest3 list 0 prompt one choice
Syntax:
!formselect name from n1 to n2 prompt promptlist !formselect name list selectlist prompt promptlist
Aliases:
htmlselect
Meaning:
Creates a select menu under a previously defined html form.
This command speeds up the creation of select menus, as well as simplifies
the source files (limited to MAX_MENU_ITEMS). In the parameters, name defines the name field of the menu,
and the values of the menu are either integers going from n1 to n2 (in the first syntax),
or items in the list selectlist.
The optional parameter promptlist can be used to generate user prompts for each items
in the list. If promptlist is empty or is shorter than selectlist, the undefined prompts
will be replaced by the value. If it is longer, the rest will be ignored.
The default of the menu will be the current value of the variable $name.
The variable $wims_formselect_switch may be used to set switches (for example by letting
wims_formselect_switch=multiple, the selection will be multiple.
getexoindex
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Meaning:
(IN PROGRESS up to next stable release)
find the number of the work determined by the two first lines
adress1 and adress2 in a sheet of a class and its severity in the sheet:
Default value for class is wims_class.
If the value of `qsheet` is not precised, find the first occurence in the class sheets.
The command can be used in non administrative module if no class is specified.
getfile
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!getfile filename [prompt]
Aliases:
outfile, fileout
Meaning:
Creates a hypertext reference pointing to a specified file on the current wims session.
Whenever possible, this command should be used instead of a direct use of
html tag <a href="...">. filename is the file name to find in the /getfile directory of current session,
which should not contain white spaces.
prompt is an optional text on which the hypertext link sits. It can be
any text or a <img...> tag, but dynamic insertions are not accepted yet.
There is no need to add the end tag </a>.
The CSS class (class='...') of the link can be controlled via the variable
wims_ref_class.
The title (title='...') of the link can be controlled via the variable
wims_ref_title.
The HTML ID (id='...') of the link can be controlled via the variable
wims_ref_id.
getopt
Type:
both execution and variable command
Syntax:
!getopt name in string
Meaning:
This command allows to extract the definition of a word in string under the form name=value.
It returns the defined value in the string, or the name itself if it appears in string
but if there is no = sign following it, or an empty string if name does not appear
in string as a word.
value can be a multi-word string, if it is enclosed by a pair of parentheses, brackets,
curly braces or double quotes. The enclosing parentheses etc. will be removed from the output.
Spaces are allowed before and/or after the = sign.
getscore
Type:
both execution and variable command, only for trusted modules (in particular administrative modules).
Meaning:
summary for work done for each exercise of a sheet. The output is four
words score mean best level:
score : sum of cumulative_points of each exercise of the sheet (limited by required points of each) divided
by sum of required_points of all exercises of the sheet (integer between 0 and 100)
mean : average of score for all score (between 0 and 10);
best : average of best scores for each exercice of the sheet (integer between 0 and 100).
see command getscorebest for meaning of best score of an exercise;
level : average of minimum score for each exercice of the sheet
(integer between 0 and 100).
See command getscorelevel for meaning of minimum score of an exercise.
Default value for class is wims_class.
Default value for user is wims_user.
If no sheet id is specified, each line represents a sheet.
getscorequality
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Meaning:
return yes if score registering for the current sheet is open and no if not.
The restrictions done in the .security of the class are taken in account.
The same is true for the technical variables attached to quser in qclass.
Default value for class is wims_class.
Default value for user is wims_user.
The command can be used in non administrative module if no user and no class is specified.
So it applies to the current wims_user and wims_class.
getscoretry
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Meaning:
return 0 if the current sheet is in preparation, 1 if it is activated,
2 if it is expired and 3 if it is hidden.
The technical variables attached to quser in qclass are taken in account.
so if the current sheet is activate or expired, the sheet can be hidden if the technical
conditions are fulled.
Default value for class is wims_class.
Default value for user is wims_user.
Write !getsheetstatus user=no to ask the generic status of the sheet.
The command can be used in non administrative module if no user and no class is specified.
So it applies to the current wims_user and wims_class.
goto
Type:
execution command
Syntax:
!goto label
Meaning:
Unconditionally jump to label. label must be a valid label in the current file.
header
Type:
execution command
Syntax:
!header parm
Aliases:
htmlheader, wimsheader
Meaning:
Standardized header for html page outputs. Includes the variable wims_html_header
and the commands !headmenu and !title.
parm is reserved for future implementation.
header1
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!header1
headmenu
Type:
execution command
Syntax:
!headmenu
Meaning:
Creates a standardised menu bar, usually to be included on the top of the page.
hex
Type:
both execution and variable command
Syntax:
!hex string
Aliases:
tohex
Meaning:
Returns a new string replacing every character in string by its hexadecimal code.
In particular, the result can be used as part of a variable
name whatever the content of string is (as long as it is not too long).
homeref
Type:
execution command
Syntax:
!homeref parm
Aliases:
wimsref
Meaning:
Creates a standardised table of links to wims homepage (and eventually other things).
parm is reserved for future implementation.
href
Type:
execution command
Syntax:
!href parms text
Meaning:
Creates a hypertext reference pointing to the wims server.
Whenever possible, this command should be used instead of a direct use of
html tag <a href="...">. parms is the string of parameters to the call to wims server,
which should not contain white spaces. Usually a cmd=... pair should be at least present;
on the other hand, the session number and prefered language will be directly added by the server.
text is the text on which the hypertext link sits. It can be
any text or a <img...> tag, but dynamic insertions are not accepted yet.
There is no need to add the end tag </a>.
The target of the reference can be controlled via the variable
wims_ref_target. It can also be defined via an optional word
target=.... Note that in this case the target must start with wims_.
The CSS class (class='...') of the link can be controlled via the variable
wims_ref_class.
The title (title='...') of the link can be controlled via the variable
wims_ref_title.
The HTML ID (id='...') of the link can be controlled via the variable
wims_ref_id.
html2iso
Type:
both execution and variable command
Syntax:
!html2iso string
Meaning:
Translate some html entities in isolatin in string. The list of translated entities
htmlmath
Type:
both execution and variable command
Syntax:
!htmlmath expr
Aliases:
math2html
Meaning:
Translate the raw mathematical expression expr, into a form which can be
best possibly rendered via html tags. If the expression is not a "machine-understandable
mathematical expression", there is no garanty on the result (at the moment and in the future !).
All digits or + or - following a ^ or _ are considered as in exponent/subscript;
expression with ( ) following a ^ or _ are considered as in exponent/subscript
parenthesis are remove (if no sign before) except in case of exponent and only digits.
Get rid of 1*.. ..*1. example: in 1 * x, x/1, the 1 is removed.
Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless.
Replace some names as greek letters by their equivalents.
Remove * or replace by multiplication sign.
Replace <=, >=, ->, =>, <=> by their html equivalents if possible.
if
Type:
execution command
Syntax:
!if string1 relation string2
... (multi-line content)
[!else]
... (multi-line content)
!endif
Meaning:
Conditional branching: execute the multi-line content between !if line and !endif line
(or between !if line and !else line if !else is present)
if relation is verified, and the potential lines between !else line and !endif line
if relation is not verified.
The leading and trailing spaces of string1 and string2
will be stripped before making comparisons.
All comparisons are made on strings: string1 rel string2.
Comparisons can be joined using and and
or. Parentheses may
be used to build complex comparison logics.
Valid relations
Relation
Condition
Erklärungen
==
string1 == string2 string1 == string2
with if: true if string1 and string2 are identical. with ifval: true if the numerical evaluations of string1 and of string2 are equal.
!=
string1 != string2 string1 <> string2
with if: true if string1 and string2 are NOT identical. with ifval: true if the numerical evaluations of string1 and of string2 are not equal.
!=
<
string1 < string2
true if (the numerical evaluation of) string1 is < string2.
<=
string1 <= string2
true if (the numerical evaluation of) string1 is string2.
>
string1 > string2
true if (the numerical evaluation of) string1 is > string2.
>=
string1 >= string2
true if (the numerical evaluation of) string1 is string2.
isin
string1 isin string2
true if string1 is a substring of string2.
notin
string1 notin string2
true if string1 is NOT a substring of string2.
iswordof
string1 iswordof string2
true if string1 is a word of string2.
notwordof
string1 notwordof string2
true if string1 is NOT a word of string2.
isvarof
string1 isvarof string2
true if string1 is a (mathematical) variable of the expression string2.
notvarof
string1 notvarof string2
true if string1 is NOT a (mathematical) variable of the expression string2.
isvariableof
string1 isvariableof string2
true if string1 is a (mathematical) variable of the expression string2.
notvariableof
string1 notvariableof string2
true if string1 is NOT a (mathematical) variable of the expression string2.
isitemof
string1 isitemof string2
true if string1 is an item of the list string2.
notitemof
string1 notitemof string2
true if string1 is NOT an item of the list string2.
islineof
string1 islineof string2
true if string1 is a line of the list string2.
notlineof
string1 notlineof string2
true if string1 is NOT a line of the list string2.
issamecase
string1 issamecase string2
true if string1 and string2 are the same text by a comparison insensitive to multiple spaces but case-sensitive.
notsamecase
string1 notsamecase string2
true if string1 and string2 are NOT the same text by a comparison nsensitive to multiple spaces but case-sensitive.
issametext
string1 issametext string2
true if string1 and string2 are the same text by a comparison insensitive to cases, multiple spaces and accented letters.
notsametext
string1 notsametext string2
true if string1 and string2 are NOT the same text by a comparison insensitive to cases, multiple spaces and accented letters.
ifval
Type:
execution command
Syntax:
!ifval string1 relation string2
... (multi-line content)
!endif
Meaning:
Same as if, but = (==), != compares the
numerical values of string1 and string2 rather than the strings themselves.
imgrename
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!imgrename
increase
Type:
execution command
Syntax:
!increase var
Aliases:
advance
Meaning:
Increase the value of var by one. The value of var is first rounded to an integer.
insdraw
Type:
execution command (only valid for phtml files)
Syntax:
!insdraw drawsource
Aliases:
inspaint
Meaning:
The server will call a paint program (flydraw), submit drawsource
as its command (with variables substituted), and insert the result into the page.
insmath
Type:
execution command (only valid for phtml files)
Syntax:
!insmath formula
Meaning:
According to the complicatedness of formula, the server will either render it
as beautifully as possible using html tags, or translate formula into TeX source then
call TeX to compile and finally transform the TeX result into a picture. The latter
is inserted into the page (at the place of the command).
If the user browser knows mathml, then the formula is simply translated into mathml
and sent to the browser. What is done is the following:
replace .. by ,
If there is no \ or { , apply rawmath if it is asked;
If there is no \ or { , apply texmath if there is some computer matrix [1,2;4,5] or if
there is a word as "sqrt int integrate sum prod product Int Sum Prod conj abs"
or if there is some / in the formula.
send it to instex (gifs) or to mathml or do nothing more according to ...
insplot
Type:
execution command (only valid for phtml files)
Syntax:
!insplot plotsource
Meaning:
The server program will call an external plotting program (gnuplot for the current version),
submit plotsource as the 2D plot command (with variables substituted),
and insert the result into the page.
The syntax of plotsource is that of the plot command of gnuplot.
insplot3d
Type:
execution command (only valid for phtml files)
Syntax:
!insplot3d plotsource
Meaning:
As for insplot,
but plotsource is in the syntax of the splot command of gnuplot, and a 3D
surface will be plotted.
instex
Type:
execution command (only valid for phtml files)
Syntax:
!instex texsource
Meaning:
The server program will call TeX to process the (plain) TeX source texsource
(after variable substitution), translate the result into a picture, and
insert it into the page (at the place of the command).
A tip: avoid using substituted variables in texsource
whenever possible. In this case WIMS will use static instex, improving
performance dramatically over dynamic instex.
The font color of the inserted text can be controled either by the variable
instex_color, or by a \special{color=...} string
in the texsource.
instexstatic
Type:
execution command (only valid for phtml files)
Syntax:
!instexstatic gifname texsource
Aliases:
instexst, staticinstex, stinstex
Meaning:
This command is obsolete, and will be dropped in future versions.
Use !instex instead.
item
Type:
both execution and variable command
Syntax:
!item numlist of string
Aliases:
items
Meaning:
Outputs selected (comma-separated) items of string, according to numlist.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of item in string
counted from the beginning,
with 1 corresponding to the first
item. A negative integer denotes the number of item from
the end of string: -1
means the last item, -2 means
the next-to-last item, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole string except the first
and the last items.
itemcnt
Type:
variable command
Syntax:
!itemcnt list
Aliases:
itemcount, itemno, itemnum
Meaning:
Returns the number of items in list.
items2lines
Type:
both execution and variable command
Syntax:
!items2lines string
Aliases:
itemstolines, list2lines, listtolines
Meaning:
This command changes multiple items in string into multiple lines.
items2words
Type:
both execution and variable command
Syntax:
!items2words string
Aliases:
itemstowords, list2words, listtowords
Meaning:
This command changes multiple items in string into multiple words.
let
Type:
execution command
Syntax:
!let name=value
Aliases:
def, define, set
Meaning:
put value into the variable name. value may be a variable command
(together with optional parameters).
leveldata
Type:
both execution and variable command
Syntax:
!leveldata size xsize,ysize ranges x1,x2,y1,y2 function f(x,y) [levels l1,l2,...]
Aliases:
levelpoints
Meaning:
Computes coordinates of points on the level curve of f(x,y), at levels l1,l2,...
(defaults to one level 0).
The computation is made from (x1,y1) to (x2,y2), and points are computed as integer
positions in a picture with size xsize,ysize.
Order of the fields is not important. All the fields except levels are mandatory.
line
Type:
both execution and variable command
Syntax:
!line numlist of string
Aliases:
lines
Meaning:
Outputs selected lines of string, according to numlist.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of line in string
counted from the beginning,
with 1 corresponding to the first
line. A negative integer denotes the number of line from
the end of string: -1
means the last line, -2 means
the next-to-last line, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole string except the first
and the last lines.
linecnt
Type:
variable command
Syntax:
!linecnt string
Aliases:
linecount, lineno, linenum
Meaning:
Returns the number of lines in string.
lines2items
Type:
both execution and variable command
Syntax:
!lines2items string
Aliases:
linestoitems, lines2list, linestolist
Meaning:
This command changes multiple lines in string into multiple items.
lines2rows
Type:
both execution and variable command
Syntax:
!lines2rows string
Meaning:
This command changes multiple lines in string into rows (the separator is
the semicolon).
lines2words
Type:
both execution and variable command
Syntax:
!lines2words string
Aliases:
linestowords
Meaning:
This command changes multiple lines in string into multiple words.
listcomplement
Type:
both execution and variable command
Syntax:
!listcomplement list1 in list2
Meaning:
Returns items appearing in list2 but not in list1. Repetitive occurrences are eliminated.
listfile
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!listfile filespec
Aliases:
listfiles, filelist, ls, dir
Meaning:
list files specified in filespec. Options to Linux command ls are accepted.
The base directory is the base of the wims server. So if you want to list files
in the current module, type
!listfile $module_dir
listintersect
Type:
both execution and variable command
Syntax:
!listintersect list1 and list2
Aliases:
listintersection
Meaning:
Returns items appearing in both list1 and list2. Repetitive occurrences are eliminated.
listunion
Type:
both execution and variable command
Syntax:
!listunion list1 and list2
Meaning:
Returns items appearing in either list1 or list2. Repetitive occurrences are eliminated.
listuniq
Type:
both execution and variable command
Syntax:
!listuniq list
Aliases:
listunique
Meaning:
Returns items in list, with repetitive occurrences eliminated.
lookup
Type:
both execution and variable command
Syntax:
!lookup defname in fname
Meaning:
Returns the definition of word defname in the file fname which must be
a dictionary file in the same syntax as for the program translator
(not necessarily sorted).
fname may be either in the module directory (in this case the
module directory need not be specified), or in the directory bases.
lower
Type:
both execution and variable command
Syntax:
!lower string
Aliases:
lowercase, tolower
Meaning:
Returns string with all upper case letters replaced by their lowercase counterparts.
mailto
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!mailto ...
Meaning:
sends an email to a person whose address is the first line of the parameter.
The second line (optional) is the sender
The third line is the subject of the message.
And the remaining lines constitute the body of the message.
mailurl
Type:
both execution and variable command
Syntax:
!mailurl address name ...
Meaning:
Creates a javascript-crypted email interface that is difficult
for spammer-robot to decrypt.
The first word of the first line in the parameter should be the email address.
The rest of the first line is the recepient name (default to email address).
The second line and up is the mail subject.
This command calls, in the order of priority, one of the following files:
"mailurl.proc" in the module directory.
"mailurl.proc" in the current theme.
"scripts/mailurl.proc".
This allows site managers and authors to define different address encryption methods.
Mail addresses are not encrypted when the user is within a virtual class.
This command collapses some variables beginning with "mailurl_".
makelist
Type:
both execution and variable command
Syntax:
!makelist templ for v=v1 to v2 [step st], or !makelist templ for v in v1,v2,v3,...
Meaning:
Outputs a list consisting of templ with variable v successively substituted
by values v1, ..., v2.
In the second syntax, the substitutions are done with respect to each item in
the list v1,v2,....
The variable v should appear in templ as a math variable
(that is, with no preceeding character).
Sample(s):
Command
Result
!makelist [x;x+1;xx] for x in a,x and y,1,(2,3)
[a;a+1;xx],[x and y;x and y+1;xx],[1;1+1;xx],[(2,3);(2,3)+1;xx]
mathmlmath
Type:
both execution and variable command
Syntax:
!mathmlmath expr
Aliases:
math2mathml
Meaning:
Translate the raw mathematical expression expr, into a form which can be best
possibly rendered via mathml tags. The transformations
are the same as in htmlmath command and the result is in html if mathml is not available.
If the expression is not a "machine-understandable mathematical expression",
there is no garanty on the result (today and in the future !).
All digits or + or - following a ^ or _ are considered as in exponent/subscript;
expression with ( ) following a ^ or _ are considered as in exponent/subscript;
parentheseses are removed (if no sign before) except in case of exponent and only digits.
Get rid of 1*.. ..*1. example: in 1 * x, x/1, the 1 is removed.
Replace scientific notation (for example) 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless.
Replace some names as greek letters by their equivalents.
Remove * or replace by multiplication sign.
Replace <=, >=, ->, =>, <=> by their html/mathml equivalents if possible.
Sample(s):
Command
Result
!mathmlmath 1*x+3*y = 35E-05
!mathmlmath 2x, 2*x
!mathmlmath x2, x_2, x^2
mathsubst
Type:
both execution and variable command
Syntax:
!mathsubst name=val in expr
Aliases:
mathsubstit, mathsubstitute
Meaning:
Manipulation of mathematical expressions: substitute variable name by val in expr.
No regular expression is allowed in name.
See also the commands
!evalsubst,
!replace.
mexec
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!mexec command parms
Meaning:
execute a module-private external command command with optional parameters parms.
command must be a valid program name in the module's home directory. But the command is
executed from the base directory of the server.
When used as variable command, returns the output of the called program.
module
Type:
both execution and variable command
Syntax:
!module defnamemodname
Meaning:
Returns the definition for defname of the module modname.
The most common use of this command is to get the title of a module
(defname is then title).
The INDEX file of the module modname will be parsed to look
for the definition of defname.
msg
Type:
execution command
Syntax:
!msg error [parm]
Meaning:
Put an error message of type error, with eventual parm depending on error.
nocache
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!nocache
nonempty
Type:
both execution and variable command
Syntax:
!nonempty objcontent
Aliases:
non_empty
Meaning:
obj can be item or line. The non-empty items or lines in content will be extracted.
nospace
Type:
both execution and variable command
Syntax:
!nospace string
Meaning:
Collapses all space characters (' ', tab, newline) in string.
nosubst
Type:
variable command
Syntax:
!nosubst string
Meaning:
Returns string as-is, without variable substitution.
passcheck
Type:
only for trusted modules (in particular administrative modules).
Syntax:
!passcheck word and list2
Meaning:
compare the (non crypted) word to the list of crypted words list2
(crypted words begin by *) and return yes if its crypted version is equal
to one of them
passcrypt
Type:
only for trusted modules (in particular administrative modules).
Syntax:
!passcrypt word
Meaning:
return word crypted (an * is added at the beginning of the
crypted result); word must contain only alphanumeric characters.
pedia
Type:
both execution and variable command
Syntax:
!pedia keyword, name
Aliases:
encyclopedia, encyclo
Meaning:
Creates a hypertext link pointing to an online encyclopedia.
keyword will be the name under which the reference is looked for,
and should be a phrase with one or several words separated by space.
Examples: finite field or linear transformation.
name is the name of the link (i.e. what people see in their page, and can click on).
Actually wims use
Wikipedia
as the standard reference encyclopedia.
perl
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!perl
positionof
Type:
both execution and variable command
Syntax:
!positionof [type] s in string
Aliases:
position, positions
Meaning:
Reports the positions of the object s in string.
The word type can be char, word,
item, line or row.
If it is specified, then the comparison only takes place for
corresponding objects of string which are identical to s.
The output of the command is a list of positions (char, word, item,
line or row, according to the value of type) where s is found in string.
Here, rows are separated by semi-colon ; and lines by new lines.
If type is missing, then s is searched in string as a substring,
and the positions reported are character positions (more precisely,
the positions of the previous character of s in string).
product
Type:
both execution and variable command
Syntax:
!product fn for v=v1 to v2 [step st] !product fn for v in v1,v2,v3,...
Aliases:
prod, multiply
Meaning:
Computes the product of a function fn(v) with variable v replaced
successively by values v1, ..., v2.
In the second syntax, the values are given with respect to each item in the list v1,v2,....
randchar
Type:
variable command
Syntax:
!randchar str
Meaning:
Returns a random character in str.
randfile
Type:
variable command
Syntax:
!randfile fname
Aliases:
randrecord
Meaning:
Returns a random record in the datafile fname.
randint
Type:
variable command
Syntax:
!randint n1, n2 !randint n1, n2 repeat i
Meaning:
Returns a random integer between n1 and n2 (inclusive).
Substitution and evaluation are done on n1 and n2 before applying random.
If n2 is missing, returns random integer between 1 and n1 (inclusive).
If both n1 and n2 are missing, returns 0.
You can also type !randint n1, n2 repeat i to repeatedly generate
i random integers.
randitem
Type:
variable command
Syntax:
!randitem list
Meaning:
Returns a random item in list. Items are separated by commas.
randline
Type:
variable command
Syntax:
!randline str
Meaning:
Returns a random line in str.
random
Type:
variable command
Syntax:
!random n1, n2
Aliases:
randdouble, randfloat
Meaning:
Returns a random real number between n1 and n2.
Substitution and evaluation are done on n1 and n2 before applying random.
If n2 is missing, returns random number between 0 and n1.
If both n1 and n2 are missing, returns 0.
You can also type !random n1,n2 repeat i to repeatedly generate
i random numbers.
randword
Type:
variable command
Syntax:
!randword str
Meaning:
Returns a random word in str.
rawmath
Type:
both execution and variable command
Syntax:
!rawmath expr
Meaning:
Translate the mathematical expression expr, possibly with common user errors,
into a machine-understandable mathematical expression.
It will replace (x+1)(x-1) into (x+1)*(x-1), 5x^3 into 5*x^3, etc.
More precisely,
Replace some badcharacters as **, ², ³.
translate ++, +-, -+, ... into one sign
translate | | in abs
replace new lines or tabs by spaces
add zero in case of decimal digits if necessary: for example, replace 4. by 4.0 and .5 -> 0.5
replace justapositions by multiplications if rawmatheasy=yes
rawmatrix
Type:
both execution and variable command
Syntax:
!rawmatrix expr
Meaning:
Translate the matrix expr, possibly with common user errors,
into a machine-understandable matrix expression.
reaccent
Type:
both execution and variable command
Syntax:
!reaccent string
Meaning:
Replace accented letter compositions in string by accented letters
(replacing e' by é, a` by à,
i" by ï, o^ by ô, etc.)
The only exception is that ç and Ç are composed from c~
and C~ respectivement.
read
Type:
execution command
Syntax:
!read file [parm]
Aliases:
include, input
Meaning:
Insert the content of file, and process it. file must be a valid file name with
the module's home directory as base directory. (directory structure may be specified in file,
but backtracing to parent directories is prohibited.)
And the parameter parm can be accessed from within
the called file under the variable name wims_read_parm.
WIMS will try to cache the file for repeated use, unless the filename is preceded by "./".
readdef
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!readdef
readproc
Type:
execution command
Syntax:
!readproc file [parm]
Meaning:
Include a variable processing file file. file must be a valid file name
with the module's home directory as base directory. (directory structure may be specified
in file, but backtracing to parent directories is prohibited.)
And the parameter parm can be accessed from within
the called file under the variable name wims_read_parm.
record
Type:
both execution and variable command
Syntax:
!record numlist of fname
Aliases:
records
Meaning:
Outputs selected records of the datafile fname, according to numlist.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of record in fname
counted from the beginning,
with 1 corresponding to the first
record. A negative integer denotes the number of record from
the end of fname: -1
means the last record, -2 means
the next-to-last record, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole fname except the first
and the last records.
recordcnt
Type:
variable command
Syntax:
!recordcnt fname
Aliases:
recordcount, recordno, recordnum
Meaning:
Returns the number of records in the datafile fname.
recursion
Type:
both execution and variable command
Syntax:
!recursion fn for v=v1 to v2 [step st] !recursion fn for v in v1,v2,v3,...
Meaning:
Computes the outcome of a recursion using the function fn in which the
variable v is replaced successively by values v1, ..., v2.
In the second syntax, the values are given with respect to each item in
the list v1,v2,....
The function fn should use the variable last to indicate the value of the previous
recursion step. And the starting value can be put into the WIMS variable
$recursion_start.
reinput
Type:
both execution and variable command
Syntax:
!reinput string
Meaning:
Prepares string to be inserted into a form input or textarea.
Browsers translate & primitives into corresponding (special) characters
even when these primitives occur in input or textarea fields. Also, if
string contains html tags, they may confuse browsers. You can
use this command on the string (usually derived from an earlier user input)
before inserting them back into a input or textarea, to avoid the above problems.
rename
Type:
both execution and variable command
Syntax:
!rename f
Meaning:
Changes the reference to a file f, such as a graphics file reachable by direct http,
into one with a different name using the method !getfile.
This command is useful with exercises where important information is carried
by multimedia files (pictures, audios, movies). It can be used to hide the
name of the multimedia file that otherwise would give clues to the solution
of the problem.
The renamed file must be located within the module, and the filename f should start
with $module_dir.
The command returns a string which is the new URL. The file is not
effectively copied or renamed on the server.
replace
Type:
both execution and variable command
Syntax:
!replace [internal] s1 by s2 in string !replace objident by s in string
Meaning:
String manipulation.
Under the first syntax, variable substitution is first done on string.
Then all occurences of substring s1 are replaced by s2.
When the keyword internal is absent, the Linux utility sed is called to make the replacements,
therefore regular expressions are accepted in s1 and s2.
Please refer to the man page of sed for details.
Under the second syntax, obj can be char, word, item or line.
Then the word, item or line identified by ident in string is replaced
by s, after variable substitutions. ident can be a string, in this case all objects (words, items or lines) matching ident
will be replaced. It can also be a number (positive or negative integer n), preceded
by the word number. In this case the object number n will be replaced.
(In the case where n<0, it is the last -n th object which is replaced.)
reset
Type:
execution command
Syntax:
!reset name1 [ ,name2,...] names[1O]
Meaning:
erase the content of the variable(s) name1, name2,
..., names1, names2,..., names10
restart
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!restart parm
Meaning:
Restart from a new request with parameters parm, usually for jumping to another module.
This command can be only used before output starts. Repeated restart is disabled,
to avoid infinite loops.
robotrap
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!robotrap
Aliases:
robottrap
lines2rows
Type:
both execution and variable command
Syntax:
!rows2lines string
Meaning:
This command changes multiple rows in string into lines (the separator is
the line break).
select
Type:
both execution and variable command
Syntax:
!select data where condition
Meaning:
Outputs rows of a matrix data, according to condition.
Rows of the matrix can be separated either by new lines or by semi-colon ;.
The condition can use words column 1, column 2, etc. to
designate comma-separated columns in each row.
setdef
Type:
execution command
Syntax:
!setdef defstr in fname
Meaning:
Set definitions defstr in the file fname.
setseed
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!setseed
sh
Type:
both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax:
!sh
shortout
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!shortout
shuffle
Type:
variable command
Syntax:
!shuffle [even|odd] n !shuffle [even|odd] list
Aliases:
randperm, randpermute
Meaning:
Randomly permutes a set of n elements. n must be a positive integer
not greater than 1024 in the first usage, or is the number of items in list in the second
usage.
For the first usage, the command returns a comma-separated list i1, i2, ...,
in, where the items ik are
randomly ordered elements of the set {1,2,...,n}.
This command can be used in conjunction with commands
!item,
!line,
!word,
!char,
to randomly permute items, lines, words, or characters in a string.
For the second usage, a new list with randomly permuted items in list is returned.
In any case, the variable wims_shuffle_order is set to be
the list i1, i2, ..., in.
When the optional word even or odd is present, only even/odd permutations are produced.
singlespace
Type:
both execution and variable command
Syntax:
!singlespace string
Meaning:
Returns string with all space characters (space, tab, newline) replaced by ,
and multiple occurrences of space characters collapsed into single one.
Leading and ending spaces are not removed. You can use this command in conjunction with
trim if you want also to
remove leading and ending spaces.
This command is especially useful for comparisons between multi-word strings.
solve
Type:
both execution and variable command
Syntax:
!solve fn for v=v1 to v2
Aliases:
rootof
Meaning:
Find out (real simple) roots of the function/equation fn
for the variable v between v1 andv2.
fn may have several roots in the interval [v1,v2], but
roots too close to each other may be overlooked.
sort
Type:
both execution and variable command
Syntax:
!sort [nocase] [reverse] [numeric] type [of] string
Meaning:
Sort string. The type of the sort may be char, word, list
(equivalently item) or line.
After this command is executed, the sort order is stored in the variable
wims_sort_order (as a list). This can therefore be used
for relational sorting, in conjunction with commands
!item,
!line,
!word or
!char.
Sample(s):
Command
Result
!sort list 0,4,2
0,2,4
!sort reverse list 0,4,2
4,2,0
!sort list 10,4,2
10,2,4
!sort numeric list 10,4,2
2,4,10
sum
Type:
both execution and variable command
Syntax:
!sum fn for v=v1 to v2 [step st] !sum fn for v in v1,v2,v3,...
Aliases:
add
Meaning:
Computes the sum of a function fn(v) with variable v replaced successively
by values v1, ..., v2.
In the second syntax, the values are given with respect to each item in the list v1,v2,....
tail
Type:
execution command
Syntax:
!tail parm
Meaning:
Standardized ending for html page outputs. Includes the command !homeref.
parm is reserved for future implementation.
texmath
Type:
both execution and variable command
Syntax:
!texmath expr
Aliases:
TeXmath, math2tex
Meaning:
Translate the mathematical expression expr into a TeX source. If the expression
is not a "machine-understandable mathematical expression", like products without *,
there is no garanty on the result
(at the moment and in the future !). See examples below.
Il might be useful to use !rawmath before applying !texmath.
The following transformations are performed:
Transform computer matrix as [ 4,5;6,7] in latex matrix.
Transform A/B in {1 over B} A or { A over B} according to the priority of
the presume type of A and B (integer, numeric, variable, poly, transcend).
transforms <=, <=> =>, -> in tex/latex codes.
Transform a relation without a second member by adding 1.
Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless.
Remove the stars *.
Replace some names as greek letters by their equivalents.
interpret sum(), integrate, prod () (coming from maxima ) in tex/latex codes.
Sample(s):
Command
Result
!texmath 1*x+3*y = 35E-05
x +3 y=35 \times 10^{-5}
!texmath 2x, 2*x
2,2 x
!texmath x2, x_2, x^2
x _2 ,x_{2},x^2
text
Type:
both execution and variable command
Syntax:
!text operationparameter
Meaning:
This is intended to be a very powerful text manipulation tool,
allowing very sophisticated processing of long text strings with high speed.
Many of the operations accept masks. A mask is a string composed of 0s and 1s.
For operations which accept a mask, only characters at positions whose corresponding
character in the mask is not a 0 are processed. (In this sense positions
corresponding to 0s are masked.) Empty mask is considered
as of being entirely composed of 1s.
A mask which is too short repeats itself, unless it terminates with a +,
in which case it fills the rest with 1s, or with a -, in which case
it fills the rest with 0s.
For the time being, implemented operations are as follows.
!text common text1 and text2 [mask maskstring]
Extracts characters in text1 one by one, for those identical
to the corresponding characters in text2 and whose
positions are not masked by maskstring.
!text compare text1 and text2
Compares the strings text1 and text2 character by character,
and returns a mask string with 0s on positions where the corresponding characters in text1
and text2 are equal, and 1s otherwise.
!text copy text [mask maskstring]
Returns non-masked characters in text.
!text count charlist in text [mask maskstring]
Returns the number of characters in text whose positions
are not masked by maskstring, and who appear in charlist.
!text diff text1 from text2 [mask maskstring]
Extracts characters in text1 one by one, for those different to the corresponding
characters in text2 and whose positions are not masked by maskstring.
(Synonyme of diff: differ).
!text expand text using maskstring
Produces a string, where positions corresponding to 0s in
maskstring are filled by (the space character),
and where positions corresponding to 1s in maskstring are filled by characters of
text. The characters in text are used one by one, and the
resulting string stops when all the characters in text are exhausted
(or when the string reaches the length limit).
!text insert text1 into text2 [mask maskstring]
Returns text2 with non-masked characters replaced by characters text1.
Characters in text1 are used one by one (without taking into account the masking), and
the replacement stops when there is no character left in text1.
!text interact text1 and text2 table itab [mask maskstring]
Returns a new text which is result of interactions of characters
in corresponding positions in text1 and text2. The rule of the interaction is defined in
itab. itab contains n+1 lines, each of n characters.
The first line defines the characters corresponding to each position
in the following n lines which defines the multiplication table.
The multiplication table needs not to be symmetric. In this case, the rows correspond
to characters in text1, and the columns correspond to characters in text2.
If text1 or text2 contains a character not in the first line of itab,
the interaction at the corresponding position is considered as empty. Also, masked
positions are ignored.
If text1 and text2 have different lengths, the longer is cut to fit the shorter.
!text mark charlist in text
Returns a mask string with 1s on positions where the corresponding character in text
appears in charlist, and with 0s on other positions.
!text max text1 and text2 [mask maskstring]
Returns a string which at each position is the character with highest
ASCII code between corresponding characters in text1 and text2.
The length of the result is that of the longest of the two. Masked positions are skipped.
!text min text1 and text2 [mask maskstring]
Returns a string which at each position is the character with lowest
ASCII code between corresponding characters in text1 and text2.
The length of the result is that of the
shortest of the two. Masked positions are skipped.
!text occur charlist in text [mask maskstring]
Returns characters in charlist which occur in unmasked positions in text.
(Synonymes of occur: appear, occurrence).
!text remove charlist in text [mask maskstring]
Returns text in which masked characters and characters
appearing in charlist are removed. (Synonymes of remove: drop, delete).
!text reorder text by orderlist
Returns a reordered text using the order list orderlist. Reordering is cyclic
if orderlist is shorter than text. orderlist must be a list of n positive integers, which
is a permutation of the set {1,...,n}. If orderlist contains
items other than integers within the bound, empty string is returned.
However, unicity check is not performed on items of orderlist.
!text repeat text to len
Repeat the string text cyclicly, up to length len.
!text reverse text
Reverse the order of text, with the last character coming first, etc.
!text select charlist in text [mask maskstring]
Returns text in which masked characters and characters not appearing in
charlist are removed. (Synonymes of select: pick, pickup).
title
Type:
execution command
Syntax:
!title parm
Aliases:
htmltitle, wimstitle
Meaning:
Puts page's title in a standardized format. parm is reserved for future implementation.
translate
Type:
both execution and variable command
Syntax:
!translate [internal] s1 to s2 in string !translate [internal] s1 in string to s2
Meaning:
String manipulation: variable substitution is first done on string.
Then all occurences of the first (resp. second, ...)
character of s1 is replaced by the first (resp. second, ...)
character of s2.
When the keyword internal is absent, the Linux utility tr is called to make the translations,
therefore regular expressions are accepted in s1 and s2.
Please refer to the man page of tr for details.
trim
Type:
variable command
Syntax:
!trim string
Meaning:
Returns string with leading and trailing spaces stripped off.
upper
Type:
both execution and variable command
Syntax:
!upper string
Aliases:
uppercase, toupper
Meaning:
Returns string with all lower case letters replaced by their uppercase counterparts.
usererror
Type:
execution command; only for trusted modules (in particular administrative modules).
Syntax:
!test
values
Type:
both execution and variable command
Syntax:
!values fns for v=v1 to v2 [step st] !values fns for v in v1,v2,v3,...
Meaning:
Outputs a list of values of fns with variable v replaced successively by values
v1, ..., v2.
In the second syntax, the values are given with respect
to each item in the list v1,v2,....
fns may be a comma-separated list of functions.
This command can also be used to make recursions. If the functions
fns contain a variable named last, this variable
will take the value of the last step each time. And the starting value
can be put into the WIMS variable $recursion_start.
varlist
Type:
both execution and variable command
Syntax:
!varlist [nofn] formula
Aliases:
listvar
Meaning:
Manipulation of mathematical expressions: returns list of variable
names (and function names) appearing in the formula.
If the switch nofn is present, function names will not be listed.
warn
Type:
execution command
Syntax:
!warn subject
Aliases:
warning
Meaning:
Outputs a warning message related to subject. Does nothing if no warning
message about subject is present.
while
Type:
execution command
Syntax:
!while string1 relation string2
Meaning:
Conditional branching: execute the multi-line content between
!while line and !endwhile line, until relation is no longer verified.
The leading and trailing spaces of string1 and string2 will be stripped
before making comparisons.
Syntax:
Same as the command while, but = (==), != compares the numerical values of string1 and string2 rather than the strings themselves.
word
Type:
both execution and variable command
Syntax:
!word numlist of string
Aliases:
words
Meaning:
Outputs selected words of string, according to numlist.
numlist can be a single integer, a comma-separated list of
integers, or a range of integers.
A positive integer denotes the number of word in string
counted from the beginning,
with 1 corresponding to the first
word. A negative integer denotes the number of word from
the end of string: -1
means the last word, -2 means
the next-to-last word, etc.
The syntax for a range of integers is
n1 to n2.
For example, 2 to -2
means the whole string except the first
and the last words.
wordcnt
Type:
variable command
Syntax:
!wordcnt string
Aliases:
wordcount, wordno, wordnum
Meaning:
Returns the number of words in string.
words2items
Type:
both execution and variable command
Syntax:
!words2items string
Aliases:
wordstoitems, words2list, wordstolist
Meaning:
This command changes multiple words in string into multiple items.
words2lines
Type:
both execution and variable command
Syntax:
!words2lines string
Aliases:
wordstolines
Meaning:
This command changes multiple words in string into multiple lines.