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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
7dbbb6de
Commit
7dbbb6de
authored
11 years ago
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method to avoid clashes.
parent
70f828cd
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+2
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+24
-0
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
7dbbb6de
...
...
@@ -75,12 +75,12 @@ module GitlabMarkdownHelper
def
new_link
(
path_with_namespace
,
string
,
ref
)
[
path_with_namespace
,
path
(
string
,
ref
),
path
_with_ref
(
string
,
ref
),
string
].
compact
.
join
(
"/"
)
end
def
path
(
string
,
ref
)
def
path
_with_ref
(
string
,
ref
)
if
File
.
exists?
(
Rails
.
root
.
join
(
string
))
"
#{
local_path
(
string
)
}
/
#{
correct_ref
(
ref
)
}
"
else
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
7dbbb6de
...
...
@@ -406,6 +406,30 @@ describe GitlabMarkdownHelper do
it
"should generate absolute urls for emoji"
do
markdown
(
":smile:"
).
should
include
(
"src=
\"
#{
url_to_image
(
"emoji/smile"
)
}
"
)
end
it
"should handle relative urls for a file in master"
do
actual
=
"[GitLab API doc](doc/api/README.md)
\n
"
expected
=
"<p><a href=
\"
/
#{
project
.
path_with_namespace
}
/blob/master/doc/api/README.md
\"
>GitLab API doc</a></p>
\n
"
markdown
(
actual
).
should
match
(
expected
)
end
it
"should handle relative urls for a directory in master"
do
actual
=
"[GitLab API doc](doc/api)
\n
"
expected
=
"<p><a href=
\"
/
#{
project
.
path_with_namespace
}
/tree/master/doc/api
\"
>GitLab API doc</a></p>
\n
"
markdown
(
actual
).
should
match
(
expected
)
end
it
"should handle absolute urls"
do
actual
=
"[GitLab](https://www.gitlab.com)
\n
"
expected
=
"<p><a href=
\"
https://www.gitlab.com
\"
>GitLab</a></p>
\n
"
markdown
(
actual
).
should
match
(
expected
)
end
it
"should handle wiki urls"
do
actual
=
"[Link](test/link)
\n
"
expected
=
"<p><a href=
\"
/
#{
project
.
path_with_namespace
}
/wikis/test/link
\"
>Link</a></p>
\n
"
markdown
(
actual
).
should
match
(
expected
)
end
end
describe
"#render_wiki_content"
do
...
...
This diff is collapsed.
Click to expand it.
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