Simple source handler for copying files from the source tree, either verbatim or by applying a content processor.
Return either the preprocessed content of the node or the IO object for the node’s source path depending on the node type.
# File lib/webgen/sourcehandler/copy.rb, line 30 30: def content(node) 31: io = website.blackboard.invoke(:source_paths)[node.node_info[:src]].io 32: if node.node_info[:preprocessor] 33: is_binary = website.blackboard.invoke(:content_processor_binary?, node.node_info[:preprocessor]) 34: context = Webgen::Context.new(:content => io.data(is_binary ? 'rb' : 'r'), :chain => [node]) 35: website.blackboard.invoke(:content_processor, node.node_info[:preprocessor]).call(context) 36: context.content 37: else 38: io 39: end 40: end
Create the node for path. If the path has the name of a content processor as the first part in the extension, it is preprocessed.
# File lib/webgen/sourcehandler/copy.rb, line 14 14: def create_node(path) 15: if path.ext.index('.') 16: processor, *rest = path.ext.split('.') 17: if website.blackboard.invoke(:content_processor_names).include?(processor) 18: path.ext = rest.join('.') 19: else 20: processor = nil 21: end 22: end 23: super(path) do |node| 24: node.node_info[:preprocessor] = processor 25: end 26: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.