diff --git a/docs/contribute.rst b/docs/contribute.rst index a96f2d02..221c405b 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -140,6 +140,10 @@ Install the needed dependencies and set up the project:: invoke setup +Create a topic branch for your plugin bug fix or feature:: + + git checkout -b name-of-your-bugfix-or-feature + After writing new tests for your plugin changes, run the plugin test suite:: invoke tests diff --git a/docs/settings.rst b/docs/settings.rst index 04ba7493..a59b9ebb 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -362,16 +362,15 @@ variables allow you to place your articles in a location such as example below). These settings give you the flexibility to place your articles and pages anywhere you want. -.. note:: - If you specify a ``datetime`` directive, it will be substituted using the - input files' date metadata attribute. If the date is not specified for a - particular file, Pelican will rely on the file's ``mtime`` timestamp. Check - the `Python datetime documentation`_ for more information. +If you don't want that flexibility and instead prefer that your generated +output paths mirror your source content's filesystem path hierarchy, try the +following settings:: -.. _Python datetime documentation: - https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior + PATH_METADATA = '(?P.*)\..*' + ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = '{path_no_ext}.html' -Also, you can use other file metadata attributes as well: +Otherwise, you can use a variety of file metadata attributes within URL-related +settings: * slug * date @@ -391,6 +390,15 @@ This would save your articles into something like ``/pages/about/index.html``, and render them available at URLs of ``/posts/2011/Aug/07/sample-post/`` and ``/pages/about/``, respectively. +.. note:: + If you specify a ``datetime`` directive, it will be substituted using the + input files' date metadata attribute. If the date is not specified for a + particular file, Pelican will rely on the file's ``mtime`` timestamp. Check + the `Python datetime documentation`_ for more information. + +.. _Python datetime documentation: + https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior + .. data:: RELATIVE_URLS = False Defines whether Pelican should use document-relative URLs or not. Only set @@ -645,7 +653,7 @@ Time and Date the language name (``lang`` metadata in your post content) as the key. In addition to the standard C89 strftime format codes that are listed in - `Python strftime documentation`_, you can use the ``-`` character between + `Python datetime documentation`_, you can use the ``-`` character between ``%`` and the format character to remove any leading zeros. For example, ``%d/%m/%Y`` will output ``01/01/2014`` whereas ``%-d/%-m/%Y`` will result in ``1/1/2014``. @@ -696,8 +704,6 @@ Time and Date .. [#] Default is the system locale. -.. _Python strftime documentation: https://docs.python.org/library/datetime.html#strftime-strptime-behavior - .. _locales on Windows: https://www.microsoft.com/en-us/download/details.aspx?id=55979 .. _locale(1): https://linux.die.net/man/1/locale diff --git a/docs/themes.rst b/docs/themes.rst index 392ec924..a2332615 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -120,8 +120,8 @@ your date according to the locale given in your settings:: {{ article.date|strftime('%d %B %Y') }} -.. _datetime: https://docs.python.org/2/library/datetime.html#datetime-objects -.. _strftime: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior +.. _datetime: https://docs.python.org/3/library/datetime.html#datetime-objects +.. _strftime: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior index.html diff --git a/pelican/__init__.py b/pelican/__init__.py index 17f4f922..97135a62 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -466,14 +466,19 @@ def listen(server, port, output, excqueue=None): excqueue.put(traceback.format_exception_only(type(e), e)[-1]) return - logging.info("Serving at port %s, server %s.", port, server) try: + print("\nServing site at: {}:{} - Tap CTRL-C to stop".format( + server, port)) httpd.serve_forever() except Exception as e: if excqueue is not None: excqueue.put(traceback.format_exception_only(type(e), e)[-1]) return + except KeyboardInterrupt: + print("\nKeyboard interrupt received. Shutting down server.") + httpd.socket.close() + def main(argv=None): args = parse_arguments(argv)