summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/pelican-import31
-rwxr-xr-xtools/pelican-quickstart21
-rwxr-xr-xtools/pelican-themes22
3 files changed, 38 insertions, 36 deletions
diff --git a/tools/pelican-import b/tools/pelican-import
index 1590e956..3a931afd 100755
--- a/tools/pelican-import
+++ b/tools/pelican-import
@@ -1,12 +1,13 @@
-#! /usr/bin/env python
+#!/usr/bin/env python
-from pelican.utils import slugify
-
-from codecs import open
-import os
import argparse
+import os
import time
+from codecs import open
+
+from pelican.utils import slugify
+
def wp2fields(xml):
"""Opens a wordpress XML file, and yield pelican fields"""
@@ -132,7 +133,7 @@ def dc2fields(file):
j=j+2
"""
- dotclear2 does not use markdown by default unless you use the markdown plugin
+ dotclear2 does not use markdown by default unless you use the markdown plugin
Ref: http://plugins.dotaddict.org/dc2/details/formatting-markdown
"""
if post_format == "markdown":
@@ -151,7 +152,7 @@ def feed2fields(file):
d = feedparser.parse(file)
for entry in d.entries:
date = (time.strftime("%Y-%m-%d %H:%M", entry.updated_parsed)
- if hasattr(entry, "updated_parsed") else None)
+ if hasattr(entry, "updated_parsed") else None)
author = entry.author if hasattr(entry, "author") else None
tags = [e['term'] for e in entry.tags] if hasattr(entry, "tags") else None
@@ -243,22 +244,22 @@ def main(input_type, input, out_markup, output_path, dircat=False):
if __name__ == '__main__':
parser = argparse.ArgumentParser(
- description="Transform feed, Wordpress or Dotclear files to rst files."
- "Be sure to have pandoc installed")
+ description="Transform feed, Wordpress or Dotclear files to rst files."
+ "Be sure to have pandoc installed")
parser.add_argument(dest='input', help='The input file to read')
parser.add_argument('--wpfile', action='store_true', dest='wpfile',
- help='Wordpress XML export')
+ help='Wordpress XML export')
parser.add_argument('--dotclear', action='store_true', dest='dotclear',
- help='Dotclear export')
+ help='Dotclear export')
parser.add_argument('--feed', action='store_true', dest='feed',
- help='Feed to parse')
+ help='Feed to parse')
parser.add_argument('-o', '--output', dest='output', default='output',
- help='Output path')
+ help='Output path')
parser.add_argument('-m', '--markup', dest='markup', default='rst',
- help='Output markup format (supports rst & markdown)')
+ help='Output markup format (supports rst & markdown)')
parser.add_argument('--dir-cat', action='store_true', dest='dircat',
- help='Put files in directories with categories name')
+ help='Put files in directories with categories name')
args = parser.parse_args()
input_type = None
diff --git a/tools/pelican-quickstart b/tools/pelican-quickstart
index ef6dff53..4048c2bf 100755
--- a/tools/pelican-quickstart
+++ b/tools/pelican-quickstart
@@ -5,7 +5,7 @@ import os, sys, argparse, string
from pelican import __version__
TEMPLATES={
- 'Makefile' : '''
+ 'Makefile' : '''
PELICAN=$pelican
PELICANOPTS=$pelicanopts
@@ -75,10 +75,10 @@ DEFAULT_LANG='$lang'
# Blogroll
LINKS = (
- ('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'),
- ('Python.org', 'http://python.org'),
- ('Jinja2', 'http://jinja.pocoo.org'),
- ('You can modify those links in your config file', '#')
+ ('Pelican', 'http://docs.notmyidea.org/alexis/pelican/'),
+ ('Python.org', 'http://python.org'),
+ ('Jinja2', 'http://jinja.pocoo.org'),
+ ('You can modify those links in your config file', '#')
)
# Social widget
@@ -129,7 +129,7 @@ def ask(question, answer=str, default=None, l=None):
r = raw_input('> {0} '.format(question, default))
r = r.strip()
-
+
if len(r) <= 0:
if default:
r = default
@@ -194,17 +194,16 @@ def ask(question, answer=str, default=None, l=None):
def main():
parser = argparse.ArgumentParser(description="A kickstarter for pelican")
- parser.add_argument('-p', '--path', default=".",
+ parser.add_argument('-p', '--path', default=".",
help="The path to generate the blog into")
parser.add_argument('-t', '--title', default=None, metavar="title",
help='Set the title of the website')
parser.add_argument('-a', '--author', default=None, metavar="author",
help='Set the author name of the website')
- parser.add_argument('-l', '--lang', default=None, metavar="lang",
+ parser.add_argument('-l', '--lang', default=None, metavar="lang",
help='Set the default lang of the website')
args = parser.parse_args()
-
print('''Welcome to pelican-quickstart v{v}.
@@ -213,7 +212,7 @@ This script will help you creating a new Pelican based website.
Please answer the following questions so this script can generate the files needed by Pelican.
'''.format(v=__version__))
-
+
CONF['basedir'] = os.path.abspath(ask('Where do you want to create your new Web site ?', answer=str, default=args.path))
CONF['sitename'] = ask('How will you call your Web site ?', answer=str, default=args.title)
CONF['author'] = ask('Who will be the author of this Web site ?', answer=str, default=args.author)
@@ -227,7 +226,7 @@ Please answer the following questions so this script can generate the files need
CONF['default_pagination'] = False
mkfile = ask('Do you want to generate a Makefile to easily manage your website ?', bool, True)
-
+
if mkfile:
if ask('Do you want to upload your website using FTP ?', answer=bool, default=False):
CONF['ftp_host'] = ask('What is the hostname of your FTP server ?', str, CONF['ftp_host'])
diff --git a/tools/pelican-themes b/tools/pelican-themes
index efc34c29..78df4a48 100755
--- a/tools/pelican-themes
+++ b/tools/pelican-themes
@@ -1,8 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import os, sys, shutil
import argparse
+import os
+import shutil
+import sys
try:
import pelican
@@ -38,11 +40,11 @@ def main():
excl= parser.add_mutually_exclusive_group()
excl.add_argument('-l', '--list', dest='action', action="store_const", const='list',
- help="Show the themes already installed and exit")
+ help="Show the themes already installed and exit")
excl.add_argument('-p', '--path', dest='action', action="store_const", const='path',
- help="Show the themes path and exit")
+ help="Show the themes path and exit")
excl.add_argument('-V', '--version', action='version', version='pelican-themes v{0}'.format(__version__),
- help='Print the version of this script')
+ help='Print the version of this script')
parser.add_argument('-i', '--install', dest='to_install', nargs='+', metavar="theme path",
@@ -52,16 +54,16 @@ def main():
parser.add_argument('-s', '--symlink', dest='to_symlink', nargs='+', metavar="theme path",
help="Same as `--install', but create a symbolic link instead of copying the theme. Useful for theme development")
parser.add_argument('-c', '--clean', dest='clean', action="store_true",
- help="Remove the broken symbolic links of the theme path")
+ help="Remove the broken symbolic links of the theme path")
parser.add_argument('-v', '--verbose', dest='verbose', action="store_true",
- help="Verbose output")
+ help="Verbose output")
args = parser.parse_args()
-
+
if args.action:
if args.action is 'list':
list_themes(args.verbose)
@@ -93,7 +95,7 @@ def main():
if args.clean:
if args.verbose:
print('Cleaning the themes directory...')
-
+
clean(v=args.verbose)
else:
print('No argument given... exiting.')
@@ -142,7 +144,7 @@ def remove(theme_name, v=False):
print('Removing directory `' + target + "'")
shutil.rmtree(target)
elif os.path.exists(target):
- err(target + ' : not a valid theme')
+ err(target + ' : not a valid theme')
else:
err(target + ' : no such file or directory')
@@ -210,6 +212,6 @@ def clean(v=False):
c+=1
print("\nRemoved {0} broken links".format(c))
-
+
if __name__ == '__main__':
main()