From 6a9aa1dca8bf24739aa075671f4e6c2b8e742e03 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 28 Dec 2019 09:48:07 +0100 Subject: [PATCH 1/7] Remove duplicate datetime URL in Settings docs --- docs/settings.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 39982315..3ffe735e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -645,7 +645,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 +696,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: http://msdn.microsoft.com/en-us/library/cdax410z%28VS.71%29.aspx .. _locale(1): https://linux.die.net/man/1/locale From d2c857883f8829806b4c7021bc903cf9ad092989 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 28 Dec 2019 09:52:33 +0100 Subject: [PATCH 2/7] Update Python documentation links to Python 3 --- docs/settings.rst | 2 +- docs/themes.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 3ffe735e..832db001 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -369,7 +369,7 @@ and pages anywhere you want. the `Python datetime documentation`_ for more information. .. _Python datetime documentation: - https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior + https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior Also, you can use other file metadata attributes as well: diff --git a/docs/themes.rst b/docs/themes.rst index b00d0236..ea9214fe 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 From d7795b8afde60fbc494bb3c9798ddf90c05dd0b1 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 28 Dec 2019 09:57:41 +0100 Subject: [PATCH 3/7] Move Python datetime note further down Settings docs --- docs/settings.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 832db001..1242205e 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -362,15 +362,6 @@ 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. - -.. _Python datetime documentation: - https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior - Also, you can use other file metadata attributes as well: * slug @@ -391,6 +382,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 From b8f2326fa656dc1e990c0a8ca4f6573ba3e205e5 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 28 Dec 2019 10:02:48 +0100 Subject: [PATCH 4/7] Document mirroring content & output path hierarchies --- docs/settings.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/settings.rst b/docs/settings.rst index 1242205e..b4ec4761 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -362,7 +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. -Also, you can use other file metadata attributes as well: +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:: + + PATH_METADATA = '(?P.*)\..*' + ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = '{path_no_ext}.html' + +Otherwise, you can use a variety of file metadata attributes within URL-related +settings: * slug * date From 70c8d2a47431cc5de29b08a830d1af4f8e6f6e30 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 28 Dec 2019 10:20:19 +0100 Subject: [PATCH 5/7] Docs: Ensure plugin developers create new branch --- docs/contribute.rst | 4 ++++ 1 file changed, 4 insertions(+) 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 From 569f8a080ec1ba55ed36a49d607bea560fad53f8 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 17 Jan 2020 15:11:42 +0100 Subject: [PATCH 6/7] Tell users they can use CTRL-C to stop web server This knowledge was heretofore assumed but is better made explicit. --- pelican/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 17f4f922..e040ca4d 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -466,8 +466,9 @@ 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: From fa719315035b38633aee88d1a10927b3ce018032 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 17 Jan 2020 15:22:12 +0100 Subject: [PATCH 7/7] Exit web server gracefully when user taps CTRL-C Users were previously met with an ugly traceback. Now `pelican --listen` invocations, when quit via CTRL-C, are followed instead by a more user-friendly message. --- pelican/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pelican/__init__.py b/pelican/__init__.py index e040ca4d..97135a62 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -475,6 +475,10 @@ def listen(server, port, output, excqueue=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)