1 package SL::Template::ShellCommand;
 
   3 use parent qw(SL::Template::LaTeX);
 
   7 use String::ShellQuote;
 
  12   return $type->SUPER::new(@_);
 
  16   my ($self, $text, @indices) = @_;
 
  18   my $form = $self->{"form"};
 
  20   while ($text =~ /$self->{substitute_vars_re}/) {
 
  21     my ($tag_pos, $tag_len) = ($-[0], $+[0] - $-[0]);
 
  22     my ($var, @option_list) = split(/\s+/, $1);
 
  23     my %options             = map { ($_ => 1) } @option_list;
 
  25     my $value               = $self->_get_loop_variable($var, 0, @indices);
 
  26     $value                  = $form->parse_amount({ numberformat => $::myconfig{output_numberformat} || $::myconfig{numberformat} }, $value) if $options{NOFORMAT};
 
  27     $value                  = $self->format_string($value); # Don't allow NOESCAPE for arguments passed to shell commands.
 
  29     substr($text, $tag_pos, $tag_len, $value);
 
  36   my ($self, $variable) = @_;
 
  38   return shell_quote_best_effort($variable);
 
  46   my ($self, $text) = @_;
 
  48   return $self->parse_block($text);