From 0af2339ba1f2ce574a8a17d706e56b3aee6835a1 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 20 Aug 2013 13:25:58 +0800 Subject: [PATCH] add support for Chinese tages: convert them to pinyin through stringex --- plugins/category_cloud.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/category_cloud.rb b/plugins/category_cloud.rb index 9226268..cfcdb4b 100644 --- a/plugins/category_cloud.rb +++ b/plugins/category_cloud.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 # WP-Cumulus for Octopress, originally developed by weefselkweekje and LukeMorton for WordPress. # Ported to Octopress by Joseph Z. Chang. # @@ -38,6 +39,7 @@ # MIT License: http://opensource.org/licenses/MIT # +require 'stringex' module Jekyll @@ -110,7 +112,7 @@ def render(context) lists.each do | item, counter | - url = cloud_dir + item.gsub(/_|\P{Word}/u, '-').gsub(/-{2,}/u, '-').downcase + url = cloud_dir + item.gsub(/_|\P{Word}/u, '-').gsub(/-{2,}/u, '-').downcase.to_url style = "font-size: #{10 + (40 * Float(counter)/max)}%" tagcloud << "#{item}"