Skip to content
Prev 24919 / 63424 Next

R CMD Rdconv drops sections: arguments, seealso, examples (PR#9649)

On Fri, 4 May 2007, Prof Brian Ripley wrote:

            
That sounds good.

Here is a modification of your fix that prints a message for
problem in the Rd file, not just the first.   E.g., in an old
version of the msm package it gives
  Note: unmatched right brace in './msm/man/deltamethod.Rd' on or after line 32
  Note: unmatched right brace in './msm/man/deltamethod.Rd' on or after line 54
  Note: unmatched right brace in './msm/man/deltamethod.Rd' on or after line 55
instead of just complaining about the first one.

Index: Rdconv.pm
===================================================================
--- Rdconv.pm	(revision 41470)
+++ Rdconv.pm	(working copy)
@@ -258,24 +258,25 @@
     }
     # Any remaining brackets must be unmatched ones.
     # However, unmatched brackets are sometimes legal,
-    # (e.g. \alias{{}), so only warn.
+    # (e.g. \alias{{}), so only warn. # }match brace in comment
     if ($complete_text =~ /([{}])/s) {
         # Would like to tell which which line has unmatched { or },
         # but lines starting with % have already been removed.
         # Hence the 'on or after' in the message.
         my $badlineno = 0 ;
-	my $extra_info = "\'$1\'" ;
-        $extra_info = "\'$1\'" if $complete_text =~ /(\\\w+{)/ ;
 	foreach my $line (split /\n/, $complete_text) {
 	    $badlineno++;
-	    last if ($line =~ /[{}]/) ;
+	    if ($line =~ /([{}])/) {
+	        my $extra_info = "\'$1\'" ;
+            	$extra_info = "\'$1\'" if $line =~ /(\\\w+{)/ ; # }match brace in pattern
+	        if( $extra_info =~ /^'}'$/ ) {
+	            warn "Note: unmatched right brace in '$Rdname'".
+		        " on or after line $badlineno\n";
+	        } elsif(! ($extra_info =~ /\\alias{/) )  # }match brace in pattern
+	            { warn "Warning: unmatched brace ($extra_info) in '$Rdname'".
+		           " on or after line $badlineno\n"; }
+           }
 	}
-	if( $extra_info =~ /^'}'$/ ) {
-	    warn "Note: unmatched right brace in '$Rdname'".
-		" on or after line $badlineno\n";
-	} elsif(! ($extra_info =~ /\\alias{/) )
-	    { warn "Warning: unmatched brace ($extra_info) in '$Rdname'".
-		   " on or after line $badlineno\n"; }
     }
 }


----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."