You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: html_file.rb
    path of file: ./repos/nesta/lib/nesta/static
    
    the code of the file until where you have to start completion: module Nesta
  module Static
    class HtmlFile
      def initialize(build_dir, page)
        @build_dir = build_dir
        @content_path = page.filename
      end

      def page_shares_path_with_directory?(dir, base_without_ext)
        Dir.exist?(File.join(dir, base_without_ext))
      end

      def filename
       
    
      def filename
        dir, base = File.split(@content_path)
        base_without_ext = File.basename(base, File.extname(base))
        subdir = dir.sub(/^#{Nesta::Config.page_path}/, '')
        path = File.join(@build_dir, subdir, base_without_ext)
        if page_shares_path_with_directory?(dir, base_without_ext)
          File.join(path, 'index.html')
        else
          path + '.html'
        end