Skip to content

Conversation

wojtekmach
Copy link
Member

Fixes #622

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}}
Copy link
Member Author

@wojtekmach wojtekmach Dec 19, 2017

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 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for two passes!

@sourcelevel-bot
Copy link

Ebert has finished reviewing this Pull Request and has found:

  • 1 possible new issue (including those that may have been commented here).

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

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).

@wojtekmach
Copy link
Member Author

@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 :)

@wojtekmach wojtekmach merged commit 2728963 into master Dec 19, 2017
@wojtekmach wojtekmach deleted the wm-custom-link branch December 19, 2017 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants