Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
95f73a68
Commit
95f73a68
authored
Sep 23, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify help path prefixing
parent
64e0dfa5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
17 deletions
+4
-17
app/controllers/help_controller.rb
app/controllers/help_controller.rb
+4
-17
No files found.
app/controllers/help_controller.rb
View file @
95f73a68
...
@@ -5,7 +5,10 @@ class HelpController < ApplicationController
...
@@ -5,7 +5,10 @@ class HelpController < ApplicationController
def
index
def
index
@help_index
=
File
.
read
(
Rails
.
root
.
join
(
'doc'
,
'README.md'
))
@help_index
=
File
.
read
(
Rails
.
root
.
join
(
'doc'
,
'README.md'
))
prefix_help_links!
(
@help_index
)
# Prefix Markdown links with `help/` unless they already have been
# See http://rubular.com/r/nwwhzH6Z8X
@help_index
.
gsub!
(
/(\]\()(?!help\/)([^\)\(]+)(\))/
,
'\1help/\2\3'
)
end
end
def
show
def
show
...
@@ -59,22 +62,6 @@ class HelpController < ApplicationController
...
@@ -59,22 +62,6 @@ class HelpController < ApplicationController
params
params
end
end
# Prefix links in a Markdown document with `help/` unless they already have
# been
#
# TODO (rspeicher): This should be a pipeline filter that only gets included
# for help pages, and it should operate on the Nokogiri doc to be more robust.
#
# text - Markdown String
#
# Modifies `text` in-place
def
prefix_help_links!
(
text
)
# Match text inside a Markdown link unless it already starts with `help/`
#
# See http://rubular.com/r/nwwhzH6Z8X
text
.
gsub!
(
%r{(
\]\(
)(?!help
\/
)([^
\)\(
]+)(
\)
)}x
,
'\1help/\2\3'
)
end
PATH_SEPS
=
Regexp
.
union
(
*
[
::
File
::
SEPARATOR
,
::
File
::
ALT_SEPARATOR
].
compact
)
PATH_SEPS
=
Regexp
.
union
(
*
[
::
File
::
SEPARATOR
,
::
File
::
ALT_SEPARATOR
].
compact
)
# Taken from ActionDispatch::FileHandler
# Taken from ActionDispatch::FileHandler
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment