scripts/generate-docs/generators/generator.rb
# Interpolates an existing documentation file, parsing out the section
# directives and replacing them with updated generated content.
#
# This method should be used instead of #write since it allows for direct
# markdown file editing (outside of the denoted sections).
Interpolates an existing documentation file, parsing out the section
directives and replacing them with updated generated content.

This method should be used instead of #write since it allows for direct
markdown file editing (outside of the denoted sections).
Interpolates an existing documentation file parsing out the section directives and replacing them with updated generated content . This method should be used instead of #write since it allows for direct markdown file editing ( outside of the denoted sections ) .
def interpolate(file_path, options = {})
    template = File.read(file_path)
    template = LinkGenerator.remove_link_footers(template)
    new_content = template.clone
    sections = new_content.scan(/<!-- START: (.*) -->/).flatten
    sections.each do |section|
      section_content = send(section).strip
      content =
        <<~EOF
        <!-- START: #{section} -->
        <!-- ----------------------------------------------------------------- -->
        <!-- DO NOT MODIFY! This section is generated from the /.metadata.toml -->
        <!-- via `make generate-docs`. See /DOCUMENTING.md for more info.      -->
        #{section_content}
        <!-- ----------------------------------------------------------------- -->
        <!-- END: #{section} -->
        EOF
      content.strip!
      new_content.gsub!(/<!-- START: #{section} -->(.*)<!-- END: #{section} -->/m, content)
    end
    new_content = normalize(new_content)
    if template.strip != new_content.strip
      File.write(file_path, new_content) if !options[:dry_run]
      action = options[:dry_run] ? "Will be changed" : "Changed"
      say("#{action} - #{file_path}", :green) if !options[:silent]
    else
      action = options[:dry_run] ? "Will not be changed" : "Not changed"
      say("#{action} - #{file_path}", :blue) if !options[:silent]
    end
  end
def interpolate ( file_path , options = { } ) template = File . read ( file_path ) template = LinkGenerator . remove_link_footers ( template ) new_content = template . clone sections = new_content . scan ( / <!-- START: (.*) --> / ) . flatten sections . each do | section | section_content = send ( section ) . strip content = <<~EOF 
        <!-- START:  #{ section }  -->
        <!-- ----------------------------------------------------------------- -->
        <!-- DO NOT MODIFY! This section is generated from the /.metadata.toml -->
        <!-- via `make generate-docs`. See /DOCUMENTING.md for more info.      -->

         #{ section_content } 

        <!-- ----------------------------------------------------------------- -->
        <!-- END:  #{ section }  -->
         EOF content . strip! new_content . gsub! ( / <!-- START:  #{ section }  -->(.*)<!-- END:  #{ section }  --> /m , content ) end new_content = normalize ( new_content ) if template . strip != new_content . strip File . write ( file_path , new_content ) if ! options [ :dry_run ] action = options [ :dry_run ] ? "Will be changed" : "Changed" say ( "#{action} - #{file_path}" , :green ) if ! options [ :silent ] else action = options [ :dry_run ] ? "Will not be changed" : "Not changed" say ( "#{action} - #{file_path}" , :blue ) if ! options [ :silent ] end end
Interpolates an existing documentation file, parsing out the section
directives and replacing them with updated generated content.
Interpolates an existing documentation file parsing out the section directives and replacing them with updated generated content .
file_path
options