mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
commit
991a49084a
4 changed files with 15 additions and 14 deletions
|
|
@ -4,3 +4,4 @@ docutils
|
||||||
feedgenerator
|
feedgenerator
|
||||||
unittest2
|
unittest2
|
||||||
pytz
|
pytz
|
||||||
|
mock
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class Pelican(object):
|
||||||
|
|
||||||
self.path = path or settings['PATH']
|
self.path = path or settings['PATH']
|
||||||
if not self.path:
|
if not self.path:
|
||||||
raise Exception('you need to specify a path containing the content'
|
raise Exception('You need to specify a path containing the content'
|
||||||
' (see pelican --help for more information)')
|
' (see pelican --help for more information)')
|
||||||
|
|
||||||
if self.path.endswith('/'):
|
if self.path.endswith('/'):
|
||||||
|
|
@ -138,7 +138,7 @@ def main():
|
||||||
static blog, with restructured text input files.""")
|
static blog, with restructured text input files.""")
|
||||||
|
|
||||||
parser.add_argument(dest='path', nargs='?',
|
parser.add_argument(dest='path', nargs='?',
|
||||||
help='Path where to find the content files')
|
help='Path where to find the content files.')
|
||||||
parser.add_argument('-t', '--theme-path', dest='theme',
|
parser.add_argument('-t', '--theme-path', dest='theme',
|
||||||
help='Path where to find the theme templates. If not specified, it'
|
help='Path where to find the theme templates. If not specified, it'
|
||||||
'will use the default one included with pelican.')
|
'will use the default one included with pelican.')
|
||||||
|
|
@ -146,28 +146,28 @@ def main():
|
||||||
help='Where to output the generated files. If not specified, a '
|
help='Where to output the generated files. If not specified, a '
|
||||||
'directory will be created, named "output" in the current path.')
|
'directory will be created, named "output" in the current path.')
|
||||||
parser.add_argument('-m', '--markup', default=None, dest='markup',
|
parser.add_argument('-m', '--markup', default=None, dest='markup',
|
||||||
help='the list of markup language to use (rst or md). Please indicate '
|
help='The list of markup language to use (rst or md). Please indicate '
|
||||||
'them separated by commas')
|
'them separated by commas.')
|
||||||
parser.add_argument('-s', '--settings', dest='settings', default='',
|
parser.add_argument('-s', '--settings', dest='settings', default='',
|
||||||
help='the settings of the application. Default to False.')
|
help='The settings of the application. Default to False.')
|
||||||
parser.add_argument('-d', '--delete-output-directory',
|
parser.add_argument('-d', '--delete-output-directory',
|
||||||
dest='delete_outputdir',
|
dest='delete_outputdir',
|
||||||
action='store_true', help='Delete the output directory.')
|
action='store_true', help='Delete the output directory.')
|
||||||
parser.add_argument('-v', '--verbose', action='store_const',
|
parser.add_argument('-v', '--verbose', action='store_const',
|
||||||
const=log.INFO, dest='verbosity',
|
const=log.INFO, dest='verbosity',
|
||||||
help='Show all messages')
|
help='Show all messages.')
|
||||||
parser.add_argument('-q', '--quiet', action='store_const',
|
parser.add_argument('-q', '--quiet', action='store_const',
|
||||||
const=log.CRITICAL, dest='verbosity',
|
const=log.CRITICAL, dest='verbosity',
|
||||||
help='Show only critical errors')
|
help='Show only critical errors.')
|
||||||
parser.add_argument('-D', '--debug', action='store_const',
|
parser.add_argument('-D', '--debug', action='store_const',
|
||||||
const=log.DEBUG, dest='verbosity',
|
const=log.DEBUG, dest='verbosity',
|
||||||
help='Show all message, including debug messages')
|
help='Show all message, including debug messages.')
|
||||||
parser.add_argument('--version', action='version', version=__version__,
|
parser.add_argument('--version', action='version', version=__version__,
|
||||||
help='Print the pelican version and exit')
|
help='Print the pelican version and exit.')
|
||||||
parser.add_argument('-r', '--autoreload', dest='autoreload',
|
parser.add_argument('-r', '--autoreload', dest='autoreload',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Relaunch pelican each time a modification occurs"
|
help="Relaunch pelican each time a modification occurs"
|
||||||
" on the content files")
|
" on the content files.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
log.init(args.verbosity)
|
log.init(args.verbosity)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class Page(object):
|
||||||
self.author = Author(settings['AUTHOR'], settings)
|
self.author = Author(settings['AUTHOR'], settings)
|
||||||
else:
|
else:
|
||||||
self.author = Author(getenv('USER', 'John Doe'), settings)
|
self.author = Author(getenv('USER', 'John Doe'), settings)
|
||||||
warning(u"Author of `{0}' unknow, assuming that his name is "
|
warning(u"Author of `{0}' unknown, assuming that his name is "
|
||||||
"`{1}'".format(filename or self.title, self.author))
|
"`{1}'".format(filename or self.title, self.author))
|
||||||
|
|
||||||
# manage languages
|
# manage languages
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ from pelican.log import warning, info
|
||||||
def get_date(string):
|
def get_date(string):
|
||||||
"""Return a datetime object from a string.
|
"""Return a datetime object from a string.
|
||||||
|
|
||||||
If no format matches the given date, raise a ValuEerror
|
If no format matches the given date, raise a ValueError.
|
||||||
"""
|
"""
|
||||||
string = re.sub(' +', ' ', string)
|
string = re.sub(' +', ' ', string)
|
||||||
formats = ['%Y-%m-%d %H:%M', '%Y/%m/%d %H:%M',
|
formats = ['%Y-%m-%d %H:%M', '%Y/%m/%d %H:%M',
|
||||||
|
|
@ -58,8 +58,8 @@ def copy(path, source, destination, destination_path=None, overwrite=False):
|
||||||
:param source: the source dir
|
:param source: the source dir
|
||||||
:param destination: the destination dir
|
:param destination: the destination dir
|
||||||
:param destination_path: the destination path (optional)
|
:param destination_path: the destination path (optional)
|
||||||
:param overwrite: wether to overwrite the destination if already exists or
|
:param overwrite: whether to overwrite the destination if already exists
|
||||||
not
|
or not
|
||||||
"""
|
"""
|
||||||
if not destination_path:
|
if not destination_path:
|
||||||
destination_path = path
|
destination_path = path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue