Exemplo n.º 1
0
 def generate_catalog(self, pages):
     logger.info("Generate catalog page.")
     catalog_generator = CatalogGenerator(self.config, self.target_path,
                                          pages)
     html = catalog_generator.generate_catalog_html()
     ofile = os.path.join(self.target_path, self.config["destination"],
                          "index.html")
     write_file(ofile, html)
Exemplo n.º 2
0
 def generate_feed(self, pages, feed_fn):
     logger.info("Generate feed.")
     feed_generator = FeedGenerator(self.config, self.target_path, pages,
                                    feed_fn)
     feed = feed_generator.generate_feed()
     ofile = os.path.join(self.target_path, self.config["destination"],
                          feed_fn)
     write_file(ofile, feed)
Exemplo n.º 3
0
    def generate_page(_file):
        pg = PageGenerator(_site_config, _base_path)
        html = pg.to_html(_file)
        # ignore draft
        if not html:
            return None

        output_fname = YAPatternMatchingEventHandler.get_ofile(_file)
        write_file(output_fname, html)
        logging.debug('Regenerating: {0}'.format(_file))
Exemplo n.º 4
0
    def generate_page(_file):
        pg = PageGenerator(_site_config, _base_path)
        html = pg.to_html(_file)
        # ignore draft
        if not html:
            return None

        output_fname = YAPatternMatchingEventHandler.get_ofile(_file)
        write_file(output_fname, html)
        logging.debug('Regenerating: {0}'.format(_file))
Exemplo n.º 5
0
 def generate_page(_file):
     pg = PageGenerator(_site_config, _base_path, _file)
     html = pg.to_html()
     category, filename = os.path.split(_file)
     category = os.path.relpath(category, _site_config['source'])
     output_fname = os.path.join(
         _base_path, _site_config['destination'], category,
         '{0}.html'.format(os.path.splitext(filename)[0]))
     write_file(output_fname, html)
     logging.debug('Regenerating: {0}'.format(_file))
Exemplo n.º 6
0
 def generate_catalog(self, pages):
     logger.info("Generate catalog page.")
     catalog_generator = CatalogGenerator(self.config, self.target_path,
                                          pages)
     html = catalog_generator.generate_catalog_html()
     ofile = os.path.join(
         self.target_path,
         self.config["destination"],
         "index.html"
     )
     write_file(ofile, html)
Exemplo n.º 7
0
 def generate_feed(self, pages, feed_fn):
     logger.info("Generate feed.")
     feed_generator = FeedGenerator(self.config, self.target_path, pages,
                                    feed_fn)
     feed = feed_generator.generate_feed()
     ofile = os.path.join(
         self.target_path,
         self.config["destination"],
         feed_fn
     )
     write_file(ofile, feed)
Exemplo n.º 8
0
 def generate_page(_file):
     pg = PageGenerator(_site_config, _base_path, _file)
     html = pg.to_html()
     category, filename = os.path.split(_file)
     category = os.path.relpath(category, _site_config['source'])
     output_fname = os.path.join(
         _base_path,
         _site_config['destination'],
         category,
         '{0}.html'.format(os.path.splitext(filename)[0])
     )
     write_file(output_fname, html)
     logging.debug('Regenerating: {0}'.format(_file))
Exemplo n.º 9
0
    def generate_single_page(self, generator, md_file):
        logger.debug("Generate: {0}".format(md_file))
        html = generator.to_html(os.path.realpath(md_file), self.include_draft)

        # ignore draft
        if not html:
            return None

        category, filename = os.path.split(md_file)
        category = os.path.relpath(category, self.config['source'])
        output_file = os.path.join(
            self.target_path, self.config['destination'], category,
            '{0}.html'.format(os.path.splitext(filename)[0]))

        write_file(output_file, html)
        meta = generator.meta
        meta['content'] = generator.content  # TODO
        return meta
Exemplo n.º 10
0
    def generate_single_page(self, md_file):
        logger.debug("Generate: {0}".format(md_file))
        page_generator = PageGenerator(self.config, self.target_path,
                                       os.path.realpath(md_file))
        html = page_generator.to_html()

        # ignore draft
        if not html:
            return None

        category, filename = os.path.split(md_file)
        category = os.path.relpath(category, self.config['source'])
        output_file = os.path.join(
            self.target_path, self.config['destination'], category,
            '{0}.html'.format(os.path.splitext(filename)[0]))

        write_file(output_file, html)
        meta = page_generator.meta
        return meta
Exemplo n.º 11
0
    def generate_catalog():
        pg = PageGenerator(_site_config, _base_path)
        pages = {}

        for root, dirs, files in os.walk(_site_config["source"]):
            files = [f for f in files if not f.startswith(".")]
            dirs[:] = [d for d in dirs if not d.startswith(".")]
            for filename in files:
                if not filename.endswith(_site_config["default_ext"]):
                    continue
                md_file = os.path.join(root, filename)
                pg.src_file = md_file
                meta, _ = pg.get_meta_and_content(do_render=False)
                pages[md_file] = meta

        cg = CatalogGenerator(_site_config, _base_path, pages)
        html = cg.generate_catalog_html()
        ofile = os.path.join(_base_path, _site_config['destination'],
                             "index.html")
        write_file(ofile, html)
        logging.debug('Regenerating catalog')
Exemplo n.º 12
0
    def generate_single_page(self, generator, md_file):
        logger.debug("Generate: {0}".format(md_file))
        html = generator.to_html(os.path.realpath(md_file),
                                 self.include_draft)

        # ignore draft
        if not html:
            return None

        category, filename = os.path.split(md_file)
        category = os.path.relpath(category, self.config['source'])
        output_file = os.path.join(
            self.target_path,
            self.config['destination'],
            category,
            '{0}.html'.format(os.path.splitext(filename)[0])
        )

        write_file(output_file, html)
        meta = generator.meta
        return meta
Exemplo n.º 13
0
    def generate_catalog():
        pg = PageGenerator(_site_config, _base_path)
        pages = {}

        for root, dirs, files in os.walk(_site_config["source"]):
            files = [f for f in files if not f.startswith(".")]
            dirs[:] = [d for d in dirs if not d.startswith(".")]
            for filename in files:
                if not filename.endswith(_site_config["default_ext"]):
                    continue
                md_file = os.path.join(root, filename)
                pg.src_file = md_file
                meta, _ = pg.get_meta_and_content(do_render=False)
                pages[md_file] = meta

        cg = CatalogGenerator(_site_config, _base_path, pages)
        html = cg.generate_catalog_html()
        ofile = os.path.join(
            _base_path,
            _site_config['destination'],
            "index.html"
        )
        write_file(ofile, html)
        logging.debug('Regenerating catalog')