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
131a04d7
Commit
131a04d7
authored
Nov 29, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove underscore from user-content id namespace
parent
19f174bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
9 deletions
+9
-9
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+1
-1
features/steps/shared/markdown.rb
features/steps/shared/markdown.rb
+1
-1
lib/banzai/filter/table_of_contents_filter.rb
lib/banzai/filter/table_of_contents_filter.rb
+1
-1
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
+3
-3
spec/support/matchers/markdown_matchers.rb
spec/support/matchers/markdown_matchers.rb
+3
-3
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
131a04d7
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
// scroll to user-generated markdown anchor if we cannot find a match
// scroll to user-generated markdown anchor if we cannot find a match
if
(
document
.
getElementById
(
hash
)
===
null
)
{
if
(
document
.
getElementById
(
hash
)
===
null
)
{
var
target
=
document
.
getElementById
(
'
user-content
_
'
+
hash
);
var
target
=
document
.
getElementById
(
'
user-content
-
'
+
hash
);
if
(
target
&&
target
.
scrollIntoView
)
{
if
(
target
&&
target
.
scrollIntoView
)
{
target
.
scrollIntoView
(
true
);
target
.
scrollIntoView
(
true
);
window
.
scrollBy
(
0
,
adjustment
);
window
.
scrollBy
(
0
,
adjustment
);
...
...
features/steps/shared/markdown.rb
View file @
131a04d7
...
@@ -2,7 +2,7 @@ module SharedMarkdown
...
@@ -2,7 +2,7 @@ module SharedMarkdown
include
Spinach
::
DSL
include
Spinach
::
DSL
def
header_should_have_correct_id_and_link
(
level
,
text
,
id
,
parent
=
".wiki"
)
def
header_should_have_correct_id_and_link
(
level
,
text
,
id
,
parent
=
".wiki"
)
node
=
find
(
"
#{
parent
}
h
#{
level
}
a#user-content
_
#{
id
}
"
)
node
=
find
(
"
#{
parent
}
h
#{
level
}
a#user-content
-
#{
id
}
"
)
expect
(
node
[
:href
]).
to
eq
"#
#{
id
}
"
expect
(
node
[
:href
]).
to
eq
"#
#{
id
}
"
# Work around a weird Capybara behavior where calling `parent` on a node
# Work around a weird Capybara behavior where calling `parent` on a node
...
...
lib/banzai/filter/table_of_contents_filter.rb
View file @
131a04d7
...
@@ -36,7 +36,7 @@ module Banzai
...
@@ -36,7 +36,7 @@ module Banzai
if
header_content
=
node
.
children
.
first
if
header_content
=
node
.
children
.
first
# namespace detection will be automatically handled via javascript (see issue #22781)
# namespace detection will be automatically handled via javascript (see issue #22781)
namespace
=
"user-content
_
"
namespace
=
"user-content
-
"
href
=
"
#{
id
}#{
uniq
}
"
href
=
"
#{
id
}#{
uniq
}
"
push_toc
(
href
,
text
)
push_toc
(
href
,
text
)
header_content
.
add_previous_sibling
(
anchor_tag
(
"
#{
namespace
}#{
href
}
"
,
href
))
header_content
.
add_previous_sibling
(
anchor_tag
(
"
#{
namespace
}#{
href
}
"
,
href
))
...
...
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
View file @
131a04d7
...
@@ -22,7 +22,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
...
@@ -22,7 +22,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
html
=
header
(
i
,
"Header
#{
i
}
"
)
html
=
header
(
i
,
"Header
#{
i
}
"
)
doc
=
filter
(
html
)
doc
=
filter
(
html
)
expect
(
doc
.
css
(
"h
#{
i
}
a"
).
first
.
attr
(
'id'
)).
to
eq
"user-content
_
header-
#{
i
}
"
expect
(
doc
.
css
(
"h
#{
i
}
a"
).
first
.
attr
(
'id'
)).
to
eq
"user-content
-
header-
#{
i
}
"
end
end
end
end
...
@@ -34,7 +34,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
...
@@ -34,7 +34,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
it
'has a namespaced id'
do
it
'has a namespaced id'
do
doc
=
filter
(
header
(
1
,
'Header'
))
doc
=
filter
(
header
(
1
,
'Header'
))
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'id'
)).
to
eq
'user-content
_
header'
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'id'
)).
to
eq
'user-content
-
header'
end
end
it
'links to the non-namespaced id'
do
it
'links to the non-namespaced id'
do
...
@@ -67,7 +67,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
...
@@ -67,7 +67,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
it
'supports Unicode'
do
it
'supports Unicode'
do
doc
=
filter
(
header
(
1
,
'한글'
))
doc
=
filter
(
header
(
1
,
'한글'
))
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'id'
)).
to
eq
'user-content
_
한글'
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'id'
)).
to
eq
'user-content
-
한글'
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'href'
)).
to
eq
'#한글'
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'href'
)).
to
eq
'#한글'
end
end
end
end
...
...
spec/support/matchers/markdown_matchers.rb
View file @
131a04d7
...
@@ -38,9 +38,9 @@ module MarkdownMatchers
...
@@ -38,9 +38,9 @@ module MarkdownMatchers
set_default_markdown_messages
set_default_markdown_messages
match
do
|
actual
|
match
do
|
actual
|
expect
(
actual
).
to
have_selector
(
'h1 a#user-content
_
gitlab-markdown'
)
expect
(
actual
).
to
have_selector
(
'h1 a#user-content
-
gitlab-markdown'
)
expect
(
actual
).
to
have_selector
(
'h2 a#user-content
_
markdown'
)
expect
(
actual
).
to
have_selector
(
'h2 a#user-content
-
markdown'
)
expect
(
actual
).
to
have_selector
(
'h3 a#user-content
_
autolinkfilter'
)
expect
(
actual
).
to
have_selector
(
'h3 a#user-content
-
autolinkfilter'
)
end
end
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