From 89a6b28662d71121fa03749c0176c3ac471342b0 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 9 Dec 2006 00:19:51 -0800 Subject: [PATCH] Output all unknown block-level elements and their descendants unchanged. --- WikiConverter/Markdown.pm | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/WikiConverter/Markdown.pm b/WikiConverter/Markdown.pm index adc6e74..15a78ee 100644 --- a/WikiConverter/Markdown.pm +++ b/WikiConverter/Markdown.pm @@ -133,9 +133,19 @@ sub rules { $rules{$_} = { preserve => 1, attrs => \@common_attrs } if !exists $rules{$_}; } + for(keys(%HTML::Tagset::isBodyElement)) { + $rules{$_} = { replace => \&_blockelem } if !exists $rules{$_}; + } + return \%rules; } +sub _blockelem { + my( $self, $node, $rules ) = @_; + $node->deobjectify_text(); + return $node->as_HTML('<>&', ' ', {}); +} + sub _header_start { my( $self, $node, $rules ) = @_; return '' unless $self->header_style eq 'atx'; @@ -171,10 +181,7 @@ sub _pre { my( $self, $node, $rules ) = @_; for($node->content_list) { - if($_->tag ne "~text") { - $node->deobjectify_text(); - return $node->as_HTML(); - } + return _blockelem(@_) if($_->tag ne "~text"); } my $text = $self->get_elem_contents($node); -- 1.4.4.2