CORBA-HTML

 view release on metacpan or  search on metacpan

lib/CORBA/HTML/HtmlVisitor.pm  view on Meta::CPAN

    $self->{symbtab} = $parser->YYData->{symbtab};
    $self->{frameset} = exists $parser->YYData->{opt_f};
    $self->{html_name} = new CORBA::HTML::NameVisitor($parser);
    $self->{html_decl} = new CORBA::HTML::DeclVisitor($self);
    $self->{html_comment} = new CORBA::HTML::CommentVisitor($self);
    $self->{scope} = q{};
    $self->{css} = $parser->YYData->{opt_s};
    $self->{style} = q{
        a.index { font-weight : bold; }
        h2 { color : red; }
        p.comment { color : green; }
        span.comment { color : green; }
        span.decl { font-weight : bold; }
        span.tag { font-weight : bold; }
        hr { text-align : center; }
    };
    return $self;
}

sub _get_defn {
    my $self = shift;
    my($defn) = @_;
    if (ref $defn) {
        return $defn;
    }
    else {
        return $self->{symbtab}->Lookup($defn);
    }
}

sub _get_name {
    my $self = shift;
    my ($node) = @_;
    return $node->visit($self->{html_name}, $self->{scope});
}

sub _print_decl {
    my $self = shift;
    my ($node) = @_;
    $node->visit($self->{html_decl}, \*OUT);
}

sub _print_comment {
    my $self = shift;
    my ($node) = @_;
    $node->visit($self->{html_comment}, \*OUT);
    print OUT "  <p />\n";
}

sub _sep_line {
    my $self = shift;
    print OUT "    <hr />\n";
}

sub _format_head {
    my $self = shift;
    my ($title, $frameset, $target) = @_;
    my $now = localtime();
#   print OUT "<?xml version='1.0' encoding='ISO-8859-1'?>\n";
    if ($frameset) {
        print OUT "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>\n";
    }
    else {
        print OUT "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n";
    }
    print OUT "<html xmlns='http://www.w3.org/1999/xhtml'>\n";
    print OUT "\n";
    print OUT "  <head>\n";
    print OUT "    <meta name='generator' content='idl2html ",$CORBA::HTML::VERSION," (Perl ",$],")' />\n";
    print OUT "    <meta name='date' content='",$now,"' />\n";
    print OUT "    <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1' />\n";
    print OUT "    <title>",$title,"</title>\n" if ($title);
    unless ($frameset) {
        print OUT "    <base target='",$target,"' />\n" if (defined $target);
        if ($self->{css}) {
            print OUT "    <link href='",$self->{css},".css' rel='stylesheet' type='text/css'/>\n";
        }
        else {
            print OUT "    <style type='text/css'>\n";
            print OUT $self->{style},"\n";
            print OUT "    </style>\n";
        }
    }
    print OUT "  </head>\n";
    print OUT "\n";
}

sub _format_head_main {
    my $self = shift;
    my ($title) = @_;
    $self->_format_head($title, 0);
    print OUT "  <body>\n";
    print OUT "    <h1><a id='__Top__' name='__Top__'/>",$title,"</h1>\n";
    print OUT "    <p><a href='index.html'>Global index</a></p>\n"
            unless ($self->{frameset});
    print OUT "    <hr />\n";
}

sub _format_head_global_index {
    my $self = shift;
    my $title = 'Global index';
    if ($self->{frameset}) {
        $self->_format_head($title, 0, 'local');
        print OUT "  <body>\n";
    }
    else {
        $self->_format_head($title, 0);
        print OUT "  <body>\n";
        print OUT "    <h1><a id='__Top__' name='__Top__'/>",$title,"</h1>\n";
        print OUT "    <hr />\n";
    }
}

sub _format_head_index {
    my $self = shift;
    my ($title) = @_;
    $self->_format_head('Index ' . $title, 0, 'main');
    print OUT "  <body>\n";
    print OUT "    <h1><a href='_",$title,".html#__Top__'>",$title,"</a></h1>\n";
}

sub _format_tail {
    my $self = shift;
    my ($frameset) = @_;



( run in 0.702 second using v1.01-cache-2.11-cpan-119454b85a5 )