orbit-basic/lib/parsers/parser_front_end.rb

39 lines
1.0 KiB
Ruby
Raw Normal View History

2011-12-23 10:34:21 +00:00
module ParserFrontEnd
include ParserCommon
2012-03-27 09:57:50 +00:00
# c.define_tag 'language_bar' do
# @site.in_use_locales.map{ |locale|
# lang = I18nVariable.first(:conditions => {:key => locale})[locale]
# if I18n.locale.to_s.eql?(locale)
# lang
# else
# "<a href='?locale=#{locale}'>#{lang}</a>"
# end
# }.join(' | ')
# end
# c.define_tag 'link' do |tag|
2012-05-11 08:16:09 +00:00
# item = Item.first(:conditions => { :path => tag.attr['name'] })
2012-03-27 09:57:50 +00:00
# ret = ''
# ret << "<a href='#{tag.attr['name']}'>"
# ret << item.i18n_variable[I18n.locale]
# ret << '</a>'
# end
# end
2012-03-21 17:51:16 +00:00
require 'nokogiri'
2012-05-13 11:32:05 +00:00
def parse_page_noko(page)
2012-03-22 02:11:02 +00:00
body = Nokogiri::HTML(page.design.layout.body)
2012-03-27 09:57:50 +00:00
parse_menu(body, page)
2012-05-13 11:32:05 +00:00
public_r_tags = parse_contents(body, page)
2012-03-27 09:57:50 +00:00
parse_images(body, page)
2012-05-08 09:27:02 +00:00
parse_footer(body, page)
parse_sub_menu(body, page)
2012-03-27 09:57:50 +00:00
public_r_tags.each do |tag|
2012-05-13 11:32:05 +00:00
send("parse_#{tag}s", body, page)
2012-03-27 09:57:50 +00:00
end
2012-03-21 17:51:16 +00:00
2012-03-27 09:57:50 +00:00
body.to_html
end
2011-12-23 10:34:21 +00:00
end