Skip to content

Commit

Permalink
Merge pull request #1112 from somiaj/popup-configure-pdf-max-size
Browse files Browse the repository at this point in the history
Add option to set size for which parserPopUp prints an inline string.
  • Loading branch information
pstaabp authored Jan 28, 2025
2 parents adb1f0b + 0666f64 commit 6f12013
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions macros/parsers/parserPopUp.pl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ =head1 DESCRIPTION
unnecessary in a static output format.) Default: 1, except 0 for
DropDownTF.
=item C<S<< inlineSize => number >>>
In PDF output, this controls break point between printing the list of
options as an inline list [A/B/C] or multiline bullet list. If the total
number of characters (of all items combined) is greater than or equal to
this setting, or an item contains a '[', '/', or ']' character, then the
list of options is printed as a bullet list, otherwise an inline list is
used. Default: 25
=back
To insert the drop-down into the problem text when using PGML:
Expand Down Expand Up @@ -231,6 +240,7 @@ sub new {
choices => $choices,
placeholder => $options{placeholder} // '',
showInStatic => $options{showInStatic} // 1,
inlineSize => $options{inlineSize} // 25,
values => $options{values} // [],
noindex => $options{noindex} // 0
}, $class;
Expand Down Expand Up @@ -437,15 +447,13 @@ sub MENU {
$menu = qq(<fillin name="$name"/>);
}
} elsif ($main::displayMode eq "TeX" && $self->{showInStatic}) {
# if the total number of characters is not more than
# 30 and not containing / or ] then we print out
# Unless the total number of characters is greater than or equal to the
# inlineSize setting (default 25), or contains [, ], or / then we print out
# the select as a string: [A/B/C]
if (length(join('', @list)) < 25
&& !grep(/(\/|\[|\])/, @list))
{
unless (length(join('', @list)) >= $self->{inlineSize} || grep(/(\/|\[|\])/, @list)) {
$menu = '[' . join('/', map { $self->quoteTeX($_) } @list) . ']';
} else {
#otherwise we print a bulleted list
# Otherwise we print a bulleted list.
$menu = '\par\vtop{\def\bitem{\hbox\bgroup\indent\strut\textbullet\ \ignorespaces}\let\eitem=\egroup';
$menu = "\n" . $menu . "\n";
foreach my $option (@list) {
Expand Down

0 comments on commit 6f12013

Please sign in to comment.