Forum: Ruby Restricting view to source code with RDOC?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
48124635945b45221ba12a26371f9e3e?d=identicon&s=25 Philip Hallstrom (Guest)
on 2006-05-03 18:58
(Received via mailing list)
Hi -

I'd like to generate some docuementation using RDOC, but don't want any
of
the "source" links available.

I've seen some existing rdoc that does this, but don't see an option
within rdoc itself to exclude them.

Am I just missing it?

Thanks!

-philip
0b561a629b87f0bbf71b45ee5a48febb?d=identicon&s=25 Dave Burt (Guest)
on 2006-05-03 18:59
(Received via mailing list)
Philip Hallstrom wrote:
> I'd like to generate some docuementation using RDOC, but don't want any
> of the "source" links available.
>
> I've seen some existing rdoc that does this, but don't see an option
> within rdoc itself to exclude them.
>
> Am I just missing it?

I've just had a quick look, and this might work:

Use the --inline-source switch, and use a stylesheet modified with
"a.source-toggle{display:none}" to hide the links.

Cheers,
Dave
48124635945b45221ba12a26371f9e3e?d=identicon&s=25 Philip Hallstrom (Guest)
on 2006-05-03 18:59
(Received via mailing list)
> I'd like to generate some docuementation using RDOC, but don't want any of
> the "source" links available.
>
> I've seen some existing rdoc that does this, but don't see an option within
> rdoc itself to exclude them.
>
> Am I just missing it?

Turns out I was.  Naturally after asking I find it :)  Buried deep in
/usr/local/lib/ruby/..... were the rdoc templates.  I borrowed html.rb
and
tore out the pieces that include the links to source.

Seems to work great.

Heh. :)
0b561a629b87f0bbf71b45ee5a48febb?d=identicon&s=25 Dave Burt (Guest)
on 2006-05-03 18:59
(Received via mailing list)
Philip Hallstrom wrote:
> and tore out the pieces that include the links to source.
>
> Seems to work great.
>
> Heh. :)

You're not going to add a --no-source switch to rdoc and share the
patch?

Cheers,
Dave
48124635945b45221ba12a26371f9e3e?d=identicon&s=25 Philip Hallstrom (Guest)
on 2006-05-03 19:00
(Received via mailing list)
>> /usr/local/lib/ruby/..... were the rdoc templates.  I borrowed html.rb
>> and tore out the pieces that include the links to source.
>>
>> Seems to work great.
>>
>> Heh. :)
>
> You're not going to add a --no-source switch to rdoc and share the patch?

Sorry, I wasn't clear.  html.rb is just a template (ie. --template) ...
in
/usr/local/lib/ruby/1.8/rdoc/generators/template/html along with some
others:

% ls
hefss.rb  html.rb  kilmer.rb  old_html.rb  one_page_html.rb

I took html.rb and searched for "source" and just removed every mention
of
it I could find...

-philip
4b174722d1b1a4bbd9672e1ab50c30a9?d=identicon&s=25 Ryan Leavengood (Guest)
on 2006-05-03 19:02
(Received via mailing list)
On 5/2/06, Philip Hallstrom <ruby@philip.pjkh.com> wrote:
> I took html.rb and searched for "source" and just removed every mention of
> it I could find...

I think Dave's point was that it is still ruby code which I imagine
you could add an if statement to which would optionally add the source
if a certain variable was setup somewhere (i.e. based on a
command-line switch.)

Ryan
This topic is locked and can not be replied to.