Module | YARD::Templates::Template |
In: |
lib/yard/templates/template.rb
|
Returns the contents of a file. If allow_inherited is set to true, use +{{{super}}}+ inside the file contents to insert the contents of the file from an inherited template. For instance, if +templates/b+ inherits from +templates/a+ and file "test.css" exists in both directories, both file contents can be retrieved by having +templates/b/test.css+ look like:
{{{__super__}}} ... body { css styles here } p.class { other styles }
@param [String] basename the name of the file @param [Boolean] allow_inherited whether inherited templates can
be inserted with +{{{__super__}}}+
@return [String] the contents of a file identified by basename. All
template paths (including any mixed in templates) are searched for the file
Runs a template on sects using extra options. This method should not be called directly. Instead, call the class method {ClassMethods#run}
@param [Hash, nil] opts any extra options to apply to sections @param [Section, Array] sects a section list of sections to render @param [Fixnum] start_at the index in the section list to start from @param [Boolean] break_first if true, renders only the first section @yield [opts] calls for the subsections to be rendered @yieldparam [Hash] opts any extra options to yield @return [String] the rendered sections joined together
Sets the sections (and subsections) to be rendered for the template
@example Sets a set of erb sections
sections :a, :b, :c # searches for a.erb, b.erb, c.erb
@example Sets a set of method and erb sections
sections :a, :b, :c # a is a method, the rest are erb files
@example Sections with subsections
sections :header, [:name, :children] # the above will call header.erb and only renders the subsections # if they are yielded by the template (see #yieldall)
@param [Array<Symbol, String, Template, Array>] args the sections
to use to render the template. For symbols and strings, the section will be executed as a method (if one exists), or rendered from the file "name.erb" where name is the section name. For templates, they will have {Template::ClassMethods#run} called on them. Any subsections can be yielded to using yield or {#yieldall}
Yields all subsections with any extra options
@param [Hash] opts extra options to be applied to subsections