#!/usr/bin/perl # package S2::BackendHTML; use strict; use vars qw($CommentColor $IdentColor $KeywordColor $StringColor $PunctColor $BracketColor $TypeColor $VarColor $IntegerColor); $CommentColor = "#008000"; $IdentColor = "#000000"; $KeywordColor = "#0000FF"; $StringColor = "#008080"; $PunctColor = "#000000"; $BracketColor = "#800080"; $TypeColor = "#000080"; $VarColor = "#000000"; $IntegerColor = "#000000"; sub new { my ($class, $l) = @_; my $this = { 'layer' => $l, }; bless $this, $class; } sub output { my ($this, $o) = @_; $o->write("
"); my $nodes = $this->{'layer'}->getNodes(); foreach my $n (@$nodes) { my $dbg = "Doing node: " . ref($n); if (ref $n eq "S2::NodeFunction") { $dbg .= " (" . $n->getName() . ")"; if ($n->getName() eq "print_body") { #use Data::Dumper; #$dbg .= Dumper($n->{'tokenlist'}); } } #Apache->request->log_error($dbg); #print $dbg; $n->asHTML($o); } $o->write(""); $o->newline(); } sub quoteHTML { shift if ref $_[0]; my $s = shift; $s =~ s/&/&/g; $s =~ s/</g; $s =~ s/>/>/g; $s; } 1;