You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/07/01 07:27:10 UTC

[lucy-commits] svn commit: r1141807 - in /incubator/lucy/branches/0.1: ./ perl/buildlib/Lucy/Test/TestUtils.pm perl/lib/Lucy/Docs/Tutorial/Simple.pod perl/sample/indexer.pl

Author: marvin
Date: Fri Jul  1 05:27:10 2011
New Revision: 1141807

URL: http://svn.apache.org/viewvc?rev=1141807&view=rev
Log:
LUCY-165 Line-ending-agnostic parsing of sample docs.

Change the regex we use to parse the sample docs so that it can handle various
line endings.

Modified:
    incubator/lucy/branches/0.1/   (props changed)
    incubator/lucy/branches/0.1/perl/buildlib/Lucy/Test/TestUtils.pm
    incubator/lucy/branches/0.1/perl/lib/Lucy/Docs/Tutorial/Simple.pod
    incubator/lucy/branches/0.1/perl/sample/indexer.pl

Propchange: incubator/lucy/branches/0.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul  1 05:27:10 2011
@@ -1 +1 @@
-/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140440,1140964
+/incubator/lucy/trunk:1126586,1134011,1134355,1134472,1134843-1134848,1134953,1134956,1139709,1139711,1139714,1140001,1140287,1140296,1140440,1140964

Modified: incubator/lucy/branches/0.1/perl/buildlib/Lucy/Test/TestUtils.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/perl/buildlib/Lucy/Test/TestUtils.pm?rev=1141807&r1=1141806&r2=1141807&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/perl/buildlib/Lucy/Test/TestUtils.pm (original)
+++ incubator/lucy/branches/0.1/perl/buildlib/Lucy/Test/TestUtils.pm Fri Jul  1 05:27:10 2011
@@ -117,7 +117,7 @@ sub get_uscon_docs {
         open( my $fh, '<', $filepath )
             or die "couldn't open file '$filepath': $!";
         my $content = do { local $/; <$fh> };
-        $content =~ /(.*?)\n\n(.*)/s
+        $content =~ /\A(.+?)^\s+(.*)/ms
             or die "Can't extract title/bodytext from '$filepath'";
         my $title    = $1;
         my $bodytext = $2;

Modified: incubator/lucy/branches/0.1/perl/lib/Lucy/Docs/Tutorial/Simple.pod
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/perl/lib/Lucy/Docs/Tutorial/Simple.pod?rev=1141807&r1=1141806&r2=1141807&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/perl/lib/Lucy/Docs/Tutorial/Simple.pod (original)
+++ incubator/lucy/branches/0.1/perl/lib/Lucy/Docs/Tutorial/Simple.pod Fri Jul  1 05:27:10 2011
@@ -61,7 +61,7 @@ Next, we'll add a subroutine which parse
         my $filepath = catfile( $uscon_source, $filename );
         open( my $fh, '<', $filepath ) or die "Can't open '$filepath': $!";
         my $text = do { local $/; <$fh> };    # slurp file content
-        $text =~ /(.*?)\n\n(.*)/s
+        $text =~ /\A(.+?)^\s+(.*)/ms
             or die "Can't extract title/bodytext from '$filepath'";
         my $title    = $1;
         my $bodytext = $2;

Modified: incubator/lucy/branches/0.1/perl/sample/indexer.pl
URL: http://svn.apache.org/viewvc/incubator/lucy/branches/0.1/perl/sample/indexer.pl?rev=1141807&r1=1141806&r2=1141807&view=diff
==============================================================================
--- incubator/lucy/branches/0.1/perl/sample/indexer.pl (original)
+++ incubator/lucy/branches/0.1/perl/sample/indexer.pl Fri Jul  1 05:27:10 2011
@@ -78,7 +78,7 @@ sub parse_file {
     my $filepath = catfile( $uscon_source, $filename );
     open( my $fh, '<', $filepath ) or die "Can't open '$filepath': $!";
     my $text = do { local $/; <$fh> };    # slurp file content
-    $text =~ /(.*?)\n\n(.*)/s
+    $text =~ /\A(.+?)^\s+(.*)/ms 
         or die "Can't extract title/bodytext from '$filepath'";
     my $title    = $1;
     my $bodytext = $2;