2010-10-30 00:56:40 +01:00
|
|
|
#!/usr/bin/env python
|
2010-08-14 05:45:16 +02:00
|
|
|
import argparse
|
|
|
|
|
|
2010-10-30 20:17:23 +01:00
|
|
|
from pelican.generators import ArticlesGenerator, PagesGenerator
|
2010-10-30 00:56:40 +01:00
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="""A tool to generate a
|
2010-08-19 04:23:07 +02:00
|
|
|
static blog, with restructured text input files.""")
|
2010-08-18 16:02:06 +02:00
|
|
|
|
2010-09-15 12:30:30 +02:00
|
|
|
parser.add_argument(dest='path',
|
2010-08-17 23:00:56 +02:00
|
|
|
help='Path where to find the content files (default is "content").')
|
2010-10-30 00:56:40 +01:00
|
|
|
parser.add_argument('-t', '--theme-path', dest='theme',
|
|
|
|
|
help='Path where to find the theme templates. If not specified, it will'
|
2010-10-30 16:47:59 +01:00
|
|
|
'use the default one included with pelican.')
|
2010-08-18 16:02:06 +02:00
|
|
|
parser.add_argument('-o', '--output', dest='output',
|
2010-08-14 05:45:16 +02:00
|
|
|
help='Where to output the generated files. If not specified, a directory'
|
|
|
|
|
' will be created, named "output" in the current path.')
|
2010-10-31 00:08:16 +01:00
|
|
|
parser.add_argument('-m', '--markup', default='rst, md', dest='markup',
|
2010-08-14 05:45:16 +02:00
|
|
|
help='the markup language to use. Currently only ReSTreucturedtext is'
|
|
|
|
|
' available.')
|
2010-08-18 16:02:06 +02:00
|
|
|
parser.add_argument('-s', '--settings', dest='settings',
|
2010-08-17 20:28:51 +02:00
|
|
|
help='the settings of the application. Default to None.')
|
2010-09-15 12:30:52 +02:00
|
|
|
|
2010-08-14 05:45:16 +02:00
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
args = parser.parse_args()
|
2010-10-30 20:17:23 +01:00
|
|
|
|
|
|
|
|
articles = ArticlesGenerator(args.settings)
|
|
|
|
|
pages = PagesGenerator(args.settings)
|
|
|
|
|
context = {}
|
2010-10-31 00:08:16 +01:00
|
|
|
|
2010-10-30 20:17:23 +01:00
|
|
|
for gen in articles, pages:
|
2010-10-31 00:08:16 +01:00
|
|
|
markup = [a.split()[0] for a in args.markup.split(',')]
|
2010-10-30 20:17:23 +01:00
|
|
|
context.update(gen.create_context(args.path, args.theme, args.output,
|
2010-10-31 00:08:16 +01:00
|
|
|
markup))
|
2010-10-30 20:17:23 +01:00
|
|
|
|
|
|
|
|
for gen in articles, pages:
|
|
|
|
|
gen.generate(context)
|
2010-10-30 01:26:58 +01:00
|
|
|
print "Enjoy !"
|