From 6059675d55d0abbb2bcba73f365d88473fb8029f Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Sat, 11 Nov 2023 14:10:08 +0100 Subject: [PATCH] Fix #3233 -- Simple theme classless semantic HTML --- .gitignore | 1 + docs/settings.rst | 6 ++++ .../custom/author/alexis-metaireau.html | 12 ++++--- .../custom/author/alexis-metaireau2.html | 16 ++++++---- .../custom/author/alexis-metaireau3.html | 12 ++++--- pelican/tests/output/custom/index.html | 12 ++++--- pelican/tests/output/custom/index2.html | 16 ++++++---- pelican/tests/output/custom/index3.html | 12 ++++--- .../author/alexis-metaireau.html | 12 ++++--- .../author/alexis-metaireau2.html | 16 ++++++---- .../author/alexis-metaireau3.html | 12 ++++--- pelican/tests/output/custom_locale/index.html | 12 ++++--- .../tests/output/custom_locale/index2.html | 16 ++++++---- .../tests/output/custom_locale/index3.html | 12 ++++--- pelican/themes/simple/templates/archives.html | 2 +- pelican/themes/simple/templates/article.html | 32 +++++++++---------- pelican/themes/simple/templates/author.html | 2 +- pelican/themes/simple/templates/authors.html | 2 +- pelican/themes/simple/templates/base.html | 18 +++++++---- .../themes/simple/templates/categories.html | 2 +- pelican/themes/simple/templates/category.html | 2 +- pelican/themes/simple/templates/index.html | 25 +++++++-------- pelican/themes/simple/templates/page.html | 8 ++++- .../themes/simple/templates/pagination.html | 16 ++++++---- .../simple/templates/period_archives.html | 2 +- pelican/themes/simple/templates/tag.html | 2 +- pelican/themes/simple/templates/tags.html | 2 +- 27 files changed, 163 insertions(+), 119 deletions(-) diff --git a/.gitignore b/.gitignore index b27f3eb9..473efea2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ samples/output *.pem *.lock .pdm-python +.venv diff --git a/docs/settings.rst b/docs/settings.rst index a7768514..88a32d23 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -1231,6 +1231,12 @@ Following are example ways to specify your preferred theme:: # Specify a customized theme, via absolute path THEME = "/home/myuser/projects/mysite/themes/mycustomtheme" +The built-in ``simple`` theme can be customized using the following settings. + +.. data:: STYLESHEET_URL + + The URL of the stylesheet to use. + The built-in ``notmyidea`` theme can make good use of the following settings. Feel free to use them in your themes as well. diff --git a/pelican/tests/output/custom/author/alexis-metaireau.html b/pelican/tests/output/custom/author/alexis-metaireau.html index a9c73e6b..aef8c6e6 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau.html +++ b/pelican/tests/output/custom/author/alexis-metaireau.html @@ -120,11 +120,13 @@

There are comments.

-

- Page 1 / 3 - » - -

+
diff --git a/pelican/tests/output/custom/author/alexis-metaireau2.html b/pelican/tests/output/custom/author/alexis-metaireau2.html index 41f00605..8d17eed5 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau2.html +++ b/pelican/tests/output/custom/author/alexis-metaireau2.html @@ -133,13 +133,15 @@ YEAH !

There are comments.

-

- - « - Page 2 / 3 - » - -

+
diff --git a/pelican/tests/output/custom/author/alexis-metaireau3.html b/pelican/tests/output/custom/author/alexis-metaireau3.html index 45a5f0d1..48fe75ba 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau3.html +++ b/pelican/tests/output/custom/author/alexis-metaireau3.html @@ -85,11 +85,13 @@ pelican.conf, it will …

There are comments.

-

- - « - Page 3 / 3 -

+
diff --git a/pelican/tests/output/custom/index.html b/pelican/tests/output/custom/index.html index ceb6e4f5..6c4d7a94 100644 --- a/pelican/tests/output/custom/index.html +++ b/pelican/tests/output/custom/index.html @@ -120,11 +120,13 @@

There are comments.

-

- Page 1 / 3 - » - -

+
diff --git a/pelican/tests/output/custom/index2.html b/pelican/tests/output/custom/index2.html index ddd4e96e..043f8c33 100644 --- a/pelican/tests/output/custom/index2.html +++ b/pelican/tests/output/custom/index2.html @@ -133,13 +133,15 @@ YEAH !

There are comments.

-

- - « - Page 2 / 3 - » - -

+
diff --git a/pelican/tests/output/custom/index3.html b/pelican/tests/output/custom/index3.html index 698139a0..f8ebaac0 100644 --- a/pelican/tests/output/custom/index3.html +++ b/pelican/tests/output/custom/index3.html @@ -85,11 +85,13 @@ pelican.conf, it will …

There are comments.

-

- - « - Page 3 / 3 -

+
diff --git a/pelican/tests/output/custom_locale/author/alexis-metaireau.html b/pelican/tests/output/custom_locale/author/alexis-metaireau.html index 41a21a98..df76ccf6 100644 --- a/pelican/tests/output/custom_locale/author/alexis-metaireau.html +++ b/pelican/tests/output/custom_locale/author/alexis-metaireau.html @@ -120,11 +120,13 @@

There are comments.

-

- Page 1 / 3 - » - -

+
diff --git a/pelican/tests/output/custom_locale/author/alexis-metaireau2.html b/pelican/tests/output/custom_locale/author/alexis-metaireau2.html index 6412784f..42a929d0 100644 --- a/pelican/tests/output/custom_locale/author/alexis-metaireau2.html +++ b/pelican/tests/output/custom_locale/author/alexis-metaireau2.html @@ -133,13 +133,15 @@ YEAH !

There are comments.

-

- - « - Page 2 / 3 - » - -

+
diff --git a/pelican/tests/output/custom_locale/author/alexis-metaireau3.html b/pelican/tests/output/custom_locale/author/alexis-metaireau3.html index 2679b0a6..941cdc46 100644 --- a/pelican/tests/output/custom_locale/author/alexis-metaireau3.html +++ b/pelican/tests/output/custom_locale/author/alexis-metaireau3.html @@ -85,11 +85,13 @@ pelican.conf, it will …

There are comments.

-

- - « - Page 3 / 3 -

+
diff --git a/pelican/tests/output/custom_locale/index.html b/pelican/tests/output/custom_locale/index.html index 4a661093..054011cc 100644 --- a/pelican/tests/output/custom_locale/index.html +++ b/pelican/tests/output/custom_locale/index.html @@ -120,11 +120,13 @@

There are comments.

-

- Page 1 / 3 - » - -

+
diff --git a/pelican/tests/output/custom_locale/index2.html b/pelican/tests/output/custom_locale/index2.html index 60fee085..fa2c4d2d 100644 --- a/pelican/tests/output/custom_locale/index2.html +++ b/pelican/tests/output/custom_locale/index2.html @@ -133,13 +133,15 @@ YEAH !

There are comments.

-

- - « - Page 2 / 3 - » - -

+
diff --git a/pelican/tests/output/custom_locale/index3.html b/pelican/tests/output/custom_locale/index3.html index 76597e82..71ccb4b1 100644 --- a/pelican/tests/output/custom_locale/index3.html +++ b/pelican/tests/output/custom_locale/index3.html @@ -85,11 +85,13 @@ pelican.conf, it will …

There are comments.

-

- - « - Page 3 / 3 -

+
diff --git a/pelican/themes/simple/templates/archives.html b/pelican/themes/simple/templates/archives.html index b7754c45..c7fb2127 100644 --- a/pelican/themes/simple/templates/archives.html +++ b/pelican/themes/simple/templates/archives.html @@ -3,7 +3,7 @@ {% block title %}{{ SITENAME|striptags }} - Archives{% endblock %} {% block content %} -

Archives for {{ SITENAME }}

+

Archives for {{ SITENAME }}

{% for article in dates %} diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index a17f2759..07e5534d 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -22,44 +22,44 @@ {% endblock %} {% block content %} +
-

+

{{ article.title }}

+ title="Permalink to {{ article.title|striptags }}">{{ article.title }} {% import 'translations.html' as translations with context %} {{ translations.translations_for(article) }}
-
-
{% endblock %} diff --git a/pelican/themes/simple/templates/author.html b/pelican/themes/simple/templates/author.html index c054f8ab..9b30dfe2 100644 --- a/pelican/themes/simple/templates/author.html +++ b/pelican/themes/simple/templates/author.html @@ -3,5 +3,5 @@ {% block title %}{{ SITENAME|striptags }} - Articles by {{ author }}{% endblock %} {% block content_title %} -

Articles by {{ author }}

+

Articles by {{ author }}

{% endblock %} diff --git a/pelican/themes/simple/templates/authors.html b/pelican/themes/simple/templates/authors.html index 9b80b499..01b4f6f1 100644 --- a/pelican/themes/simple/templates/authors.html +++ b/pelican/themes/simple/templates/authors.html @@ -3,7 +3,7 @@ {% block title %}{{ SITENAME|striptags }} - Authors{% endblock %} {% block content %} -

Authors on {{ SITENAME }}

+

Authors on {{ SITENAME }}

    {% for author, articles in authors|sort %}
  • {{ author }} ({{ articles|count }})
  • diff --git a/pelican/themes/simple/templates/base.html b/pelican/themes/simple/templates/base.html index 94a16930..e006cba1 100644 --- a/pelican/themes/simple/templates/base.html +++ b/pelican/themes/simple/templates/base.html @@ -6,6 +6,12 @@ + {% if SITESUBTITLE %} + + {% endif %} + {% if STYLESHEET_URL %} + + {% endif %} {% if FEED_ALL_ATOM %} {% endif %} @@ -35,32 +41,32 @@
    -

    {{ SITENAME }}{% if SITESUBTITLE %} {{ SITESUBTITLE }}{% endif %}

    -
    +

    {{ SITENAME }}

    {% if SITESUBTITLE %}

    {{ SITESUBTITLE }}

    {% endif %}
    +
    {% block content %} {% endblock %}
    -
    +
    Proudly powered by Pelican, which takes great advantage of Python. -
    +
    diff --git a/pelican/themes/simple/templates/categories.html b/pelican/themes/simple/templates/categories.html index f099e88f..7da19fb4 100644 --- a/pelican/themes/simple/templates/categories.html +++ b/pelican/themes/simple/templates/categories.html @@ -3,7 +3,7 @@ {% block title %}{{ SITENAME|striptags }} - Categories{% endblock %} {% block content %} -

    Categories on {{ SITENAME }}

    +

    Categories on {{ SITENAME }}

      {% for category, articles in categories|sort %}
    • {{ category }} ({{ articles|count }})
    • diff --git a/pelican/themes/simple/templates/category.html b/pelican/themes/simple/templates/category.html index da1a8b52..16525fb2 100644 --- a/pelican/themes/simple/templates/category.html +++ b/pelican/themes/simple/templates/category.html @@ -3,5 +3,5 @@ {% block title %}{{ SITENAME|striptags }} - {{ category }} category{% endblock %} {% block content_title %} -

      Articles in the {{ category }} category

      +

      Articles in the {{ category }} category

      {% endblock %} diff --git a/pelican/themes/simple/templates/index.html b/pelican/themes/simple/templates/index.html index ab4bc345..c9837b54 100644 --- a/pelican/themes/simple/templates/index.html +++ b/pelican/themes/simple/templates/index.html @@ -1,28 +1,27 @@ {% extends "base.html" %} {% block content %} -
      {% block content_title %}

      All articles

      {% endblock %} -
        + {% for article in articles_page.object_list %} -
      1. + + {% endfor %} -
      + {% if articles_page.has_other_pages() %} {% include 'pagination.html' %} {% endif %} -
      + {% endblock content %} diff --git a/pelican/themes/simple/templates/page.html b/pelican/themes/simple/templates/page.html index eea816a9..38452d1d 100644 --- a/pelican/themes/simple/templates/page.html +++ b/pelican/themes/simple/templates/page.html @@ -13,15 +13,21 @@ {% endblock %} {% block content %} -

      {{ page.title }}

      +
      +
      +

      {{ page.title }}

      +
      {% import 'translations.html' as translations with context %} {{ translations.translations_for(page) }} {{ page.content }} {% if page.modified %} +

      Last updated: {{ page.locale_modified }}

      +
      {% endif %} +
      {% endblock %} diff --git a/pelican/themes/simple/templates/pagination.html b/pelican/themes/simple/templates/pagination.html index 588f130c..45e7f167 100644 --- a/pelican/themes/simple/templates/pagination.html +++ b/pelican/themes/simple/templates/pagination.html @@ -1,15 +1,17 @@ {% if DEFAULT_PAGINATION %} {% set first_page = articles_paginator.page(1) %} {% set last_page = articles_paginator.page(articles_paginator.num_pages) %} -

      +

      {% endif %} diff --git a/pelican/themes/simple/templates/period_archives.html b/pelican/themes/simple/templates/period_archives.html index 9cdc354d..595def50 100644 --- a/pelican/themes/simple/templates/period_archives.html +++ b/pelican/themes/simple/templates/period_archives.html @@ -3,7 +3,7 @@ {% block title %}{{ SITENAME|striptags }} - {{ period | reverse | join(' ') }} archives{% endblock %} {% block content %} -

      Archives for {{ period | reverse | join(' ') }}

      +

      Archives for {{ period | reverse | join(' ') }}

      {% for article in dates %} diff --git a/pelican/themes/simple/templates/tag.html b/pelican/themes/simple/templates/tag.html index 59725a05..f9b71f48 100644 --- a/pelican/themes/simple/templates/tag.html +++ b/pelican/themes/simple/templates/tag.html @@ -3,5 +3,5 @@ {% block title %}{{ SITENAME|striptags }} - {{ tag }} tag{% endblock %} {% block content_title %} -

      Articles tagged with {{ tag }}

      +

      Articles tagged with {{ tag }}

      {% endblock %} diff --git a/pelican/themes/simple/templates/tags.html b/pelican/themes/simple/templates/tags.html index 92c142d2..6b5c6b1c 100644 --- a/pelican/themes/simple/templates/tags.html +++ b/pelican/themes/simple/templates/tags.html @@ -3,7 +3,7 @@ {% block title %}{{ SITENAME|striptags }} - Tags{% endblock %} {% block content %} -

      Tags for {{ SITENAME }}

      +

      Tags for {{ SITENAME }}

        {% for tag, articles in tags|sort %}
      • {{ tag }} ({{ articles|count }})