Skip to content

Commit

Permalink
Remove more encoded entities from graphviz; #117
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jun 6, 2024
1 parent 3d57285 commit 5d3d58b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ged2site
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,8 @@ foreach my $surname(sort keys %{$surnames}) {

# https://github.com/nigelhorne/ged2site/issues/117
$filename =~ s/'/APOS/g;
$filename =~ s/č/CCARON/gi;
$filename =~ s/š/SCARON/gi;

print $html "<li><a href=\"$filename.html\">$name</a> (";
# FIXME: "Implicit scalar context for hash in null operation"
Expand Down Expand Up @@ -8230,9 +8232,12 @@ sub print_person
my $filename = $tmp->filename();
if(open(my $fout, '|-', "$dot -Tpng -o$png -Tcmapx -o$filename")) {
# if(open(my $fout, '|-', '/bin/cat')) {
# We're using UTF-8 for the graphviz encoding
binmode($fout, ':utf8');

# print $fout 'digraph family { graph [rankdir=LR];';
print $fout 'digraph family {',
' charset="UTF-8"',
' subgraph parents { rank="min"; ';
if($father) {
print_graphviz({ person => $father, fout => $fout, format => 'static' });
Expand Down Expand Up @@ -8294,10 +8299,14 @@ sub print_person
$filename = $tmp->filename();
if(open(my $fout, '|-', "$dot -Tpng -o$png -Tcmapx -o$filename")) {
# if(open(my $fout, '|-', '/bin/cat')) {
# We're using UTF-8 for the graphviz encoding
binmode($fout, ':utf8');

# print $fout 'digraph family { graph [rankdir=LR];';
# Best to agree with the colour in css/web.css
# print $fout 'digraph family { bgcolor="#d6d6d6"',
print $fout 'digraph family {',
' charset="UTF-8"',
' subgraph parents { rank="min"; ';
if($father) {
print_graphviz({ person => $father, fout => $fout, format => 'dynamic' });
Expand Down Expand Up @@ -11669,9 +11678,20 @@ sub print_graphviz
if($is_alive && !$opts{'l'}) {
$label = 'Living';
} else {
# We're using UTF-8 for the graphviz encoding

# https://github.com/nigelhorne/ged2site/issues/117
# $label = wide_to_html($person->as_string());
$label = HTML::Entities::decode($person->as_string());
$label =~ s/\N{U+00E4}/ä/g;
$label =~ s/\xc3\xa4/ä/g;
$label =~ s/\N{U+010D}/č/g;
$label =~ s/\xc4\x8d/č/g;
$label =~ s/\N{U+0160}/Š/g;
$label =~ s/\xc5\xa0/Š/g;
$label =~ s/\N{U+0161}/š/g;
$label =~ s/\xc5\xa1/š/g;

$dob = dateofbirth($person);
$dod = dateofdeath($person);
}
Expand Down Expand Up @@ -13794,6 +13814,7 @@ sub wide_to_html

$string = HTML::Entities::decode($string);
# $string =~ s/ & / &amp; /g;
$string =~ s/&ccaron;/č/g; # I don't think HTML::Entities does this
$string =~ s/&/&amp;/g;

unless($params{'keep_hrefs'}) {
Expand Down Expand Up @@ -13982,6 +14003,7 @@ sub wide_to_xml
# print STDERR __LINE__, ": ($string)\n";

# $string =~ s/&amp;/&/g;
$string =~ s/&ccaron;/č/g; # I don't think HTML::Entities does this
$string =~ s/&/&amp;/g;

unless($params{'keep_hrefs'}) {
Expand Down

0 comments on commit 5d3d58b

Please sign in to comment.