10000 Merge pull request #629 from vyper/master · hardBox/rubysec.github.com@e2596c0 · GitHub
[go: up one dir, main page]

Skip to content

Commit e2596c0

Browse files
committed
Merge pull request #629 from vyper/master
Added stringex and changed to use #to_url for create directory.
2 parents 880b0fb + 2fe9da9 commit e2596c0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/category_generator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# - category_title_prefix: The string used before the category name in the page title (default is
2020
# 'Category: ').
2121

22+
require 'stringex'
23+
2224
module Jekyll
2325

2426
# The CategoryIndex class creates a single category page for the specified category.
@@ -106,7 +108,7 @@ def write_category_indexes
106108
if self.layouts.key? 'category_index'
107109
dir = self.config['category_dir'] || 'categories'
108110
self.categories.keys.each do |category|
109-
self.write_category_index(File.join(dir, category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase), category)
111+
self.write_category_index(File.join(dir, category.to_url), category)
110112
end
111113

112114
# Throw an exception if the layout couldn't be found.
@@ -171,7 +173,7 @@ def category_links(categories)
171173
#
172174
def category_link(category)
173175
dir = @context.registers[:site].config['category_dir']
174-
"<a class='category' href='/#{dir}/#{category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{category}</a>"
176+
"<a class='category' href='/#{dir}/#{category.to_url}/'>#{category}</a>"
175177
end
176178

177179
# Outputs the post.date as formatted html, with hooks for CSS styling.

0 commit comments

Comments
 (0)
0