diff --git a/lib/Value/String.pm b/lib/Value/String.pm index fc7af6087b..829aaa6b4b 100644 --- a/lib/Value/String.pm +++ b/lib/Value/String.pm @@ -127,6 +127,20 @@ sub quoteHTML { return '' . $s . ''; } +# +# Quote XML special characters +# +sub quoteXML { + shift; + my $s = shift; + return unless defined $s; + return $s if eval('$main::displayMode') eq 'TeX'; + $s =~ s/&/\&/g; + $s =~ s//\>/g; + return $s; +} + # # Render the value verbatim # diff --git a/macros/parsers/parserMultipleChoice.pl b/macros/parsers/parserMultipleChoice.pl new file mode 100644 index 0000000000..ed8d5d85fe --- /dev/null +++ b/macros/parsers/parserMultipleChoice.pl @@ -0,0 +1,30 @@ + +=head1 NAME + +parserMultipleChoice.pl - Load all the multiple choice parsers: PopUp, CheckboxList, RadioButtons, RadioMultiAnswer. + +=head1 SYNOPSIS + + loadMacros('parserMultipleChoice.pl'); + +=head1 DESCRIPTION + +parserMultipleChoice.pl loads the following macro files: + +=over + +=item * parserPopUp.pl + +=item * parserCheckboxList.pl + +=item * parserRadioButtons.pl + +=item * parserRadioMultiAnswer.pl + +=back + +=cut + +loadMacros("parserPopUp.pl", "parserCheckboxList.pl", "parserRadioButtons.pl", "parserRadioMultiAnswer.pl"); + +1; diff --git a/macros/parsers/parserPopUp.pl b/macros/parsers/parserPopUp.pl index d7476aef08..980aa416f9 100644 --- a/macros/parsers/parserPopUp.pl +++ b/macros/parsers/parserPopUp.pl @@ -15,82 +15,164 @@ =head1 NAME -parserPopUp.pl - Pop-up menus compatible with Value objects. +parserPopUp.pl - Drop-down lists compatible with MathObjects, + specifically MultiAnswer objects. =head1 DESCRIPTION -This file implements a pop-up menu object that is compatible with -MathObjects, and in particular, with the MultiAnswer object, and with -PGML. +This file implements drop-down select objects that are compatible +with MathObjects, and in particular, with the MultiAnswer object, and +with PGML. -To create a PopUp object, use one of: +To create a PopUp, DropDown, or DropDownTF object, use - $popup = PopUp([choices,...], correct); - $dropdown = DropDown([choices,...], correct); - $truefalse = DropDownTF(correct); + $popup = PopUp([ choices, ... ], correct, options); + $dropdown = DropDown([ choices, ... ], correct, options); + $truefalse = DropDownTF(correct, options); -where "choices" are the strings for the items in the popup menu, -and "correct" is the choice that is the correct answer for the -popup (or its index, with 0 being the first one). +where "choices" are the items in the drop-down list, "correct" is the +the correct answer for the group (or its index, with 0 being the +first one), and options are chosen from among those listed below. If +the correct answer is a number, it is interpreted as an index, even +if the array of choices are also numbers. (See the C below +for more details.) -The difference between C and Cis that in HTML, -the latter will have an unselectable placeholder value. This value is '?' -by default, but can be customized with a C option. +Note that drop-down menus can not contain mathematical notation, only +plain text. This is because the browser's native menus are used, and +these can contain only text, not mathematics or graphics. -C is like C with options being localized versions of -"True" and "False". 1 is understood as "True" and 0 as "False". The initial -letter of the localized word is understood as that word if those letter are -different. All of this is case-insensitive. Also, in static output (PDF, PTX) -C is 0. It is assumed that context makes the menu redundant. +The difference between C and Cis that in HTML, +the latter will have an unselectable placeholder value. This value +is '?' by default, but can be customized with a C option. + +C is like C with options being localized +versions of "True" and "False". 1 is understood as "True" and 0 as +"False". The initial letter of the localized word is understood as +that word if those letter are different. All of this is not case +sensitive. Also, in static output (PDF, PTX) C defaults +to 0. It is assumed that text preceding the drop-down makes the menu +redundant. + +The entries in the choices array can either be the actual strings to +be used in the drop-down menu (which is known as a "label" for the +option input in HTML) or C<< { label => value } >> where C