# Restricting view to source code with RDOC?

**URL:** <https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364>\
**Category:** Ruby\
**Created:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364 "2006-05-03T18:58:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/1 "2006-05-03T18:58:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/2 "2006-05-03T18:59:09Z")

</div>

Philip H. 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

---

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/3 "2006-05-03T18:59:50Z")

</div>

> 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. 🙂

---

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/4 "2006-05-03T18:59:53Z")

</div>

Philip H. 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

---

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/5 "2006-05-03T19:00:15Z")

</div>

> > /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

---

<div class="post-metadata">

**Author:** ![phallstrom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@phallstrom](https://www.ruby-forum.com/u/phallstrom)\
**Post date:** [May 3, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/restricting-view-to-source-code-with-rdoc/59364/6 "2006-05-03T19:02:26Z")

</div>

On 5/2/06, Philip H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
