BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
9 deletions
+9
-9
common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+1
-1
markdown.rb
features/steps/shared/markdown.rb
+1
-1
table_of_contents_filter.rb
lib/banzai/filter/table_of_contents_filter.rb
+1
-1
table_of_contents_filter_spec.rb
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
+3
-3
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 @@
// scroll to user-generated markdown anchor if we cannot find a match
if
(
document
.
getElementById
(
hash
)
===
null
)
{
var
target
=
document
.
getElementById
(
'user-content
_
'
+
hash
);
var
target
=
document
.
getElementById
(
'user-content
-
'
+
hash
);
if
(
target
&&
target
.
scrollIntoView
)
{
target
.
scrollIntoView
(
true
);
window
.
scrollBy
(
0
,
adjustment
);
...
...
features/steps/shared/markdown.rb
View file @
131a04d7
...
...
@@ -2,7 +2,7 @@ module SharedMarkdown
include
Spinach
::
DSL
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
}
"
# 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
if
header_content
=
node
.
children
.
first
# namespace detection will be automatically handled via javascript (see issue #22781)
namespace
=
"user-content
_
"
namespace
=
"user-content
-
"
href
=
"
#{
id
}#{
uniq
}
"
push_toc
(
href
,
text
)
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
html
=
header
(
i
,
"Header
#{
i
}
"
)
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
...
...
@@ -34,7 +34,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
it
'has a namespaced id'
do
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
it
'links to the non-namespaced id'
do
...
...
@@ -67,7 +67,7 @@ describe Banzai::Filter::TableOfContentsFilter, lib: true do
it
'supports Unicode'
do
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
'#한글'
end
end
...
...
spec/support/matchers/markdown_matchers.rb
View file @
131a04d7
...
...
@@ -38,9 +38,9 @@ module MarkdownMatchers
set_default_markdown_messages
match
do
|
actual
|
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
(
'h3 a#user-content
_
autolinkfilter'
)
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
(
'h3 a#user-content
-
autolinkfilter'
)
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