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
Léo-Paul Géneau
gitlab-ce
Commits
7d56d592
Commit
7d56d592
authored
Mar 30, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Gollum pages link url expansion to render correctly in preview
parent
b69f8a62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
lib/banzai/filter/gollum_tags_filter.rb
lib/banzai/filter/gollum_tags_filter.rb
+9
-3
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
+5
-3
No files found.
lib/banzai/filter/gollum_tags_filter.rb
View file @
7d56d592
...
...
@@ -144,12 +144,18 @@ module Banzai
# if it is not.
def
process_page_link_tag
(
parts
)
if
parts
.
size
==
1
url
=
parts
[
0
].
strip
reference
=
parts
[
0
].
strip
else
name
,
url
=
*
parts
.
compact
.
map
(
&
:strip
)
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
end
content_tag
(
:a
,
name
||
url
,
href:
url
)
if
url?
(
reference
)
href
=
reference
else
href
=
::
File
.
join
(
project_wiki_base_path
,
reference
)
end
content_tag
(
:a
,
name
||
reference
,
href:
href
)
end
def
project_wiki
...
...
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
View file @
7d56d592
...
...
@@ -70,20 +70,22 @@ describe Banzai::Filter::GollumTagsFilter, lib: true do
end
context
'linking internal resources'
do
it
"the created link's text will
be equal to the resource's text
"
do
it
"the created link's text will
include the resource's text and project_wiki_base_path
"
do
tag
=
'[[wiki-slug]]'
doc
=
filter
(
"See
#{
tag
}
"
,
project_wiki:
project_wiki
)
expected_path
=
::
File
.
join
(
project_wiki
.
wiki_base_path
,
'wiki-slug'
)
expect
(
doc
.
at_css
(
'a'
).
text
).
to
eq
'wiki-slug'
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
'wiki-slug'
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
expected_path
end
it
"the created link's text will be link-text"
do
tag
=
'[[link-text|wiki-slug]]'
doc
=
filter
(
"See
#{
tag
}
"
,
project_wiki:
project_wiki
)
expected_path
=
::
File
.
join
(
project_wiki
.
wiki_base_path
,
'wiki-slug'
)
expect
(
doc
.
at_css
(
'a'
).
text
).
to
eq
'link-text'
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
'wiki-slug'
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
expected_path
end
end
...
...
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