From f691ad87516043aaf7a5f1f55f82d4c1713be7a4 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 28 Oct 2013 18:44:21 -0700 Subject: fixed numerous bugs relating to localization --- lib/static_page.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/static_page.rb') diff --git a/lib/static_page.rb b/lib/static_page.rb index d7d6529..9f4cc05 100644 --- a/lib/static_page.rb +++ b/lib/static_page.rb @@ -16,7 +16,8 @@ require 'rdiscount' #require 'iconv' class StaticPage - attr_accessor :path, :children, :name, :file_path, :props, :parent, :mount_point, :locales + attr_accessor :path, :children, :name, :file_path, :parent, :mount_point, :locales + attr_accessor :props # type PropertySet ## ## CLASS METHODS @@ -273,8 +274,8 @@ class StaticPage # returns an array like so: # # [ - # ['/path/to/page/en.haml', 'en'] - # ['/path/to/page/es.haml', 'es'] + # ['/path/to/page/en.haml', :en] + # ['/path/to/page/es.haml', :es] # ] # # Or this, if page is simple: @@ -290,7 +291,7 @@ class StaticPage elsif File.directory?(@file_path) Dir.foreach(@file_path).collect { |file| if file && file =~ LOCALE_FILE_MATCH - [File.join(@file_path, file), $1] + [File.join(@file_path, file), $1.to_sym] end }.compact end @@ -410,7 +411,7 @@ class StaticPage rd = RDiscount.new(string, :smart, :generate_toc, :autolink) html = rd.to_html if props.locale(locale).toc != false && rd.toc_content - html = "
%s
\n\n%s" % [rd.toc_content, html] + html = "
%s
\n\n%s" % [rd.toc_content.force_encoding('utf-8'), html] end unless (title = explicit_title(locale)).nil? html = "

#{title}

\n\n" + html -- cgit v1.2.3