[LON-CAPA-users] style file

Felicia Berryman lon-capa-users@mail.lon-capa.org
Tue, 09 Dec 2008 12:07:25 -0500


Hello,

I'm working with someone who is using custom metadata in a problem.  She 
wants to only display the custom metadata for the reference in the problem.

Here is an example problem:
--------------------------------------------------
<problem>
<meta name="color" content="red" />
<meta name="level" content="two" />
<meta name="reference" content="Go Dog Go, PD Eastman, 1961" />
<meta name="shape" content="square" />
<startouttext />Which of the following is a number
<endouttext />
<radiobuttonresponse direction="vertical" id="11" randomize="no">
<foilgroup>
<foil value="false" name="foilA"><startouttext />A<endouttext /></foil>
<foil value="false" name="foilB"><startouttext />B<endouttext /></foil>
<foil value="true" name="foilC"><startouttext />3<endouttext /></foil>
<foil value="false" name="foilD"><startouttext />D<endouttext /></foil>
<foil value="false" name="foilE"><startouttext />E<endouttext /></foil>
</foilgroup>
</radiobuttonresponse>
</problem>
--------------------------------------------------

My style file is:
--------------------------------------------------
<definetag name="meta" parms="name,content">
     <render>
<script type="loncapa/perl">
$var1='word';
$var2=$content;
if($name eq 'reference'){$output=$content}
</script>
<!-- $var1, $name, and $content display correctly. -->
<web>variable1:$var1, variable2:$var2, output:$output, name:$name, 
content:$content <br /></web>
<!-- tex portions displays all metadata -->
<tex>$name: \verb|$content| \\</tex>
     </render>
</definetag>
--------------------------------------------------

Note that the <script> in the style file breaks the editor.  See
http://bugs.loncapa.org/show_bug.cgi?id=5845
The point of this style file is to print out a library of problems and 
it won't be used in a course, so the potential editor problems shouldn't 
be an issue in this case.

Has anyone else done something like this before?  Any ideas?

Thanks,

Felicia