]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_perl/Maasha/Gwiki.pm
fixed bowtie_seq
[biopieces.git] / code_perl / Maasha / Gwiki.pm
index b0e5c971f9c5a35eea512d2e14b2b8ed3a7e685c..055df09d889d83bb25e2fce2081663b975730b3e 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
@@ -28,10 +28,12 @@ package Maasha::Gwiki;
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
 use Data::Dumper;
 use Term::ANSIColor;
 use Maasha::Common;
+use Maasha::Filesys;
 use vars qw ( @ISA @EXPORT );
 
 @ISA = qw( Exporter );
@@ -63,6 +65,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' }";
@@ -129,7 +137,7 @@ sub gwiki_read
 
     my ( $fh, @lines, $i, $c, $section, $paragraph, @block, @output );
 
-    $fh = Maasha::Common::read_open( $file );
+    $fh = Maasha::Filesys::file_read_open( $file );
 
     @lines = <$fh>;
     
@@ -144,7 +152,17 @@ sub gwiki_read
     {
         undef @block;
 
-        if ( $lines[ $i ] =~ /^===\s*(.+)\s*===$/ )
+        if ( $lines[ $i ] =~ /(#summary.+)/ ) # TODO: unsolved problem with anchor!
+        {
+            $section = $1;
+
+            push @block, {
+                TEXT    => $section,
+                SECTION => $section,
+                FORMAT  => "summary",
+            };
+        }
+        elsif ( $lines[ $i ] =~ /^===\s*(.+)\s*===$/ )
         {
             $section = $1;
 
@@ -227,7 +245,7 @@ sub gwiki_read
 
             $c = $i;
 
-            while ( $lines[ $c ] !~ /^\s*$/ )
+            while ( defined $lines[ $c ] and $lines[ $c ] !~ /^\s*$/ )
             {
                 $paragraph .= " $lines[ $c ]";