Changeset 1549
- Timestamp:
- 08/21/06 00:26:33
- Files:
-
- branches/hackathon-summary/plagger/lib/Plagger/Text.pm (modified) (1 diff)
- branches/hackathon-summary/plagger/lib/Plagger/Util.pm (modified) (1 diff)
- branches/hackathon-summary/plagger/t/core/text.t (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/hackathon-summary/plagger/lib/Plagger/Text.pm
r1527 r1549 43 43 } 44 44 45 sub html { 46 my $self = shift; 47 if ($self->is_html) { 48 return $self->data; 49 } else { 50 Plagger::Util::encode_xml($self->data); 51 } 52 } 53 45 54 sub plaintext { 46 55 my $self = shift; branches/hackathon-summary/plagger/lib/Plagger/Util.pm
r1547 r1549 170 170 '<' => '<', 171 171 '>' => '>', 172 "'" => '"', 172 '"' => '"', 173 "'" => ''', 173 174 ); 174 175 branches/hackathon-summary/plagger/t/core/text.t
r1544 r1549 10 10 my $block = shift; 11 11 my $text = Plagger::Text->new_from_text($block->input); 12 my $test = { type => $text->type, plaintext => $text->plaintext };12 my $test = { type => $text->type, plaintext => $text->plaintext, html => $text->html }; 13 13 is_deeply $test, $block->expected, $block->name; 14 14 } … … 22 22 type: text 23 23 plaintext: Hello World 24 html: Hello World 24 25 25 26 === & … … 29 30 type: html 30 31 plaintext: Hello & World 32 html: Hello & World 31 33 32 34 === & … … 36 38 type: text 37 39 plaintext: '"The Big & Small"' 40 html: ""The Big & Small"" 38 41 39 42 === quot; … … 42 45 --- expected 43 46 type: html 44 plaintext: Foo "baz" 47 plaintext: Foo "baz" 48 html: Foo "baz" 45 49 46 50 === Tags … … 50 54 type: html 51 55 plaintext: Hello World 56 html: <p>Hello World</p> 52 57 53 58 === XHTML … … 57 62 type: html 58 63 plaintext: "Hello\nWorld" 64 html: Hello <br /> World 59 65 60 66 === <wbr> … … 64 70 type: html 65 71 plaintext: Hello World 72 html: Hello <wbr> World 66 73 67 74 === Unknown Tags … … 71 78 type: text 72 79 plaintext: <foo>Hello</foo> 80 html: "<foo>Hello</foo>" 81 82
