Sha256: 4bdf9fad5715d8335e16ecc3a052df41d6c04f61cce9e98aceca825a52057f5a
Contents?: true
Size: 898 Bytes
Versions: 3
Compression:
Stored size: 898 Bytes
Contents
module Nagoro module Pipe # Include is used to include the contents of another file. # The file will not be changed or interpreted in any way by this pipe. # # If the tag contains anything the contents will be put after the included # contents. # # Syntax: # <include href="some_file.xhtml" /> # <include src="some_file.xhtml" /> class Include < Base def tag_start(tag, original_attrs, value_attrs) if tag == 'include' filename = value_attrs['href'] || value_attrs.fetch('src') append contents(filename) else super end end def contents(file) open(file){|o| o.read.strip } rescue Errno::ENOENT, Errno::EISDIR => ex warn ex.message "<!-- #{ex} -->" end def tag_end(tag) super unless tag == 'include' end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
manveru-nagoro-2009.03.28 | lib/nagoro/pipe/include.rb |
manveru-nagoro-2009.05 | lib/nagoro/pipe/include.rb |
nagoro-2009.05 | lib/nagoro/pipe/include.rb |