C
Charles Mills
Looks like rdoc doesn't replace tabs in .c files like expected (when
using the -w option).
I added a handle_tab_width() function to parse_c.rb and it seems to
work fine.
Here is the diff <myversion> <1.9version> output:
$ diff parse_c.rb
/Users/boson/local/lib/ruby/1.9/rdoc/parsers/parse_c.rb
177c177
< @body = handle_tab_width(handle_ifdefs_in(body))
---
<
< def handle_tab_width(body)
< if /\t/ =~ body
< tab_str = ' ' *
Options.instance.tab_width
< body.gsub(/\t/, tab_str)
< #tab_width = Options.instance.tab_width
< #content = content.split(/\n/).map do
|line|
< #1 while line.gsub!(/\t+/) { ' ' *
(tab_width*$&.length - $`.length % tab_width)} && $~ #`
< # line
< #end .join("\n")
< else
< body
< end
< end
The commented out code is copied from parse_rb.rb, is that a better way
to do it?
-Charlie
using the -w option).
I added a handle_tab_width() function to parse_c.rb and it seems to
work fine.
Here is the diff <myversion> <1.9version> output:
$ diff parse_c.rb
/Users/boson/local/lib/ruby/1.9/rdoc/parsers/parse_c.rb
177c177
< @body = handle_tab_width(handle_ifdefs_in(body))
---
514,527d513@body = handle_ifdefs_in(body)
<
< def handle_tab_width(body)
< if /\t/ =~ body
< tab_str = ' ' *
Options.instance.tab_width
< body.gsub(/\t/, tab_str)
< #tab_width = Options.instance.tab_width
< #content = content.split(/\n/).map do
|line|
< #1 while line.gsub!(/\t+/) { ' ' *
(tab_width*$&.length - $`.length % tab_width)} && $~ #`
< # line
< #end .join("\n")
< else
< body
< end
< end
The commented out code is copied from parse_rb.rb, is that a better way
to do it?
-Charlie