[Rd] R CMD Rdconv drops sections: arguments, seealso, examples (PR#9649)
Bill Dunlap
bill at insightful.com
Mon May 7 21:39:40 CEST 2007
On Fri, 4 May 2007, Prof Brian Ripley wrote:
> On Thu, 3 May 2007, Prof Brian Ripley wrote:
>
> > It is not clear to me that throwing an error is helpful as it would stop
> > the package installation process when all but one section in one .Rd file
> > would be useful. But it would seem good to give a warning, and so I
> > propose that we adapt your code to do so.
>
> Doing so (now in R-devel) shows a couple of false positives (\align{{} in
> Paren.Rd is one), and rather a lot of correct warnings about excess }s
> that are not doing any harm. So I have tuned the warnings to be less
> strident in the latter case.
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."
More information about the R-devel
mailing list