From e6005302b89f1874926ad0b9b2020dd0be73b382 Mon Sep 17 00:00:00 2001 From: zPlus Date: Sun, 15 Dec 2024 11:17:29 +0100 Subject: [PATCH] Move HTML templates, and articles, to root directory. --- app.py | 43 ++++++++++--------- {pages => articles}/1984_ehf..html | 2 +- .../Bottle_(web_framework).html | 2 +- {pages => articles}/DOKK.html | 2 +- {pages => articles}/Dragora_(software).html | 2 +- {pages => articles}/ForgeFed.html | 2 +- {pages => articles}/GNU_Hackers_Meeting.html | 2 +- {pages => articles}/Gitea_(software).html | 2 +- {pages => articles}/Gogs_(software).html | 2 +- .../Header_Dictionary_Triples.html | 2 +- {pages => articles}/Minifree_Ltd.html | 2 +- {pages => articles}/NotABug.org.html | 2 +- {pages => articles}/The_Peers_Community.html | 2 +- {pages => articles}/TuxFamily.html | 2 +- {pages => articles}/Vervis_(software).html | 2 +- {pages => articles}/Vikings_GmbH.html | 2 +- {pages => articles}/archive-webextension.html | 2 +- {pages => articles}/freepost_(software).html | 2 +- {pages => articles}/lib.reviews.html | 2 +- {pages => articles}/radio-browser.info.html | 2 +- ...al_hosting_platform_for_free_software.html | 2 +- .../articles/article.html | 2 +- .../articles/index.html | 2 +- {pages/templates => templates}/base.html | 0 {pages/templates => templates}/index.html | 2 +- .../library/index.html | 2 +- .../templates => templates}/library/item.html | 2 +- .../license/index.html | 2 +- .../license/license.html | 2 +- .../manpages/disambiguation.html | 2 +- .../manpages/distribution.html | 2 +- .../manpages/index.html | 2 +- .../manpages/manpage.html | 2 +- .../manpages/package.html | 2 +- .../mimi_and_eunice/index.html | 2 +- .../mimi_and_eunice/strip.html | 2 +- 36 files changed, 56 insertions(+), 55 deletions(-) rename {pages => articles}/1984_ehf..html (96%) rename {pages => articles}/Bottle_(web_framework).html (97%) rename {pages => articles}/DOKK.html (95%) rename {pages => articles}/Dragora_(software).html (96%) rename {pages => articles}/ForgeFed.html (97%) rename {pages => articles}/GNU_Hackers_Meeting.html (96%) rename {pages => articles}/Gitea_(software).html (97%) rename {pages => articles}/Gogs_(software).html (98%) rename {pages => articles}/Header_Dictionary_Triples.html (98%) rename {pages => articles}/Minifree_Ltd.html (97%) rename {pages => articles}/NotABug.org.html (97%) rename {pages => articles}/The_Peers_Community.html (97%) rename {pages => articles}/TuxFamily.html (97%) rename {pages => articles}/Vervis_(software).html (95%) rename {pages => articles}/Vikings_GmbH.html (95%) rename {pages => articles}/archive-webextension.html (86%) rename {pages => articles}/freepost_(software).html (98%) rename {pages => articles}/lib.reviews.html (98%) rename {pages => articles}/radio-browser.info.html (94%) rename {pages => articles}/virtual_hosting_platform_for_free_software.html (95%) rename {pages/templates => templates}/articles/article.html (90%) rename {pages/templates => templates}/articles/index.html (92%) rename {pages/templates => templates}/base.html (100%) rename {pages/templates => templates}/index.html (95%) rename {pages/templates => templates}/library/index.html (97%) rename {pages/templates => templates}/library/item.html (96%) rename {pages/templates => templates}/license/index.html (89%) rename {pages/templates => templates}/license/license.html (90%) rename {pages/templates => templates}/manpages/disambiguation.html (96%) rename {pages/templates => templates}/manpages/distribution.html (94%) rename {pages/templates => templates}/manpages/index.html (94%) rename {pages/templates => templates}/manpages/manpage.html (95%) rename {pages/templates => templates}/manpages/package.html (94%) rename {pages/templates => templates}/mimi_and_eunice/index.html (91%) rename {pages/templates => templates}/mimi_and_eunice/strip.html (96%) diff --git a/app.py b/app.py index f339fa2..ad971da 100755 --- a/app.py +++ b/app.py @@ -23,7 +23,7 @@ if not FUSEKI_ENDPOINT: application = bottle.app() # Directories to search for HTML templates -bottle.TEMPLATE_PATH = [ './pages' ] +bottle.TEMPLATE_PATH = [ './templates', './articles' ] def query(query_string, jsonld_frame=None): """ @@ -100,7 +100,7 @@ def homepage(): Homepage. """ - return template('templates/index.html') + return template('index.html') @bottle.route('/library', method=['GET', 'POST'], name='library') def library(): @@ -188,7 +188,7 @@ def library(): 'library:title': {} }) - return template('templates/library/index.html', authors=authors, licenses=licenses, items=items, + return template('library/index.html', authors=authors, licenses=licenses, items=items, filters_author=filters_author, filters_license=filters_license) @bottle.get('/library/', name='library_item') @@ -243,7 +243,7 @@ def library_item(item_id): } )["@graph"][0] - return template('templates/library/item.html', item_id=item_id, plaintext=item_plaintext, data=data) + return template('library/item.html', item_id=item_id, plaintext=item_plaintext, data=data) @bottle.get('/license', name='license_list') def license_list(): @@ -263,7 +263,7 @@ def license_list(): ORDER BY ASC(UCASE(?name)) """) - return template('templates/license/index.html', data=data) + return template('license/index.html', data=data) @bottle.get('/license/', name='license') def license(id): @@ -278,7 +278,7 @@ def license(id): DESCRIBE """) - return template('templates/license/license.html', data=data) + return template('license/license.html', data=data) @bottle.get('/manpages', name='manpages') def manpages(): @@ -298,7 +298,7 @@ def manpages(): ORDER BY ?name ?number """) - return template('templates/manpages/index.html', data=data) + return template('manpages/index.html', data=data) @bottle.get('/manpages//', name='manpages_distribution') def manpages_distribution(distribution, version): @@ -323,7 +323,7 @@ def manpages_distribution(distribution, version): ORDER BY ?name ''') - return template('templates/manpages/distribution.html', data=data, distribution=distribution, version=version) + return template('manpages/distribution.html', data=data, distribution=distribution, version=version) @bottle.get('/manpages///', name='manpages_package') def manpages_package(distribution, version, package): @@ -352,7 +352,7 @@ def manpages_package(distribution, version, package): ORDER BY ?filename ''') - return template('templates/manpages/package.html', data=data, distribution=distribution, version=version, package=package) + return template('manpages/package.html', data=data, distribution=distribution, version=version, package=package) @bottle.get('/manpages/.
', name='manpages_disambiguation') def manpages_disambiguation(name, section): @@ -383,7 +383,7 @@ def manpages_disambiguation(name, section): ORDER BY ?distro_name ?distro_number ?package_name ''')['results']['bindings'] - return template('templates/manpages/disambiguation.html', name=name, section=section, data=data) + return template('manpages/disambiguation.html', name=name, section=section, data=data) @bottle.get('/manpages////', name='manpages_page') def manpages_page(distro_name, distro_number, package, page): @@ -441,7 +441,7 @@ def manpages_page(distro_name, distro_number, package, page): >{match.group('page')}({match.group('section')})''', html) - return template('templates/manpages/manpage.html', + return template('manpages/manpage.html', distro = {'name': distro_name, 'number': distro_number}, package = package, page = { @@ -469,7 +469,7 @@ def mimi_and_eunice(): ORDER BY ?number """) - return template('templates/mimi_and_eunice/index.html', data=data) + return template('mimi_and_eunice/index.html', data=data) @bottle.get('/mimi_and_eunice/', name='mimi_and_eunice_strip') def mimi_and_eunice_strip(number): @@ -505,24 +505,25 @@ def mimi_and_eunice_strip(number): 'blob:at': {} }) - return template('templates/mimi_and_eunice/strip.html', data=data['@graph'][0]) + return template('mimi_and_eunice/strip.html', data=data['@graph'][0]) @bottle.get('/articles', name='articles') def articles(): """ """ - pages = [ page.stem for page in sorted(pathlib.Path('./pages').glob('*.html')) ] + pages = [ page.stem for page in sorted(pathlib.Path('./articles').glob('*.html')) ] - return template('templates/articles/index.html', pages=pages) + return template('articles/index.html', pages=pages) -# TODO Make this obsolete. Replace with controllers -@bottle.get('/', name='page') -def article(page=''): +@bottle.get('/', name='article') +def article(article_title=''): """ - Path for serving a "page". + Path for serving an "article". + If no other controller has matched, this will look into the "articles" folder. + Keep this controller last. """ - page += '.html' + article_title += '.html' - return template(page) + return template(article_title) diff --git a/pages/1984_ehf..html b/articles/1984_ehf..html similarity index 96% rename from pages/1984_ehf..html rename to articles/1984_ehf..html index 5702f6a..caf0ee1 100644 --- a/pages/1984_ehf..html +++ b/articles/1984_ehf..html @@ -1,5 +1,5 @@ {% set title = "1984 ehf." %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Bottle_(web_framework).html b/articles/Bottle_(web_framework).html similarity index 97% rename from pages/Bottle_(web_framework).html rename to articles/Bottle_(web_framework).html index eb10230..13434b5 100644 --- a/pages/Bottle_(web_framework).html +++ b/articles/Bottle_(web_framework).html @@ -1,5 +1,5 @@ {% set title = "Bottle" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/DOKK.html b/articles/DOKK.html similarity index 95% rename from pages/DOKK.html rename to articles/DOKK.html index 90f9826..f332c51 100644 --- a/pages/DOKK.html +++ b/articles/DOKK.html @@ -1,5 +1,5 @@ {% set title = "DOKK" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Dragora_(software).html b/articles/Dragora_(software).html similarity index 96% rename from pages/Dragora_(software).html rename to articles/Dragora_(software).html index d2a9d26..077c023 100644 --- a/pages/Dragora_(software).html +++ b/articles/Dragora_(software).html @@ -1,5 +1,5 @@ {% set title = "Dragora" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/ForgeFed.html b/articles/ForgeFed.html similarity index 97% rename from pages/ForgeFed.html rename to articles/ForgeFed.html index 6a46df3..1c03c33 100644 --- a/pages/ForgeFed.html +++ b/articles/ForgeFed.html @@ -1,5 +1,5 @@ {% set title = "ForgeFed" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/GNU_Hackers_Meeting.html b/articles/GNU_Hackers_Meeting.html similarity index 96% rename from pages/GNU_Hackers_Meeting.html rename to articles/GNU_Hackers_Meeting.html index 1eb7009..62fc89c 100644 --- a/pages/GNU_Hackers_Meeting.html +++ b/articles/GNU_Hackers_Meeting.html @@ -1,5 +1,5 @@ {% set title = "GNU Hackers' Meetings" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Gitea_(software).html b/articles/Gitea_(software).html similarity index 97% rename from pages/Gitea_(software).html rename to articles/Gitea_(software).html index 873fae7..baa451b 100644 --- a/pages/Gitea_(software).html +++ b/articles/Gitea_(software).html @@ -1,5 +1,5 @@ {% set title = "Gitea" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Gogs_(software).html b/articles/Gogs_(software).html similarity index 98% rename from pages/Gogs_(software).html rename to articles/Gogs_(software).html index 39f77af..f977891 100644 --- a/pages/Gogs_(software).html +++ b/articles/Gogs_(software).html @@ -1,5 +1,5 @@ {% set title = "Gogs" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Header_Dictionary_Triples.html b/articles/Header_Dictionary_Triples.html similarity index 98% rename from pages/Header_Dictionary_Triples.html rename to articles/Header_Dictionary_Triples.html index 8be1604..8f092d9 100644 --- a/pages/Header_Dictionary_Triples.html +++ b/articles/Header_Dictionary_Triples.html @@ -1,5 +1,5 @@ {% set title = "Header Dictionary Triples" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Minifree_Ltd.html b/articles/Minifree_Ltd.html similarity index 97% rename from pages/Minifree_Ltd.html rename to articles/Minifree_Ltd.html index db0894e..9e07602 100644 --- a/pages/Minifree_Ltd.html +++ b/articles/Minifree_Ltd.html @@ -1,5 +1,5 @@ {% set title = "Minifree Ltd" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/NotABug.org.html b/articles/NotABug.org.html similarity index 97% rename from pages/NotABug.org.html rename to articles/NotABug.org.html index abcf9af..1fedea6 100644 --- a/pages/NotABug.org.html +++ b/articles/NotABug.org.html @@ -1,5 +1,5 @@ {% set title = "NotABug.org" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/The_Peers_Community.html b/articles/The_Peers_Community.html similarity index 97% rename from pages/The_Peers_Community.html rename to articles/The_Peers_Community.html index ccd87b3..cde6afb 100644 --- a/pages/The_Peers_Community.html +++ b/articles/The_Peers_Community.html @@ -1,5 +1,5 @@ {% set title = "The Peers Community" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/TuxFamily.html b/articles/TuxFamily.html similarity index 97% rename from pages/TuxFamily.html rename to articles/TuxFamily.html index 1c93753..0fe9649 100644 --- a/pages/TuxFamily.html +++ b/articles/TuxFamily.html @@ -1,5 +1,5 @@ {% set title = "TuxFamily" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Vervis_(software).html b/articles/Vervis_(software).html similarity index 95% rename from pages/Vervis_(software).html rename to articles/Vervis_(software).html index b694aee..eabb172 100644 --- a/pages/Vervis_(software).html +++ b/articles/Vervis_(software).html @@ -1,5 +1,5 @@ {% set title = "Vervis" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/Vikings_GmbH.html b/articles/Vikings_GmbH.html similarity index 95% rename from pages/Vikings_GmbH.html rename to articles/Vikings_GmbH.html index 3a0de5b..e293507 100644 --- a/pages/Vikings_GmbH.html +++ b/articles/Vikings_GmbH.html @@ -1,5 +1,5 @@ {% set title = "Vikings GmbH" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/archive-webextension.html b/articles/archive-webextension.html similarity index 86% rename from pages/archive-webextension.html rename to articles/archive-webextension.html index 4f8d8f2..92f268a 100644 --- a/pages/archive-webextension.html +++ b/articles/archive-webextension.html @@ -1,5 +1,5 @@ {% set title = "archive-webextension" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/freepost_(software).html b/articles/freepost_(software).html similarity index 98% rename from pages/freepost_(software).html rename to articles/freepost_(software).html index c11e314..cdf1c30 100644 --- a/pages/freepost_(software).html +++ b/articles/freepost_(software).html @@ -1,5 +1,5 @@ {% set title = "freepost" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/lib.reviews.html b/articles/lib.reviews.html similarity index 98% rename from pages/lib.reviews.html rename to articles/lib.reviews.html index daad857..f2c9318 100644 --- a/pages/lib.reviews.html +++ b/articles/lib.reviews.html @@ -1,5 +1,5 @@ {% set title = "lib.reviews" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/radio-browser.info.html b/articles/radio-browser.info.html similarity index 94% rename from pages/radio-browser.info.html rename to articles/radio-browser.info.html index d1313f9..d0d78fc 100644 --- a/pages/radio-browser.info.html +++ b/articles/radio-browser.info.html @@ -1,5 +1,5 @@ {% set title = "radio-browser.info" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/virtual_hosting_platform_for_free_software.html b/articles/virtual_hosting_platform_for_free_software.html similarity index 95% rename from pages/virtual_hosting_platform_for_free_software.html rename to articles/virtual_hosting_platform_for_free_software.html index 4260d53..c8edc12 100644 --- a/pages/virtual_hosting_platform_for_free_software.html +++ b/articles/virtual_hosting_platform_for_free_software.html @@ -1,5 +1,5 @@ {% set title = "Virtual Hosting platform For Free Software" %} -{% extends "templates/articles/article.html" %} +{% extends "articles/article.html" %} {% block article %} diff --git a/pages/templates/articles/article.html b/templates/articles/article.html similarity index 90% rename from pages/templates/articles/article.html rename to templates/articles/article.html index 5fbbfd9..412f47c 100644 --- a/pages/templates/articles/article.html +++ b/templates/articles/article.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block stylesheets %} diff --git a/pages/templates/articles/index.html b/templates/articles/index.html similarity index 92% rename from pages/templates/articles/index.html rename to templates/articles/index.html index 5169f51..8b452bb 100644 --- a/pages/templates/articles/index.html +++ b/templates/articles/index.html @@ -2,7 +2,7 @@ because unused #} -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Articles{% endblock %} diff --git a/pages/templates/base.html b/templates/base.html similarity index 100% rename from pages/templates/base.html rename to templates/base.html diff --git a/pages/templates/index.html b/templates/index.html similarity index 95% rename from pages/templates/index.html rename to templates/index.html index 74d30ef..83bc128 100644 --- a/pages/templates/index.html +++ b/templates/index.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{% endblock %} diff --git a/pages/templates/library/index.html b/templates/library/index.html similarity index 97% rename from pages/templates/library/index.html rename to templates/library/index.html index e7fb841..9f02c5f 100644 --- a/pages/templates/library/index.html +++ b/templates/library/index.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Library{% endblock %} diff --git a/pages/templates/library/item.html b/templates/library/item.html similarity index 96% rename from pages/templates/library/item.html rename to templates/library/item.html index f24ce52..f7299d9 100644 --- a/pages/templates/library/item.html +++ b/templates/library/item.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ data['library:title'] }}{% endblock %} diff --git a/pages/templates/license/index.html b/templates/license/index.html similarity index 89% rename from pages/templates/license/index.html rename to templates/license/index.html index bf0208e..d0f8ec3 100644 --- a/pages/templates/license/index.html +++ b/templates/license/index.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Licenses{% endblock %} diff --git a/pages/templates/license/license.html b/templates/license/license.html similarity index 90% rename from pages/templates/license/license.html rename to templates/license/license.html index 4cead96..915978d 100644 --- a/pages/templates/license/license.html +++ b/templates/license/license.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ data['license:name'] }}{% endblock %} diff --git a/pages/templates/manpages/disambiguation.html b/templates/manpages/disambiguation.html similarity index 96% rename from pages/templates/manpages/disambiguation.html rename to templates/manpages/disambiguation.html index 26c3550..49daa3a 100644 --- a/pages/templates/manpages/disambiguation.html +++ b/templates/manpages/disambiguation.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Man pages named {{ name }} in section {{ section }}{% endblock %} diff --git a/pages/templates/manpages/distribution.html b/templates/manpages/distribution.html similarity index 94% rename from pages/templates/manpages/distribution.html rename to templates/manpages/distribution.html index 23ed03c..396e9b5 100644 --- a/pages/templates/manpages/distribution.html +++ b/templates/manpages/distribution.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ distribution }} {{ version }} man pages{% endblock %} diff --git a/pages/templates/manpages/index.html b/templates/manpages/index.html similarity index 94% rename from pages/templates/manpages/index.html rename to templates/manpages/index.html index d15ddcb..bf0e251 100644 --- a/pages/templates/manpages/index.html +++ b/templates/manpages/index.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}man pages{% endblock %} diff --git a/pages/templates/manpages/manpage.html b/templates/manpages/manpage.html similarity index 95% rename from pages/templates/manpages/manpage.html rename to templates/manpages/manpage.html index c8379b4..bcf58a6 100644 --- a/pages/templates/manpages/manpage.html +++ b/templates/manpages/manpage.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ page["name"] }}({{ page["section"] }}){% endblock %} {% block stylesheets %} diff --git a/pages/templates/manpages/package.html b/templates/manpages/package.html similarity index 94% rename from pages/templates/manpages/package.html rename to templates/manpages/package.html index 73a0ebb..d3134b3 100644 --- a/pages/templates/manpages/package.html +++ b/templates/manpages/package.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}{{ package }} ({{ distribution }} {{ version }}) man pages{% endblock %} diff --git a/pages/templates/mimi_and_eunice/index.html b/templates/mimi_and_eunice/index.html similarity index 91% rename from pages/templates/mimi_and_eunice/index.html rename to templates/mimi_and_eunice/index.html index f3c2b4a..04144e8 100644 --- a/pages/templates/mimi_and_eunice/index.html +++ b/templates/mimi_and_eunice/index.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Mimi & Eunice{% endblock %} diff --git a/pages/templates/mimi_and_eunice/strip.html b/templates/mimi_and_eunice/strip.html similarity index 96% rename from pages/templates/mimi_and_eunice/strip.html rename to templates/mimi_and_eunice/strip.html index 0d48798..c162f56 100644 --- a/pages/templates/mimi_and_eunice/strip.html +++ b/templates/mimi_and_eunice/strip.html @@ -1,4 +1,4 @@ -{% extends "templates/base.html" %} +{% extends "base.html" %} {% block title %}Mimi&Eunice {{ data['comics:number'] }}: {{ data['comics:title'] }}{% endblock %}