[PATCH] RDoc Lib: Fix Missing Closing Parentheses

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

[PATCH] RDoc Lib: Fix Missing Closing Parentheses

by Kris Katterjohn-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

I've noticed a problem in the RDoc-generated HTML when a doc-modifier is
used on a method without parentheses.  I've attached a patch against SVN
trunk that fixes this (though you may find a better way).

I use :yields: in the following examples, but I've tried it with
:notnew: and the same thing happened (and is fixed by my patch).


Using this example with Ruby 1.9 (and 1.8):

def hello # :yields: greetings
        yield "hello"
end

def helloparam(hi) # :yields: greetings
        yield hi
end


gives the following in the RDoc generated HTML:


Public Instance methods
hello( {|greetings| ...}
helloparam(hi) {|greetings| ...}


Notice the missing closing parentheses after hello?

But after applying my patch, the parentheses is there:

Public Instance methods
hello() {|greetings| ...}
helloparam(hi) {|greetings| ...}


I've been showing helloparam() in these examples to show that it still
works as expected on other methods.

Thanks,
Kris Katterjohn


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSBDC7P9K37xXYl36AQKVNQ/+I1hcu7rmPLnf6cMB2F7wNLZYonCDKrfL
9fEB1TxmX3o1lCENt3NhK+SLuvpzUj7Fe2dSCufHkrOpkw/hR6PtSzkRlQqybhHh
QVyeSBvvLBpLQ0T6woUvVaeyInovowvAJ2IEVNgZeVIWUU5s+xbnfO8nwFZ/mc5l
Px9eQKxnIdSPe9Ju14tGna/cqhkpc9CoMumWgt76vD7erZB/9eh0SPwxyqMvGz5D
uc8NMeIZo1tjgqkg676FvriCSwgi1kzZjRMbYugEiRO+P0+DY/whV5cPqP6iqD8c
AQ3g3ea4pakMLyz9GWVyH29zcEDGuNZ3Tl+4Ec2s334hEi2KZuWgO/ps+35e9TRK
Sk9h9jKpQfDLfcxBw2kSX8aNg3Rt1lJ4QcGfrgF3abpz/v3buFOAd6BcI2LffiWs
TwQt+n4SfO42c3oztfTaHVyPMo9GUKWcc4gbYPk7gatJt3ua2Es7r1sFdZc3v2+e
emLJntTQmRXBQvkNIZoTLmOI0XeyKgHLcobyOG47mgdfpmI8L7h5SA3flH6dZXzD
AYrbt/BQLYdUtDJoHc6u3uLNQB78/CL4TQaEtyn6mVe49xtxLecsDWgO1CY+x1Yj
n7vQxFpnpuDrZ8YsdipVg1ialQhD6jWCMGQuslBaaSg3GgAXfSmx1xIRwJuecgct
1osywRiP5s4=
=42c/
-----END PGP SIGNATURE-----

Index: rdoc/parsers/parse_rb.rb
===================================================================
--- rdoc/parsers/parse_rb.rb (revision 16187)
+++ rdoc/parsers/parse_rb.rb (working copy)
@@ -1998,7 +1998,7 @@
 
   def parse_method_parameters(method)
     res = parse_method_or_yield_parameters(method)
-    res = "(" + res + ")" unless res[0] == ?(
+    res = "(" + (res[0] == ?# ? "" : res) + ")" unless res[0] == ?(
     method.params = res unless method.params
     if method.block_params.nil?
       skip_tkspace(false)