Wiki will show relative links related to the wiki gollum repository.

This commit is contained in:
Marin Jankovski 2014-03-17 11:27:59 +01:00
parent 55e2f353d4
commit f04d5bfaf6
2 changed files with 5 additions and 4 deletions

View File

@ -63,8 +63,7 @@ module GitlabMarkdownHelper
# project_path_with_namespace - namespace/projectname, eg. gitlabhq/gitlabhq # project_path_with_namespace - namespace/projectname, eg. gitlabhq/gitlabhq
# ref - name of the branch or reference, eg. stable # ref - name of the branch or reference, eg. stable
# requested_path - path of request, eg. doc/api/README.md, used in special case when path is pointing to the .md file were the original request is coming from # requested_path - path of request, eg. doc/api/README.md, used in special case when path is pointing to the .md file were the original request is coming from
# wiki - whether the markdown is from wiki or not def create_relative_links(text, project, ref, requested_path)
def create_relative_links(text, project, ref, requested_path, wiki = false)
@path_to_satellite = project.satellite.path @path_to_satellite = project.satellite.path
project_path_with_namespace = project.path_with_namespace project_path_with_namespace = project.path_with_namespace
paths = extract_paths(text) paths = extract_paths(text)

View File

@ -46,8 +46,10 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
end end
def preprocess(full_document) def preprocess(full_document)
if @project if is_wiki?
h.create_relative_links(full_document, @project, @ref, @request_path, is_wiki?) full_document
elsif @project
h.create_relative_links(full_document, @project, @ref, @request_path)
else else
full_document full_document
end end