You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
930 B

#!/usr/bin/env python3
import sys
import click
import ciclostile
@click.group()
def cli():
pass
@cli.command()
@click.option('-t', '--template', type=click.File('r'))
@click.option('-o', '--output', type=click.File('w'), default=sys.stdout)
@click.argument('markdown', type=click.File('r'), default=sys.stdin)
def compile(template, output, markdown):
data = ciclostile.parse(markdown.read())
html = ciclostile.compile(template.read(), data)
output.write(html)
@cli.command()
@click.option('-t', '--template', type=click.File('r'))
@click.option('-o', '--output', type=click.File('w'), default=sys.stdout)
@click.argument('folder', type=click.Path(exists=True,
file_okay=False))
def index(template, output, folder):
data = ciclostile.index(folder)
html = ciclostile.compile(template.read(), data)
output.write(html)
if __name__ == "__main__":
cli()