File:  [LON-CAPA] / loncom / homework / templates / CustomResponse.problem
Revision 1.3: download - view: text, annotated - select for diffs
Mon Jul 6 17:12:47 2009 UTC (14 years, 10 months ago) by bisitz
Branches: MAIN
CVS tags: version_2_9_99_0, bz6209-base, bz6209, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3
Consistent problem templates:
- New line after each tag (not for texts in foils)
- One empty row after each end tag and before new start tag for second level tags
- No indentation for second level tags, e.g. <script>
- Four white spaces as indentation for each further sub level
    Exceptions:
        -Content (mostly text) in separate line(s): no indentation
        - Concept groups: same indentation as foilgroup
          (allows to insert code from problems without concept groups without changing the indentation and vice versa)
- No new line at end of template
- Removed new lines from within the middle of default texts
- Added one blank each after "<m>$" and before "$</m>" to ensure no misinterpretation neither by human nor by machine (e.g. "<m>$x" is not "<m>$ $x")
- Replaced deprecated font tag in <instructorcomment> by CSS
- Removed dos line endings
- dos2unix conversion
  (ClickImageExample.problem, RandomLabelExample.problem, SimpleMatching.problem)

    1: <problem>
    2: 
    3: <startouttext />
    4: Accept an answer of around 90 or -90
    5: <endouttext />
    6: 
    7: <customresponse answerdisplay="something near 90 or -90">
    8:     <answer type="loncapa/perl">
    9: # We do not want a vector
   10: if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
   11: # No units needed
   12: if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
   13: # Need a numerical answer here
   14: if ($submission!~/^\d+$/) { return 'WANTED_NUMERIC'; }
   15: $difference=abs(90-abs($submission));
   16: if ($difference==0) { return 'EXACT_ANS'; }
   17: if ($difference < 0.001) { return 'APPROX_ANS'; }
   18: return 'INCORRECT';
   19:     </answer>
   20:     <textline />
   21: </customresponse>
   22: 
   23: </problem>

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