Sha256: 0f0e0a34a8dff15632b5451d4806e813961b911be3c4852c22627cff974eba47
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# -*- encoding: utf-8 -*- module Genit # Replace the <genit class="fragment"/> in the template. class ClassFragmentTag < Tag # Public: Constructor. # # working_dir - The String working directory, where live the project. # template - The Nokogiri::XML::Document into which we process the tag. # filename - The String name of the page # tag - The tag to process as a Nokogiri::XML::Element def initialize working_dir, template, filename, tag super working_dir, template, filename, tag @file = @tag['file'] error "Incomplete #{@tag}" if @file.nil? @full_path = File.join(@working_dir, 'fragments', @file) error "No such file #{@tag}" unless File.exists?(@full_path) end # Public: Do the replacement. # # Returns the template as a Nokogiri::XML::Document def process fragment = HtmlDocument.build_page_content(@full_path, @working_dir) css_rule = "genit.fragment[file='#{@file}']" replace_tag_into_template! css_rule, fragment.to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
genit-1.0.1 | lib/genit/tags/class_fragment_tag.rb |
genit-1.0 | lib/genit/tags/class_fragment_tag.rb |