From: Dr Balwinder S Dheeman Date: 2005-05-04T02:44:50+09:00 Subject: Re: rdoc external include... --------------030504020505080207010500 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit On 04/26/2005 02:21 PM, Tilman Sauerbeck wrote: > Jeff Rose [2005-04-26 17:18]: > >>Problem: >> When I put this in the README file ":include:examples/sample.rb" it >>does include the source, but it takes the # symbols off the comments in >>the code, which makes it un-runnable if someone copy and pastes. (It >>also looks lame...) >> >>Anyone know how to have it include the source but either turn off rdoc >>completely or treat it as regular stuff rather than cutting out #'s? > > > The attached patch should fix this, didn't try it though. > > > > ------------------------------------------------------------------------ > > Only in ruby-1.8.2/lib/rdoc/markup/simple_markup: .preprocess.rb.swp > diff -aur ruby-1.8.2.orig/lib/rdoc/markup/simple_markup/preprocess.rb ruby-1.8.2/lib/rdoc/markup/simple_markup/preprocess.rb > --- ruby-1.8.2.orig/lib/rdoc/markup/simple_markup/preprocess.rb 2004-11-26 05:32:11.000000000 +0100 > +++ ruby-1.8.2/lib/rdoc/markup/simple_markup/preprocess.rb 2005-04-26 10:49:09.000000000 +0200 > @@ -43,7 +43,7 @@ > def include_file(name, indent) > if (full_name = find_include_file(name)) > content = File.open(full_name) {|f| f.read} > - res = content.gsub(/^#?/, indent) > + res = content.gsub(/^\s*/, indent) > else > $stderr.puts "Couldn't find file to include: '#{name}'" > '' Hey, that patch of yours eats out all indentation. Here is the correct patch: -- Dr Balwinder Singh Dheeman Registered Linux User: #229709 CLLO (Chief Linux Learning Officer) Machines: #168573, 170593, 259192 Anu's Linux@HOME Distros: Ubuntu, Fedora, Knoppix More: http://anu.homelinux.net/~bsd/ Visit: http://counter.li.org/ --------------030504020505080207010500 Content-Type: text/x-patch; name="preprocess.rb.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="preprocess.rb.patch" --- preprocess.rb.orig 2004-11-26 04:32:11.000000000 +0000 +++ preprocess.rb 2005-05-03 17:23:20.060454795 +0000 @@ -43,7 +43,7 @@ def include_file(name, indent) if (full_name = find_include_file(name)) content = File.open(full_name) {|f| f.read} - res = content.gsub(/^#?/, indent) + res = content.gsub(/(^.?)/, indent + '\1') else $stderr.puts "Couldn't find file to include: '#{name}'" '' --------------030504020505080207010500--