Skip to content

Commit

Permalink
Combine regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 31, 2024
1 parent df537a7 commit f4ffea5
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -14718,11 +14718,10 @@ sub get_language

sub get_language_code
{
if($ENV{'LANGUAGE'}) {
if($ENV{'LANGUAGE'} =~ /^([a-z]{2})/i) {
return lc($1);
}
if($ENV{'LANGUAGE'} && ($ENV{'LANGUAGE'} =~ /^([a-z]{2})/i)) {
return lc($1);
}

foreach my $variable('LC_ALL', 'LC_MESSAGES', 'LANG') {
my $val = $ENV{$variable};
next unless(defined($val));
Expand Down Expand Up @@ -15096,11 +15095,12 @@ sub wide_to_html
# $string =~ s/&id=/&id=/g;

unless($params->{'keep_apos'}) {
$string =~ s/'/'/g;
$string =~ s/‘/'/g;
$string =~ s/’/'/g;
$string =~ s/‘/'/g;
$string =~ s/\x98/'/g;
# $string =~ s/'/'/g;
# $string =~ s/‘/'/g;
# $string =~ s/’/'/g;
# $string =~ s/‘/'/g;
# $string =~ s/\x98/'/g;
$string =~ s/['‘’‘\x98]/'/g;
}

if($string !~ /[^[:ascii:]]/) {
Expand Down Expand Up @@ -15371,11 +15371,12 @@ sub wide_to_xml
$string =~ s/([<>“”"])/$replacements{$1}/g;
}

$string =~ s/‘/&apos;/g;
$string =~ s/’/&apos;/g;
$string =~ s/‘/&apos;/g;
$string =~ s/‘/&apos;/g;
$string =~ s/\x98/&apos;/g;
# $string =~ s/‘/&apos;/g;
# $string =~ s/’/&apos;/g;
# $string =~ s/‘/&apos;/g;
# $string =~ s/‘/&apos;/g;
# $string =~ s/\x98/&apos;/g;
$string =~ s/['‘’‘\x98]/&apos;/g;

$string =~ s/&Aacute;/&#x0C1;/g; # Á
$string =~ s/&aring;/&#x0E5;/g; # å
Expand Down

0 comments on commit f4ffea5

Please sign in to comment.