summaryrefslogtreecommitdiff
path: root/lib/static_page.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-10-28 18:44:21 -0700
committerelijah <elijah@riseup.net>2013-10-28 18:44:21 -0700
commitf691ad87516043aaf7a5f1f55f82d4c1713be7a4 (patch)
treed287db8f8adf9df32bcf07c3a21bae2fd3379c0e /lib/static_page.rb
parent25e8050ed8f9c627493b51f8e9c9a730c71ddcd4 (diff)
fixed numerous bugs relating to localization
Diffstat (limited to 'lib/static_page.rb')
-rw-r--r--lib/static_page.rb11
1 files changed, 6 insertions, 5 deletions
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 = "<div id=\"TOC\">%s</div>\n\n%s" % [rd.toc_content, html]
+ html = "<div id=\"TOC\">%s</div>\n\n%s" % [rd.toc_content.force_encoding('utf-8'), html]
end
unless (title = explicit_title(locale)).nil?
html = "<h1 class=\"first\">#{title}</h1>\n\n" + html