File:  [LON-CAPA] / loncom / html / adm / help / tex / Authoring_Scripting_Tags.tex
Revision 1.6: download - view: text, annotated - select for diffs
Thu Jan 19 21:12:45 2017 UTC (7 years, 6 months ago) by damieng
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, HEAD
edited sections about XML, comments, algebra, chem, m, script, startouttext, reformatted problem examples, added &input

    1: \label{Authoring_Scripting_Tags}
    2: 
    3: \begin{itemize}
    4: \item \textbf{display}\index{display}: The intervening Perl script is evaluated
    5: in the safe space and the return value of the script replaces the
    6: entire tag.
    7: \item \textbf{import}\index{import}: This causes the parse to read in the file
    8: named in the body of the tag and parse it as if the entire text of
    9: the file had existed at the location of the tag.
   10: \item \textbf{parserlib}\index{parserlib}: The enclosed filename contains
   11: definitions for new tags.
   12: \item \textbf{script}\index{script}: If the attribute \textbf{type} is
   13: set to {}``loncapa/perl'' the enclosed data is a Perl script which
   14: is evaluated inside the Perl safe space. The return value of the script
   15: is ignored. 
   16: Without a \textbf{type} attribute or with the \texttt{text/javascript} value,
   17: the script is considered to be Javascript, and will be executed as such by the web browser.
   18: \item \textbf{scriptlib}\index{scriptlib}: The enclosed filename contains
   19: Perl code to run in the safe space.
   20: \item \textbf{block}\index{block}: This has a required argument \textbf{condition}
   21: that is evaluated. If the condition is true, everything inside the
   22: tag is evaluated; otherwise, everything inside the block tag is skipped.
   23: \item \textbf{notsolved}\index{notsolved}: Everything inside the tag is
   24: skipped if the problem is {}``solved''.
   25: \item \textbf{postanswerdate}\index{postanswerdate}: Everything inside
   26: the tag is skipped if the problem is before the answer date.
   27: \item \textbf{preduedate}\index{preduedate}: Everything inside the tag
   28: is skipped if the problem is after the due date. 
   29: \item \textbf{randomlist}\index{randomlist}: The enclosed tags are parsed
   30: in a stable random order. The optional attribute \textbf{show=``N''} restricts
   31: the number of tags inside that are actually parsed to no more than
   32: \textbf{N}. N can equal the total tags inside. The randomlist tag can be used to randomize problem 
   33: parts by wrapping the $<$part$>$ tags with a randomlist tag. 
   34: \index{randomizing parts}Note that when randomlist wraps $<$part$>$ tags, that all
   35: students will work all parts only if \textbf{show=``N''} where N is the total number
   36: of parts wrapped. When N is less than the total number of parts wrapped, 
   37: there will be gaps in the assessment chart, and also in the table
   38: of submissions for each student, corresponding to those parts which are
   39: never available to that particular student. For more examples see Authoring
   40: Library Files section \ref{Authoring_Library_Scripts}. 
   41: \item \textbf{solved}\index{solved}: Everything inside the tag is skipped
   42: if the problem is {}``not solved''.
   43: \item \textbf{while}\index{while}: This implements a while loop. The required
   44: attribute \textbf{condition} is a Perl scriptlet that when evaluated
   45: results in a true or false value. If true, the entirety of the text
   46: between the whiles is parsed. The condition is tested again, etc.
   47: If false, it goes to the next tag.
   48: \end{itemize}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>