Changeset 6316


Ignore:
Timestamp:
02/13/10 16:30:45 (2 years ago)
Author:
MichaelTempest
Message:

Item8422: Add here-document support for %STARTSECTION and %ENDSECTION

Foswiki::parseSections is a static method. So I passed "undef" instead of $this, and modified _extractHereDocuments to cope with that. Perhaps parseSections should pass $Foswiki::Plugins::SESSION instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki.pm

    r6314 r6316  
    21472147    my $ntext  = ''; 
    21482148    my $offset = 0; 
    2149     foreach my $bit ( split( /(%(?:START|END)SECTION(?:{.*?})?%)/, $_[0] ) ) { 
     2149    my @queue = split( /(%(?:START|END)SECTION(?:{.*?})?%)/, $_[0] ); 
     2150    while ( scalar(@queue) ) { 
     2151        my $bit = shift(@queue); 
    21502152        if ( $bit =~ /^%STARTSECTION(?:{(.*)})?%$/ ) { 
    21512153            require Foswiki::Attrs; 
     
    21532155            # SMELL: unchecked implicit untaint? 
    21542156            my $attrs = new Foswiki::Attrs($1); 
     2157            _extractHereDocuments(undef, $attrs, \@queue); 
    21552158            $attrs->{type} ||= 'section'; 
    21562159            $attrs->{name} = 
     
    21852188            # SMELL: unchecked implicit untaint? 
    21862189            my $attrs = new Foswiki::Attrs($1); 
     2190            _extractHereDocuments(undef, $attrs, \@queue); 
    21872191            $attrs->{type} ||= 'section'; 
    21882192            $attrs->{name} = $attrs->{_DEFAULT} || $attrs->{name} || ''; 
     
    29902994            $attrs->{$param} =~ s/%/%/g; 
    29912995            # Emit a warning to help wiki-app developers see what is wrong 
    2992             $attrs->{$param} .= $this->inlineAlert( 'alerts', 'here_not_found', $here ); 
     2996            if ($this) { 
     2997                $attrs->{$param} .= $this->inlineAlert( 'alerts', 'here_not_found', $here ); 
     2998            } 
     2999            else { 
     3000                Foswiki::Func::writeWarning("HERE-document end marker '$here' not found"); 
     3001            } 
    29933002        } 
    29943003    } 
Note: See TracChangeset for help on using the changeset viewer.