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

Unlink unintentional autolinked code ref links #254

Merged

Conversation

jonathanhefner
Copy link
Member

RDoc can be overzealous when autolinking words that look like module names. For example, autolinking every occurrence of "Rails" or "ERB".

This commit uses postprocessing to unlink autolinked code ref links that appear to be unintentional. If a link's text is an uppercase letter followed by either all lowercase letters (e.g. "Rails") or all uppercase letters (e.g. "ERB"), then it's assumed the link is unintentional, and the link is replaced with the just its text.

These kinds of modules can still be linked by prepending the module namespace (e.g. "::ERB" or "ActionView::Template::Handlers::ERB"), or by manually linking the text (e.g. "{Rails}[rdoc-ref:Rails]").

Before After
before1 after1
before2 after2

RDoc can be overzealous when autolinking words that look like module
names.  For example, autolinking every occurrence of "Rails" or "ERB".

This commit uses postprocessing to unlink autolinked code ref links that
appear to be unintentional.  If a link's text is an uppercase letter
followed by either all lowercase letters (e.g. "Rails") or all uppercase
letters (e.g. "ERB"), then it's assumed the link is unintentional, and
the link is replaced with the just its text.

These kinds of modules can still be linked by prepending the module
namespace (e.g. "::ERB" or "ActionView::Template::Handlers::ERB"), or by
manually linking the text (e.g. "{Rails}[rdoc-ref:Rails]").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant