Sha256: 322af83726f93dac112253d60d5bcf8447826c6ceb2e416cb3f05076d95e126b

Contents?: true

Size: 919 Bytes

Versions: 4

Compression:

Stored size: 919 Bytes

Contents

# -*- encoding: utf-8 -*-

module Genit

  # Replace the <genit class="pages"/> in the template.
  class ClassPagesTag < 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
    end
    
    # Public: Do the replacement.
    #
    # Returns the template as a Nokogiri::XML::Document
    def process
      replace_tag_into_template! 'genit.pages', page_content
    end
    
    private
    
    def page_content
      filename = File.join(@working_dir, 'pages', @filename)
      HtmlDocument.build_page_content filename, @working_dir
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
genit-1.0.1 lib/genit/tags/class_pages_tag.rb
genit-1.0 lib/genit/tags/class_pages_tag.rb
genit-0.99 lib/genit/tags/class_pages_tag.rb
genit-0.9 lib/genit/tags/class_pages_tag.rb