[dw-free] site-embed == tribbles
[commit: http://hg.dwscoalition.org/dw-free/rev/7ae5063f002e]
http://bugs.dwscoalition.org/show_bug.cgi?id=970
Don't add multiple embed tags when editing a post that contains video.
Patch by
kaisa.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=970
Don't add multiple embed tags when editing a post that contains video.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/EmbedModule.pm
-------------------------------------------------------------------------------- diff -r 3d6682ab6adc -r 7ae5063f002e cgi-bin/LJ/EmbedModule.pm --- a/cgi-bin/LJ/EmbedModule.pm Fri Aug 07 06:59:04 2009 +0000 +++ b/cgi-bin/LJ/EmbedModule.pm Fri Aug 07 09:42:53 2009 -0500 @@ -85,9 +85,9 @@ sub _expand_tag { if ($opts{expand_full}){ return $class->module_content(moduleid => $attrs{id}, journalid => $journal->id); } elsif ($edit) { - return '<site-embed ' . join(' ', map {"$_=\"$attrs{$_}\""} keys %attrs) . ">\n" . + return '<site-embed ' . join(' ', map {"$_=\"$attrs{$_}\""} keys %attrs) . ">" . $class->module_content(moduleid => $attrs{id}, journalid => $journal->id) . - "\n<\/site-embed>"; + "<\/site-embed>"; } else { @opts{qw /width height/} = @attrs{qw/width height/}; return $class->module_iframe_tag($journal, $attrs{id}, %opts) @@ -106,7 +106,7 @@ sub parse_module_embed { return unless LJ::is_enabled('embed_module'); # fast track out if we don't have to expand anything - return unless $$postref =~ /lj\-embed|embed|object/i; + return unless $$postref =~ /(lj|site)\-embed|embed|object/i; # do we want to replace with the lj-embed tags or iframes? my $expand = $opts{expand}; @@ -139,7 +139,7 @@ sub parse_module_embed { my $reconstructed = $class->reconstruct($token); if ($state == REGULAR) { - if ($tag eq 'lj-embed' && $type eq 'S' && ! $attr->{'/'}) { + if (($tag eq 'lj-embed' || $tag eq 'site-embed') && $type eq 'S' && ! $attr->{'/'}) { # <lj-embed ...>, not self-closed # switch to EXPLICIT state $newstate = EXPLICIT; @@ -180,7 +180,7 @@ sub parse_module_embed { } elsif ($state == EXPLICIT) { - if ($tag eq 'lj-embed' && $type eq 'E') { + if (($tag eq 'lj-embed' || $tag eq 'site-embed') && $type eq 'E') { # </lj-embed> - that's the end of explicit embed block, switch to REGULAR $newstate = REGULAR; } else { @@ -202,7 +202,7 @@ sub parse_module_embed { preview => $preview, ); - $newtxt .= "<lj-embed " . join(' ', map { exists $embed_attrs{$_} ? "$_=\"$embed_attrs{$_}\"" : () } qw / id width height /) . "/>"; + $newtxt .= "<site-embed " . join(' ', map { exists $embed_attrs{$_} ? "$_=\"$embed_attrs{$_}\"" : () } qw / id width height /) . "/>"; $embed = ''; %embed_attrs = (); --------------------------------------------------------------------------------