<commit_before>package EnsEMBL::Web::Form::Element::RadioGroup;

use EnsEMBL::Web::Form::Element;
use CGI qw(escapeHTML);
our @ISA = qw( EnsEMBL::Web::Form::Element );

sub new {
  my $class = shift;
  my %params = @_;
  my $self = $class->SUPER::new( %params, 'render_as' => $params{'select'} ? 'select' : 'radiobutton', 'values' => $params{'values'} );
  $self->{'class'} = $params{'class'} || 'radiocheck';
  return $self;
}

sub validate { return $_[0]->render_as eq 'select'; }

sub render {
  my $self =shift;

  my $output = '';
  my $K = 0;
  my $checked;
  foreach my $V ( @{$self->values} ) {
      $checked = 'no';
      # check if we want to tick this box
      foreach my $M ( @{$self->value||[]} ) {
	  if ($M eq $$V{'value'}) {
	      $checked = 'yes';
	      last;
	  }
      }
      if ($V->{'checked'}) {
	  $checked = 'yes';
      }
      $output .= sprintf( "    <div class=\"%s\"><input id=\"%s_%d\" class=\"radio\" type=\"radio\" name=\"%s\" value=\"%s\" %s/><label for=\"%s_%d\">%s</label></div>\n",
			  $self->{'class'},
			  CGI::escapeHTML($self->id), $K, CGI::escapeHTML($self->name), CGI::escapeHTML($V->{'value'}),
			  $checked eq 'yes' ? ' checked="checked"' : '', CGI::escapeHTML($self->id), $K,
			  CGI::escapeHTML($V->{'name'})
			  );
      $K++;
  }
  return $self->introduction.$output.$self->notes;

}

1;<commit_msg>allowed to provide an HTML text for radio box label<commit_after>package EnsEMBL::Web::Form::Element::RadioGroup;

use EnsEMBL::Web::Form::Element;
use CGI qw(escapeHTML);
our @ISA = qw( EnsEMBL::Web::Form::Element );

sub new {
  my $class = shift;
  my %params = @_;
  my $self = $class->SUPER::new( %params, 'render_as' => $params{'select'} ? 'select' : 'radiobutton', 'values' => $params{'values'} );
  $self->{'class'} = $params{'class'} || 'radiocheck';
  return $self;
}

sub validate { return $_[0]->render_as eq 'select'; }

sub render {
  my $self =shift;

  my $output = '';
  my $K = 0;
  my $checked;
  foreach my $V ( @{$self->values} ) {
      $checked = 'no';
      # check if we want to tick this box
      foreach my $M ( @{$self->value||[]} ) {
	  if ($M eq $$V{'value'}) {
	      $checked = 'yes';
	      last;
	  }
      }
      if ($V->{'checked'}) {
	  $checked = 'yes';
      }
      $output .= sprintf( "    <div class=\"%s\"><input id=\"%s_%d\" class=\"radio\" type=\"radio\" name=\"%s\" value=\"%s\" %s/><label for=\"%s_%d\">%s</label></div>\n",
			  $self->{'class'},
			  CGI::escapeHTML($self->id), 
			  $K, CGI::escapeHTML($self->name), 
			  CGI::escapeHTML($V->{'value'}),
			  $checked eq 'yes' ? ' checked="checked"' : '', 
			  CGI::escapeHTML($self->id), $K,
			  $self->{'noescape'} ? $V->{'name'} : CGI::escapeHTML($V->{'name'}),
			  );
      $K++;
  }
  return $self->introduction.$output.$self->notes;

}

1;
{'fraction_non_alphanumeric': 0.25035612535612534, 'fraction_numerical': 0.002136752136752137, 'mean_word_length': 3.2177177177177176, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3946115', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1044, 'n_words': 224}