diff --git a/app/assets/stylesheets/sitemap.scss b/app/assets/stylesheets/sitemap.scss new file mode 100644 index 0000000..1b79b7b --- /dev/null +++ b/app/assets/stylesheets/sitemap.scss @@ -0,0 +1,13 @@ +.sitemap-list { + padding-left: 1em; + li { + line-height: 1.5; + margin-bottom: 0.8em; + } +} + +.sitemap-list.level-2, +.sitemap-list.level-3 { + margin: 12px 0; + padding-left: 2em; +} \ No newline at end of file diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index cc0de2e..d731987 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -353,7 +353,22 @@ class PagesController < ApplicationController if @editmode session[:mobile] = $temp_mobile end - final_html_for_render + format_date(final_html_for_render) rescue final_html_for_render + end + + def format_date(html) + doc = Nokogiri::HTML(html, nil, "UTF-8") + dates = doc.css("*[date-format]") + if dates.blank? + return html + else + dates.each do |d| + format = d.attributes["date-format"].value + date = DateTime.parse(d.inner_text) + d.inner_html = d.inner_html.gsub(d.inner_text, " " + date.strftime(format)) + end + return doc.to_html + end end def get_widget_path(widget) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2b55c4d..3ce1cb1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -376,14 +376,23 @@ module ApplicationHelper def render_sitemap items = action_data - def node(items) - html = "