gititConfigFromConf :: Conf -> IO GititConfig
gititConfigFromConf conf = do
  mimes <- case cfg_mime_types_file conf of
                Nothing -> return mimeTypes
                Just f  -> readMimeTypesFile f

  format <- case readPageFormat (cfg_default_format conf) of
                  Just f  -> return f
                  Nothing -> err 11 $ "Unknown default format: " ++
                                   T.unpack (cfg_default_format conf)

  let gconfig = GititConfig{ mime_types = mimes
                           , default_format = format
                           , repository_path = cfg_repository_path conf
                           , page_extension = cfg_page_extension conf
                           , static_path = cfg_static_dir conf
                           , use_mathjax = cfg_use_mathjax conf
                           , feed_days  = cfg_feed_days conf
                           , feed_minutes  = cfg_feed_minutes conf
                           , pandoc_user_data = cfg_pandoc_user_data conf
                           , use_cache = cfg_use_cache conf
                           , cache_dir = cfg_cache_dir conf
                           , front_page = cfg_front_page conf
                           , help_page = cfg_help_page conf
                           , latex_engine = cfg_latex_engine conf
                           }
  return gconfig
gititConfigFromConf :: Conf -> IO GititConfig
gititConfigFromConf conf = do
  mimes <- case cfg_mime_types_file conf of
                Nothing -> return mimeTypes
                Just f  -> readMimeTypesFile f

  format <- case readPageFormat (cfg_default_format conf) of
                  Just f  -> return f
                  Nothing -> err 11 $ "Unknown default format: " ++
                                   T.unpack (cfg_default_format conf)

  let gconfig = GititConfig{ mime_types = mimes
                           , default_format = format
                           , repository_path = cfg_repository_path conf
                           , page_extension = cfg_page_extension conf
                           , static_path = cfg_static_dir conf
                           , use_mathjax = cfg_use_mathjax conf
                           , feed_days  = cfg_feed_days conf
                           , feed_minutes  = cfg_feed_minutes conf
                           , pandoc_user_data = cfg_pandoc_user_data conf
                           , use_cache = cfg_use_cache conf
                           , cache_dir = cfg_cache_dir conf
                           , front_page = cfg_front_page conf
                           , help_page = cfg_help_page conf
                           , latex_engine = cfg_latex_engine conf
                           }
  return gconfig
gititConfigFromConf conf = do
  mimes <- case cfg_mime_types_file conf of
                Nothing -> return mimeTypes
                Just f  -> readMimeTypesFile f

  format <- case readPageFormat (cfg_default_format conf) of
                  Just f  -> return f
                  Nothing -> err 11 $ "Unknown default format: " ++
                                   T.unpack (cfg_default_format conf)

  let gconfig = GititConfig{ mime_types = mimes
                           , default_format = format
                           , repository_path = cfg_repository_path conf
                           , page_extension = cfg_page_extension conf
                           , static_path = cfg_static_dir conf
                           , use_mathjax = cfg_use_mathjax conf
                           , feed_days  = cfg_feed_days conf
                           , feed_minutes  = cfg_feed_minutes conf
                           , pandoc_user_data = cfg_pandoc_user_data conf
                           , use_cache = cfg_use_cache conf
                           , cache_dir = cfg_cache_dir conf
                           , front_page = cfg_front_page conf
                           , help_page = cfg_help_page conf
                           , latex_engine = cfg_latex_engine conf
                           }
  return gconfig