Class: QDA::Filters::Templates::CommentStrippingFileSource

Inherits:
PageTemplate::FileSource
  • Object
show all
Defined in:
lib/weft/filters/templates.rb

Instance Method Summary collapse

Instance Method Details

#get(name) ⇒ Object

return the template content of the file named name. Uses the standard PageTemplate FileSource mechanism for searching directories etc, but removes any comment lines (all lines at the beginning of the document starting with a comment marker ‘#’) before returning the content.



8
9
10
11
12
# File 'lib/weft/filters/templates.rb', line 8

def get(name)
  # all stuff starting from the beginning up to the first newline that is
  # not followed by a comment character
  super(name).sub(/\A.*?\n(?!#)/m, '')
end