CORBA-HTML

 view release on metacpan or  search on metacpan

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


#
#           Interface Definition Language (OMG IDL CORBA v3.0)
#

package CORBA::HTML::HtmlVisitor;

use strict;
use warnings;

our $VERSION = '2.60';

use File::Basename;
use CORBA::HTML::NameVisitor;
use CORBA::HTML::DeclVisitor;
use CORBA::HTML::CommentVisitor;

sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $self = {};
    bless $self, $class;
    my ($parser) = @_;
    $self->{parser} = $parser;
    $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);



( run in 3.130 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )