[Rd] Rdconv --type=Ssgm drops singleton keywords (PR#9051)
maechler at stat.math.ethz.ch
maechler at stat.math.ethz.ch
Sat Jul 1 16:20:54 CEST 2006
Thank you Bill,
particularly for not only reporting the bug but also diagnose
and patch it.
I've committed the fix for both R-devel and R-patched.
With regards,
Martin
>> If an Rd file has only one keyword entry then
>> the Splus sgm file made with Rdconv --type=SSgm
>> has no keyword entries.
>>
>> To reproduce:
>> Use prompt() to make a skeleton help file
>> R> f<-function(x)log(1+x)-log1p(x)
>> R> prompt(f)
>> Created file named 'f.Rd'.
>> Edit the file and move it to the appropriate directory.
>> R> q()
>> It has 2 \keyword entries in it
>> % grep keyword f.Rd
>> \keyword{ ~kwd1 }% at least one, from doc/KEYWORDS
>> \keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
>> If you convert it to the Splus sgm format you get 2
>> <s-keyword> entries, in a <s-keywords> section:
>> % R CMD Rdconv --type=Ssgm f.Rd | grep 'keyword'
>> <s-keywords>
>> <s-keyword>~kwd1</s-keyword>
>> <s-keyword>~kwd2</s-keyword>
>> </s-keywords>
>> %
>> That is good.
>>
>> If you remove one keyword entry from the Rd file so it has one left
>> then the sgm file has no <s-keyword> entries (and no <s-keywords>
>> section):
>> % grep -v '~kwd2' < f.Rd > f1kw.Rd
>> % grep keyword f1kw.Rd
>> \keyword{ ~kwd1 }% at least one, from doc/KEYWORDS
>> % R CMD Rdconv --type=Ssgm f1kw.Rd | grep s-keyword
>> %
>>
>> The fix:
>> The problem is that the line
>> if ($#keywords > 0) {
>> should use >= 0 to tell if the list @keywords is non-empty.
>>
>> *** share/perl/R/Rdconv.pm 2006-05-23 08:51:16.000000000 -0700
>> --- /tmp/Rdconv.pm 2006-06-30 11:51:53.000000000 -0700
>> ***************
>> *** 2965,2971 ****
>> Ssgm_print_block_named("references", "References");
>> Ssgm_print_seealso();
>> Ssgm_print_examples();
>> ! if ($#keywords > 0) {
>> print $sgmlout "<s-keywords>\n";
>> while ($#keywords >= 0) {
>> print $sgmlout "<s-keyword>", shift( @keywords ),
>> --- 2965,2971 ----
>> Ssgm_print_block_named("references", "References");
>> Ssgm_print_seealso();
>> Ssgm_print_examples();
>> ! if ($#keywords >= 0) {
>> print $sgmlout "<s-keywords>\n";
>> while ($#keywords >= 0) {
>> print $sgmlout "<s-keyword>", shift( @keywords ),
>>
>>
>> --please do not edit the information below--
>>
>> Version:
>> platform = i686-pc-linux-gnu
>> arch = i686
>> os = linux-gnu
>> system = i686, linux-gnu
>> status = Under development (unstable)
>> major = 2
>> minor = 4.0
>> year = 2006
>> month = 06
>> day = 29
>> svn rev = 38459
>> language = R
>> version.string = R version 2.4.0 Under development (unstable) (2006-06-29 r38459)
>>
>> Locale:
>> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>>
>> Search Path:
>> .GlobalEnv, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list