summaryrefslogtreecommitdiff
path: root/app/models/wiki_page.rb
diff options
context:
space:
mode:
authorAlex Braha Stoll <alexbrahastoll@gmail.com>2017-01-30 01:07:31 -0200
committerAlex Braha Stoll <alexbrahastoll@gmail.com>2017-01-30 01:07:31 -0200
commit683097666aa01ef6a5b490be67a4a0d9733152e3 (patch)
tree08ef6a71de041dd2934ecf2056f4a4e9c4076620 /app/models/wiki_page.rb
parent4c57fa4282afc1679e2891b215174c92bf883c6a (diff)
downloadgitlab-ce-683097666aa01ef6a5b490be67a4a0d9733152e3.tar.gz
Add WikiPage.unhyphenize
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r--app/models/wiki_page.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 20bd9719b2f..2f4f92846b4 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -34,6 +34,10 @@ class WikiPage
flatten
end
+ def self.unhyphenize(name)
+ name.gsub(/-+/, ' ')
+ end
+
def to_key
[:slug]
end
@@ -78,7 +82,7 @@ class WikiPage
# The formatted title of this page.
def title
if @attributes[:title]
- @attributes[:title].gsub(/-+/, ' ')
+ self.class.unhyphenize(@attributes[:title])
else
""
end