Beispiel #1
0
 def on_init(self,
             config,
             doc_src_path,
             site_config,
             logger=None,
             multiprocess=True,
             **kw_args):
     '''
         @config a dict object
         @logger teedoc.logger.Logger object
     '''
     self.multiprocess = multiprocess
     self.logger = Fake_Logger() if not logger else logger
     self.doc_src_path = doc_src_path
     self.site_config = site_config
     self.config = Plugin.defautl_config
     mathjax_config = self.config["mathjax"]
     if "mathjax" in config:
         for k, v in config["mathjax"].items():
             if type(v) != dict:
                 mathjax_config[k] = v
             else:
                 mathjax_config[k].update(v)
     self.config.update(config)
     self.config["mathjax"] = mathjax_config
     self.logger.i("-- plugin <{}> init".format(self.name))
     self.logger.i("-- plugin <{}> config: {}".format(
         self.name, self.config))
     if not self.multiprocess:
         from .renderer import create_markdown_parser
         from .parse_metadata import Meta_Parser
         self.create_markdown_parser = create_markdown_parser
         self.Meta_Parser = Meta_Parser
Beispiel #2
0
    def on_init(self,
                config,
                doc_src_path,
                site_config,
                logger=None,
                multiprocess=True,
                **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        self.html_header_items = []

        # set site_root_url env value
        if not "id" in config:
            self.logger.e('can not find config["id"] in plugin {}'.format(
                self.name))
            return
        code_raw = '''    <script async src="https://www.googletagmanager.com/gtag/js?id={}"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){{dataLayer.push(arguments);}}
      gtag('js', new Date());
  
      gtag('config', '{}');
    </script>'''.format(config["id"], config["id"])
        self.html_header_items = [code_raw]
Beispiel #3
0
    def on_init(self, config, doc_src_path, site_config, logger = None, multiprocess = True, **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(self.name, self.config))
        
        # set site_root_url env value
        if not "code" in config:
            self.logger.e('can not find config["code"] in plugin {}'.format(self.name))
            return
        baidu_tongji_code = '''<script>
var _hmt = _hmt || [];
(function() {{
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?{}";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
}})();
</script>'''.format(config["code"])
        self.html_header_items = [baidu_tongji_code]
Beispiel #4
0
 def __init__(self, config, doc_src_path, site_config, logger=None):
     '''
         @config a dict object
         @logger teedoc.logger.Logger object
     '''
     self.logger = Fake_Logger() if not logger else logger
     self.doc_src_path = doc_src_path
     self.site_config = site_config
     self.config = Plugin.defautl_config
     self.config.update(config)
     self.logger.i("-- plugin <{}> init".format(self.name))
     self.logger.i("-- plugin <{}> config: {}".format(
         self.name, self.config))
     self._extention = {
         "toc": {
             "depth": config["toc_depth"] if "toc_depth" in config else 3
         },
         "metadata": None,
         "fenced-code-blocks": None,
         "highlightjs-lang": None,
         "break-on-newline": None,
         "code-friendly": None,
         "cuddled-lists": None,
         "footnotes": None,
         "strike": None,
         "spoiler": None,
         "tables": None,
         "task_list": None
     }
Beispiel #5
0
    def __init__(self, config, doc_src_path, site_config, logger=None):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        self.assets_abs_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "assets")
        self.temp_dir = os.path.join(tempfile.gettempdir(),
                                     "teedoc_plugin_search")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)

        self.css = {
            "/static/css/search/style.css":
            os.path.join(self.assets_abs_path, "style.css"),
        }
        self.footer_js = {
            "/static/js/search/main.js":
            os.path.join(self.assets_abs_path, "main.js")
        }
        self.images = {
            "/static/image/search/close.svg":
            os.path.join(self.assets_abs_path, "close.svg"),
            "/static/image/search/search.svg":
            os.path.join(self.assets_abs_path, "search.svg"),
        }

        # set site_root_url env value
        if not "env" in config:
            config['env'] = {}
        config['env']["site_root_url"] = self.site_config["site_root_url"]
        # replace variable in css with value
        vars = config["env"]
        self.css = self._update_file_var(self.css, vars, self.temp_dir)
        self.footer_js = self._update_file_var(self.footer_js, vars,
                                               self.temp_dir)
        # files to copy
        self.html_header_items = self._generate_html_header_items()
        self.files_to_copy = {}
        self.files_to_copy.update(self.css)
        self.files_to_copy.update(self.footer_js)
        self.files_to_copy.update(self.images)

        self.html_js_items = self._generate_html_js_items()
        self.content = {"articles": {}, "pages": {}}
Beispiel #6
0
 def on_init(self, config, doc_src_path, site_config, logger = None, multiprocess = True, **kw_args):
     '''
         @config a dict object
         @logger teedoc.logger.Logger object
     '''
     self.logger = Fake_Logger() if not logger else logger
     self.doc_src_path = doc_src_path
     self.site_config = site_config
     self.config = Plugin.defautl_config
     self.config.update(config)
     self.logger.i("-- plugin <{}> init".format(self.name))
     self.logger.i("-- plugin <{}> config: {}".format(self.name, self.config))
Beispiel #7
0
 def on_init(self,
             config,
             doc_src_path,
             site_config,
             logger=None,
             multiprocess=True,
             **kw_args):
     '''
         @config a dict object
         @logger teedoc.logger.Logger object
     '''
     self.multiprocess = multiprocess
     self.logger = Fake_Logger() if not logger else logger
     self.doc_src_path = doc_src_path
     self.site_config = site_config
     self.config = Plugin.defautl_config
     self.config.update(config)
     self.logger.i("-- plugin <{}> init".format(self.name))
     self.logger.i("-- plugin <{}> config: {}".format(
         self.name, self.config))
     self.temp_dir = os.path.join(tempfile.gettempdir(),
                                  "teedoc_plugin_blog")
     if os.path.exists(self.temp_dir):
         shutil.rmtree(self.temp_dir)
     os.makedirs(self.temp_dir)
     self.assets_abs_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)), "assets")
     self.assets = {
         "/static/js/plugin_blog/main.js":
         os.path.join(self.assets_abs_path, "main.js"),
     }
     vars = {"site_root_url": self.site_config["site_root_url"]}
     self.assets = self._update_file_var(self.assets, vars, self.temp_dir)
     self.files_to_copy = self.assets.copy()  # must use copy
     blog_url = list(self.site_config["route"]["blog"].keys())
     if len(blog_url) > 1:
         self.logger.e("only support one blog url path")
         raise Exception("only support one blog url path")
     self.blog_url = blog_url[0]
     self.blog_dir = os.path.join(
         self.doc_src_path,
         self.site_config["route"]["blog"][self.blog_url]).replace(
             "\\", "/")
     self.index_content = {"items": {}}
Beispiel #8
0
    def on_init(self,
                config,
                doc_src_path,
                site_config,
                logger=None,
                multiprocess=True,
                **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        self.module_path = os.path.abspath(
            os.path.dirname(os.path.abspath(__file__)))
        self.assets_abs_path = os.path.join(self.module_path, "assets")
        self.temp_dir = self.get_temp_dir()

        self.footer_js = {
            # don't use ad(advertisement) keyword, may blocked by browser plugin
            "/static/js/add_hint/style.css":
            os.path.join(self.assets_abs_path, "style.css"),
            "/static/js/add_hint/main.js":
            os.path.join(self.assets_abs_path, "main.js")
        }
        self.html_footer_items = []
        for url in self.footer_js:
            if url.endswith(".css"):
                item = '<link rel="stylesheet" href="{}" type="text/css"/>'.format(
                    url)
            else:
                item = '<script src="{}"></script>'.format(url)
            self.html_footer_items.append(item)
        vars = self.config
        self.footer_js = self.update_file_var(self.footer_js, vars,
                                              self.temp_dir)
        self.files_to_copy = self.footer_js
Beispiel #9
0
 def on_init(self,
             config,
             doc_src_path,
             site_config,
             logger=None,
             multiprocess=True,
             **kw_args):
     '''
         @config a dict object
         @logger teedoc.logger.Logger object
     '''
     self.logger = Fake_Logger() if not logger else logger
     self.doc_src_path = doc_src_path
     self.site_config = site_config
     self.config = Plugin.defautl_config
     self.config.update(config)
     self.logger.i("-- plugin <{}> init".format(self.name))
     self.logger.i("-- plugin <{}> config: {}".format(
         self.name, self.config))
     self.module_path = os.path.abspath(
         os.path.dirname(os.path.abspath(__file__)))
     self.assets_abs_path = os.path.join(self.module_path, "assets")
Beispiel #10
0
    def on_init(self,
                config,
                doc_src_path,
                site_config,
                logger=None,
                multiprocess=True,
                **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        # check config
        for key in self.config["env"]:
            if not key in config["env"]:
                self.logger.e(
                    'you MUST set env var "{}" for gitalk plugin in site_config'
                    .format(key))
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        self.assets_abs_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "assets")

        self.files_to_copy = {
            "/static/js/gitalk/gitalk.min.js":
            os.path.join(self.assets_abs_path, "gitalk.min.js"),
            "/static/js/gitalk/main.js":
            os.path.join(self.assets_abs_path, "main.js"),
            "/static/css/gitalk/gitalk.css":
            os.path.join(self.assets_abs_path, "gitalk.css")
        }
        self.html_header_items = [
            '<link rel="stylesheet" href="{}" type="text/css"/>'.format(
                "/static/css/gitalk/gitalk.css"),
        ]
        self.html_js_items = [
            '<script src="{}"></script>'.format(
                "/static/js/gitalk/gitalk.min.js"),
            '<script src="{}"></script>'.format("/static/js/gitalk/main.js")
        ]

        self.temp_dir = os.path.join(tempfile.gettempdir(),
                                     "teedoc_plugin_comments_gitalk")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)

        # custom main color
        custom_color_vars = {}
        if "main_color" in self.config["env"]:
            self.logger.i("-- plugin <{}> get main_color {}".format(
                self.name, self.config["env"]["main_color"]))
            self.html_header_items.append(
                '<link rel="stylesheet" href="{}" type="text/css"/>'.format(
                    "/static/css/gitalk/custom_gitalk.css"))
            self.files_to_copy[
                "/static/css/gitalk/custom_gitalk.css"] = os.path.join(
                    self.assets_abs_path, "custom_gitalk.css")
            # remove color vars from env, for env used by js
            if not "second_color" in self.config["env"]:
                self.config["env"]["second_color"] = self.config["env"][
                    "main_color"]
            custom_color_vars["main_color"] = self.config["env"]["main_color"]
            custom_color_vars["second_color"] = self.config["env"][
                "second_color"]
            self.config["env"].pop("main_color")
            self.config["env"].pop("second_color")
        else:
            self.logger.i("-- plugin <{}> use default color")
        vars = {
            "comment_contrainer_id": self.config["contrainer"],
            "config": json.dumps(self.config["env"])
        }
        vars.update(custom_color_vars)
        self.files_to_copy = self._update_file_var(self.files_to_copy, vars,
                                                   self.temp_dir)
Beispiel #11
0
    def on_init(self, config, doc_src_path, site_config, logger = None, multiprocess = True, **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        # check config
        for key in self.config["env"]:
            if not key in config["env"]:
                self.logger.e('you MUST set env var "{}" for gitalk plugin in site_config'.format(key))
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(self.name, self.config))

        self.files_to_copy = {}
        self.html_header_items = []
        self.html_footer_items = []
        for item in self.config["header_items"]:
            if item.startswith("/"):
                path = os.path.join(self.doc_src_path, item[1:])
                if os.path.exists(path):
                    if path.endswith(".js"):
                        self.html_header_items.append(f'<script src="{item}"></script>')
                        self.files_to_copy[item] = path
                    elif path.endswith(".css"):
                        self.html_header_items.append(f'<link rel="stylesheet" href="{item}" type="text/css"/>')
                        self.files_to_copy[item] = path
                    else:
                        self.logger.e(f"config: url {item} not support! you can use html tag instead")
                else:
                    self.logger.e(f"config: url {item} wrong, file {path} no found ")
            else:
                self.html_header_items.append(item)
        for item in self.config["footer_items"]:
            if item.startswith("/"):
                path = os.path.join(self.doc_src_path, item[1:])
                if os.path.exists(path):
                    if path.endswith(".js"):
                        self.html_footer_items.append(f'<script src="{item}"></script>')
                        self.files_to_copy[item] = path
                    elif path.endswith(".css"):
                        self.html_footer_items.append(f'<link rel="stylesheet" href="{item}" type="text/css"/>')
                        self.files_to_copy[item] = path
                    else:
                        self.logger.e(f"config: url {item} not support! you can use html tag instead")
                else:
                    self.logger.e(f"config: url {item} wrong, file {path} no found ")
            elif item.startswith("http"):
                if item.endswith(".js"):
                    self.html_footer_items.append(f'<script src="{item}"></script>')
                elif item.endswith(".css"):
                    self.html_footer_items.append(f'<link rel="stylesheet" href="{item}" type="text/css"/>')
                else:
                    self.logger.e(f"config: url {item} not support! you can use html tag instead")
            else:
                self.html_footer_items.append(item)

        self.temp_dir = os.path.join(tempfile.gettempdir(), "teedoc_plugin_assets")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)
            
        self.files_to_copy  = self._update_file_var(self.files_to_copy, self.config["env"], self.temp_dir)
Beispiel #12
0
    def on_init(self,
                config,
                doc_src_path,
                site_config,
                logger=None,
                multiprocess=True,
                **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        if not self.config["content_type"] in self.supported_content_type:
            self.logger.e(
                "-- plugin <{}> config content_type error: {}, should be in {}"
                .format(self.name, self.config["content_type"],
                        self.supported_content_type))
        if self.config["content_type"] == "raw":
            self.content_from = "raw"
        else:
            self.content_from = "body"
        self.module_path = os.path.abspath(
            os.path.dirname(os.path.abspath(__file__)))
        self.assets_abs_path = os.path.join(self.module_path, "assets")
        self.temp_dir = os.path.join(tempfile.gettempdir(),
                                     "teedoc_plugin_search")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)

        self.css = {
            "/static/css/search/style.css":
            os.path.join(self.assets_abs_path, "style.css"),
        }
        self.footer_js = {
            "/static/js/search/search_main.js":
            os.path.join(self.assets_abs_path, "search_main.js")
        }
        self.images = {
            "/static/image/search/close.svg":
            os.path.join(self.assets_abs_path, "close.svg"),
            "/static/image/search/search.svg":
            os.path.join(self.assets_abs_path, "search.svg"),
        }

        # set site_root_url env value
        if not "env" in self.config:
            self.config['env'] = {}
        self.config['env']["site_root_url"] = self.site_config["site_root_url"]
        # replace variable in css with value
        vars = self.config["env"]
        self.css = self._update_file_var(self.css, vars, self.temp_dir)
        self.footer_js = self._update_file_var(self.footer_js, vars,
                                               self.temp_dir)
        # files to copy
        self.html_header_items = self._generate_html_header_items()
        self.files_to_copy = {}
        self.files_to_copy.update(self.css)
        self.files_to_copy.update(self.footer_js)
        self.files_to_copy.update(self.images)

        self.html_js_items = self._generate_html_js_items()
        self.content = {"articles": {}, "pages": {}}
        self.docs_name = {}
Beispiel #13
0
    def __init__(self, config, doc_src_path, site_config, logger = None):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        self.config.update(config)
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(self.name, self.config))
        self.assets_abs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets")

        self.dark_css  = {
            "/static/css/theme_default/dark.css": os.path.join(self.assets_abs_path, "dark.css")
        }
        self.light_css = {
            "/static/css/theme_default/light.css": os.path.join(self.assets_abs_path, "light.css")
        }
        self.css = {
            "/static/css/theme_default/prism.min.css": os.path.join(self.assets_abs_path, "prism.min.css"),
        }
        # js files
        self.dark_js = {

        }
        self.light_js = {
        }
        self.header_js = {
            "/static/js/theme_default/jquery.min.js": os.path.join(self.assets_abs_path, "jquery.min.js"),
            "/static/js/theme_default/pre_main.js": os.path.join(self.assets_abs_path, "pre_main.js")
        }
        self.footer_js = {
            "/static/js/theme_default/main.js": os.path.join(self.assets_abs_path, "main.js"),
            "/static/css/theme_default/prism.min.js": os.path.join(self.assets_abs_path, "prism.min.js")
        }
        self.images = {
            "/static/image/theme_default/indicator.svg": os.path.join(self.assets_abs_path, "indicator.svg"),
            "/static/image/theme_default/menu.svg": os.path.join(self.assets_abs_path, "menu.svg"),
            "/static/image/theme_default/to-top.svg": os.path.join(self.assets_abs_path, "to-top.svg"),
            "/static/image/theme_default/light_mode.svg": os.path.join(self.assets_abs_path, "light_mode.svg"),
            "/static/image/theme_default/dark_mode.svg": os.path.join(self.assets_abs_path, "dark_mode.svg")
        }
        # set site_root_url env value
        if not "env" in config:
            config['env'] = {}
        config['env']["site_root_url"] = self.site_config["site_root_url"]
        # replace variable in css with value
        vars = config["env"]
        self.temp_dir = os.path.join(tempfile.gettempdir(), "teedoc_plugin_theme_default")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)
        self.dark_css  = self._update_file_var(self.dark_css, vars, self.temp_dir)
        self.light_css = self._update_file_var(self.light_css, vars, self.temp_dir)
        self.css       = self._update_file_var(self.css, vars, self.temp_dir)
        self.header_js = self._update_file_var(self.header_js, vars, self.temp_dir)
        # files to copy
        self.html_header_items = self._generate_html_header_items()
        self.files_to_copy = {}
        if self.config["dark"]:
            self.files_to_copy.update(self.dark_css)
            self.files_to_copy.update(self.dark_js)
        self.files_to_copy.update(self.light_css)
        self.files_to_copy.update(self.css)
        self.files_to_copy.update(self.light_js)
        self.files_to_copy.update(self.header_js)
        self.files_to_copy.update(self.footer_js)
        self.files_to_copy.update(self.images)
        if self.config["dark"]:
            self.themes_btn = '<a id="themes" class="light"></a>'
        else:
            self.themes_btn = ""

        self.html_js_items = self._generate_html_js_items()
Beispiel #14
0
    def on_init(self,
                config,
                doc_src_path,
                site_config,
                logger=None,
                multiprocess=True,
                **kw_args):
        '''
            @config a dict object
            @logger teedoc.logger.Logger object
        '''
        self.logger = Fake_Logger() if not logger else logger
        self.doc_src_path = doc_src_path
        self.site_config = site_config
        self.config = Plugin.defautl_config
        env = self.config["env"]
        if "env" in config:
            env.update(config["env"])
        self.config.update(config)
        self.config["env"] = env
        if self.config["mobile_navbar_collapsed"]:
            self.config["env"]["mobile_navbar_collapsed"] = "none"
        else:
            self.config["env"]["mobile_navbar_collapsed"] = "block"
        if self.config["dark"] and self.config["default_dark"]:
            self.config["env"]["default_theme"] = "dark"
        else:
            self.config["env"]["default_theme"] = "light"
        if self.config["show_print_page"]:
            self.config["env"]["show_print_page"] = "true"
        else:
            self.config["env"]["show_print_page"] = "false"
        self.logger.i("-- plugin <{}> init".format(self.name))
        self.logger.i("-- plugin <{}> config: {}".format(
            self.name, self.config))
        self.assets_abs_path = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), "assets")

        self.dark_css = {
            "/static/css/theme_default/dark.css":
            os.path.join(self.assets_abs_path, "dark.css")
        }
        self.light_css = {
            "/static/css/theme_default/light.css":
            os.path.join(self.assets_abs_path, "light.css")
        }
        # code hilight css file
        if "code_highlight_css" in self.config and self.config[
                "code_highlight_css"]:
            self.css = {}
            self.code_highlight_css = self.config["code_highlight_css"]
        else:
            self.code_highlight_css = None
            self.css = {
                "/static/css/theme_default/prism.min.css":
                os.path.join(self.assets_abs_path, "prism.min.css"),
            }
        # image viewer
        self.css["/static/css/theme_default/viewer.min.css"] = os.path.join(
            self.assets_abs_path, "viewer.min.css")
        # js files
        self.dark_js = {}
        self.light_js = {}
        self.header_js = {
            "/static/js/theme_default/split.js":
            os.path.join(self.assets_abs_path, "split.js"),
            "/static/js/theme_default/jquery.min.js":
            os.path.join(self.assets_abs_path, "jquery.min.js"),
            "/static/js/theme_default/pre_main.js":
            os.path.join(self.assets_abs_path, "pre_main.js")
        }
        self.footer_js = {
            "/static/js/theme_default/tocbot.min.js":
            os.path.join(self.assets_abs_path, "tocbot.min.js"),
            "/static/js/theme_default/main.js":
            os.path.join(self.assets_abs_path, "main.js"),
            "/static/js/theme_default/viewer.min.js":
            os.path.join(self.assets_abs_path, "viewer.min.js")
        }
        # code hilight js file
        if "code_highlight_js" in self.config and self.config[
                "code_highlight_js"]:
            self.code_highlight_js = self.config["code_highlight_js"]
        else:
            self.code_highlight_js = None
            self.footer_js[
                "/static/css/theme_default/prism.min.js"] = os.path.join(
                    self.assets_abs_path, "prism.min.js")
        self.images = {
            "/static/image/theme_default/indicator.svg":
            os.path.join(self.assets_abs_path, "indicator.svg"),
            "/static/image/theme_default/menu.svg":
            os.path.join(self.assets_abs_path, "menu.svg"),
            "/static/image/theme_default/to-top.svg":
            os.path.join(self.assets_abs_path, "to-top.svg"),
            "/static/image/theme_default/light_mode.svg":
            os.path.join(self.assets_abs_path, "light_mode.svg"),
            "/static/image/theme_default/dark_mode.svg":
            os.path.join(self.assets_abs_path, "dark_mode.svg"),
            "/static/image/theme_default/print.svg":
            os.path.join(self.assets_abs_path, "print.svg")
        }
        # set site_root_url env value
        self.config['env']["site_root_url"] = self.site_config["site_root_url"]
        # replace variable in css with value
        vars = self.config["env"]
        self.temp_dir = os.path.join(tempfile.gettempdir(),
                                     "teedoc_plugin_theme_default")
        if os.path.exists(self.temp_dir):
            shutil.rmtree(self.temp_dir)
        os.makedirs(self.temp_dir)
        self.dark_css = self._update_file_var(self.dark_css, vars,
                                              self.temp_dir)
        self.light_css = self._update_file_var(self.light_css, vars,
                                               self.temp_dir)
        self.css = self._update_file_var(self.css, vars, self.temp_dir)
        self.header_js = self._update_file_var(self.header_js, vars,
                                               self.temp_dir)
        self.footer_js = self._update_file_var(self.footer_js, vars,
                                               self.temp_dir)
        # files to copy
        self.html_header_items = self._generate_html_header_items()
        self.files_to_copy = {}
        if self.config["dark"]:
            self.files_to_copy.update(self.dark_css)
            self.files_to_copy.update(self.dark_js)
        self.files_to_copy.update(self.light_css)
        self.files_to_copy.update(self.css)
        self.files_to_copy.update(self.light_js)
        self.files_to_copy.update(self.header_js)
        self.files_to_copy.update(self.footer_js)
        self.files_to_copy.update(self.images)
        if self.config["dark"]:
            self.themes_btn = '<a id="themes" class="light"></a>'
        else:
            self.themes_btn = ""

        self.html_js_items = self._generate_html_js_items()