/[wait]/branches/unido/lib/WAIT/Format/HTML.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /branches/unido/lib/WAIT/Format/HTML.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 106 - (hide annotations)
Tue Jul 13 12:22:09 2004 UTC (19 years, 10 months ago) by dpavlin
File size: 1414 byte(s)
Changes made by Andreas J. Koenig <andreas.koenig(at)anima.de> for Unido project

1 dpavlin 106 # -*- Mode: Perl -*-
2     # HTML.pm --
3     # ITIID : $ITI$ $Header $__Header$
4     # Author : Ulrich Pfeifer
5     # Created On : Wed Sep 18 19:24:55 1996
6     # Last Modified By: Ulrich Pfeifer
7     # Last Modified On: Sun Nov 22 18:44:45 1998
8     # Language : CPerl
9     # Update Count : 14
10     # Status : Unknown, Use with caution!
11     #
12     # Copyright (c) 1996-1997, Ulrich Pfeifer
13     #
14    
15     package WAIT::Format::HTML;
16     require WAIT::Format::Base;
17     use strict;
18     use vars qw(@ISA);
19    
20     @ISA = qw(WAIT::Format::Base);
21    
22     my %DEFAULT = (
23     bold_s => '<B>',
24     bold_e => '</B>',
25     query_s => '<B><FONT COLOR="#ff0000">', # SIZE="+2"
26     query_e => '</FONT></B>',
27     italic_s => '<I>',
28     italic_e => '</I>',
29     );
30     sub new {
31     my $type = shift;
32     my %parm = @_;
33     my %self = %DEFAULT;
34    
35     for (keys %DEFAULT) {
36     $self{$_} = $parm{$_} if exists $parm{$_};
37     }
38     bless \%self, ref($type) || $type;
39     }
40    
41     sub bold {
42     my $self = shift;
43     $self->{bold_s} . $_[0] . $self->{bold_e};
44     }
45    
46     sub italic {
47     my $self = shift;
48     $self->{italic_s} . $_[0] . $self->{italic_e};
49     }
50    
51     sub query {
52     my $self = shift;
53     $self->{query_s} . $_[0] . $self->{query_e};
54     }
55    
56     use HTML::Entities;
57    
58     sub text {
59     encode_entities($_[1]);
60     }
61    
62     sub as_string {
63     my $self = shift;
64    
65     "<PRE>\n" . $self->SUPER::as_string(@_) . "\n</PRE>\n";
66     }
67    
68     1;

  ViewVC Help
Powered by ViewVC 1.1.26