From b99282804d682251928f932812068513f4061abb Mon Sep 17 00:00:00 2001 From: Fu Xu Date: Thu, 10 Nov 2016 13:57:46 +0800 Subject: fix error links in help page --- app/controllers/help_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/help_controller.rb') diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 4eca278599f..4b3c71874be 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -7,8 +7,8 @@ class HelpController < ApplicationController @help_index = File.read(Rails.root.join('doc', 'README.md')) # Prefix Markdown links with `help/` unless they already have been - # See http://rubular.com/r/nwwhzH6Z8X - @help_index.gsub!(/(\]\()(?!help\/)([^\)\(]+)(\))/, '\1help/\2\3') + # See http://rubular.com/r/ie2MlpdUMq + @help_index.gsub!(/(\]\()(\/?help\/)?([^\)\(]+\))/, '\1/help/\3') end def show -- cgit v1.2.1 From c4ded595ccf520bc30bde90403366ad14ba8b594 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Fri, 18 Nov 2016 12:57:25 +0100 Subject: Fix broken external links in help/index.html An external link was recently added but was broken because 'https://gitlab.com/help/' was prepended to every link in the page. Since no link in the main help readme begins with "help" and since doing so wouldn't make sense, the substitution conditionaly prepending "help" can be simplified and reused. Signed-off-by: David Wagner --- app/controllers/help_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/help_controller.rb') diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 4b3c71874be..a10cdcce72b 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -6,9 +6,9 @@ class HelpController < ApplicationController def index @help_index = File.read(Rails.root.join('doc', 'README.md')) - # Prefix Markdown links with `help/` unless they already have been - # See http://rubular.com/r/ie2MlpdUMq - @help_index.gsub!(/(\]\()(\/?help\/)?([^\)\(]+\))/, '\1/help/\3') + # Prefix Markdown links with `help/` unless they are external links + # See http://rubular.com/r/MioSrVLK3S + @help_index.gsub!(%r{(\]\()(?!.+://)([^\)\(]+\))}, '\1/help/\2') end def show -- cgit v1.2.1 From 633538151b99c658bcbb2173e91eb5deba4408f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 1 Dec 2016 12:07:52 +0100 Subject: Fix URL rewritting in the Help section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/controllers/help_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/controllers/help_controller.rb') diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index a10cdcce72b..37feff79999 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -7,8 +7,10 @@ class HelpController < ApplicationController @help_index = File.read(Rails.root.join('doc', 'README.md')) # Prefix Markdown links with `help/` unless they are external links - # See http://rubular.com/r/MioSrVLK3S - @help_index.gsub!(%r{(\]\()(?!.+://)([^\)\(]+\))}, '\1/help/\2') + # See http://rubular.com/r/X3baHTbPO2 + @help_index.gsub!(%r{(?\]\()(?!.+://)(?!/)(?[^\)\(]+\))}) do + "#{$~[:delim]}#{Gitlab.config.gitlab.relative_url_root}/help/#{$~[:link]}" + end end def show -- cgit v1.2.1