Skip to content

Commit

Permalink
add support for Chinese tages: convert them to pinyin through stringex
Browse files Browse the repository at this point in the history
  • Loading branch information
guori12321 committed Aug 20, 2013
1 parent cbc9953 commit 0af2339
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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.
#
Expand Down Expand Up @@ -38,6 +39,7 @@
# MIT License: http://opensource.org/licenses/MIT
#

require 'stringex'

module Jekyll

Expand Down Expand Up @@ -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 << "<a href='#{url}' style='#{style}'>#{item}"
Expand Down

0 comments on commit 0af2339

Please sign in to comment.