#! /usr/bin/perl -w $VSN = q$Id: outline2html,v 1.6 2002/06/19 01:50:29 mca1001 Exp $; $VSN =~ s/.+?,v\s*(.+:\S+).*/$1/; use strict; use vars qw(@lvls $VSN); use HTML::Entities; use Tree::DAG_Node; # these are local names & likely to change use DAGnode_Import; # use DAGnode_Export; die "$0: stdin or one file --> stdout filter" if @ARGV > 1; my $tree = Tree::DAG_Node::Import::outline2tree(\*ARGV, $ARGV[0]); my @output; $tree->walk_down ({ _depth => 0, html => \@output, showprivate => undef, callback => sub { my ($node, $opt) = @_; # the file itself has no heading but the text at the top # return 1 if $node->attributes->{'invented'}; my ($t, $h) = ($node->name, $opt->{'html'}); HTML::Entities::encode($t); my $hidden = not ispublic($node, $opt->{'showprivate'}); $t = '[Hidden tree section]' if $hidden; if ($opt->{'_depth'} == 0) { push @$h, make_header($node, $t, $opt->{'showprivate'}); } else { push @$h, join "", '
$t"; } push @$h, "