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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
955d013a
Commit
955d013a
authored
May 06, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
3ffc71d5
f741a7dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
changelogs/unreleased/patch-49.yml
changelogs/unreleased/patch-49.yml
+5
-0
lib/banzai/filter/table_of_contents_filter.rb
lib/banzai/filter/table_of_contents_filter.rb
+1
-0
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
+5
-0
No files found.
changelogs/unreleased/patch-49.yml
0 → 100644
View file @
955d013a
---
title
:
Remove leading / trailing spaces from heading when generating header ids
merge_request
:
27025
author
:
Willian Balmant
type
:
fixed
lib/banzai/filter/table_of_contents_filter.rb
View file @
955d013a
...
...
@@ -31,6 +31,7 @@ module Banzai
if
header_content
=
node
.
children
.
first
id
=
node
.
text
.
strip
.
downcase
.
gsub
(
PUNCTUATION_REGEXP
,
''
)
# remove punctuation
.
tr
(
' '
,
'-'
)
# replace spaces with dash
...
...
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
View file @
955d013a
...
...
@@ -58,6 +58,11 @@ describe Banzai::Filter::TableOfContentsFilter do
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'href'
)).
to
eq
'#this-header-is-filled-with-punctuation'
end
it
'removes any leading or trailing spaces'
do
doc
=
filter
(
header
(
1
,
"
\r\n\t
Title with spaces
\r\n\t
"
))
expect
(
doc
.
css
(
'h1 a'
).
first
.
attr
(
'href'
)).
to
eq
'#title-with-spaces'
end
it
'appends a unique number to duplicates'
do
doc
=
filter
(
header
(
1
,
'One'
)
+
header
(
2
,
'One'
))
...
...
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