Skip to content

Commit

Permalink
Added Emitter class
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.kwiki.org/kwiki/trunk/src/ingy/WikiText@326 4b3b33bc-d223-0410-9309-b363ae52eedd
  • Loading branch information
ingy committed Feb 26, 2008
1 parent 7dafc4f commit 3668836
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
23 changes: 23 additions & 0 deletions lib/WikiText/Emitter.pm
@@ -0,0 +1,23 @@
package WikiText::Emitter;
use strict;
use warnings;

use base 'WikiText::Receiver';

sub init {
my $self = shift;
$self->{output} = '';
}

sub content {
my $self = shift;
return $self->{output};
}

sub insert {
my $self = shift;
my $ast = shift;
$self->{output} .= $ast->{output} || '';
}

1;
18 changes: 1 addition & 17 deletions lib/WikiText/HTML/Emitter.pm
Expand Up @@ -2,7 +2,7 @@ package WikiText::HTML::Emitter;
use strict;
use warnings;

use base 'WikiText::Receiver';
use base 'WikiText::Emitter';
use CGI::Util;

my $type_tags = {
Expand All @@ -11,22 +11,6 @@ my $type_tags = {
wikilink => 'a',
};

sub init {
my $self = shift;
$self->{output} = '';
}

sub content {
my $self = shift;
return $self->{output};
}

sub insert {
my $self = shift;
my $ast = shift;
$self->{output} .= $ast->{output} || '';
}

sub uri_escape {
$_ = shift;
s/ /\%20/g;
Expand Down

0 comments on commit 3668836

Please sign in to comment.