From ad3defa3c2f7c3b1d5a15e0f145f424302eb23a4 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 11 Oct 2013 21:41:33 +0200 Subject: [PATCH] Skip relative links render in help page. --- features/project/source/markdown_render.feature | 5 +++++ features/steps/project/project_markdown_render.rb | 12 ++++++++++++ lib/redcarpet/render/gitlab_html.rb | 6 +++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/features/project/source/markdown_render.feature b/features/project/source/markdown_render.feature index d461ae86c81..a7a9cee7b0d 100644 --- a/features/project/source/markdown_render.feature +++ b/features/project/source/markdown_render.feature @@ -68,3 +68,8 @@ Feature: Project markdown render When I go back to wiki page home And I click on Rake tasks link Then I see Rake tasks directory + + Scenario: I visit the help page with markdown + Given I visit to the help page + And I select a page with markdown + Then I should see a help page with markdown \ No newline at end of file diff --git a/features/steps/project/project_markdown_render.rb b/features/steps/project/project_markdown_render.rb index 11a3ff9d0cb..951c831838d 100644 --- a/features/steps/project/project_markdown_render.rb +++ b/features/steps/project/project_markdown_render.rb @@ -150,4 +150,16 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps page.should have_content "backup_restore.md" page.should have_content "maintenance.md" end + + Given 'I visit to the help page' do + visit help_path + end + + And 'I select a page with markdown' do + click_link "Rake Tasks" + end + + Then 'I should see a help page with markdown' do + page.should have_content "GitLab provides some specific rake tasks to enable special features or perform maintenance tasks" + end end \ No newline at end of file diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 5ac37625d2d..b84c005524f 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -35,7 +35,11 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML end def preprocess(full_document) - h.create_relative_links(full_document, @project.path_with_namespace, @ref, @request_path, is_wiki?) + if @project + h.create_relative_links(full_document, @project.path_with_namespace, @ref, @request_path, is_wiki?) + else + full_document + end end def postprocess(full_document)