diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-16 10:24:44 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-17 07:39:16 +0100 |
commit | 5e3c9475a9332d7104a791f7bdfef30e069dd848 (patch) | |
tree | 780f1e5eb121d411ccfec0d9eaa66c7b41e97cb6 /lib | |
parent | 1dd279d83335de71c69d0acfdcdd7eb0ebe7f3dd (diff) | |
download | gitlab-ce-5e3c9475a9332d7104a791f7bdfef30e069dd848.tar.gz |
Add minor improvements in code related to issue move
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gfm/reference_unfolder.rb | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/gitlab/gfm/reference_unfolder.rb b/lib/gitlab/gfm/reference_unfolder.rb index 57871c36eb4..0a68d6f977f 100644 --- a/lib/gitlab/gfm/reference_unfolder.rb +++ b/lib/gitlab/gfm/reference_unfolder.rb @@ -1,8 +1,30 @@ module Gitlab module Gfm ## - # Class than unfolds local references in text. + # Class that unfolds local references in text. # + # The initializer takes text in Markdown and project this text is valid + # in context of. + # + # `unfold` method tries to find all local references and unfold each of + # those local references to cross reference format. + # + # Examples: + # + # 'Hello, this issue is related to #123 and + # other issues labeled with ~"label"', will be converted to: + # + # 'Hello, this issue is related to gitlab-org/gitlab-ce#123 and + # other issue labeled with gitlab-org/gitlab-ce~"label"'. + # + # It does respect markdown lexical rules, so text in code block will not be + # replaced, see another example: + # + # 'Merge request for issue #1234, see also link: + # http://gitlab.com/some/link/#1234, and code `puts #1234`' => + # + # 'Merge request for issue gitlab-org/gitlab-ce#1234, se also link: + # http://gitlab.com/some/link/#1234, and code `puts #1234`' # class ReferenceUnfolder def initialize(text, project) @@ -66,8 +88,7 @@ module Gitlab end def markdown(text) - helper = Class.new.extend(GitlabMarkdownHelper) - helper.markdown(text, project: @project, no_original_data: true) + Banzai.render(text, project: @project, no_original_data: true) end end end |