Class: Webgen::PathHandler::TipueSearch
- Inherits:
-
Object
- Object
- Webgen::PathHandler::TipueSearch
- Includes:
- Base, PageUtils
- Defined in:
- lib/webgen/bundle/tipue_search/tipue_search_path_handler.rb
Overview
Path handler for creating a Tipue Search site index.
Defined Under Namespace
Classes: Node
Constant Summary collapse
- MANDATORY_INFOS =
The mandatory keys that need to be set in a tipue search file.
%W[mode entries]
Instance Method Summary collapse
-
#content(node) ⇒ Object
Return the rendered feed represented by
node
. -
#create_nodes(path, blocks) ⇒ Object
Create a Tipue Search site index from
path
.
Instance Method Details
#content(node) ⇒ Object
Return the rendered feed represented by node
.
67 68 69 70 71 72 |
# File 'lib/webgen/bundle/tipue_search/tipue_search_path_handler.rb', line 67 def content(node) context = Webgen::Context.new(@website) context.render_block(:name => "tipue_search", :node => 'first', :chain => [node, node.resolve("/templates/tipue_search.template", node.lang, true), node].compact) end |
#create_nodes(path, blocks) ⇒ Object
Create a Tipue Search site index from path
.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/webgen/bundle/tipue_search/tipue_search_path_handler.rb', line 44 def create_nodes(path, blocks) if MANDATORY_INFOS.any? {|t| path.[t].nil?} raise Webgen::NodeCreationError.new("At least one of #{MANDATORY_INFOS.join('/')} is missing", "path_handler.tipue_search", path) end if @website.config['website.base_url'].empty? raise Webgen::NodeCreationError.new("The configuration option 'website.base_url' needs to be set", "path_handler.tipue_search", path) end path.ext = 'js' path['node_class'] = Node.to_s path['write_order'] = 'z' create_node(path) do |node| set_blocks(node, blocks) node.node_info[:entries] = {:flatten => true, :and => node['entries']} @website.ext.item_tracker.add(node, :nodes, :node_finder_option_set, {:opts => node.node_info[:entries], :ref_alcn => node.alcn}, :content) end end |