lib/erbook/document.rb
# Data from the format specification file.
Data from the format specification file.
Data from the format specification file .
def load_format format_name
      @format_file = format_name.to_s
      File.file? @format_file or
        @format_file = File.join(ERBook::FORMATS_DIR, @format_file + '.yaml')
      begin
        @format = YAML.load_file(@format_file)
        @format[:file] = File.expand_path(@format_file)
        @format[:name] = File.basename(@format_file).sub(/\..*?$/, '')
        if @format.key? 'code'
          eval @format['code'].to_s, TOPLEVEL_BINDING, "#{@format_file}:code"
        end
      rescue Exception
        error "Could not load format specification file #{@format_file.inspect}"
      end
      @node_defs = @format['nodes']
    end
def load_format format_name @format_file = format_name . to_s File . file? @format_file or @format_file = File . join ( ERBook :: FORMATS_DIR , @format_file + '.yaml' ) begin @format = YAML . load_file ( @format_file ) @format [ :file ] = File . expand_path ( @format_file ) @format [ :name ] = File . basename ( @format_file ) . sub ( / \. .*?$ / , '' ) if @format . key? 'code' eval @format [ 'code' ] . to_s , TOPLEVEL_BINDING , "#{@format_file}:code" end rescue Exception error "Could not load format specification file #{@format_file.inspect}" end @node_defs = @format [ 'nodes' ] end
Data from the format specification file.
Data from the format specification file .
format_name