Skip to content

Commit

Permalink
Item8422: Undo here-documents part 5: Roll back change to attribute p…
Browse files Browse the repository at this point in the history
…arsing

git-svn-id: http://svn.foswiki.org/trunk@6489 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelTempest authored and MichaelTempest committed Feb 23, 2010
1 parent 7da1dfc commit 70b6048
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions core/lib/Foswiki/Attrs.pm
Expand Up @@ -54,7 +54,6 @@ our $VERSION = '$Rev$';
our $ERRORKEY = '_ERROR';
our $DEFAULTKEY = '_DEFAULT';
our $RAWKEY = '_RAW';
our $HEREKEY = '-HERE'; # Not a valid attribute name
our $MARKER = "\0";

=begin TML
Expand All @@ -76,7 +75,6 @@ sub new {
my $this = bless( {}, $class );

$this->{$RAWKEY} = $string;
my @here;

return $this unless defined($string);

Expand All @@ -86,33 +84,17 @@ sub new {
my $sep = ( $friendly ? "[\\s,]" : "\\s" );
my $first = 1;

if ( !$friendly && $string =~ s/^\s*\"(.*?)\"\s*(\w+\s*=\s*(?:\"|<<\w+)|$)/$2/s ) {
if ( !$friendly && $string =~ s/^\s*\"(.*?)\"\s*(\w+\s*=\s*\"|$)/$2/s ) {
$this->{$DEFAULTKEY} = $1;
}
while ( $string =~ m/\S/s ) {

# name=<<HERE pairs
if ( $string =~ s/^$sep*(\w+)\s*=\s*<<(\w+)//is ) {
$this->{$1} = '';
push @here, $1, $2;
$first = 0;
}

# name="value" pairs
elsif ( $string =~ s/^$sep*(\w+)\s*=\s*\"(.*?)\"//is ) {
if ( $string =~ s/^$sep*(\w+)\s*=\s*\"(.*?)\"//is ) {
$this->{$1} = $2;
$first = 0;
}

# <<HERE with no name, sets the default
elsif ( $string =~ s/^$sep*<<(\w+)(?!\S)//os ) {
unless (defined $this->{$DEFAULTKEY} ) {
push @here, $DEFAULTKEY, $1;
$this->{$DEFAULTKEY} = '';
}
$first = 0;
}

# simple double-quoted value with no name, sets the default
elsif ( $string =~ s/^$sep*\"(.*?)\"//os ) {
$this->{$DEFAULTKEY} = $1
Expand Down Expand Up @@ -166,7 +148,6 @@ sub new {
foreach my $k ( keys %$this ) {
$this->{$k} =~ s/$MARKER(\d\d)/chr($1)/geo; # escapes
}
$this->{$HEREKEY} = \@here if @here;
return $this;
}

Expand Down

0 comments on commit 70b6048

Please sign in to comment.