move around some doc/testing logic
[scpubgit/stemmatology.git] / lib / Text / Tradition / Parser / Self.pm
index 97c2e55..0c4b83f 100644 (file)
@@ -34,10 +34,10 @@ my( $IDKEY, $TOKENKEY, $TRANSPOS_KEY, $RANK_KEY, $CLASS_KEY,
          source target witness extra relationship/;
 
 sub parse {
-    my( $tradition, $graphml_str ) = @_;
+    my( $tradition, $opts ) = @_;
+    my $graph_data = Text::Tradition::Parser::GraphML::parse( $opts );
     
     # TODO this is begging for stream parsing instead of multiple loops.
-    my $graph_data = Text::Tradition::Parser::GraphML::parse( $graphml_str );
 
     my $collation = $tradition->collation;
     my %witnesses;
@@ -67,11 +67,14 @@ sub parse {
         my $rank = delete $node_data{$RANK_KEY};
         
         # Create the node.  Current valid classes are common and meta. 
-        # Everything else is a normal reading.  
+        # Everything else is a normal reading.
+        ## TODO RATIONALIZE THESE CLASSES
         my $gnode = $collation->add_reading( $nodeid );
         $gnode->text( $reading );
         $gnode->make_common if $class eq 'common';
         $gnode->is_meta( 1 ) if $class eq 'meta';
+        # This is a horrible hack.
+        $gnode->is_lacuna( $reading =~ /^\#LACUNA/ );
         $gnode->rank( $rank ) if defined $rank;
 
         # Now save the data that we need for post-processing,