Example #1
0
def markdown(text):
    if 'markdown_prefork' in ns.sections:
        markdown_prefork.update(ns.sections.markdown_prefork)

    for module in markdown_prefork.values():
        if module:
            text = import_module(module)(text)
    md = Markdown()
    return md.convert(text)
Example #2
0
def markdown(text):
    if 'markdown_prefork' in ns.sections:
        markdown_prefork.update(ns.sections.markdown_prefork)

    for module in markdown_prefork.values():
        if module:
            text = import_module(module)(text)
    md = Markdown()
    return md.convert(text)
Example #3
0
 def run_command(cmd):
     if cmd == 'build':
         return build(args.config)
     if cmd == 'create':
         return create(args.config)
     config = init(args.config)
     if not config.has_section('commands'):
         return
     for k, v in config.items('commands'):
         if args.command == k:
             return import_module(v)(args.config)
Example #4
0
 def run_command(cmd):
     if cmd == 'build':
         return build(args.config)
     if cmd == 'create':
         return create(args.config)
     config = init_config(args.config)
     if not config.has_section('commands'):
         return
     for k, v in config.items('commands'):
         if args.command == k:
             return import_module(v)(args.config)
Example #5
0
def build(config_file):
    begin = time.time()
    if not os.path.exists(config_file):
        answer = raw_input('This is not a Felix Felicis repo, '
                           'would you like to create one?(Y/n) ')
        if answer.lower() == 'n':
            sys.exit(1)
            return
        return create()

    init_config(config_file)
    init_post()

    logger.info('Starting readers')
    for reader in ns.readers.values():
        if reader:
            import_module(reader)().start()

    logger.info('Starting writers')
    for writer in ns.writers.values():
        if writer:
            import_module(writer)().start()

    logger.info('Running writers')
    for writer in ns.writers.values():
        if writer:
            import_module(writer)().run()

    for error in ns.storage.errors:
        logger.error('Invalid Post: %s' % error)

    end = time.time()
    logger.info('Total time: %s' % (end - begin))
    return
Example #6
0
def build(config_file):
    begin = time.time()
    if not os.path.exists(config_file):
        answer = raw_input('This is not a Felix Felicis repo, '
                           'would you like to create one?(Y/n) ')
        if answer.lower() == 'n':
            sys.exit(1)
            return
        return create()

    init_config(config_file)
    init_post()

    logger.info('Starting readers')
    for reader in ns.readers.values():
        if reader:
            import_module(reader)().start()

    logger.info('Starting writers')
    for writer in ns.writers.values():
        if writer:
            import_module(writer)().start()

    logger.info('Running writers')
    for writer in ns.writers.values():
        if writer:
            import_module(writer)().run()

    for error in ns.storage.errors:
        logger.error('Invalid Post: %s' % error)

    end = time.time()
    logger.info('Total time: %s' % (end - begin))
    return
Example #7
0
    def jinja(self):
        if hasattr(self, '_jinja'):
            return self._jinja
        tpl = os.path.join(ns.storage.projectdir, ns.site.template)
        autoescape = ns.site.autoescape == 'true'
        jinja = Environment(
            loader=FileSystemLoader(
                [tpl, os.path.join(ns.storage.root, '_templates')]),
            autoescape=autoescape,
            extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_'],
        )
        for k, v in ns.filters.items():
            jinja.filters.update({k: import_module(v)})

        self._jinja = jinja
        return jinja
Example #8
0
    def jinja(self):
        if hasattr(self, '_jinja'):
            return self._jinja
        tpl = os.path.join(namespace.projectdir,
                           namespace.site.get('template', '_templates'))
        autoescape = namespace.site.get('autoescape', 'false')
        autoescape = True if autoescape == 'true' else False
        jinja = Environment(
            loader = FileSystemLoader([tpl, os.path.join(namespace.root, '_templates')]),
            autoescape = autoescape,
            extensions = ['jinja2.ext.autoescape', 'jinja2.ext.with_'],
        )
        for k, v in namespace.filters.items():
            jinja.filters.update({k: import_module(v)})

        self._jinja = jinja
        return jinja
Example #9
0
def generate():
    for reader in ns.readers.values():
        if reader:
            import_module(reader)().start()

    for writer in ns.writers.values():
        if writer:
            import_module(writer)().start()

    for writer in ns.writers.values():
        if writer:
            import_module(writer)().run()
Example #10
0
    def jinja(self):
        if hasattr(self, '_jinja'):
            return self._jinja
        tpl = os.path.join(ns.storage.projectdir,
                           ns.site.template)
        autoescape = ns.site.autoescape == 'true'
        jinja = Environment(
            loader=FileSystemLoader([
                tpl, os.path.join(ns.storage.root, '_templates')
            ]),
            autoescape=autoescape,
            extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_'],
        )
        for k, v in ns.filters.items():
            jinja.filters.update({k: import_module(v)})

        self._jinja = jinja
        return jinja
Example #11
0
    def jinja(self):
        if hasattr(self, '_jinja'):
            return self._jinja
        tpl = os.path.join(namespace.projectdir,
                           namespace.site.get('template', '_templates'))
        autoescape = namespace.site.get('autoescape', 'false')
        autoescape = True if autoescape == 'true' else False
        jinja = Environment(
            loader=FileSystemLoader([
                tpl, os.path.join(namespace.root, '_templates')
            ]),
            autoescape=autoescape,
            extensions=['jinja2.ext.autoescape', 'jinja2.ext.with_'],
        )
        for k, v in namespace.filters.items():
            jinja.filters.update({k: import_module(v)})

        self._jinja = jinja
        return jinja
Example #12
0
def build(config_file):
    if not os.path.exists(config_file):
        answer = raw_input('This is not a Felix Felicis repo, would you like to create one?(Y/n) ')
        if 'n' == answer.lower():
            sys.exit(1)
            return
        return create()

    init(config_file)

    begin = time.time()
    for reader in namespace.readers.values():
        import_module(reader)().start()
    for writer in namespace.writers.values():
        import_module(writer)().start()

    for writer in namespace.writers.values():
        import_module(writer)().run()
    end = time.time()

    logger.info('Total time: %s' % (end - begin))
    return
Example #13
0
def build(config_file):
    if not os.path.exists(config_file):
        answer = raw_input('This is not a Felix Felicis repo, '
                           'would you like to create one?(Y/n) ')
        if 'n' == answer.lower():
            sys.exit(1)
            return
        return create()

    init(config_file)

    begin = time.time()
    for reader in namespace.readers.values():
        import_module(reader)().start()
    for writer in namespace.writers.values():
        import_module(writer)().start()

    for writer in namespace.writers.values():
        import_module(writer)().run()
    end = time.time()

    logger.info('Total time: %s' % (end - begin))
    return
Example #14
0
def detect_reader(filepath):
    for reader in ns.readers.values():
        reader = import_module(reader)(filepath)
        if reader.support():
            return reader
    return None
Example #15
0
def detect_reader(filepath):
    for reader in namespace.readers.values():
        reader = import_module(reader)(filepath)
        if reader.support():
            return reader
    return None