2010-10-30 00:56:40 +01:00
|
|
|
#!/usr/bin/env python
|
2010-08-14 05:45:16 +02:00
|
|
|
import argparse
|
|
|
|
|
|
2010-11-05 00:22:03 +00:00
|
|
|
from pelican.generators import Generator
|
|
|
|
|
from pelican.processors import (ArticlesProcessor, PagesProcessor,
|
2010-11-06 02:03:32 +00:00
|
|
|
StaticProcessor, PdfProcessor)
|
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-11-12 02:38:43 +00:00
|
|
|
help='Path where to find the content files')
|
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-11-05 00:22:03 +00:00
|
|
|
markup = [a.split()[0] for a in args.markup.split(',')]
|
2010-10-30 20:17:23 +01:00
|
|
|
|
2010-11-05 00:22:03 +00:00
|
|
|
generator = Generator(args.settings, args.path, args.theme,
|
|
|
|
|
args.output, markup)
|
2010-11-06 02:25:47 +00:00
|
|
|
|
|
|
|
|
processors = [ArticlesProcessor, PagesProcessor, StaticProcessor]
|
|
|
|
|
if generator.settings['PDF_PROCESSOR']:
|
|
|
|
|
processors.append(PdfProcessor)
|
|
|
|
|
|
|
|
|
|
generator.run(processors)
|
2010-10-30 01:26:58 +01:00
|
|
|
print "Enjoy !"
|