• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.config_changed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nikola.utils.config_changed函数的典型用法代码示例。如果您正苦于以下问题:Python config_changed函数的具体用法?Python config_changed怎么用?Python config_changed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了config_changed函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: gen_tasks

    def gen_tasks(self):
        """Generate Windows Live Tiles and notifications."""
        kw = {
            "default_lang": self.site.config["DEFAULT_LANG"],
            "site_url": self.site.config["BASE_URL"],
            "output_folder": self.site.config["OUTPUT_FOLDER"],
            "show_untranslated_posts": self.site.config["SHOW_UNTRANSLATED_POSTS"],
            "windows_live_tiles": self.site.config["WINDOWS_LIVE_TILES"],
        }

        msapplication_assets = os.path.join(kw["output_folder"], "assets", "msapplication")
        if not os.path.exists(msapplication_assets):
            os.makedirs(msapplication_assets)

        self.site.scan_posts()
        yield self.group_task()

        deps = []
        if kw["show_untranslated_posts"]:
            posts = self.site.posts[:5]
        else:
            posts = [x for x in self.site.posts if x.is_translation_available(kw["default_lang"])][:5]
        for post in posts:
            deps += post.deps(kw["default_lang"])

        for i, post in zip(range(len(posts)), posts):
            notification_deps = post.deps(kw["default_lang"])
            output_name = os.path.join(msapplication_assets, "tile_notification" + str(i + 1) + ".xml")
            titles = {
                "maintitle": post.title(kw["default_lang"]),
                "title1": posts[0].title(kw["default_lang"]),
                "title2": posts[1].title(kw["default_lang"]),
                "title3": posts[2].title(kw["default_lang"])
            }

            yield {
                "basename": "windows_live_tiles",
                "name": os.path.normpath(output_name),
                "file_dep": notification_deps,
                "targets": [output_name],
                "actions": [(self.generate_notification_tile, (output_name, kw["default_lang"], kw["windows_live_tiles"]["tileimages"], titles, post.meta[kw["default_lang"]]["previewimage"]))],
                "task_dep": ["render_posts"],
                "clean": True,
                "uptodate": [utils.config_changed(kw)],
            }

        browserconfig_output_name = os.path.join(kw["output_folder"], "browserconfig.xml")
        yield {
            "basename": "windows_live_tiles",
            "name": os.path.normpath(browserconfig_output_name),
            "file_dep": deps,
            "targets": [browserconfig_output_name],
            "actions": [(self.generate_browserconfig,
                        (browserconfig_output_name, kw["windows_live_tiles"],
                         len(posts)))],

            "task_dep": ["render_posts"],
            "clean": True,
            "uptodate": [utils.config_changed(kw)],
        }
开发者ID:dwilliams,项目名称:plugins,代码行数:60,代码来源:windows_live_tiles.py


示例2: remove_excluded_image

    def remove_excluded_image(self, img):
        # Remove excluded images
        # img is something like galleries/demo/tesla2_lg.jpg so it's the *source* path
        # and we should remove both the large and thumbnail *destination* paths

        img = os.path.relpath(img, self.kw['gallery_path'])
        output_folder = os.path.dirname(
            os.path.join(
                self.kw["output_folder"],
                self.site.path("gallery", os.path.dirname(img))))
        img_path = os.path.join(output_folder, os.path.basename(img))
        fname, ext = os.path.splitext(img_path)
        thumb_path = fname + '.thumbnail' + ext

        yield utils.apply_filters({
            'basename': '_render_galleries_clean',
            'name': thumb_path,
            'actions': [
                (utils.remove_file, (thumb_path,))
            ],
            'clean': True,
            'uptodate': [utils.config_changed(self.kw)],
        }, self.kw['filters'])

        yield utils.apply_filters({
            'basename': '_render_galleries_clean',
            'name': img_path,
            'actions': [
                (utils.remove_file, (img_path,))
            ],
            'clean': True,
            'uptodate': [utils.config_changed(self.kw)],
        }, self.kw['filters'])
开发者ID:Liessae,项目名称:nikola,代码行数:33,代码来源:galleries.py


示例3: remove_excluded_image

    def remove_excluded_image(self, img, input_folder):
        # Remove excluded images
        # img is something like input_folder/demo/tesla2_lg.jpg so it's the *source* path
        # and we should remove both the large and thumbnail *destination* paths

        output_folder = os.path.dirname(
            os.path.join(self.kw["output_folder"], self.site.path("gallery", os.path.dirname(img)))
        )
        img = os.path.relpath(img, input_folder)
        img_path = os.path.join(output_folder, os.path.basename(img))
        fname, ext = os.path.splitext(img_path)
        thumb_path = fname + ".thumbnail" + ext

        yield utils.apply_filters(
            {
                "basename": "_render_galleries_clean",
                "name": thumb_path,
                "actions": [(utils.remove_file, (thumb_path,))],
                "clean": True,
                "uptodate": [utils.config_changed(self.kw, "nikola.plugins.task.galleries:clean_thumb")],
            },
            self.kw["filters"],
        )

        yield utils.apply_filters(
            {
                "basename": "_render_galleries_clean",
                "name": img_path,
                "actions": [(utils.remove_file, (img_path,))],
                "clean": True,
                "uptodate": [utils.config_changed(self.kw, "nikola.plugins.task.galleries:clean_file")],
            },
            self.kw["filters"],
        )
开发者ID:mgaitan,项目名称:nikola,代码行数:34,代码来源:galleries.py


示例4: gen_tasks

    def gen_tasks(self):
        """Create tasks to copy the assets of the whole theme chain.

        If a file is present on two themes, use the version
        from the "youngest" theme.
        """

        kw = {
            "themes": self.site.THEMES,
            "output_folder": self.site.config['OUTPUT_FOLDER'],
            "filters": self.site.config['FILTERS'],
            "code_color_scheme": self.site.config['CODE_COLOR_SCHEME'],
        }
        flag = True
        has_code_css = False
        tasks = {}
        code_css_path = os.path.join(kw['output_folder'], 'assets', 'css', 'code.css')
        for theme_name in kw['themes']:
            src = os.path.join(utils.get_theme_path(theme_name), 'assets')
            dst = os.path.join(kw['output_folder'], 'assets')
            for task in utils.copy_tree(src, dst):
                if task['name'] in tasks:
                    continue
                if task['targets'][0] == code_css_path:
                    has_code_css = True
                tasks[task['name']] = task
                task['uptodate'] = [utils.config_changed(kw)]
                task['basename'] = self.name
                flag = False
                yield utils.apply_filters(task, kw['filters'])

        if flag:
            yield {
                'basename': self.name,
                'name': 'None',
                'uptodate': [True],
                'actions': [],
            }

        if not has_code_css:  # Generate it

            def create_code_css():
                from pygments.formatters import get_formatter_by_name
                formatter = get_formatter_by_name('html', style=kw["code_color_scheme"])
                utils.makedirs(os.path.dirname(code_css_path))
                with codecs.open(code_css_path, 'wb+', 'utf8') as outf:
                    outf.write(formatter.get_style_defs('.code'))
                    outf.write("table.codetable { width: 100%;} td.linenos {text-align: right; width: 4em;}")

            task = {
                'basename': self.name,
                'name': code_css_path,
                'targets': [code_css_path],
                'uptodate': [utils.config_changed(kw)],
                'actions': [(create_code_css, [])],
                'clean': True,
            }
            yield utils.apply_filters(task, kw['filters'])
开发者ID:emilopez,项目名称:nikola,代码行数:58,代码来源:copy_assets.py


示例5: gen_tasks

    def gen_tasks(self):
        """Create tasks to copy the assets of the whole theme chain.

        If a file is present on two themes, use the version
        from the "youngest" theme.
        """

        kw = {
            "themes": self.site.THEMES,
            "output_folder": self.site.config["OUTPUT_FOLDER"],
            "filters": self.site.config["FILTERS"],
            "code_color_scheme": self.site.config["CODE_COLOR_SCHEME"],
        }
        has_code_css = False
        tasks = {}
        code_css_path = os.path.join(kw["output_folder"], "assets", "css", "code.css")

        yield self.group_task()

        for theme_name in kw["themes"]:
            src = os.path.join(utils.get_theme_path(theme_name), "assets")
            dst = os.path.join(kw["output_folder"], "assets")
            for task in utils.copy_tree(src, dst):
                if task["name"] in tasks:
                    continue
                if task["targets"][0] == code_css_path:
                    has_code_css = True
                tasks[task["name"]] = task
                task["uptodate"] = [utils.config_changed(kw)]
                task["basename"] = self.name
                yield utils.apply_filters(task, kw["filters"])

        if not has_code_css:  # Generate it

            def create_code_css():
                from pygments.formatters import get_formatter_by_name

                formatter = get_formatter_by_name("html", style=kw["code_color_scheme"])
                utils.makedirs(os.path.dirname(code_css_path))
                with codecs.open(code_css_path, "wb+", "utf8") as outf:
                    outf.write(formatter.get_style_defs(["pre.code", "div.code pre"]))
                    outf.write("\ntable.codetable { width: 100%;} td.linenos {text-align: right; width: 4em;}\n")

            task = {
                "basename": self.name,
                "name": code_css_path,
                "targets": [code_css_path],
                "uptodate": [utils.config_changed(kw)],
                "actions": [(create_code_css, [])],
                "clean": True,
            }
            yield utils.apply_filters(task, kw["filters"])
开发者ID:jonhedson,项目名称:nikola,代码行数:52,代码来源:copy_assets.py


示例6: create_target_images

    def create_target_images(self, img, input_path):
        """Copy images to output."""
        gallery_name = os.path.dirname(img)
        output_gallery = os.path.dirname(
            os.path.join(
                self.kw["output_folder"],
                self.site.path("gallery_global", gallery_name)))
        # Do thumbnails and copy originals
        # img is "galleries/name/image_name.jpg"
        # img_name is "image_name.jpg"
        # fname, ext are "image_name", ".jpg"
        # thumb_path is
        # "output/GALLERY_PATH/name/image_name.thumbnail.jpg"
        img_name = os.path.basename(img)
        fname, ext = os.path.splitext(img_name)
        thumb_path = os.path.join(
            output_gallery,
            ".thumbnail".join([fname, ext]))
        # thumb_path is "output/GALLERY_PATH/name/image_name.jpg"
        orig_dest_path = os.path.join(output_gallery, img_name)
        yield utils.apply_filters({
            'basename': self.name,
            'name': thumb_path,
            'file_dep': [img],
            'targets': [thumb_path],
            'actions': [
                (self.resize_image,
                    (img, thumb_path, self.kw['thumbnail_size'], True, self.kw['preserve_exif_data'],
                     self.kw['exif_whitelist'], self.kw['preserve_icc_profiles']))
            ],
            'clean': True,
            'uptodate': [utils.config_changed({
                1: self.kw['thumbnail_size']
            }, 'nikola.plugins.task.galleries:resize_thumb')],
        }, self.kw['filters'])

        yield utils.apply_filters({
            'basename': self.name,
            'name': orig_dest_path,
            'file_dep': [img],
            'targets': [orig_dest_path],
            'actions': [
                (self.resize_image,
                    (img, orig_dest_path, self.kw['max_image_size'], True, self.kw['preserve_exif_data'],
                     self.kw['exif_whitelist'], self.kw['preserve_icc_profiles']))
            ],
            'clean': True,
            'uptodate': [utils.config_changed({
                1: self.kw['max_image_size']
            }, 'nikola.plugins.task.galleries:resize_max')],
        }, self.kw['filters'])
开发者ID:scp93ch,项目名称:nikola,代码行数:51,代码来源:galleries.py


示例7: create_target_images

    def create_target_images(self, img):
        gallery_name = os.path.relpath(os.path.dirname(img), self.kw['gallery_path'])
        output_gallery = os.path.dirname(
            os.path.join(
                self.kw["output_folder"],
                self.site.path("gallery", gallery_name)))
        # Do thumbnails and copy originals
        # img is "galleries/name/image_name.jpg"
        # img_name is "image_name.jpg"
        # fname, ext are "image_name", ".jpg"
        # thumb_path is
        # "output/GALLERY_PATH/name/image_name.thumbnail.jpg"
        img_name = os.path.basename(img)
        fname, ext = os.path.splitext(img_name)
        thumb_path = os.path.join(
            output_gallery,
            ".thumbnail".join([fname, ext]))
        # thumb_path is "output/GALLERY_PATH/name/image_name.jpg"
        orig_dest_path = os.path.join(output_gallery, img_name)
        yield utils.apply_filters({
            'basename': self.name,
            'name': thumb_path,
            'file_dep': [img],
            'targets': [thumb_path],
            'actions': [
                (self.resize_image,
                    (img, thumb_path, self.kw['thumbnail_size']))
            ],
            'clean': True,
            'uptodate': [utils.config_changed({
                1: self.kw['thumbnail_size']
            })],
        }, self.kw['filters'])

        yield utils.apply_filters({
            'basename': self.name,
            'name': orig_dest_path,
            'file_dep': [img],
            'targets': [orig_dest_path],
            'actions': [
                (self.resize_image,
                    (img, orig_dest_path, self.kw['max_image_size']))
            ],
            'clean': True,
            'uptodate': [utils.config_changed({
                1: self.kw['max_image_size']
            })],
        }, self.kw['filters'])
开发者ID:Liessae,项目名称:nikola,代码行数:48,代码来源:galleries.py


示例8: gen_tasks

    def gen_tasks(self):
        """Copy static files into the output folder."""
        self.kw = {
            'image_thumbnail_size': self.site.config['IMAGE_THUMBNAIL_SIZE'],
            'image_thumbnail_format': self.site.config['IMAGE_THUMBNAIL_FORMAT'],
            'max_image_size': self.site.config['MAX_IMAGE_SIZE'],
            'image_folders': self.site.config['IMAGE_FOLDERS'],
            'output_folder': self.site.config['OUTPUT_FOLDER'],
            'filters': self.site.config['FILTERS'],
            'preserve_exif_data': self.site.config['PRESERVE_EXIF_DATA'],
            'exif_whitelist': self.site.config['EXIF_WHITELIST'],
            'preserve_icc_profiles': self.site.config['PRESERVE_ICC_PROFILES'],
        }

        self.image_ext_list = self.image_ext_list_builtin
        self.image_ext_list.extend(self.site.config.get('EXTRA_IMAGE_EXTENSIONS', []))

        yield self.group_task()
        for src in self.kw['image_folders']:
            dst = self.kw['output_folder']
            filters = self.kw['filters']
            real_dst = os.path.join(dst, self.kw['image_folders'][src])
            for task in self.process_tree(src, real_dst):
                task['basename'] = self.name
                task['uptodate'] = [utils.config_changed(self.kw)]
                yield utils.apply_filters(task, filters)
开发者ID:FelixSchwarz,项目名称:nikola,代码行数:26,代码来源:scale_images.py


示例9: gen_tasks

 def gen_tasks(self):
     """Build final pages from metadata and HTML fragments."""
     kw = {
         "post_pages": self.site.config["post_pages"],
         "translations": self.site.config["TRANSLATIONS"],
         "filters": self.site.config["FILTERS"],
     }
     self.site.scan_posts()
     flag = False
     for lang in kw["translations"]:
         for post in self.site.timeline:
             for task in self.site.generic_page_renderer(lang, post,
                                                         kw["filters"]):
                 task['uptodate'] = [config_changed({
                     1: task['uptodate'][0].config,
                     2: kw})]
                 task['basename'] = self.name
                 flag = True
                 yield task
     if flag is False:  # No page rendered, yield a dummy task
         yield {
             'basename': self.name,
             'name': 'None',
             'uptodate': [True],
             'actions': [],
         }
开发者ID:Almad,项目名称:nikola,代码行数:26,代码来源:task_render_pages.py


示例10: tag_page_as_list

 def tag_page_as_list(self, tag, lang, post_list, kw, is_category):
     """We render a single flat link list with this tag's posts"""
     kind = "category" if is_category else "tag"
     template_name = "tag.tmpl"
     output_name = os.path.join(kw['output_folder'], self.site.path(
         kind, tag, lang))
     context = {}
     context["lang"] = lang
     context["title"] = kw["messages"][lang]["Posts about %s"] % tag
     context["posts"] = post_list
     context["permalink"] = self.site.link(kind, tag, lang)
     context["tag"] = tag
     context["kind"] = kind
     context["description"] = None
     task = self.site.generic_post_list_renderer(
         lang,
         post_list,
         output_name,
         template_name,
         kw['filters'],
         context,
     )
     task_cfg = {1: task['uptodate'][0].config, 2: kw}
     task['uptodate'] = [utils.config_changed(task_cfg)]
     task['basename'] = str(self.name)
     yield task
开发者ID:Gumnos,项目名称:nikola,代码行数:26,代码来源:tags.py


示例11: author_page_as_list

 def author_page_as_list(self, author, lang, post_list, kw):
     """Render a single flat link list with this author's posts."""
     kind = "author"
     template_name = "author.tmpl"
     output_name = os.path.join(kw['output_folder'], self.site.path(
         kind, author, lang))
     context = {}
     context["lang"] = lang
     title = self._get_title(author)
     context["author"] = title
     context["title"] = kw["messages"][lang]["Posts by %s"] % title
     context["posts"] = post_list
     context["permalink"] = self.site.link(kind, author, lang)
     context["kind"] = kind
     context["description"] = self._get_description(author, lang)
     context["pagekind"] = ["list", "author_page"]
     task = self.site.generic_post_list_renderer(
         lang,
         post_list,
         output_name,
         template_name,
         kw['filters'],
         context,
     )
     task['uptodate'] = task['uptodate'] + [utils.config_changed(kw, 'nikola.plugins.task.authors:list')]
     task['basename'] = str(self.name)
     yield task
开发者ID:habi,项目名称:nikola,代码行数:27,代码来源:authors.py


示例12: list_tags_page

 def list_tags_page(self, kw):
     """a global "all your tags/categories" page for each language"""
     tags = list(self.site.posts_per_tag.keys())
     categories = list(self.site.posts_per_category.keys())
     # We want our tags to be sorted case insensitive
     tags.sort(key=lambda a: a.lower())
     categories.sort(key=lambda a: a.lower())
     if categories != [""]:
         has_categories = True
     else:
         has_categories = False
     template_name = "tags.tmpl"
     kw["tags"] = tags
     kw["categories"] = categories
     for lang in kw["translations"]:
         output_name = os.path.join(kw["output_folder"], self.site.path("tag_index", None, lang))
         output_name = output_name
         context = {}
         if has_categories:
             context["title"] = kw["messages"][lang]["Tags and Categories"]
         else:
             context["title"] = kw["messages"][lang]["Tags"]
         context["items"] = [(tag, self.site.link("tag", tag, lang)) for tag in tags]
         if has_categories:
             context["cat_items"] = [(tag, self.site.link("category", tag, lang)) for tag in categories]
         else:
             context["cat_items"] = None
         context["permalink"] = self.site.link("tag_index", None, lang)
         context["description"] = None
         task = self.site.generic_post_list_renderer(lang, [], output_name, template_name, kw["filters"], context)
         task_cfg = {1: task["uptodate"][0].config, 2: kw}
         task["uptodate"] = [utils.config_changed(task_cfg)]
         task["basename"] = str(self.name)
         yield task
开发者ID:shalicke,项目名称:nikola,代码行数:34,代码来源:tags.py


示例13: _generate_classification_page_as_rss

 def _generate_classification_page_as_rss(self, taxonomy, classification, filtered_posts, title, description, kw, lang):
     """Create a RSS feed for a single classification in a given language."""
     kind = taxonomy.classification_name
     # Render RSS
     output_name = os.path.normpath(os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path(kind + "_rss", classification, lang)))
     feed_url = urljoin(self.site.config['BASE_URL'], self.site.link(kind + "_rss", classification, lang).lstrip('/'))
     deps = []
     deps_uptodate = []
     for post in filtered_posts:
         deps += post.deps(lang)
         deps_uptodate += post.deps_uptodate(lang)
     blog_title = kw["blog_title"](lang)
     task = {
         'basename': str(self.name),
         'name': output_name,
         'file_dep': deps,
         'targets': [output_name],
         'actions': [(utils.generic_rss_renderer,
                     (lang, "{0} ({1})".format(blog_title, title) if blog_title != title else blog_title,
                      kw["site_url"], description, filtered_posts,
                      output_name, kw["feed_teasers"], kw["feed_plain"], kw['feed_length'],
                      feed_url, _enclosure, kw["feed_links_append_query"]))],
         'clean': True,
         'uptodate': [utils.config_changed(kw, 'nikola.plugins.task.taxonomies:rss')] + deps_uptodate,
         'task_dep': ['render_posts'],
     }
     return utils.apply_filters(task, kw['filters'])
开发者ID:scp93ch,项目名称:nikola,代码行数:27,代码来源:taxonomies.py


示例14: _render_classification_overview

 def _render_classification_overview(self, classification_name, template, lang, context, kw):
     # Prepare rendering
     context["permalink"] = self.site.link("{}_index".format(classification_name), None, lang)
     if "pagekind" not in context:
         context["pagekind"] = ["list", "tags_page"]
     output_name = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path('{}_index'.format(classification_name), None, lang))
     blinker.signal('generate_classification_overview').send({
         'site': self.site,
         'classification_name': classification_name,
         'lang': lang,
         'context': context,
         'kw': kw,
         'output_name': output_name,
     })
     task = self.site.generic_post_list_renderer(
         lang,
         [],
         output_name,
         template,
         kw['filters'],
         context,
     )
     task['uptodate'] = task['uptodate'] + [utils.config_changed(kw, 'nikola.plugins.task.taxonomies:page')]
     task['basename'] = str(self.name)
     yield task
开发者ID:scp93ch,项目名称:nikola,代码行数:25,代码来源:taxonomies.py


示例15: tag_rss

 def tag_rss(self, tag, lang, posts, kw, is_category):
     """RSS for a single tag / language"""
     kind = "category" if is_category else "tag"
     # Render RSS
     output_name = os.path.normpath(
         os.path.join(kw['output_folder'],
                      self.site.path(kind + "_rss", tag, lang)))
     feed_url = urljoin(self.site.config['BASE_URL'], self.site.link(kind + "_rss", tag, lang).lstrip('/'))
     deps = []
     deps_uptodate = []
     post_list = sorted(posts, key=lambda a: a.date)
     post_list.reverse()
     for post in post_list:
         deps += post.deps(lang)
         deps_uptodate += post.deps_uptodate(lang)
     task = {
         'basename': str(self.name),
         'name': output_name,
         'file_dep': deps,
         'targets': [output_name],
         'actions': [(utils.generic_rss_renderer,
                     (lang, "{0} ({1})".format(kw["blog_title"](lang), tag),
                      kw["site_url"], None, post_list,
                      output_name, kw["rss_teasers"], kw["rss_plain"], kw['feed_length'],
                      feed_url))],
         'clean': True,
         'uptodate': [utils.config_changed(kw, 'nikola.plugins.task.tags:rss')] + deps_uptodate,
         'task_dep': ['render_posts'],
     }
     return utils.apply_filters(task, kw['filters'])
开发者ID:magmax,项目名称:nikola,代码行数:30,代码来源:tags.py


示例16: gen_tasks

 def gen_tasks(self):
     """Generate RSS feeds."""
     kw = {
         "translations": self.site.config["TRANSLATIONS"],
         "filters": self.site.config["FILTERS"],
         "blog_title": self.site.config["BLOG_TITLE"],
         "site_url": self.site.config["SITE_URL"],
         "blog_description": self.site.config["BLOG_DESCRIPTION"],
         "output_folder": self.site.config["OUTPUT_FOLDER"],
         "rss_teasers": self.site.config["RSS_TEASERS"],
     }
     self.site.scan_posts()
     # TODO: timeline is global, kill it
     for lang in kw["translations"]:
         output_name = os.path.join(kw['output_folder'],
                                    self.site.path("rss", None, lang))
         deps = []
         posts = [x for x in self.site.timeline if x.use_in_feeds][:10]
         for post in posts:
             deps += post.deps(lang)
         yield {
             'basename': 'render_rss',
             'name': output_name,
             'file_dep': deps,
             'targets': [output_name],
             'actions': [(utils.generic_rss_renderer,
                         (lang, kw["blog_title"], kw["site_url"],
                          kw["blog_description"], posts, output_name,
                          kw["rss_teasers"]))],
             'clean': True,
             'uptodate': [utils.config_changed(kw)],
         }
开发者ID:StyXman,项目名称:nikola,代码行数:32,代码来源:task_render_rss.py


示例17: gen_tasks

    def gen_tasks(self):
        """Copy static files into the output folder."""

        kw = {
            'files_folders': self.site.config['FILES_FOLDERS'],
            'output_folder': self.site.config['OUTPUT_FOLDER'],
            'filters': self.site.config['FILTERS'],
        }

        flag = False
        for src in kw['files_folders']:
            dst = kw['output_folder']
            filters = kw['filters']
            real_dst = os.path.join(dst, kw['files_folders'][src])
            for task in utils.copy_tree(src, real_dst, link_cutoff=dst):
                flag = True
                task['basename'] = self.name
                task['uptodate'] = task.get('uptodate', []) +\
                    [utils.config_changed(kw)]
                yield utils.apply_filters(task, filters)
        if not flag:
            yield {
                'basename': self.name,
                'actions': (),
            }
开发者ID:Bluerise,项目名称:nikola,代码行数:25,代码来源:task_copy_files.py


示例18: gen_tasks

    def gen_tasks(self):
        """Build HTML fragments from metadata and text."""
        self.site.scan_posts()
        kw = {
            "translations": self.site.config["TRANSLATIONS"],
            "timeline": self.site.timeline,
            "default_lang": self.site.config["DEFAULT_LANG"],
            "show_untranslated_posts": self.site.config['SHOW_UNTRANSLATED_POSTS'],
            "demote_headers": self.site.config['DEMOTE_HEADERS'],
        }

        yield self.group_task()

        for lang in kw["translations"]:
            deps_dict = copy(kw)
            deps_dict.pop('timeline')
            for post in kw['timeline']:
                dest = post.translated_base_path(lang)
                file_dep = [p for p in post.fragment_deps(lang) if not p.startswith("####MAGIC####")]
                task = {
                    'basename': self.name,
                    'name': dest,
                    'file_dep': file_dep,
                    'targets': [dest],
                    'actions': [(post.compile, (lang, )),
                                (update_deps, (post, lang, )),
                                ],
                    'clean': True,
                    'uptodate': [
                        utils.config_changed(deps_dict, 'nikola.plugins.task.posts'),
                        lambda p=post, l=lang: dependence_on_timeline(p, l)
                    ] + post.fragment_deps_uptodate(lang),
                }
                yield task
开发者ID:bnmnetp,项目名称:nikola,代码行数:34,代码来源:posts.py


示例19: fragment_deps_uptodate

 def fragment_deps_uptodate(self, lang):
     """Return a list of file dependencies to build this post's fragment."""
     deps = []
     deps += self._get_dependencies(self._dependency_uptodate_fragment[lang])
     deps += self._get_dependencies(self._dependency_uptodate_fragment[None])
     deps.append(utils.config_changed({1: sorted(self.compiler.config_dependencies)}, 'nikola.post.Post.deps_uptodate:compiler:' + self.source_path))
     return deps
开发者ID:GetsDrawn,项目名称:nikola,代码行数:7,代码来源:post.py


示例20: gen_tasks

    def gen_tasks(self):
        """Generate redirections tasks."""

        kw = {
            'redirections': self.site.config['REDIRECTIONS'],
            'output_folder': self.site.config['OUTPUT_FOLDER'],
        }

        if not kw['redirections']:
            # If there are no redirections, still needs to create a
            # dummy action so dependencies don't fail
            yield {
                'basename': self.name,
                'name': 'None',
                'uptodate': [True],
                'actions': [],
            }

        else:
            for src, dst in kw["redirections"]:
                src_path = os.path.join(kw["output_folder"], src)
                yield {
                    'basename': self.name,
                    'name': src_path,
                    'targets': [src_path],
                    'actions': [(create_redirect, (src_path, dst))],
                    'clean': True,
                    'uptodate': [utils.config_changed(kw)],
                }
开发者ID:emilopez,项目名称:nikola,代码行数:29,代码来源:redirect.py



注:本文中的nikola.utils.config_changed函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.copy_tree函数代码示例发布时间:2022-05-27
下一篇:
Python utils.ask函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap