Changeset 4294


Ignore:
Timestamp:
06/24/09 19:53:49 (3 years ago)
Author:
MichaelTempest
Message:

Item1770: perltidy

Location:
trunk/WysiwygPlugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm

    r4292 r4294  
    601601 
    602602    my $xmltags = $this->{opts}->{xmltag}; 
     603 
    603604    # Take out custom XML tags 
    604605    sub _takeOutCustomXmlProcess { 
    605606        my ( $this, $state, $scoop ) = @_; 
    606607        my $params = $state->{tagParams}; 
    607         my $tag = $state->{tag}; 
     608        my $tag    = $state->{tag}; 
    608609        my $markup = "<$tag$params>$scoop</$tag>"; 
    609         if ($this->{opts}->{xmltag}->{$tag}->($markup)) { 
     610        if ( $this->{opts}->{xmltag}->{$tag}->($markup) ) { 
    610611            return $this->_liftOut( $markup, 'PROTECTED' ); 
    611612        } 
    612613        else { 
    613             return $this->_liftOut( "<$tag$params>", 'PROTECTED' ) . $scoop . $this->_liftOut( "</$tag>", 'PROTECTED' ); 
     614            return $this->_liftOut( "<$tag$params>", 'PROTECTED' ) . $scoop 
     615              . $this->_liftOut( "</$tag>", 'PROTECTED' ); 
    614616        } 
    615617    } 
     
    624626 
    625627sub _takeOutBlocks { 
     628 
    626629    # my ( $this, $intext, $tag ) = @_; 
    627630 
     
    653656    my $scoop; 
    654657 
    655     # &$fn may rely on the existence of these fields,  
     658    # &$fn may rely on the existence of these fields, 
    656659    # and may add more fields, if needed 
    657660    my %state = ( tag => $tag, n => 0, tagParams => undef ); 
  • trunk/WysiwygPlugin/test/unit/WysiwygPlugin/ExtendedTranslatorTests.pm

    r4292 r4294  
    8282        exec => $TML2HTML | $ROUNDTRIP, 
    8383        name => 'UnspecifiedCustomXmlTag', 
    84         html => '<p>' . $protecton . '&lt;customtag&gt;' . $protectoff . 'some &gt; text' . $protecton . '&lt;/customtag&gt;' . $protectoff . '</p>', 
    85         tml  => '<customtag>some >  text</customtag>', 
    86         finaltml  => '<customtag>some &gt; text</customtag>', 
     84        html => '<p>' 
     85          . $protecton 
     86          . '&lt;customtag&gt;' 
     87          . $protectoff 
     88          . 'some &gt; text' 
     89          . $protecton 
     90          . '&lt;/customtag&gt;' 
     91          . $protectoff . '</p>', 
     92        tml      => '<customtag>some >  text</customtag>', 
     93        finaltml => '<customtag>some &gt; text</customtag>', 
    8794    }, 
    8895    { 
    89         exec => $TML2HTML | $ROUNDTRIP, 
    90         name => 'DisabledCustomXmlTag', 
    91         setup => sub { Foswiki::Plugins::WysiwygPlugin::addXMLTag('customtag', sub { 0 } ); }, 
    92         html => '<p>' . $protecton . '&lt;customtag&gt;' . $protectoff . 'some &gt; text' . $protecton . '&lt;/customtag&gt;' . $protectoff . '</p>', 
    93         tml  => '<customtag>some >  text</customtag>', 
    94         finaltml  => '<customtag>some &gt; text</customtag>', 
     96        exec  => $TML2HTML | $ROUNDTRIP, 
     97        name  => 'DisabledCustomXmlTag', 
     98        setup => sub { 
     99            Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 
     100                sub { 0 } ); 
     101        }, 
     102        html => '<p>' 
     103          . $protecton 
     104          . '&lt;customtag&gt;' 
     105          . $protectoff 
     106          . 'some &gt; text' 
     107          . $protecton 
     108          . '&lt;/customtag&gt;' 
     109          . $protectoff . '</p>', 
     110        tml      => '<customtag>some >  text</customtag>', 
     111        finaltml => '<customtag>some &gt; text</customtag>', 
    95112    }, 
    96113    { 
    97         exec => $TML2HTML | $ROUNDTRIP, 
    98         name => 'CustomXmlTag', 
    99         setup => sub { Foswiki::Plugins::WysiwygPlugin::addXMLTag('customtag', sub { 1 } ); }, 
    100         html => '<p>' . $protecton . '&lt;customtag&gt;some&nbsp;&gt;&nbsp;&nbsp;text&lt;/customtag&gt;' . $protectoff . '</p>', 
    101         tml  => '<customtag>some >  text</customtag>', 
     114        exec  => $TML2HTML | $ROUNDTRIP, 
     115        name  => 'CustomXmlTag', 
     116        setup => sub { 
     117            Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 
     118                sub { 1 } ); 
     119        }, 
     120        html => '<p>' 
     121          . $protecton 
     122          . '&lt;customtag&gt;some&nbsp;&gt;&nbsp;&nbsp;text&lt;/customtag&gt;' 
     123          . $protectoff . '</p>', 
     124        tml => '<customtag>some >  text</customtag>', 
    102125    }, 
    103126    { 
    104         exec => $TML2HTML | $ROUNDTRIP, 
    105         name => 'CustomXmlTagWithAttributes', 
    106         setup => sub { Foswiki::Plugins::WysiwygPlugin::addXMLTag('customtag', sub { 1 } ); }, 
    107         html => '<p>' . $protecton . '&lt;customtag&nbsp;with="attributes"&gt;<br />&nbsp;&nbsp;formatting&nbsp;&gt;&nbsp;&nbsp;preserved<br />&lt;/customtag&gt;' . $protectoff . '</p>', 
    108         tml  => <<BLAH, 
     127        exec  => $TML2HTML | $ROUNDTRIP, 
     128        name  => 'CustomXmlTagWithAttributes', 
     129        setup => sub { 
     130            Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'customtag', 
     131                sub { 1 } ); 
     132        }, 
     133        html => '<p>' 
     134          . $protecton 
     135          . '&lt;customtag&nbsp;with="attributes"&gt;<br />&nbsp;&nbsp;formatting&nbsp;&gt;&nbsp;&nbsp;preserved<br />&lt;/customtag&gt;' 
     136          . $protectoff . '</p>', 
     137        tml => <<BLAH, 
    109138<customtag with="attributes"> 
    110139  formatting >  preserved 
     
    183212 
    184213    # Reset the extendable parts of WysiwygPlugin 
    185     %Foswiki::Plugins::WysiwygPlugin::xmltag = (); 
     214    %Foswiki::Plugins::WysiwygPlugin::xmltag       = (); 
    186215    %Foswiki::Plugins::WysiwygPlugin::xmltagPlugin = (); 
    187216 
    188217    # Test-specific setup 
    189     if (exists $args->{setup}) { 
     218    if ( exists $args->{setup} ) { 
    190219        $args->{setup}->(); 
    191220    } 
     
    201230            expandVarsInURL => 
    202231              \&Foswiki::Plugins::WysiwygPlugin::expandVarsInURL, 
    203             xmltag     => \%Foswiki::Plugins::WysiwygPlugin::xmltag, 
     232            xmltag => \%Foswiki::Plugins::WysiwygPlugin::xmltag, 
    204233        } 
    205234    ); 
    206235 
    207236    # Test-specific cleanup 
    208     if (exists $args->{cleanup}) { 
     237    if ( exists $args->{cleanup} ) { 
    209238        $args->{cleanup}->(); 
    210239    } 
     
    223252 
    224253    # Reset the extendable parts of WysiwygPlugin 
    225     %Foswiki::Plugins::WysiwygPlugin::xmltag = (); 
     254    %Foswiki::Plugins::WysiwygPlugin::xmltag       = (); 
    226255    %Foswiki::Plugins::WysiwygPlugin::xmltagPlugin = (); 
    227256 
    228257    # Test-specific setup 
    229     if (exists $args->{setup}) { 
     258    if ( exists $args->{setup} ) { 
    230259        $args->{setup}->(); 
    231260    } 
     
    241270            expandVarsInURL => 
    242271              \&Foswiki::Plugins::WysiwygPlugin::expandVarsInURL, 
    243             xmltag     => \%Foswiki::Plugins::WysiwygPlugin::xmltag, 
     272            xmltag => \%Foswiki::Plugins::WysiwygPlugin::xmltag, 
    244273        } 
    245274    ); 
     
    258287 
    259288    # Test-specific cleanup 
    260     if (exists $args->{cleanup}) { 
     289    if ( exists $args->{cleanup} ) { 
    261290        $args->{cleanup}->(); 
    262291    } 
     
    281310 
    282311    # Reset the extendable parts of WysiwygPlugin 
    283     %Foswiki::Plugins::WysiwygPlugin::xmltag = (); 
     312    %Foswiki::Plugins::WysiwygPlugin::xmltag       = (); 
    284313    %Foswiki::Plugins::WysiwygPlugin::xmltagPlugin = (); 
    285314 
    286315    # Test-specific setup 
    287     if (exists $args->{setup}) { 
     316    if ( exists $args->{setup} ) { 
    288317        $args->{setup}->(); 
    289318    } 
     
    302331 
    303332    # Test-specific cleanup 
    304     if (exists $args->{cleanup}) { 
     333    if ( exists $args->{cleanup} ) { 
    305334        $args->{cleanup}->(); 
    306335    } 
Note: See TracChangeset for help on using the changeset viewer.