[R] HTML translation problem in R-2.10.1

Jim Lemon jim at bitwrit.com.au
Fri Jan 15 12:24:47 CET 2010


On 01/15/2010 12:13 AM, Duncan Murdoch wrote:
> On 14/01/2010 11:20 AM, Jim Lemon wrote:
>> Hi Core Team,
>> I received an email about a problem with the help on the plotrix
>> package. Apparently the \link tags in the help pages were showing up
>> as literal text. I couldn't see this problem, nor any problem with the
>> Rd files. Since the plotrix package hasn't been built for a while, I
>> rechecked, rebuilt and reinstalled it. Sure enough, the \link tags
>> showed up as literal text in both text and HTML help. This may be
>> peculiar to R-2.10.1 as I never installed 2.10.0. If it helps, the
>> --no-latex tag wasn't recognized by the INSTALL command (although only
>> the HTML help was apparently built).
>>
>> As far as I can see, the previous behavior of translating \link{ into
>> <a href="... and the following } into </a> has been lost. The \samp{
>> string is now translated to an HTML span tag whereas I think it used
>> to be translated to a <code> tag and this may be where the problem lies.
>>
>> I think this is all done in Perl, so I can't help with the debugging.
>
> The help parsing is done in C now, and the conversion to output formats
> is done in R. See the Rd2* functions in the tools package if you want to
> debug anything.
Thanks for the tip. You're talking my language now.

The problem is indeed with the \samp{} markup tag, as this is translated 
to define a <span> class "samp" that is supposed to change the font to 
"monospace" between the tags (it doesn't). I tried changing this to 
defining a style (not recommended, but...) and that didn't work, either. 
Fooled around with the R.css file, explicitly defining fontfamily as 
"Courier" doesn't work. None of the other classes defined as a font 
change to "monospace" work. <span> itself doesn't appear consider any 
text within it as literal, as manually entering the link within the 
<span> tags in the HTML page creates a valid link. As far as I can 
determine, the writeLink function doesn't get called for links within a 
\samp{} as there are no error messages but the link doesn't get written 
to the HTML file. My suspicion at the moment is that by the time the 
action reaches line 227 in Rd2HTML, the "\link" string is no longer 
there to recognize.

I can fix the problem by reverting to using \code{} _except_ where that 
markup includes a link. This gives the font change, but of course prints 
everything within the resulting <pre> tags literally. However, that 
produces an HTML page that looks okay and has the requested links. I 
suspect that this will not be a welcome fix, as I can still recall 
changing all the \code{} to \samp{} in my Rd files.

I wouldn't mind an opinion on a preferred direction before trying to 
find where the processing of \samp{} is going wrong.

Jim



More information about the R-help mailing list