def init_templates(self) -> None: theme_factory = HTMLThemeFactory(self.app) themename, themeoptions = self.get_theme_config() self.theme = theme_factory.create(themename) self.theme_options = themeoptions.copy() self.create_template_bridge() self.templates.init(self, self.theme)
def apply_theme(self, themename, themeoptions): """Apply a new theme to the document. This will store the existing theme configuration and apply a new one. """ # push the existing values onto the Stack self._theme_stack.append((self.theme, self.theme_options)) theme_factory = HTMLThemeFactory(self.app) theme_factory.load_additional_themes(self.get_builtin_theme_dirs() + self.config.slide_theme_path) self.theme = theme_factory.create(themename) self.theme_options = themeoptions.copy() self.templates.init(self, self.theme) self.templates.environment.filters['json'] = json.dumps if self.theme not in self._additional_themes: self._additional_themes.append(self.theme)
def init(self): # type: () -> None self.create_template_bridge() theme_factory = HTMLThemeFactory(self.app) self.theme = theme_factory.create('default') self.templates.init(self, self.theme)