From: John T. <ta...@us...> - 2001-06-26 16:16:51
|
Update of /cvsroot/twiki/twiki/lib/TWiki In directory usw-pr-cvs1:/tmp/cvs-serv15265/lib/TWiki Modified Files: Store.pm Log Message: rdiff fix meta changes format to 1.0beta2 Now upgrades category format to form format. Index: Store.pm =================================================================== RCS file: /cvsroot/twiki/twiki/lib/TWiki/Store.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** Store.pm 2001/06/18 19:24:53 1.24 --- Store.pm 2001/06/26 16:16:49 1.25 *************** *** 384,388 **** my @meta = (); ! ($text, @meta) = _extractMetaData( $text ); return( $text, @meta ); --- 384,388 ---- my @meta = (); ! ( $text, @meta ) = _extractMetaData( $theWeb, $text ); return( $text, @meta ); *************** *** 473,485 **** # ========================= ! # rdiff: $text = &TWiki::Store::getRevisionDiff( $topic, "1.$r2", "1.$r1" ); sub getRevisionDiff { ! my( $topic, $rev1, $rev2 ) = @_; my $tmp= ""; if ( $rev1 eq "1.1" && $rev2 eq "1.1" ) { ! my( $text, @meta ) = readVersion($topic, 1.1); # bug fix 19 Feb 1999 ! $text = TWiki::renderMetaData( $TWiki::webName, $topic, \@meta ); $tmp = "1a1\n"; foreach( split( /\n/, $text ) ) { --- 473,484 ---- # ========================= ! # rdiff: $text = &TWiki::Store::getRevisionDiff( $webName, $topic, "1.$r2", "1.$r1" ); sub getRevisionDiff { ! my( $web, $topic, $rev1, $rev2 ) = @_; my $tmp= ""; if ( $rev1 eq "1.1" && $rev2 eq "1.1" ) { ! my $text = _readVersionNoMeta( $web, $topic, 1.1); # bug fix 19 Feb 1999 $tmp = "1a1\n"; foreach( split( /\n/, $text ) ) { *************** *** 616,619 **** --- 615,629 ---- # ============================ + # Remove all meta information of a given type + sub metaRemove + { + my( $metaDataType, @meta ) = @_; + + @meta = grep( !/^%META:$metaDataType\{/, @meta ); + return sort @meta; + } + + + # ============================ # Replace all of a meta data item # e.g. *************** *** 713,717 **** } ! @meta = grep( !/^%META:$metaDataType\{$identifier/, @meta ); push @meta, "%META:$metaDataType\{$metaDataArgs}%"; --- 723,727 ---- } ! @meta = grep( !/^%META:$metaDataType\{(.*\s)?$identifier/, @meta ); push @meta, "%META:$metaDataType\{$metaDataArgs}%"; *************** *** 724,733 **** my( $args ) = @_; - my @items = split /\s/, $args; - my @res = (); ! foreach my $item ( @items ) { ! $item =~ /(.*)="([^"]*)"/; push @res, $1; push @res, $2; --- 734,742 ---- my( $args ) = @_; my @res = (); ! # Format of data is name="value" name1="value1" [...] ! while( $args ) { ! $args =~ s/\s*([^=]+)=\"([^"]*)\"//o; push @res, $1; push @res, $2; *************** *** 750,754 **** "date" => "$time", "author" => "$user", ! "format" => "1.0beta" ); # FIXME put correct format version here @meta = metaUpdate( "TOPICINFO", \@args, "", @meta ); --- 759,763 ---- "date" => "$time", "author" => "$user", ! "format" => "1.0beta2" ); # FIXME put correct format version here @meta = metaUpdate( "TOPICINFO", \@args, "", @meta ); *************** *** 1302,1306 **** sub convert2metaFormat { ! my( $text ) = @_; my @meta = (); --- 1311,1315 ---- sub convert2metaFormat { ! my( $web, $text ) = @_; my @meta = (); *************** *** 1309,1313 **** ( $text, @meta ) = TWiki::Attach::migrateToFileAttachmentMacro( $text ); } ! return( $text, @meta ); --- 1318,1325 ---- ( $text, @meta ) = TWiki::Attach::migrateToFileAttachmentMacro( $text ); } ! ! if ( $text =~ /<!--TWikiCat-->/ ) { ! ( $text, @meta ) = TWiki::Form::upgradeCategoryTable( $web, $text, @meta ); ! } return( $text, @meta ); *************** *** 1320,1324 **** sub _extractMetaData { ! my( $fulltext ) = @_; my $text = ""; --- 1332,1336 ---- sub _extractMetaData { ! my( $web, $fulltext ) = @_; my $text = ""; *************** *** 1335,1339 **** # If there is no meta data then convert if( $#meta == -1 ) { ! ($text, @meta ) = convert2metaFormat( $text ); } --- 1347,1361 ---- # If there is no meta data then convert if( $#meta == -1 ) { ! ($text, @meta ) = convert2metaFormat( $web, $text ); ! } else { ! my $fieldP; ! ( $fieldP, @meta ) = metaExtract( "TOPICINFO", "", "", @meta ); ! my @fields = @$fieldP; ! my %fld = @fields; ! if( $fld{"format"} eq "1.0beta" ) { ! if( $text =~ /<!--TWikiCat-->/ ) { ! ( $text, @meta ) = TWiki::Form::upgradeCategoryTable( $web, $text, @meta ); ! } ! } } *************** *** 1357,1360 **** --- 1379,1391 ---- } + # ========================= + sub readTopicRaw + { + my( $theWeb, $theName ) = @_; + my $text = &readFile( "$TWiki::dataDir/$theWeb/$theName.txt" ); + + return $text; + } + # FIXME replace readWebTopic sub readWebTopicNew *************** *** 1365,1369 **** my @meta = (); ! ($text, @meta) = _extractMetaData( $text ); return( $text, @meta ); --- 1396,1400 ---- my @meta = (); ! ($text, @meta) = _extractMetaData( $theWeb, $text ); return( $text, @meta ); |