-
Notifications
You must be signed in to change notification settings - Fork 351
Allow custom links in Autolink.elixir_functions #813
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
Conversation
fun_re = ~r{([ct]:)?(#{module_re}([a-z_]+[A-Za-z_\d]*[\\?\\!]?|[\{\}=&\\|\\.<>~*^@\\+\\%\\!-]+)/\d+)}.source | ||
normal_link_re = ~r{(?<!\[)`\s*(#{fun_re})\s*`(?!\])}.source | ||
custom_link_re = ~r{(?|\[(.*)\])\(`(#{fun_re})`\)}.source | ||
re = ~r{#{custom_link_re}|#{normal_link_re}} |
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.
@josevalim instead of making this regex more complicated, we could process custom links in a separate pass, WDYT?
I put together a fresh project to play with this stuff, see how that 2 pass thing could look like: https://github.com/wojtekmach/autolink/blob/master/lib/autolink.ex#L95:L98 In that snippet I'm also unifying local_doc
and elixir_functions
and I'm still exploring whether that's a good idea, so let's ignore that for now :)
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.
👍 for two passes!
Ebert has finished reviewing this Pull Request and has found:
You can see more details about this review at https://ebertapp.io/github/elixir-lang/ex_doc/pulls/813. |
end) | ||
end | ||
|
||
def replacement(all, match, project_funs, extension, lib_dirs, text \\ nil) do |
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.
Function takes too many parameters (arity is 6, max is 5).
@josevalim ready! we could allow custom links in other places too, e.g. for local calls, modules, erlang functions and whatnot, but maybe let's wait for use cases :) |
Fixes #622