Skip to content

Commit

Permalink
If married after known divorce, note that
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jul 30, 2024
1 parent 84307bc commit f65891c
Showing 1 changed file with 67 additions and 14 deletions.
81 changes: 67 additions & 14 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -4168,6 +4168,31 @@ sub print_person
record => $death_of_first_spouse,
});
}
if(my $divorce = $person->get_record('divorce') || $person->get_record('fams divorce')) {
if(my $dateofdivorce = $divorce->date()) {
if(datecmp($dateofmarriage, $dateofdivorce) > 0) {
if($printed_bracket) {
$name .= ', ';
} else {
$name .= '(';
$printed_bracket = 1;
}
if($death_of_first_spouse =~ /\s$/) {
complain({ person => $person, warning => 'Removing trailing spaces from date' });
$dateofdivorce =~ s/\s+$//;
}
$name .= 'following ' .
(($person->pronoun() eq 'She') ? 'her' : 'his') .
' divorce ' .
year({
person => $person,
record => $dateofdivorce
});
} else {
complain({ person => $person, warning => "Divorced on $dateofdivorce after marriage on $dateofmarriage" });
}
}
}
}
$name .= ')' if($printed_bracket);
push @names, $name;
Expand Down Expand Up @@ -13091,13 +13116,13 @@ sub wide_to_html
# Experimental code with false positives at the moment
sub dbpedia
{
my %params = (ref($_[0]) eq 'HASH') ? %{$_[0]} : @_;
my $params = get_params(undef, @_);

my $person = $params{'person'};
my $yod = $params{'yod'};
my $birth_dt = $params{'birth_dt'};
my $yob = $params{'yob'};
my $birth_country = $params{'birth_country'};
my $person = $params->{'person'};
my $yod = $params->{'yod'};
my $birth_dt = $params->{'birth_dt'};
my $yob = $params->{'yob'};
my $birth_country = $params->{'birth_country'};

if(defined($birth_dt)) {
if(!ref($birth_dt)) {
Expand Down Expand Up @@ -13230,6 +13255,11 @@ sub dbpedia
@categories = ( $result->{'Categories'}->{'Category'} );
}
foreach my $category(@categories) {
my $label = $category->{'Label'}->{'text'};
if($label =~ /^Companies based in/) {
next RESULT;
}

my $uri = $category->{'URI'}->{'text'};
if(($uri =~ /Category:Teaching_hospitals/) ||
($uri =~ /Category:Public_housing/) ||
Expand Down Expand Up @@ -13359,20 +13389,43 @@ sub newspaper
# Avoid end of sentences such as "with his twin sister Jane E.."
sub given_names
{
my %params;
my $params = get_params('person', @_);

if(my $given = $params->{'person'}->given_names()) {
$given =~ s/\.$//;
return $given;
}
}

# Helper routine to parse the arguments given to a function,
# allowing the caller to call the function in anyway that they want
# e.g. foo('bar'), foo(arg => 'bar'), foo({ arg => 'bar' }) all mean the same
# when called _get_params('arg', @_);
sub get_params
{
my $default = shift;

my %rc;

if(ref($_[0]) eq 'HASH') {
%params = %{$_[0]};
%rc = %{$_[0]};
} elsif(scalar(@_) % 2 == 0) {
%params = @_;
%rc = @_;
} elsif(scalar(@_) == 1) {
$params{'person'} = shift;
if(defined($default)) {
$rc{$default} = shift;
} else {
my @c = caller(1);
my $func = $c[3]; # calling function name
Carp::croak('Usage: ', __PACKAGE__, "->$func($default => " . '$val)');
}
} elsif((scalar(@_) == 0) && defined($default)) {
my @c = caller(1);
my $func = $c[3]; # calling function name
Carp::croak('Usage: ', __PACKAGE__, "->$func($default => " . '$val)');
}

if(my $given = $params{'person'}->given_names()) {
$given =~ s/\.$//;
return $given;
}
return \%rc;
}

# Must all be in lower case
Expand Down

0 comments on commit f65891c

Please sign in to comment.