Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Document-method: []" is not handled correctly #452

Closed
stomar opened this issue Jun 3, 2017 · 0 comments · Fixed by #582
Closed

"Document-method: []" is not handled correctly #452

stomar opened this issue Jun 3, 2017 · 0 comments · Fixed by #582

Comments

@stomar
Copy link
Contributor

stomar commented Jun 3, 2017

Also submitted under https://bugs.ruby-lang.org/issues/13275

RDoc doesn't handle Document-method directives for #[] correctly. When multiple directives are given, "Document-method: []" shows up as a code block, at the beginning of the docs for the method of the directive before:

$ cat document-method-test.c 
/*
 * Document-method: foo
 * Document-method: []
 * Document-method: bar
 *
 * Does nothing.
 */
static VALUE
rb_my_method(void)
{

}

rb_cFoo = rb_define_class("Foo", rb_cObject);
rb_define_method(rb_cFoo, "foo", rb_my_method, 0);
rb_define_method(rb_cFoo, "bar", rb_my_method, 0);
rb_define_method(rb_cFoo, "[]", rb_my_method, 0);

The directive affects the docs for #foo:

$ rdoc --ri document-method-test.c -o mydoc
$ ri Foo.foo -d mydoc

Foo.foo

(from /.../.../mydoc)
------------------------------------------------------------------------------
  foo()

------------------------------------------------------------------------------

  Document-method: []

Does nothing.

When the order of the Document-method directives is changed, with Document-method: [] as the first one, everything is rendered correctly.

[Real life example: https://docs.ruby-lang.org/en/2.3.0/Proc.html#method-i-call,
in the meantime fixed with above workaround in r57767 and related backports]

aycabta added a commit to aycabta/rdoc that referenced this issue Jan 1, 2018
RDoc::Text#strip_stars removes unnecessary Document-method directive.
But the regexp uses only [\w:.#=!?], so it fails with some operator
methods. This commit adds other operater characters to the regexp.

This closes ruby#452.
aycabta added a commit to aycabta/rdoc that referenced this issue Jan 1, 2018
RDoc::Text#strip_stars removes unnecessary Document-method directive.
But the regexp uses only [\w:.#=!?], so it fails with some operator
methods. This commit adds other operater characters to the regexp.

This closes ruby#452.
aycabta added a commit to aycabta/rdoc that referenced this issue Jan 4, 2018
RDoc::Text#strip_stars removes unnecessary Document-method directive.
But the regexp uses only [\w:.#=!?], so it fails with some operator
methods. This commit adds other operator characters to the regexp.

This closes ruby#452.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant