def read
      @metadata = {}
      @content = File.read(path)

      if @content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
        @content = $POSTMATCH

        begin
          @metadata = YAML.load($1)
          raise unless @metadata.is_a? Hash
        rescue => ex
          $stderr.puts "#{File.basename($PROGRAM_NAME)}: #{ex.to_s}"
          $stderr.puts "WARNING: Couldn't load metadata."
          @metadata = {}
        end

        @metadata.symbolize_keys!
        import_metadata
      end
    end
def read
      @metadata = {}
      @content = File.read(path)

      if @content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
        @content = $POSTMATCH

        begin
          @metadata = YAML.load($1)
          raise unless @metadata.is_a? Hash
        rescue => ex
          $stderr.puts "#{File.basename($PROGRAM_NAME)}: #{ex.to_s}"
          $stderr.puts "WARNING: Couldn't load metadata."
          @metadata = {}
        end

        @metadata.symbolize_keys!
        import_metadata
      end
    end
Adapted from `jekyll/convertible.rb` with thanks to Tom Preston-Werner.