diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-03-30 15:30:36 -0300 |
---|---|---|
committer | Gabriel Mazetto <gabriel@gitlab.com> | 2016-03-30 15:43:58 -0300 |
commit | 7d56d592cd7d1df718d59981af1ced9d0be8eaac (patch) | |
tree | 784d83ff994793f91e695da5ab5f3cebe940a145 /lib/banzai | |
parent | b69f8a62b2078fbd43413c670dea76871b74d0d5 (diff) | |
download | gitlab-ce-7d56d592cd7d1df718d59981af1ced9d0be8eaac.tar.gz |
Fixed Gollum pages link url expansion to render correctly in preview
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/gollum_tags_filter.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/banzai/filter/gollum_tags_filter.rb b/lib/banzai/filter/gollum_tags_filter.rb index 7ce26db1b90..cfd3e28ed09 100644 --- a/lib/banzai/filter/gollum_tags_filter.rb +++ b/lib/banzai/filter/gollum_tags_filter.rb @@ -144,12 +144,18 @@ module Banzai # if it is not. def process_page_link_tag(parts) if parts.size == 1 - url = parts[0].strip + reference = parts[0].strip else - name, url = *parts.compact.map(&:strip) + name, reference = *parts.compact.map(&:strip) end - content_tag(:a, name || url, href: url) + if url?(reference) + href = reference + else + href = ::File.join(project_wiki_base_path, reference) + end + + content_tag(:a, name || reference, href: href) end def project_wiki |