]> git.donarmstrong.com Git - biopieces.git/commitdiff
changed wiki renderer
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 May 2009 15:44:25 +0000 (15:44 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 May 2009 15:44:25 +0000 (15:44 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@369 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm
code_perl/Maasha/Gwiki.pm

index 8260d0979f672b137f89da609339c1c2220cc8e3..cba6c5244d98ea106cebbb4993915b3859a313d7 100644 (file)
@@ -1,7 +1,7 @@
 package Maasha::Biopieces;
 
 
-# Copyright (C) 2007-2008 Martin A. Hansen.
+# Copyright (C) 2007-2009 Martin A. Hansen.
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -97,8 +97,10 @@ $BP_TMP = Maasha::Common::get_tmpdir();
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> LOG <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-my $log_global = Maasha::Common::append_open( "$ENV{ 'BP_LOG' }/biopieces.log" );
-my $log_local  = Maasha::Common::append_open( "$ENV{ 'HOME' }/.biopieces.log" );
+my ( $log_global, $log_local );
+
+$log_global = Maasha::Common::append_open( "$ENV{ 'BP_LOG' }/biopieces.log" );
+$log_local  = Maasha::Common::append_open( "$ENV{ 'HOME' }/.biopieces.log" );
 
 $log_global->autoflush( 1 );
 $log_local->autoflush( 1 );
@@ -1161,8 +1163,10 @@ sub script_print_usage
 
     $wiki = Maasha::Gwiki::gwiki_read( $file );
 
+    ( $wiki->[ 2 ], $wiki->[ 3 ], $wiki->[ 0 ], $wiki->[ 1 ] ) = ( $wiki->[ 0 ], $wiki->[ 1 ], $wiki->[ 2 ], $wiki->[ 3 ] );
+
     if ( not $options->{ "help" } ) {
-        @{ $wiki } = grep { $_->[ 0 ]->{ 'SECTION' } =~ /Biopiece|Synopsis|Usage|Options|Help/ } @{ $wiki };
+        @{ $wiki } = grep { $_->[ 0 ]->{ 'SECTION' } =~ /Biopiece|summary|Usage|Options|Help/ } @{ $wiki };
     }
 
     $lines = Maasha::Gwiki::gwiki2ascii( $wiki );
@@ -1177,7 +1181,7 @@ sub script_list_biopieces
 {
     # Martin A. Hansen, January 2008.
 
-    # Prints the synopsis from the usage for each of the biopieces.
+    # Prints the summary from the usage for each of the biopieces.
 
     my ( $in,        # handle to in stream
          $out,       # handle to out stream
@@ -1186,7 +1190,7 @@ sub script_list_biopieces
 
     # Returns nothing.
 
-    my ( @files, $file, $wiki, $program, $synopsis );
+    my ( @files, $file, $wiki, $program, $summary );
 
     @files = Maasha::Common::ls_files( "$ENV{ 'BP_DIR' }/bp_usage" );
 
@@ -1198,13 +1202,10 @@ sub script_list_biopieces
 
             $wiki = Maasha::Gwiki::gwiki_read( $file );
 
-            @{ $wiki } = grep { $_->[ 0 ]->{ 'SECTION' } =~ /Synopsis/ }  @{ $wiki };
-            @{ $wiki } = grep { $_->[ 0 ]->{ 'FORMAT' }  =~ /paragraph/ } @{ $wiki };
-
-            $synopsis = $wiki->[ 0 ]->[ 0 ]->{ 'TEXT' };
-            $synopsis =~ s/!(\w)/$1/g;
+            $summary = $wiki->[ 0 ]->[ 0 ]->{ 'TEXT' };
+            $summary =~ s/^#summary\s+//;
 
-            printf( "%-30s%s\n", $program, $synopsis );
+            printf( "%-30s%s\n", $program, $summary );
         }
     }
 
@@ -6478,11 +6479,11 @@ sub grab_eval
 
     if ( defined $record->{ $key } ) 
     {
-        return 1 if ( $op eq "<" and $record->{ $key } < $val );
-        return 1 if ( $op eq ">" and $record->{ $key } > $val );
+        return 1 if ( $op eq "<"  and $record->{ $key } <  $val );
+        return 1 if ( $op eq ">"  and $record->{ $key } >  $val );
         return 1 if ( $op eq ">=" and $record->{ $key } >= $val );
         return 1 if ( $op eq "<=" and $record->{ $key } <= $val );
-        return 1 if ( $op eq "=" and $record->{ $key } == $val );
+        return 1 if ( $op eq "="  and $record->{ $key } == $val );
         return 1 if ( $op eq "!=" and $record->{ $key } != $val );
         return 1 if ( $op eq "eq" and $record->{ $key } eq $val );
         return 1 if ( $op eq "ne" and $record->{ $key } ne $val );
@@ -6700,7 +6701,7 @@ sub clean_tmp
             $sid  = $2;
             $pid  = $3;
 
-            next if $user eq "m.hansen";
+#            next if $user eq "maasha"; # DEBUG
 
             if ( $user eq Maasha::Common::get_user() )
             {
index b0e5c971f9c5a35eea512d2e14b2b8ed3a7e685c..cd658680a8b6efd9f338ed2752610a867697fe5d 100644 (file)
@@ -1,6 +1,6 @@
 package Maasha::Gwiki;
 
-# Copyright (C) 2008 Martin A. Hansen.
+# Copyright (C) 2008-2009 Martin A. Hansen.
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -63,6 +63,12 @@ sub gwiki2ascii
         {
             push @lines, text_bold( "$block->[ 0 ]->{ 'TEXT' }" );
         }
+        elsif ( $block->[ 0 ]->{ 'FORMAT' } eq "summary" )
+        {
+            $block->[ 0 ]->{ 'TEXT' } =~ s/^#summary\s+//;
+
+            push @lines, text_bold( "Summary" ), "\n$block->[ 0 ]->{ 'TEXT' }";
+        }
         elsif ( $block->[ 0 ]->{ 'FORMAT' } eq "level_3" )
         {
             push @lines, "$block->[ 0 ]->{ 'TEXT' }";
@@ -144,7 +150,17 @@ sub gwiki_read
     {
         undef @block;
 
-        if ( $lines[ $i ] =~ /^===\s*(.+)\s*===$/ )
+        if ( $lines[ $i ] =~ /^(#summary.+)/ )
+        {
+            $section = $1;
+
+            push @block, {
+                TEXT    => $section,
+                SECTION => $section,
+                FORMAT  => "summary",
+            };
+        }
+        elsif ( $lines[ $i ] =~ /^===\s*(.+)\s*===$/ )
         {
             $section = $1;