How to wrap code examples in comments

View: New views
2 Messages — Rating Filter:   Alert me  

How to wrap code examples in comments

by Ubaldo Villaseca :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys,
I'm new on documenting Ruby sources, I have some early opinions about
RDoc but this time and want to ask you something.
I tried to wrap code examples in comments using the following:
# <tt>
# def setUp
#     files << File.new()
# end
# </tt>

But it doesn't work, it generates an ugly HTML like
<tt> def setUp

    @appStates << AppState1.new()

end </tt>

What am I missing here?

Thanks,
Ubaldo


Re: How to wrap code examples in comments

by Eric Hodel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 12, 2007, at 15:07 , Ubaldo Villaseca wrote:

> Hi guys,
> I'm new on documenting Ruby sources, I have some early opinions about
> RDoc but this time and want to ask you something.
> I tried to wrap code examples in comments using the following:
> # <tt>
> # def setUp
> #     files << File.new()
> # end
> # </tt>
>
> But it doesn't work, it generates an ugly HTML like
> <tt> def setUp
>
>     @appStates << AppState1.new()
>
> end </tt>
>
> What am I missing here?

# You can do blah blah blah like this:
#
#   class MyClass < YourClass
#     def initialize
#       @files = []
#     end
#   <-- important trailing whitespace here
#     def some_method
#     end
#   end

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars