Parent

Class Index [+]

Quicksearch

Webgen::Tag::IncludeFile

Includes a file verbatim and optionally escapes all special HTML characters and processes webgen tags in it.

Public Instance Methods

call(tag, body, context) click to toggle source

Include the specified file verbatim in the output, optionally escaping special HTML characters and processing tags in it.

    # File lib/webgen/tag/includefile.rb, line 20
20:     def call(tag, body, context)
21:       filename = param('tag.includefile.filename')
22:       filename = File.join(website.directory, filename) unless filename =~ /^(\/|\w:)/
23:       content = File.open(filename, 'rb') {|f| f.read}
24:       content = CGI::escapeHTML(content) if param('tag.includefile.escape_html')
25:       (context.dest_node.node_info[:tag_includefile_filenames] ||= []) << [filename, File.mtime(filename)]
26: 
27:       [content, param('tag.includefile.process_output')]
28:     end

Private Instance Methods

node_changed?(node) click to toggle source
    # File lib/webgen/tag/includefile.rb, line 34
34:     def node_changed?(node)
35:       if filenames = node.node_info[:tag_includefile_filenames]
36:         node.flag(:dirty) if filenames.any? {|f, mtime| File.mtime(f) > mtime}
37:       end
38:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.