From 243cf350452543f3e2c8535e22a8a6d4f37d0e29 Mon Sep 17 00:00:00 2001 From: "slamm%netscape.com" Date: Fri, 11 Feb 2000 01:16:09 +0000 Subject: [PATCH] Inline entities in rdf file. Remove calculater (bug 18373). It was causing problems. --- .../sidebar/resources/make-panels.pl | 70 ++++++++++++------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/xpfe/components/sidebar/resources/make-panels.pl b/xpfe/components/sidebar/resources/make-panels.pl index 065cb7ad4e95..a45cad596a33 100755 --- a/xpfe/components/sidebar/resources/make-panels.pl +++ b/xpfe/components/sidebar/resources/make-panels.pl @@ -52,18 +52,22 @@ while () { # Output the RDF # -my $fh_rdf = new FileHandle(">out.rdf"); -my $fh_dtd = new FileHandle(">out.dtd"); +print ''."\n" + ."\n"; -print $fh_rdf qq( \n); +print ''; +print qq( \n); for my $child (@{$items{'master-panel-list'}->{children}}) { - print_structure($fh_rdf, $child, ' '); + print_structure($child, ' '); } -print $fh_rdf qq( \n); -print_items($fh_rdf, $fh_dtd, \%items); +print qq( \n); +print_items(\%items); -$fh_rdf->close; -$fh_dtd->close; +print "\n"; # end of main ############################################################# @@ -95,47 +99,55 @@ sub parse_line { } elsif (/^panel\|/) { $rec->{content_url} = $content_url; } - $items->{$id} = $rec; + $items->{"$id"} = $rec; push @{$items->{$parent}->{children}}, $rec; } +sub print_entities { + my ($items) = @_; + for my $id (sort keys %{$items}) { + my $item = $items->{$id}; + + print_entity($item); + } +} + sub print_structure { - my ($fh, $item, $depth) = @_; + my ($item, $depth) = @_; $depth = '' unless defined $depth; if ($item->{type} eq 'panel-group') { - print $fh qq(\n $depth\n); - print $fh qq( $depth\n); + print qq(\n $depth\n); + print qq( $depth\n); for my $child (@{$item->{children}}) { - print_structure($fh, $child, $depth.' '); + print_structure($child, $depth.' '); } - print $fh qq( $depth\n); - print $fh qq( $depth\n); + print qq( $depth\n); + print qq( $depth\n); } else { - print $fh qq( $depth\n); + print qq( $depth\n); } } sub print_items { - my ($fh_rdf, $fh_dtd, $items) = @_; + my ($items) = @_; for my $id (sort keys %{$items}) { my $item = $items->{$id}; next unless $item->{type} eq 'panel-group'; next if $item->{label} eq ''; - print_item($fh_rdf, $fh_dtd, $item); + print_item($item); } for my $id (sort keys %{$items}) { my $item = $items->{$id}; next if $item->{type} eq 'panel-group'; - print_item($fh_rdf, $fh_dtd, $item); + print_item($item); } } sub print_item { - my ($fh_rdf, $fh_dtd, $item) = @_; - my $output = ''; + my ($item) = @_; - $output = "\n" + my $output = "\n" . " \n" . " &$item->{entity};\n"; if ($item->{type} eq 'panel') { @@ -148,6 +160,14 @@ sub print_item { } $output .= " \n"; + print $output; +} + +sub print_entity { + my ($item) = @_; + + return unless $item->{entity}; + my $entity = ''; if ($item->{label} =~ /^"[^\"]+"$/) { $entity .= "\n"; @@ -155,9 +175,10 @@ sub print_item { $entity .= "\n"; } $item->{label} =~ s/\"//g; + $entity .= sprintf qq{{label}">\n}, $item->{entity}; - print $fh_rdf $output; - print $fh_dtd $entity; + + print $entity; } __DATA__ @@ -191,7 +212,6 @@ nc-panel|Local Movies|localmovie|sports-entertainment nc-panel|Sports|sports|sports-entertainment panel-group|Applications|applications|master-panel-list -nc-panel|Calculator|calculator|applications nc-panel|Calendar|calendar|applications nc-panel|Delivery|delivery|applications nc-panel|"Netcenter" Apps|netcenterservices|applications