-
Notifications
You must be signed in to change notification settings - Fork 441
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
Autolink directive #1264
base: master
Are you sure you want to change the base?
Autolink directive #1264
Conversation
lib/rdoc/options.rb
Outdated
@@ -1378,4 +1378,15 @@ def self.load_options | |||
options | |||
end | |||
|
|||
def self.boolean(flag, message = nil) | |||
if flag == true or flag == false | |||
@autolink = flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@autolink = flag | |
flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
Can you add more examples in the description on how this would be used? I think it'd be like this? class MyClass # Mentioning MyClass in plain text won't be linked by default
# :autolink: false
end For not linking to specific words, like Using directives for it could have a few downsides:
So for ease of maintenance and understanding, I still prefer #1259 as the solution to #1254 |
The inverse can be true.
There is unexpected linking risk, too. In general, WiKi style autolinking is a sweet trap, for Ruby that capitalized words have the special meaning at least, I think. |
956c7fb
to
ee5f96a
Compare
lib/rdoc/code_object.rb
Outdated
autolink = @metadata["autolink"] | ||
if autolink | ||
RDoc::Options.boolean(autolink, "autolink") | ||
else | ||
true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify this?
autolink = @metadata["autolink"] | |
if autolink | |
RDoc::Options.boolean(autolink, "autolink") | |
else | |
true | |
end | |
RDoc::Options.boolean(@metadata["autolink"] || true, "autolink") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetch
may be better?
autolink = @metadata["autolink"] | |
if autolink | |
RDoc::Options.boolean(autolink, "autolink") | |
else | |
true | |
end | |
RDoc::Options.boolean(@metadata.fetch("autolink", true), "autolink") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
I agree that this will be a better long-term direction 👍 But given this could be a breaking change, can you open an issue to expand this idea and we can discuss about the steps needed to get there? |
What I don't like is we have to manage excluded words, like #1266, to add to each ".rdoc_options" file. |
d4d5a4d
to
aeb7529
Compare
aeb7529
to
afb19dd
Compare
To control cross-reference linking.
Fix #1254.