]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/Gwiki.pm
fixed another annoying bug in clean_tmp()
[biopieces.git] / code_perl / Maasha / Gwiki.pm
index d97a8d4e5543069aea65e0030299b30f9651fd60..b0e5c971f9c5a35eea512d2e14b2b8ed3a7e685c 100644 (file)
@@ -76,16 +76,12 @@ sub gwiki2ascii
             for ( $i = 0; $i < @{ $block }; $i++ ) {
                 push @lines, "   * $block->[ $i ]->{ 'TEXT' }";
             }
-
-            push @lines, "";
         }
         elsif ( $block->[ 0 ]->{ 'FORMAT' } eq "enumerate" )
         {
             for ( $i = 0; $i < @{ $block }; $i++ ) {
                 push @lines, "   " . ( $i + 1 ) . ". $block->[ $i ]->{ 'TEXT' }";
             }
-
-            push @lines, "";
         }
         elsif ( $block->[ 0 ]->{ 'FORMAT' } eq "paragraph" )
         {
@@ -93,15 +89,16 @@ sub gwiki2ascii
             {
                 $line = $triple->{ 'TEXT' };
 
+                $line =~ s/!(\w)/$1/g;
                 $line =~ s/^\s*//;
                 $line =~ s/\s*$//;
                 $line =~ s/\s+/ /g;
                 $line =~ tr/`//d;
-                $line =~ s/\[([^\]]+?)\]/$1/g;
-                $line =~ s/\*([^\*]+?)\*/&text_bold($1)/ge;
-                $line =~ s/_([^_]+?)_/&text_underline($1)/ge;
+                $line =~ s/\[([^\]]+?)\]/&text_underline($1)/ge;
+                $line =~ s/\*(\w+)\*/&text_bold($1)/ge           if $line =~ /(^| )\*\w+\*( |$)/;
+                $line =~ s/_(\w+)_/&text_underline($1)/ge        if $line =~ /(^| )_\w+_( |$)/;
 
-                push @lines, $_ foreach &Maasha::Common::wrap_line( $line, 80 );
+                push @lines, $_ foreach Maasha::Common::wrap_line( $line, 80 );
             }
         }
         elsif ( $block->[ 0 ]->{ 'FORMAT' } eq "whitespace" )
@@ -132,7 +129,7 @@ sub gwiki_read
 
     my ( $fh, @lines, $i, $c, $section, $paragraph, @block, @output );
 
-    $fh = &Maasha::Common::read_open( $file );
+    $fh = Maasha::Common::read_open( $file );
 
     @lines = <$fh>;
     
@@ -270,7 +267,7 @@ sub text_bold
     my ( $txt,
        ) = @_;
 
-    return colored ( $txt, "magenta" );
+    return colored ( $txt, "bold" );
 }