summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-09-23 11:44:17 +0000
committerRobert Speicher <rspeicher@gmail.com>2015-09-23 12:23:26 -0400
commite8c144af5149ab1353b86e22902d43ea519ae2ec (patch)
tree73f274fe95d34a3ba15f8f125394fe2b229a5ab8
parent9911f86c3d76b75bfd673aaa4b7f115cd3f8be04 (diff)
downloadgitlab-ce-e8c144af5149ab1353b86e22902d43ea519ae2ec.tar.gz
Merge branch 'rs-fix-help-links' into 'master'
Prevent double-prefixing of help page paths Closes #2679 See merge request !1400
-rw-r--r--app/controllers/help_controller.rb5
-rw-r--r--app/views/help/index.html.haml6
-rw-r--r--doc/README.md2
3 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index ad00948da51..55050615473 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -4,6 +4,11 @@ class HelpController < ApplicationController
layout 'help'
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/nwwhzH6Z8X
+ @help_index.gsub!(/(\]\()(?!help\/)([^\)\(]+)(\))/, '\1help/\2\3')
end
def show
diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml
index f492aaf4c0a..ab7ed1b5d95 100644
--- a/app/views/help/index.html.haml
+++ b/app/views/help/index.html.haml
@@ -27,11 +27,7 @@
.col-md-8
.documentation-index
= preserve do
- - readme_text = File.read(Rails.root.join("doc", "README.md"))
- - text = readme_text.dup
- - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") }
- = markdown text
-
+ = markdown(@help_index)
.col-md-4
.panel.panel-default
.panel-heading
diff --git a/doc/README.md b/doc/README.md
index 5f38086b8e3..a0ff856ebb6 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -51,7 +51,7 @@
### Administrator documentation
-+ [User permissions](permissions/README.md)
++ [User permissions](permissions/permissions.md)
+ [API](api/README.md)
## Contributor documentation