How do I use rdoc's link: hyperlinks?

I'm trying to include a hyperlink using the label[url] form, where the
hyperlink uses the link: prefix to refer to a local file. However I'm not
able to get rdoc to generate the correct href. What's the right way to do
this?

Tim Hunter wrote:

I'm trying to include a hyperlink using the label[url] form, where the
hyperlink uses the link: prefix to refer to a local file. However I'm not
able to get rdoc to generate the correct href. What's the right way to do
this?

Is the local file one of those generated by rdoc? This has worked for me:

   doc/protocol.txt[link:files/doc/protocol_txt.html]

where my dirs are:

   doc/
     protocol.txt # doc source file
     api/
       classes/
       files/
         doc/
           protocol_txt.html # generated by rdoc
         lib/
       index.html
   lib/

and I run rdoc with the options

   rdoc -o doc/api doc/*.txt

Seems a bit contorted, but it works :slight_smile:

Joel VanderWerf wrote:

Is the local file one of those generated by rdoc? This has worked for me:

   doc/protocol.txt[link:files/doc/protocol_txt.html]

Is there magic in the --op option? I just tried a simple test. I made a
file, rdoctest.rb, with just this line:
        # label[link:doc/files/rdoctest_rb.html]

Then I ran
        rdoc rdoctest.html

Rdoc created this hyperlink:
        <a href="link:doc/files/rdoctest_rb.html">label</a>

Tim Hunter wrote:

Joel VanderWerf wrote:

Is the local file one of those generated by rdoc? This has worked for me:

  doc/protocol.txt[link:files/doc/protocol_txt.html]

Is there magic in the --op option? I just tried a simple test. I made a
file, rdoctest.rb, with just this line:
        # label[link:doc/files/rdoctest_rb.html]

Then I ran rdoc rdoctest.html

?? File not found: rdoctest.html

Rdoc created this hyperlink: <a href="link:doc/files/rdoctest_rb.html">label</a>

IIRC, the link URL is relative to the --op dir. Since you are using the default --op dir, which is doc/, you omit that from your url:

         # label[link:files/rdoctest_rb.html]

You example seems to work now.