--- trunk/Estraier.pm 2006/01/04 13:33:07 4 +++ trunk/Estraier.pm 2006/01/04 14:38:35 5 @@ -66,6 +66,10 @@ $doc->add_attr( name => 'value' ); +B: delete attribute using + + $doc->add_attr( name => undef ); + =cut sub add_attr { @@ -73,10 +77,49 @@ my $attrs = {@_}; while (my ($name, $value) = each %{ $attrs }) { - push @{$self->{attrs}->{_s($name)}}, _s($value); + push @{ $self->{attrs}->{_s($name)} }, _s($value); } } + +=head2 add_text + + $doc->add_text('this is example text to display'); + +=cut + +sub add_text { + my $self = shift; + my $text = shift; + return unless defined($text); + + push @{ $self->{dtexts} }, _s($text); +} + + +=head2 add_hidden_text + + $doc->add_hidden_text('this is example text just for search'); + +=cut + +sub add_hidden_text { + my $self = shift; + my $text = shift; + return unless defined($text); + + push @{ $self->{htexts} }, _s($text); +} + +=head2 dump_draft + + print $doc->dump_draft; + +=cut + +sub dump_draft { +} + =head2 delete Empty document object @@ -88,7 +131,9 @@ sub delete { my $self = shift; - delete($self->{attrs}); + foreach my $data (qw/attrs dtexts stexts/) { + delete($self->{$data}); + } return 1; }