diff --git a/ablog/__init__.py b/ablog/__init__.py index 9252bbf7..d936f042 100755 --- a/ablog/__init__.py +++ b/ablog/__init__.py @@ -6,6 +6,9 @@ from glob import glob from pathlib import PurePath +from sphinx.builders.html import StandaloneHTMLBuilder +from sphinx.jinja2glue import BuiltinTemplateLoader, SphinxFileSystemLoader + from .blog import CONFIG, Blog from .post import ( CheckFrontMatter, @@ -22,12 +25,23 @@ ) from .version import version as __version__ +PKGDIR = os.path.abspath(os.path.dirname(__file__)) + + __all__ = ["setup"] +def get_html_templates_path(): + """ + Return path to ABlog templates folder. + """ + pkgdir = os.path.abspath(os.path.dirname(__file__)) + return os.path.join(pkgdir, "templates") + + def anchor(post): """ - Return anchor string for posts that arepage sections. + Return anchor string for posts that are page sections. """ if post.section: return "#" + post.section @@ -59,6 +73,55 @@ def html_page_context(app, pagename, templatename, context, doctree): context["feed_title"] = blog.blog_title +def config_inited(app, config): + # Automatically identify any blog posts if a pattern is specified in the config + if isinstance(config.blog_post_pattern, str): + config.blog_post_pattern = [config.blog_post_pattern] + matched_patterns = [] + for pattern in config.blog_post_pattern: + pattern = os.path.join(app.srcdir, pattern) + # make sure that blog post paths have forward slashes even on windows + matched_patterns.extend( + PurePath(ii).relative_to(app.srcdir).with_suffix("").as_posix() + for ii in glob(pattern, recursive=True) + ) + app.config.matched_blog_posts = matched_patterns + + +def builder_inited(app): + if not isinstance(app.builder, StandaloneHTMLBuilder) or app.config.skip_injecting_base_ablog_templates: + return + if not isinstance(app.builder.templates, BuiltinTemplateLoader): + raise Exception( + "Ablog does not know how to inject templates into with custom " + "template bridges. You can use `ablog.get_html_templates_path()` to " + "get the path to add in your custom template bridge and set " + "`skip_injecting_base_ablog_templates = False` in your " + "`conf.py` file." + ) + if get_html_templates_path() in app.config.templates_path: + raise Exception( + "Found the path from `ablog.get_html_templates_path()` in the " + "`templates_path` variable from `conf.py`. Doing so interferes " + "with Ablog's ability to stay compatible with Sphinx themes that " + "support it out of the box. Please remove `get_html_templates_path` " + "from `templates_path` in your `conf.py` to resolve this." + ) + theme = app.builder.theme + loaders = app.builder.templates.loaders + templatepathlen = app.builder.templates.templatepathlen + if theme.get_config("ablog", "inject_templates_after_theme", False): + # Inject *after* the user templates and the theme templates, + # allowing themes to override the templates provided by this + # extension while those templates still serve as a fallback. + loaders.append(SphinxFileSystemLoader(get_html_templates_path())) + else: + # Inject *after* the user templates and *before* the theme + # templates. This enables ablog to provide support for themes + # that don't support it out-of-the-box, like alabaster. + loaders.insert(templatepathlen, SphinxFileSystemLoader(get_html_templates_path())) + + def setup(app): """ Setup ABlog extension. @@ -68,6 +131,7 @@ def setup(app): app.add_directive("post", PostDirective) app.add_directive("postlist", PostListDirective) app.connect("config-inited", config_inited) + app.connect("builder-inited", builder_inited) app.connect("doctree-read", process_posts) app.connect("env-purge-doc", purge_posts) app.connect("doctree-resolved", process_postlist) @@ -86,27 +150,3 @@ def setup(app): locale_dir = os.path.join(pkgdir, "locales") app.config.locale_dirs.append(locale_dir) return {"version": __version__} # identifies the version of our extension - - -def config_inited(app, config): - app.config.templates_path.append(get_html_templates_path()) - # Automatically identify any blog posts if a pattern is specified in the config - if isinstance(config.blog_post_pattern, str): - config.blog_post_pattern = [config.blog_post_pattern] - matched_patterns = [] - for pattern in config.blog_post_pattern: - pattern = os.path.join(app.srcdir, pattern) - # make sure that blog post paths have forward slashes even on windows - matched_patterns.extend( - PurePath(ii).relative_to(app.srcdir).with_suffix("").as_posix() - for ii in glob(pattern, recursive=True) - ) - app.config.matched_blog_posts = matched_patterns - - -def get_html_templates_path(): - """ - Return path to ABlog templates folder. - """ - pkgdir = os.path.abspath(os.path.dirname(__file__)) - return os.path.join(pkgdir, "templates") diff --git a/ablog/blog.py b/ablog/blog.py index 6eab2822..d391ddb9 100644 --- a/ablog/blog.py +++ b/ablog/blog.py @@ -91,37 +91,38 @@ def verify_fn(key, value, config): CONFIG = [ # name, default, rebuild, verify_fn # where verify_fn is (key, value, app.config) --> value, throwing a KeyError if the value isn't right - ("blog_path", "blog", True, require_config_type(str)), - ("blog_title", "Blog", True, require_config_type(str)), - ("blog_baseurl", "", True, require_config_type(str)), ("blog_archive_titles", None, False, require_config_type(bool)), + ("blog_authors", {}, True, require_config_full_name_link_dict()), + ("blog_baseurl", "", True, require_config_type(str)), + ("blog_default_author", None, True, require_config_str_or_list_lookup("blog_authors")), + ("blog_default_language", None, True, require_config_str_or_list_lookup("blog_languages")), + ("blog_default_location", None, True, require_config_str_or_list_lookup("blog_locations")), ("blog_feed_archives", False, True), ("blog_feed_fulltext", False, True), + ("blog_feed_length", None, None), ("blog_feed_subtitle", None, True), - ("blog_feed_titles", None, False), ("blog_feed_templates", {"atom": {}}, True), - ("blog_feed_length", None, None), - ("blog_authors", {}, True, require_config_full_name_link_dict()), - ("blog_default_author", None, True, require_config_str_or_list_lookup("blog_authors")), - ("blog_locations", {}, True, require_config_full_name_link_dict()), - ("blog_default_location", None, True, require_config_str_or_list_lookup("blog_locations")), + ("blog_feed_titles", None, False), ("blog_languages", {}, True, require_config_full_name_link_dict()), - ("blog_default_language", None, True, require_config_str_or_list_lookup("blog_languages")), - ("fontawesome_link_cdn", None, True), - ("fontawesome_included", False, True, require_config_type(bool)), + ("blog_locations", {}, True, require_config_full_name_link_dict()), + ("blog_path", "blog", True, require_config_type(str)), + ("blog_post_pattern", [], True, require_config_type((str, list))), + ("blog_title", "Blog", True, require_config_type(str)), + ("disqus_drafts", False, True), + ("disqus_pages", False, True), + ("disqus_shortname", None, True), ("fontawesome_css_file", "", True, require_config_type(str)), - ("post_date_format", "%d %B %Y", True, require_config_type(str)), - ("post_date_format_short", "%d %B", True, require_config_type(str)), - ("post_auto_orphan", True, True, require_config_type(bool)), - ("post_auto_image", 0, True), + ("fontawesome_included", False, True, require_config_type(bool)), + ("fontawesome_link_cdn", None, True), + ("post_always_section", False, True), ("post_auto_excerpt", 1, True), + ("post_auto_image", 0, True), + ("post_auto_orphan", True, True, require_config_type(bool)), + ("post_date_format_short", "%d %B", True, require_config_type(str)), + ("post_date_format", "%d %B %Y", True, require_config_type(str)), ("post_redirect_refresh", 5, True), - ("post_always_section", False, True), ("post_show_prev_next", True, True), - ("disqus_shortname", None, True), - ("disqus_drafts", False, True), - ("disqus_pages", False, True), - ("blog_post_pattern", [], True, require_config_type((str, list))), + ("skip_injecting_base_ablog_templates", False, True), ] TOMORROW = datetime.today() + dtmod.timedelta(1) TOMORROW = TOMORROW.replace(hour=0, minute=0, second=0, microsecond=0) @@ -129,7 +130,7 @@ def verify_fn(key, value, config): def revise_pending_xrefs(doctree, docname): - for node in doctree.traverse(addnodes.pending_xref): + for node in doctree.findall(addnodes.pending_xref): node["refdoc"] = docname diff --git a/ablog/locales/ca/LC_MESSAGES/sphinx.po b/ablog/locales/ca/LC_MESSAGES/sphinx.po index a4330d74..d5b5d0a3 100644 --- a/ablog/locales/ca/LC_MESSAGES/sphinx.po +++ b/ablog/locales/ca/LC_MESSAGES/sphinx.po @@ -22,7 +22,7 @@ msgstr "" msgid "Updated on " msgstr "Actualitzat el " -#: ablog/post.py:601 ablog/templates/authors.html:2 +#: ablog/post.py:601 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Autors" @@ -30,7 +30,7 @@ msgstr "Autors" msgid "Posts by" msgstr "Publicacions de" -#: ablog/post.py:602 ablog/templates/locations.html:3 +#: ablog/post.py:602 ablog/templates/ablog/locations.html:3 msgid "Locations" msgstr "Ubicacions" @@ -38,7 +38,7 @@ msgstr "Ubicacions" msgid "Posts from" msgstr "Publicacions des de" -#: ablog/post.py:603 ablog/templates/languages.html:3 +#: ablog/post.py:603 ablog/templates/ablog/languages.html:3 msgid "Languages" msgstr "Idiomes" @@ -46,7 +46,7 @@ msgstr "Idiomes" msgid "Posts in" msgstr "Publicacions en" -#: ablog/post.py:604 ablog/templates/categories.html:3 +#: ablog/post.py:604 ablog/templates/ablog/categories.html:3 msgid "Categories" msgstr "Categories" @@ -58,8 +58,8 @@ msgstr "Totes les publicacions" msgid "Posted in" msgstr "Publicat al" -#: ablog/post.py:606 ablog/templates/postcard2.html:57 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:606 ablog/templates/ablog/postcard2.html:57 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Etiquetes" @@ -79,46 +79,46 @@ msgstr "Totes les" msgid "Drafts" msgstr "Borradors" -#: ablog/templates/archives.html:3 +#: ablog/templates/ablog/archives.html:3 msgid "Archives" msgstr "Arxius" -#: ablog/templates/collection.html:47 +#: ablog/templates/ablog/collection.html:47 msgid "Read more ..." msgstr "Llegir-ne més ..." -#: ablog/templates/postcard2.html:5 +#: ablog/templates/ablog/postcard2.html:5 msgid "Update" msgstr "Actualització" -#: ablog/templates/postcard2.html:12 +#: ablog/templates/ablog/postcard2.html:12 msgid "Author" msgstr "Autor" -#: ablog/templates/postcard2.html:24 +#: ablog/templates/ablog/postcard2.html:24 msgid "Location" msgstr "Ubicació" -#: ablog/templates/postcard2.html:35 +#: ablog/templates/ablog/postcard2.html:35 msgid "Language" msgstr "Idioma" -#: ablog/templates/postcard2.html:46 +#: ablog/templates/ablog/postcard2.html:46 msgid "Category" msgstr "Categoria" -#: ablog/templates/postcard2.html:60 +#: ablog/templates/ablog/postcard2.html:60 msgid "Tag" msgstr "Etiqueta" -#: ablog/templates/postnavy.html:5 +#: ablog/templates/ablog/postnavy.html:5 msgid "Previous" msgstr "Anterior" -#: ablog/templates/postnavy.html:15 +#: ablog/templates/ablog/postnavy.html:15 msgid "Next" msgstr "Següent" -#: ablog/templates/recentposts.html:3 +#: ablog/templates/ablog/recentposts.html:3 msgid "Recent Posts" msgstr "Publicacions recents" diff --git a/ablog/locales/de/LC_MESSAGES/sphinx.po b/ablog/locales/de/LC_MESSAGES/sphinx.po index e763b7c1..f7477264 100644 --- a/ablog/locales/de/LC_MESSAGES/sphinx.po +++ b/ablog/locales/de/LC_MESSAGES/sphinx.po @@ -21,7 +21,7 @@ msgstr "" msgid "Updated on" msgstr "Aktualisiert am" -#: ablog/post.py:387 ablog/templates/authors.html:2 +#: ablog/post.py:387 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Autoren" @@ -29,7 +29,7 @@ msgstr "Autoren" msgid "Posts by" msgstr "Einträge von" -#: ablog/post.py:388 ablog/templates/locations.html:2 +#: ablog/post.py:388 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "Orte" @@ -37,7 +37,7 @@ msgstr "Orte" msgid "Posts from" msgstr "Einträge aus" -#: ablog/post.py:389 ablog/templates/languages.html:2 +#: ablog/post.py:389 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Sprachen" @@ -45,7 +45,7 @@ msgstr "Sprachen" msgid "Posts in" msgstr "Einträge in" -#: ablog/post.py:390 ablog/templates/categories.html:2 +#: ablog/post.py:390 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Kategorien" @@ -57,8 +57,8 @@ msgstr "Alle Einträge" msgid "Posted in" msgstr "Einträge in" -#: ablog/post.py:392 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:392 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Schlagworte" @@ -70,46 +70,46 @@ msgstr "Einträge mit Schlagwort" msgid "Drafts" msgstr "Entwurf" -#: ablog/templates/archive.html:49 +#: ablog/templates/ablog/archive.html:49 msgid "Read more ..." msgstr "Weiter..." -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Archive" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Aktualisierung" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Autor" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Ort" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Sprache" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Kategorie" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Schlagwort" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Vorige" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Nächste" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Neue Einträge" diff --git a/ablog/locales/es/LC_MESSAGES/sphinx.po b/ablog/locales/es/LC_MESSAGES/sphinx.po index 850e5620..7c62a61f 100644 --- a/ablog/locales/es/LC_MESSAGES/sphinx.po +++ b/ablog/locales/es/LC_MESSAGES/sphinx.po @@ -22,7 +22,7 @@ msgstr "" msgid "Updated on" msgstr "Actualizado el" -#: ablog/post.py:387 ablog/templates/authors.html:2 +#: ablog/post.py:387 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Autores" @@ -30,7 +30,7 @@ msgstr "Autores" msgid "Posts by" msgstr "Entradas por" -#: ablog/post.py:388 ablog/templates/locations.html:2 +#: ablog/post.py:388 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "Lugares" @@ -38,7 +38,7 @@ msgstr "Lugares" msgid "Posts from" msgstr "Entradas desde" -#: ablog/post.py:389 ablog/templates/languages.html:2 +#: ablog/post.py:389 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Idiomas" @@ -46,7 +46,7 @@ msgstr "Idiomas" msgid "Posts in" msgstr "Entradas en" -#: ablog/post.py:390 ablog/templates/categories.html:2 +#: ablog/post.py:390 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Categorías" @@ -58,8 +58,8 @@ msgstr "Todas las entradas" msgid "Posted in" msgstr "Publicado en" -#: ablog/post.py:392 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:392 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Etiquetas" @@ -71,46 +71,46 @@ msgstr "Entradas etiquetadas" msgid "Drafts" msgstr "Borradores" -#: ablog/templates/archive.html:49 +#: ablog/templates/ablog/archive.html:49 msgid "Read more ..." msgstr "Leer más ..." -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Archivos" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Actualizado" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Autor" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Lugar" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Idioma" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Categoría" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Etiqueta" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Anterior" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Siguiente" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Entradas recientes" diff --git a/ablog/locales/et/LC_MESSAGES/sphinx.po b/ablog/locales/et/LC_MESSAGES/sphinx.po index daa43898..579fd266 100644 --- a/ablog/locales/et/LC_MESSAGES/sphinx.po +++ b/ablog/locales/et/LC_MESSAGES/sphinx.po @@ -21,7 +21,7 @@ msgstr "" msgid "Updated on" msgstr "Uuendus" -#: ablog/post.py:387 ablog/templates/authors.html:2 +#: ablog/post.py:387 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Autorid" @@ -29,7 +29,7 @@ msgstr "Autorid" msgid "Posts by" msgstr "Postitused autorilt" -#: ablog/post.py:388 ablog/templates/locations.html:2 +#: ablog/post.py:388 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "Kohad" @@ -37,7 +37,7 @@ msgstr "Kohad" msgid "Posts from" msgstr "" -#: ablog/post.py:389 ablog/templates/languages.html:2 +#: ablog/post.py:389 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Keeltes" @@ -45,7 +45,7 @@ msgstr "Keeltes" msgid "Posts in" msgstr "" -#: ablog/post.py:390 ablog/templates/categories.html:2 +#: ablog/post.py:390 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Kategooriad" @@ -57,8 +57,8 @@ msgstr "Kõik postitused" msgid "Posted in" msgstr "Postitused kategoorias" -#: ablog/post.py:392 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:392 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Märksõnad" @@ -70,46 +70,46 @@ msgstr "Postitused märksõnaga" msgid "Drafts" msgstr "Eelnõu" -#: ablog/templates/archive.html:49 +#: ablog/templates/ablog/archive.html:49 msgid "Read more ..." msgstr "Edasi..." -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Arhiiv" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Ajakohastama" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Autor" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Koht" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Keel" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Kategooria" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Märksõna" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Eelmine" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Järgmine" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Viimased postitused" diff --git a/ablog/locales/fr/LC_MESSAGES/sphinx.po b/ablog/locales/fr/LC_MESSAGES/sphinx.po index 09a7e22c..f258d3d8 100644 --- a/ablog/locales/fr/LC_MESSAGES/sphinx.po +++ b/ablog/locales/fr/LC_MESSAGES/sphinx.po @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.8.0\n" -#: ablog/post.py:525 ablog/templates/authors.html:2 +#: ablog/post.py:525 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Auteurs" @@ -26,7 +26,7 @@ msgstr "Auteurs" msgid "Posts by" msgstr "Billets par" -#: ablog/post.py:526 ablog/templates/locations.html:2 +#: ablog/post.py:526 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "Lieux" @@ -34,7 +34,7 @@ msgstr "Lieux" msgid "Posts from" msgstr "Billets depuis" -#: ablog/post.py:527 ablog/templates/languages.html:2 +#: ablog/post.py:527 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Langues" @@ -42,7 +42,7 @@ msgstr "Langues" msgid "Posts in" msgstr "Billets dans" -#: ablog/post.py:528 ablog/templates/categories.html:2 +#: ablog/post.py:528 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Catégories" @@ -54,8 +54,8 @@ msgstr "Tous les billets" msgid "Posted in" msgstr "Publié dans" -#: ablog/post.py:530 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:530 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Tags" @@ -75,46 +75,46 @@ msgstr "Tous les billets" msgid "Drafts" msgstr "Brouillons" -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Archives" -#: ablog/templates/collection.html:48 +#: ablog/templates/ablog/collection.html:48 msgid "Read more ..." msgstr "Lire plus…" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Mis à jour" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Auteur" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Lieu" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Langue" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Catégorie" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Tag" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Précédent" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Suivant" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Billets récents" diff --git a/ablog/locales/ru/LC_MESSAGES/sphinx.po b/ablog/locales/ru/LC_MESSAGES/sphinx.po index 63edab0a..d117a471 100644 --- a/ablog/locales/ru/LC_MESSAGES/sphinx.po +++ b/ablog/locales/ru/LC_MESSAGES/sphinx.po @@ -23,7 +23,7 @@ msgstr "" msgid "Updated on" msgstr "Обновлено" -#: ablog/post.py:387 ablog/templates/authors.html:2 +#: ablog/post.py:387 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Авторы" @@ -31,7 +31,7 @@ msgstr "Авторы" msgid "Posts by" msgstr "Опубликовано" -#: ablog/post.py:388 ablog/templates/locations.html:2 +#: ablog/post.py:388 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "" @@ -39,7 +39,7 @@ msgstr "" msgid "Posts from" msgstr "Сообщения из" -#: ablog/post.py:389 ablog/templates/languages.html:2 +#: ablog/post.py:389 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Языки" @@ -47,7 +47,7 @@ msgstr "Языки" msgid "Posts in" msgstr "Сообщений в" -#: ablog/post.py:390 ablog/templates/categories.html:2 +#: ablog/post.py:390 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Категории" @@ -59,8 +59,8 @@ msgstr "Все записи" msgid "Posted in" msgstr "Опубликовано в" -#: ablog/post.py:392 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:392 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Теги" @@ -72,46 +72,46 @@ msgstr "Сообщения с тегом" msgid "Drafts" msgstr "Черновик" -#: ablog/templates/archive.html:49 +#: ablog/templates/ablog/archive.html:49 msgid "Read more ..." msgstr "Читать ..." -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Архив" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Обновить" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Автор" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Расположение" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Язык" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Категория" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Тег" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Предыдущий" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Следующий" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Недавние Записи" diff --git a/ablog/locales/tr/LC_MESSAGES/sphinx.po b/ablog/locales/tr/LC_MESSAGES/sphinx.po index bd79826f..8652d2e5 100644 --- a/ablog/locales/tr/LC_MESSAGES/sphinx.po +++ b/ablog/locales/tr/LC_MESSAGES/sphinx.po @@ -21,7 +21,7 @@ msgstr "" msgid "Updated on" msgstr "Güncelleme" -#: ablog/post.py:387 ablog/templates/authors.html:2 +#: ablog/post.py:387 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "Yazarlar" @@ -29,7 +29,7 @@ msgstr "Yazarlar" msgid "Posts by" msgstr "Yazar" -#: ablog/post.py:388 ablog/templates/locations.html:2 +#: ablog/post.py:388 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "Mevkiler" @@ -37,7 +37,7 @@ msgstr "Mevkiler" msgid "Posts from" msgstr "Mevki" -#: ablog/post.py:389 ablog/templates/languages.html:2 +#: ablog/post.py:389 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "Diller" @@ -45,7 +45,7 @@ msgstr "Diller" msgid "Posts in" msgstr "Kategori" -#: ablog/post.py:390 ablog/templates/categories.html:2 +#: ablog/post.py:390 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "Kategoriler" @@ -57,8 +57,8 @@ msgstr "Bütün yazılar" msgid "Posted in" msgstr "Sene" -#: ablog/post.py:392 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:392 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "Etiketler" @@ -70,46 +70,46 @@ msgstr "Etiket" msgid "Drafts" msgstr "Taslaklar" -#: ablog/templates/archive.html:49 +#: ablog/templates/ablog/archive.html:49 msgid "Read more ..." msgstr "Okumaya devam et ..." -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "Arşiv" -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "Güncelleme" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "Yazar" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "Mevki" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "Dil" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "Kategori" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "Etiket" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "Önceki" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "Sonraki" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "Yeni Yazılar" diff --git a/ablog/locales/zh_CN/LC_MESSAGES/sphinx.po b/ablog/locales/zh_CN/LC_MESSAGES/sphinx.po index 588e32d4..7f213e8d 100644 --- a/ablog/locales/zh_CN/LC_MESSAGES/sphinx.po +++ b/ablog/locales/zh_CN/LC_MESSAGES/sphinx.po @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.7.0\n" -#: ablog/post.py:525 ablog/templates/authors.html:2 +#: ablog/post.py:525 ablog/templates/ablog/authors.html:2 msgid "Authors" msgstr "作者" @@ -26,7 +26,7 @@ msgstr "作者" msgid "Posts by" msgstr "文章" -#: ablog/post.py:526 ablog/templates/locations.html:2 +#: ablog/post.py:526 ablog/templates/ablog/locations.html:2 msgid "Locations" msgstr "地点" @@ -34,7 +34,7 @@ msgstr "地点" msgid "Posts from" msgstr "文章自" -#: ablog/post.py:527 ablog/templates/languages.html:2 +#: ablog/post.py:527 ablog/templates/ablog/languages.html:2 msgid "Languages" msgstr "语言" @@ -42,7 +42,7 @@ msgstr "语言" msgid "Posts in" msgstr "文章:" -#: ablog/post.py:528 ablog/templates/categories.html:2 +#: ablog/post.py:528 ablog/templates/ablog/categories.html:2 msgid "Categories" msgstr "类别" @@ -54,8 +54,8 @@ msgstr "所有文章" msgid "Posted in" msgstr "文章:" -#: ablog/post.py:530 ablog/templates/postcard2.html:43 -#: ablog/templates/tagcloud.html:2 +#: ablog/post.py:530 ablog/templates/ablog/postcard2.html:43 +#: ablog/templates/ablog/tagcloud.html:2 msgid "Tags" msgstr "标签" @@ -75,46 +75,46 @@ msgstr "所有" msgid "Drafts" msgstr "草稿" -#: ablog/templates/archives.html:2 +#: ablog/templates/ablog/archives.html:2 msgid "Archives" msgstr "归档" -#: ablog/templates/collection.html:48 +#: ablog/templates/ablog/collection.html:48 msgid "Read more ..." msgstr "更多 ..." -#: ablog/templates/postcard2.html:2 +#: ablog/templates/ablog/postcard2.html:2 msgid "Update" msgstr "更新" -#: ablog/templates/postcard2.html:7 +#: ablog/templates/ablog/postcard2.html:7 msgid "Author" msgstr "作者" -#: ablog/templates/postcard2.html:16 +#: ablog/templates/ablog/postcard2.html:16 msgid "Location" msgstr "地点" -#: ablog/templates/postcard2.html:25 +#: ablog/templates/ablog/postcard2.html:25 msgid "Language" msgstr "语言" -#: ablog/templates/postcard2.html:34 +#: ablog/templates/ablog/postcard2.html:34 msgid "Category" msgstr "类别" -#: ablog/templates/postcard2.html:44 +#: ablog/templates/ablog/postcard2.html:44 msgid "Tag" msgstr "标签" -#: ablog/templates/postnavy.html:7 +#: ablog/templates/ablog/postnavy.html:7 msgid "Previous" msgstr "上一篇" -#: ablog/templates/postnavy.html:17 +#: ablog/templates/ablog/postnavy.html:17 msgid "Next" msgstr "下一篇" -#: ablog/templates/recentposts.html:2 +#: ablog/templates/ablog/recentposts.html:2 msgid "Recent Posts" msgstr "最近文章" diff --git a/ablog/post.py b/ablog/post.py index 3595302f..27a863b6 100644 --- a/ablog/post.py +++ b/ablog/post.py @@ -157,12 +157,12 @@ class CheckFrontMatter(SphinxTransform): def apply(self): # Check if page-level metadata has been given - docinfo = list(self.document.traverse(nodes.docinfo)) + docinfo = list(self.document.findall(nodes.docinfo)) if not docinfo: return None docinfo = docinfo[0] # Pull the metadata for the page to check if it is a blog post - metadata = {fn.children[0].astext(): fn.children[1].astext() for fn in docinfo.traverse(nodes.field)} + metadata = {fn.children[0].astext(): fn.children[1].astext() for fn in docinfo.findall(nodes.field)} tags = metadata.get("tags") if isinstance(tags, str): # myst_parser store front-matter field to TextNode in dict_to_fm_field_list. @@ -172,14 +172,14 @@ def apply(self): metadata["tags"] = ",".join( [t.strip().lstrip('"').lstrip("'").rstrip('"').rstrip("'") for t in tags.split(",")] ) - if list(docinfo.traverse(nodes.author)): - metadata["author"] = list(docinfo.traverse(nodes.author))[0].astext() + if list(docinfo.findall(nodes.author)): + metadata["author"] = list(docinfo.findall(nodes.author))[0].astext() # These two fields are special-cased in docutils - if list(docinfo.traverse(nodes.date)): - metadata["date"] = list(docinfo.traverse(nodes.date))[0].astext() + if list(docinfo.findall(nodes.date)): + metadata["date"] = list(docinfo.findall(nodes.date))[0].astext() if "blogpost" not in metadata and self.env.docname not in self.config.matched_blog_posts: return None - if self.document.traverse(PostNode): + if self.document.findall(PostNode): logging.warning(f"Found blog post front-matter as well as post directive, using post directive.") # Iterate through metadata and create a PostNode with relevant fields option_spec = PostDirective.option_spec @@ -197,7 +197,7 @@ def apply(self): if not metadata.get("excerpt"): blog = Blog(self.app) node["excerpt"] = blog.post_auto_excerpt - sections = list(self.document.traverse(nodes.section)) + sections = list(self.document.findall(nodes.section)) if sections: sections[0].children.append(node) node.parent = sections[0] @@ -239,7 +239,7 @@ def _get_section_title(section): """ Return section title as text. """ - for title in section.traverse(nodes.title): + for title in section.findall(nodes.title): return title.astext() raise Exception("Missing title") # A problem with the following is that title may contain pending @@ -250,7 +250,7 @@ def _get_update_dates(section, docname, post_date_format): """ Return list of dates of updates found section. """ - update_nodes = list(section.traverse(UpdateNode)) + update_nodes = list(section.findall(UpdateNode)) update_dates = [] for update_node in update_nodes: try: @@ -283,7 +283,7 @@ def process_posts(app, doctree): env = app.builder.env if not hasattr(env, "ablog_posts"): env.ablog_posts = {} - post_nodes = list(doctree.traverse(PostNode)) + post_nodes = list(doctree.findall(PostNode)) if not post_nodes: return post_date_format = app.config["post_date_format"] @@ -328,7 +328,7 @@ def process_posts(app, doctree): excerpt.append(child.deepcopy()) elif node["excerpt"]: count = 0 - for nod in section.traverse(nodes.paragraph): + for nod in section.findall(nodes.paragraph): excerpt.append(nod.deepcopy()) count += 1 if count >= (node["excerpt"] or 0): @@ -338,7 +338,7 @@ def process_posts(app, doctree): node.replace_self([]) nimg = node["image"] or blog.post_auto_image if nimg: - for img, nod in enumerate(section.traverse(nodes.image), start=1): + for img, nod in enumerate(section.findall(nodes.image), start=1): if img == nimg: excerpt.append(nod.deepcopy()) break @@ -381,7 +381,7 @@ def process_posts(app, doctree): else: section_copy = section.deepcopy() # multiple posting may result having post nodes - for nn in section_copy.traverse(PostNode): + for nn in section_copy.findall(PostNode): if nn["exclude"]: nn.replace_self([]) else: @@ -433,7 +433,7 @@ def process_postlist(app, doctree, docname): blog = Blog(app) if not blog: register_posts(app) - for node in doctree.traverse(PostList): + for node in doctree.findall(PostList): colls = [] for cat in ["tags", "author", "category", "location", "language"]: for coll in node[cat]: @@ -554,7 +554,7 @@ def generate_archive_pages(app): blog = Blog(app) for post in blog.posts: for redirect in post.redirect: - yield (redirect, {"redirect": post.docname, "post": post}, "redirect.html") + yield (redirect, {"redirect": post.docname, "post": post}, "ablog/redirect.html") found_docs = app.env.found_docs atom_feed = bool(blog.blog_baseurl) feed_archives = blog.blog_feed_archives @@ -571,7 +571,7 @@ def generate_archive_pages(app): continue context = {"parents": [], "title": title, "header": header, "catalog": catalog, "summary": True} if catalog.docname not in found_docs: - yield (catalog.docname, context, "catalog.html") + yield (catalog.docname, context, "ablog/catalog.html") for collection in catalog: if not collection: continue @@ -586,7 +586,7 @@ def generate_archive_pages(app): } context["feed_title"] = context["title"] if collection.docname not in found_docs: - yield (collection.docname, context, "collection.html") + yield (collection.docname, context, "ablog/collection.html") if 1: context = { "parents": [], @@ -598,9 +598,9 @@ def generate_archive_pages(app): "feed_path": blog.blog_path, } docname = blog.posts.docname - yield (docname, context, "collection.html") + yield (docname, context, "ablog/collection.html") context = {"parents": [], "title": _("Drafts"), "collection": blog.drafts, "summary": True} - yield (blog.drafts.docname, context, "collection.html") + yield (blog.drafts.docname, context, "ablog/collection.html") def generate_atom_feeds(app): diff --git a/ablog/start.py b/ablog/start.py index d0b6d9c7..3389df73 100644 --- a/ablog/start.py +++ b/ablog/start.py @@ -77,6 +77,11 @@ def w(t, ls=80): # 'Earth': ('The Blue Planet', 'https://en.wikipedia.org/wiki/Earth), # }} +# This will prevent ablog from injecting its own templates into the Sphinx +# build. This is only useful when you have a custom template bridge (rare). +# See https://github.com/sunpy/ablog/pull/144 for the full context. +# skip_injecting_base_ablog_templates = False + # -- Blog Post Related -------------------------------------------------------- # Format date for a post. @@ -123,10 +128,9 @@ def w(t, ls=80): # In addition, there are authors.html, languages.html, and locations.html # sidebars that link to author and location archive pages. html_sidebars = {{ - '**': [ 'about.html', - 'postcard.html', 'navigation.html', - 'recentposts.html', 'tagcloud.html', - 'categories.html', 'archives.html', + '**': [ 'ablog/postcard.html', 'navigation.html', + 'ablog/recentposts.html', 'ablog/tagcloud.html', + 'ablog/categories.html', 'ablog/archives.html', 'searchbox.html', ], }} @@ -215,9 +219,6 @@ def w(t, ls=80): 'ablog', ] -# Add any paths that contain templates here, relative to this directory. -templates_path = ["{dot}templates", ablog.get_html_templates_path()] - # The suffix(es) of source filenames. source_suffix = "{suffix}" diff --git a/ablog/templates/ablog/archives.html b/ablog/templates/ablog/archives.html new file mode 100644 index 00000000..d846d137 --- /dev/null +++ b/ablog/templates/ablog/archives.html @@ -0,0 +1,16 @@ +{% if ablog.archive %} +
+

+ {{ gettext('Archives') }} +

+ +
+{% endif %} diff --git a/ablog/templates/ablog/authors.html b/ablog/templates/ablog/authors.html new file mode 100644 index 00000000..fbf0bf5a --- /dev/null +++ b/ablog/templates/ablog/authors.html @@ -0,0 +1,12 @@ +{% if ablog.author %} +
+

{{ gettext('Authors') }}

+ +
+{% endif %} diff --git a/ablog/templates/ablog/catalog.html b/ablog/templates/ablog/catalog.html new file mode 100644 index 00000000..dc333c60 --- /dev/null +++ b/ablog/templates/ablog/catalog.html @@ -0,0 +1,28 @@ +{%- extends "page.html" %} +{% block body %} +{% for collection in catalog %} +{% if collection %} +
+

+ {{ header }} + {{ collection }} +

+ {% for post in collection %} +
+

+ {% if post.published %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + Draft + {% endif %} + - + {{ post.title }} +

+
+ {% endfor %} +
+{% endif %} +{% endfor %} +{% endblock %} diff --git a/ablog/templates/ablog/categories.html b/ablog/templates/ablog/categories.html new file mode 100644 index 00000000..5396b0a4 --- /dev/null +++ b/ablog/templates/ablog/categories.html @@ -0,0 +1,16 @@ +{% if ablog.category %} +
+

+ {{ gettext('Categories') }} +

+ +
+{% endif %} diff --git a/ablog/templates/ablog/collection.html b/ablog/templates/ablog/collection.html new file mode 100644 index 00000000..6816f8a9 --- /dev/null +++ b/ablog/templates/ablog/collection.html @@ -0,0 +1,62 @@ +{%- extends "page.html" %} {% block body %} +
+

+ {% if archive_feed and fa %} + + + {% endif %} + {{ header }} + {% if collection.href %} + {{ collection }} + {% else %} + {{ collection }} + {% endif %} +

+ {% if ablog.blog_archive_titles %} + {% for post in collection %} +
+

+ {% if post.published %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + Draft + {% endif %} + - + {{ post.title }} +

+
+ {% endfor %} + {% else %} + {% for post in collection %} +
+

+ {{ post.title }} +

+ + {{ post.to_html(collection.docname) }} +

{{ _("Read more ...") }}

+
+
+ {% endfor %} + {% endif %} +
+{% endblock %} diff --git a/ablog/templates/ablog/languages.html b/ablog/templates/ablog/languages.html new file mode 100644 index 00000000..fc69e3cd --- /dev/null +++ b/ablog/templates/ablog/languages.html @@ -0,0 +1,14 @@ +{% if ablog.language %} +
+

+ {{ gettext('Languages') }} +

+ +
+{% endif %} diff --git a/ablog/templates/ablog/locations.html b/ablog/templates/ablog/locations.html new file mode 100644 index 00000000..970593db --- /dev/null +++ b/ablog/templates/ablog/locations.html @@ -0,0 +1,16 @@ +{% if ablog.location %} +
+

+ {{ gettext('Locations') }} +

+ +
+{% endif %} diff --git a/ablog/templates/ablog/postcard.html b/ablog/templates/ablog/postcard.html new file mode 100644 index 00000000..baa51cbc --- /dev/null +++ b/ablog/templates/ablog/postcard.html @@ -0,0 +1,26 @@ +{% if pagename in ablog %} +
+{% set fa = ablog.fontawesome %} +{% set post = ablog[pagename] %} +

+ {% if post.published %} + {% if fa %} + + {% endif %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + {% if fa %} + + {% endif %} + {% if post.date %} + {{ post.date.strftime(ablog.post_date_format)}} + {% else %} + Draft + {% endif %} + {% endif %} +

+ +
+{% endif %} diff --git a/ablog/templates/ablog/postcard2.html b/ablog/templates/ablog/postcard2.html new file mode 100644 index 00000000..163f2cfb --- /dev/null +++ b/ablog/templates/ablog/postcard2.html @@ -0,0 +1,165 @@ +{% if post.published and post.date != post.update %} +
+
  • + + {% if fa %} + + {% else %} + {{gettext('Update') }}: + {% endif %} + + {{ post.update.strftime(ablog.post_date_format) }} +
  • +{% endif %} +{% if post.author %} +
  • + + {% if fa %} + + {% else %} + {{ gettext('Author')}}: + {% endif %} + + {% for coll in post.author %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.author|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.author|length %} + , + {% endif %} + {% endif %} + {% endfor %} +
  • +{% endif %} +{% if post.location %} +
  • + + {% if fa %} + + {% else %} + {{gettext('Location') }}: + {% endif %} + + {% for coll in post.location %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.location|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.location|length %} + , + {% endif %} + {% endif %} + {% endfor %} +
  • +{% endif %} +{% if post.language %} +
  • + + {% if fa %} + + {% else %} + {{gettext('Language') }}: + {% endif %} + + {% for coll in post.language %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.language|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.language|length %} + , + {% endif %} + {% endif %} + {% endfor %} +
  • +{% endif %} +{% if post.category %} +
  • + + {% if fa %} + + {% else %} + {{ gettext('Category') }}: + {% endif %} + + {% for coll in post.category %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.category|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.category|length %} + , + {% endif %} + {% endif %} + {% endfor %} +
  • +{% endif %} +{% if post.tags %} +
  • + + {% if post.tags|length > 1 %} + {% if fa %} + + {% else %} + {{ gettext('Tags') }}: + {% endif %} + {% else %} + {% if fa %} + + {% else %} + {{ gettext('Tag') }}: + {% endif %}{% endif %} + + {% for coll in post.tags %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.tags|length %} + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.tags|length %} + {% endif %} + {% endif %} + {% endfor %} +
  • +{% endif %} +{% if ablog.disqus_shortname and (ablog[pagename].published or ablog.disqus_drafts) %} +
  • + + {% if fa %} + + {% endif %} + + {% if not fa %} + Comments + {% endif %} + +
  • +
    +{% endif %} diff --git a/ablog/templates/ablog/postnavy.html b/ablog/templates/ablog/postnavy.html new file mode 100644 index 00000000..b64898bc --- /dev/null +++ b/ablog/templates/ablog/postnavy.html @@ -0,0 +1,33 @@ +{# prev/next are not set for drafts #} +{% set post = ablog[pagename] %} +{% if post.published and ablog.post_show_prev_next %} +
    + + {% if post.prev %} + {% if not ablog.fontawesome %} + {{ gettext('Previous') }}: + {% endif %} + + {% if ablog.fontawesome %} + + {% endif %} + {{ post.prev.title }} + + {% endif %} + +   + + {% if post.next %} + {% if not ablog.fontawesome %} + {{ gettext('Next') }}: + {% endif %} + + {{ post.next.title }} + {% if ablog.fontawesome %} + + {% endif %} + + {% endif %} + +
    +{% endif %} diff --git a/ablog/templates/ablog/recentposts.html b/ablog/templates/ablog/recentposts.html new file mode 100644 index 00000000..fe49c7b6 --- /dev/null +++ b/ablog/templates/ablog/recentposts.html @@ -0,0 +1,17 @@ +{% if ablog %} +
    +

    + {{ gettext('Recent Posts') }} +

    + +
    +{% endif %} diff --git a/ablog/templates/ablog/redirect.html b/ablog/templates/ablog/redirect.html new file mode 100644 index 00000000..baa3af6a --- /dev/null +++ b/ablog/templates/ablog/redirect.html @@ -0,0 +1,8 @@ +{%- extends "!layout.html" %} +{%- block extrahead %} +{{ super() }} + +{% endblock %} +{% block body %} +You are being redirected to {{ post.title }} in {{ ablog.post_redirect_refresh }} seconds; +{% endblock %} diff --git a/ablog/templates/ablog/tagcloud.html b/ablog/templates/ablog/tagcloud.html new file mode 100644 index 00000000..e3ca32f5 --- /dev/null +++ b/ablog/templates/ablog/tagcloud.html @@ -0,0 +1,14 @@ +{% if ablog.tags %} +
    +

    {{ gettext('Tags') }}

    + +
    +{% endif %} diff --git a/ablog/templates/archives.html b/ablog/templates/archives.html index 95d4465f..b26e94fe 100644 --- a/ablog/templates/archives.html +++ b/ablog/templates/archives.html @@ -1,12 +1,17 @@ +{{ warning("archives.html is an old template path, that is no longer used by ablog. Please use ablog/archives.html instead.") }} {% if ablog.archive %} +

    {{ gettext('Archives') }}

    +
    {% endif %} diff --git a/ablog/templates/authors.html b/ablog/templates/authors.html index 5ba0c92b..4ac4ad43 100644 --- a/ablog/templates/authors.html +++ b/ablog/templates/authors.html @@ -1,4 +1,6 @@ +{{ warning("authors.html is an old template path, that is no longer used by ablog. Please use ablog/authors.html instead.") }} {% if ablog.author %} +

    {{ gettext('Authors') }}

    +
    {% endif %} diff --git a/ablog/templates/catalog.html b/ablog/templates/catalog.html index e2769ec1..e1a2ed31 100644 --- a/ablog/templates/catalog.html +++ b/ablog/templates/catalog.html @@ -1,26 +1,29 @@ -{%- extends "page.html" %} {% block body %} {% for collection in catalog %} {% -if collection %} -
    +{{ warning("catalog.html is an old template path, that is no longer used by ablog. Please use ablog/catalog.html instead.") }} +{%- extends "page.html" %} +{% block body %} +{% for collection in catalog %} +{% if collection %} +

    {{ header }} {{ collection }}

    {% for post in collection %} -
    +

    - {% if fa %}{% endif %} {% if post.published %} {{ - post.date.strftime(ablog.post_date_format) }} {% else %} Draft {% endif %} + {% if post.published %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + Draft + {% endif %} - {{ post.title }}

    - {% if 0 %} -
      - {% include "postcard2.html" %} -
    - {% endif %}
    {% endfor %}
    -{% endif %} {% endfor %} {% endblock %} +{% endif %} +{% endfor %} +{% endblock %} diff --git a/ablog/templates/categories.html b/ablog/templates/categories.html index 772de52e..b5d0e9a7 100644 --- a/ablog/templates/categories.html +++ b/ablog/templates/categories.html @@ -1,12 +1,17 @@ +{{ warning("category.html is an old template path, that is no longer used by ablog. Please use ablog/category.html instead.") }} {% if ablog.category %} +

    {{ gettext('Categories') }}

      - {% for coll in ablog.category %} {% if coll %} + {% for coll in ablog.category %} + {% if coll %}
    • {{ coll }} ({{ coll|length }})
    • - {% endif %} {% endfor %} + {% endif %} + {% endfor %}
    +
    {% endif %} diff --git a/ablog/templates/collection.html b/ablog/templates/collection.html index 8c07b451..d4957050 100644 --- a/ablog/templates/collection.html +++ b/ablog/templates/collection.html @@ -1,52 +1,63 @@ +{{ warning("collection.html is an old template path, that is no longer used by ablog. Please use ablog/collection.html instead.") }} {%- extends "page.html" %} {% block body %} -
    +

    {% if archive_feed and fa %} - {% endif %} {{ header }} {% if collection.href %} + + + {% endif %} + {{ header }} + {% if collection.href %} {{ collection }} - {% else %} {{ collection }} {% endif %} + {% else %} + {{ collection }} + {% endif %}

    - {% if ablog.blog_archive_titles %} {% for post in collection %} -
    + {% if ablog.blog_archive_titles %} + {% for post in collection %} +

    - {% if fa %}{% endif %} {% if post.published %} {{ - post.date.strftime(ablog.post_date_format) }} {% else %} Draft {% endif %} + {% if post.published %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + Draft + {% endif %} - - {{ post.title }} + {{ post.title }}

    - {% if 0 %} -
      - {% include "postcard2.html" %} -
    - {% endif %}
    - {% endfor %} {% else %} {% for post in collection %} - + {% endfor %} + {% else %} + {% for post in collection %}

    - {{ post.title }} + {{ post.title }}

    -
    • - {% if post.published %} {% if fa %}{% - endif %} {{ post.date.strftime(ablog.post_date_format) }} {% else %} {% - if fa %}{% endif %} {% if post.date %}{{ - post.date.strftime(ablog.post_date_format) }} {% else %} Draft {% endif - %} {% endif %} + {% if post.published %} + {% if fa %} + + {% endif %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + {% if fa %} + + {% endif %} + {% if post.date %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + Draft + {% endif %} + {% endif %}
    • - {% include "postcard2.html" %} + {% include "ablog/postcard2.html" %}
    {{ post.to_html(collection.docname) }}

    {{ _("Read more ...") }}

    -
    +
    - {% endfor %} {% endif %} + {% endfor %} + {% endif %}
    {% endblock %} diff --git a/ablog/templates/languages.html b/ablog/templates/languages.html index 57f30cf8..d159df1a 100644 --- a/ablog/templates/languages.html +++ b/ablog/templates/languages.html @@ -1,4 +1,6 @@ +{{ warning("languages.html is an old template path, that is no longer used by ablog. Please use ablog/languages.html instead.") }} {% if ablog.language %} +

    {{ gettext('Languages') }}

    @@ -9,4 +11,5 @@

    {% endif %} {% endfor %} +

    {% endif %} diff --git a/ablog/templates/locations.html b/ablog/templates/locations.html index 2ed8c7aa..4ab646c9 100644 --- a/ablog/templates/locations.html +++ b/ablog/templates/locations.html @@ -1,12 +1,17 @@ +{{ warning("locations.html is an old template path, that is no longer used by ablog. Please use ablog/locations.html instead.") }} {% if ablog.location %} +

    {{ gettext('Locations') }}

      - {% for coll in ablog.location %} {% if coll %} + {% for coll in ablog.location %} + {% if coll %}
    • {{ coll }} ({{ coll|length }})
    • - {% endif %} {% endfor %} + {% endif %} + {% endfor %}
    +
    {% endif %} diff --git a/ablog/templates/page.html b/ablog/templates/page.html index 4c765364..364b202e 100644 --- a/ablog/templates/page.html +++ b/ablog/templates/page.html @@ -1,13 +1,17 @@ -{%- extends "layout.html" %} {% set fa = ablog.fontawesome %} {%- block -extrahead %} {{ super() }} {% if feed_path %} +{%- extends "layout.html" %} +{% set fa = ablog.fontawesome %} +{%- block extrahead %} +{{ super() }} +{% if feed_path %} -{% endif %} {% if ablog.fontawesome_link_cdn%} - +{% endif %} +{% if ablog.fontawesome_link_cdn%} + {% elif ablog.fontawesome_css_file %} {% endif %} - -{% endblock %} {% block body %} {{ body }} -
    - {% if pagename in ablog %} {% include "postnavy.html" %} {% endif %} {% if - ablog.disqus_shortname and ablog.blog_baseurl and (not - ablog[pagename].nocomments) and ((pagename in ablog and - (ablog[pagename].published or ablog.disqus_drafts)) or (not pagename in ablog - and ablog.disqus_pages)) %} -
    +{% endblock %} +{% block body %} +{{ body }} +
    + {% if pagename in ablog %} + {% include "ablog/postnavy.html" %} + {% endif %} + {% if ablog.disqus_shortname and ablog.blog_baseurl and (not ablog[pagename].nocomments) and ((pagename in ablog and (ablog[pagename].published or ablog.disqus_drafts)) or (not pagename in ablog and ablog.disqus_pages)) %} +

    Comments

    - - comments powered by Disqus + + + comments powered by Disqus +
    {% endif %}
    diff --git a/ablog/templates/postcard.html b/ablog/templates/postcard.html index 2d1ddea4..28186f19 100644 --- a/ablog/templates/postcard.html +++ b/ablog/templates/postcard.html @@ -1,15 +1,27 @@ -{% if pagename in ablog %} {% set fa = ablog.fontawesome %} {% set post = -ablog[pagename] %} +{{ warning("postcard.html is an old template path, that is no longer used by ablog. Please use ablog/postcard.html instead.") }} +{% if pagename in ablog %} +
    +{% set fa = ablog.fontawesome %} +{% set post = ablog[pagename] %}

    - {% if post.published %} {% if fa %}{% endif %} - {{ post.date.strftime(ablog.post_date_format) }} {% else %} {% if fa %}{% endif %} {% if post.date %}{{ post.date.strftime(ablog.post_date_format) - }} {% else %} Draft {% endif %} {% endif %} + {% if post.published %} + {% if fa %} + + {% endif %} + {{ post.date.strftime(ablog.post_date_format) }} + {% else %} + {% if fa %} + + {% endif %} + {% if post.date %} + {{ post.date.strftime(ablog.post_date_format)}} + {% else %} + Draft + {% endif %} + {% endif %}

    -
      - {% include "postcard2.html" %} + {% include "ablog/postcard2.html" %}
    +
    {% endif %} diff --git a/ablog/templates/postcard2.html b/ablog/templates/postcard2.html index 7329d575..65cd04fc 100644 --- a/ablog/templates/postcard2.html +++ b/ablog/templates/postcard2.html @@ -1,77 +1,147 @@ +{{ warning("postcard2.html is an old template path, that is no longer used by ablog. Please use ablog/postcard2.html instead.") }} {% if post.published and post.date != post.update %} +
  • - {% if fa %}{% else %}{{ - gettext('Update') }}:{% endif %} + + {% if fa %} + + {% else %} + {{gettext('Update') }}: + {% endif %} + {{ post.update.strftime(ablog.post_date_format) }}
  • -{% endif %} {% if post.author %} -
  • - {% if fa %}{% else %}{{ gettext('Author') - }}:{% endif %} - {% for coll in post.author %} {% if coll|length %} - {{ coll }}{% if loop.index < - post.author|length %},{% endif %} {% else %}{{ coll }}{% if loop.index < - post.author|length %},{% endif %}{% endif %} {% endfor %} +{% endif %} +{% if post.author %} +
  • + + {% if fa %} + + {% else %} + {{ gettext('Author')}}: + {% endif %} + + {% for coll in post.author %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.author|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.author|length %} + , + {% endif %} + {% endif %} + {% endfor %}
  • -{% endif %} {% if post.location %} -
  • - {% if fa %}{% else %}{{ - gettext('Location') }}:{% endif %} - {% for coll in post.location %} {% if coll|length %} - {{ coll }}{% if loop.index < - post.location|length %},{% endif %} {% else %}{{ coll }}{% if loop.index < - post.location|length %},{% endif %}{% endif %} {% endfor %} +{% endif %} +{% if post.location %} +
  • + + {% if fa %} + + {% else %} + {{gettext('Location') }}: + {% endif %} + + {% for coll in post.location %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.location|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.location|length %} + , + {% endif %} + {% endif %} + {% endfor %}
  • -{% endif %} {% if post.language %} -
  • - {% if fa %}{% else %}{{ - gettext('Language') }}:{% endif %} - {% for coll in post.language %} {% if coll|length %} - {{ coll }}{% if loop.index < - post.language|length %},{% endif %} {% else %}{{ coll }}{% if loop.index < - post.language|length %},{% endif %}{% endif %} {% endfor %} +{% endif %} +{% if post.language %} +
  • + + {% if fa %} + + {% else %} + {{gettext('Language') }}: + {% endif %} + + {% for coll in post.language %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.language|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.language|length %} + , + {% endif %} + {% endif %} + {% endfor %}
  • -{% endif %} {% if post.category %} -
  • - {% if fa %}{% else %}{{ - gettext('Category') }}:{% endif %} - {% for coll in post.category %} {% if coll|length %} - {{ coll }}{% if loop.index < - post.category|length %},{% endif %} {% else %}{{ coll }}{% if loop.index < - post.category|length %},{% endif %}{% endif %} {% endfor %} +{% endif %} +{% if post.category %} +
  • + + {% if fa %} + + {% else %} + {{ gettext('Category') }}: + {% endif %} + + {% for coll in post.category %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.category|length %} + , + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.category|length %} + , + {% endif %} + {% endif %} + {% endfor %}
  • -{% endif %} {% if post.tags %} -
  • - {% if post.tags|length > 1 %}{% if fa %}{% - else %}{{ gettext('Tags') }}:{% endif %} {% else %}{% if fa %}{% else %}{{ gettext('Tag') }}:{% endif %}{% endif %} - {% for coll in post.tags %} {% if coll|length %} - {{ coll }}{% if loop.index < - post.tags|length %}{% endif %} {% else %}{{ coll }}{% if loop.index < - post.tags|length %}{% endif %}{% endif %} {% endfor %} +{% endif %} +{% if post.tags %} +
  • + + {% if post.tags|length > 1 %} + {% if fa %} + + {% else %} + {{ gettext('Tags') }}: + {% endif %} + {% else %} + {% if fa %} + + {% else %} + {{ gettext('Tag') }}: + {% endif %}{% endif %} + + {% for coll in post.tags %} + {% if coll|length %} + {{ coll }} + {% if loop.index < post.tags|length %} + {% endif %} + {% else %} + {{ coll }} + {% if loop.index < post.tags|length %} + {% endif %} + {% endif %} + {% endfor %}
  • -{% endif %} {% if ablog.disqus_shortname and (ablog[pagename].published or -ablog.disqus_drafts) %} -
  • +{% endif %} +{% if ablog.disqus_shortname and (ablog[pagename].published or ablog.disqus_drafts) %} +
  • - {% if fa %}{% endif %} - - {% if not fa %}Comments{% endif %} + {% if fa %} + + {% endif %} + + {% if not fa %} + Comments + {% endif %} +
  • +
    {% endif %} diff --git a/ablog/templates/postnavy.html b/ablog/templates/postnavy.html index a39f69ed..4d324b38 100644 --- a/ablog/templates/postnavy.html +++ b/ablog/templates/postnavy.html @@ -1,24 +1,32 @@ -{# prev/next are not set for drafts #} {% set post = ablog[pagename] %} +{{ warning("postnavy.html is an old template path, that is no longer used by ablog. Please use ablog/postnavy.html instead.") }} +{# prev/next are not set for drafts #} +{% set post = ablog[pagename] %} {% if post.published and ablog.post_show_prev_next %} -
    +
    - {% if post.prev %} {% if not ablog.fontawesome %}{{ gettext('Previous') }}: + {% if post.prev %} + {% if not ablog.fontawesome %} + {{ gettext('Previous') }}: {% endif %} - {% if ablog.fontawesome %}{% endif - %} {{ post.prev.title }} + {% if ablog.fontawesome %} + + {% endif %} + {{ post.prev.title }} {% endif %}   - {% if post.next %} {% if not ablog.fontawesome %}{{ gettext('Next') }}: {% - endif %} + {% if post.next %} + {% if not ablog.fontawesome %} + {{ gettext('Next') }}: + {% endif %} - {{ post.next.title }} {% if ablog.fontawesome %}{% endif %} + {{ post.next.title }} + {% if ablog.fontawesome %} + + {% endif %} {% endif %} diff --git a/ablog/templates/recentposts.html b/ablog/templates/recentposts.html index 3f738711..5a7dad64 100644 --- a/ablog/templates/recentposts.html +++ b/ablog/templates/recentposts.html @@ -1,15 +1,18 @@ +{{ warning("recentposts.html is an old template path, that is no longer used by ablog. Please use ablog/recentposts.html instead.") }} {% if ablog %} +

    {{ gettext('Recent Posts') }}

    +
    {% endif %} diff --git a/ablog/templates/redirect.html b/ablog/templates/redirect.html index f8e25705..21109bb1 100644 --- a/ablog/templates/redirect.html +++ b/ablog/templates/redirect.html @@ -1,8 +1,9 @@ -{%- extends "!layout.html" %} {%- block extrahead %} {{ super() }} - -{% endblock %} {% block body %} You are being redirected to -{{ post.title }} in {{ -ablog.post_redirect_refresh }} seconds; {% endblock %} +{{ warning("redirect.html is an old template path, that is no longer used by ablog. Please use ablog/redirect.html instead.") }} +{%- extends "!layout.html" %} +{%- block extrahead %} +{{ super() }} + +{% endblock %} +{% block body %} +You are being redirected to {{ post.title }} in {{ ablog.post_redirect_refresh }} seconds; +{% endblock %} diff --git a/ablog/templates/tagcloud.html b/ablog/templates/tagcloud.html index fac869db..67592664 100644 --- a/ablog/templates/tagcloud.html +++ b/ablog/templates/tagcloud.html @@ -1,41 +1,15 @@ +{{ warning("tagcloud.html is an old template path, that is no longer used by ablog. Please use ablog/tagcloud.html instead.") }} {% if ablog.tags %} +

    {{ gettext('Tags') }}

    -
      - {% for coll in ablog.tags %} {% if coll %} + {% for coll in ablog.tags %} + {% if coll %}
    • {{ coll }}
    • - {% endif %} {% endfor %} + {% endif %} + {% endfor %}
    +
    {% endif %} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c19849c1..6dbae87e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -67,11 +67,10 @@ stages: - pandoc - graphviz envs: - - macos: py37-sphinx4 - - windows: py37-sphinx4 - - linux: py37-sphinx5 - - linux: py38-sphinx4 - - linux: py310-docs + - linux: py38-sphinx5 + - linux: py39-sphinx5 + - macos: py38-sphinx5 + - windows: py38-sphinx5 - stage: ThirdPhaseTests displayName: Stage 3 Tests @@ -87,7 +86,4 @@ stages: - graphviz envs: - linux: py310-sphinxdev - - linux: py38-sphinx5 - - linux: py39-sphinx4 - - linux: py39-sphinx5 - - linux: py310-sphinx4 + - linux: py310-docs diff --git a/docs/conf.py b/docs/conf.py index 2cb7db5d..375c63af 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,5 @@ import re -import alabaster from pkg_resources import get_distribution from sphinx import addnodes @@ -14,24 +13,17 @@ "sphinx.ext.ifconfig", "sphinx.ext.extlinks", "sphinx_automodapi.automodapi", + "ablog", "alabaster", "nbsphinx", "myst_parser", - "ablog", ] -# PROJECT versionmod = get_distribution("ablog") -myst_update_mathjax = False -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# The short X.Y version. version = ".".join(versionmod.version.split(".")[:3]) -# The full version, including alpha/beta/rc tags. release = versionmod.version.split("+")[0] -# Is this version a development release is_development = ".dev" in release + project = "ABlog" copyright = "2014-2022, ABlog Team" master_doc = "index" @@ -39,9 +31,8 @@ ".rst": "restructuredtext", ".md": "markdown", } -exclude_patterns = ["_build"] +exclude_patterns = ["_build", "docs/manual/.ipynb_checkpoints"] -# HTML OUTPUT html_title = "ABlog" html_static_path = ["_static"] html_use_index = True @@ -49,12 +40,11 @@ html_show_sourcelink = True html_favicon = "_static/ablog.ico" -# ABLOG blog_title = "ABlog" blog_baseurl = "https://ablog.readthedocs.org/" blog_locations = { "Pittsburgh": ("Pittsburgh, PA", "https://en.wikipedia.org/wiki/Pittsburgh"), - "SF": ("San Francisco, CA", "https://en.wikipedia.org/wiki/San_Francisco"), + "San Fran": ("San Francisco, CA", "https://en.wikipedia.org/wiki/San_Francisco"), "Denizli": ("Denizli, Turkey", "https://en.wikipedia.org/wiki/Denizli"), } blog_languages = { @@ -71,18 +61,13 @@ } blog_feed_archives = True blog_feed_fulltext = True -blog_feed_length = None blog_feed_templates = { - # Use defaults, no templates "atom": { - # Format tags as hashtags and append to the content "content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}", }, - # Create content text suitable posting to micro-bogging "social": { - # Format tags as hashtags and append to the content "content": "{{ title }}{% for tag in post.tags %}" " #{{ tag.name|trim()|replace(' ', '') }}" "{% endfor %}", @@ -92,21 +77,19 @@ disqus_pages = True fontawesome_link_cdn = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" -# THEME html_style = "alabaster.css" html_theme = "alabaster" html_sidebars = { "**": [ "about.html", - "postcard.html", - "recentposts.html", - "tagcloud.html", - "categories.html", - "archives.html", + "ablog/postcard.html", + "ablog/recentposts.html", + "ablog/tagcloud.html", + "ablog/categories.html", + "ablog/archives.html", "searchbox.html", ] } -html_theme_path = [alabaster.get_path()] html_theme_options = { "travis_button": False, "github_user": "sunpy", @@ -115,7 +98,6 @@ "logo": "ablog.png", } -# SPHINX intersphinx_mapping = { "python": ("https://docs.python.org/", None), "sphinx": ("https://www.sphinx-doc.org/en/master/", None), @@ -125,7 +107,6 @@ "issue": ("https://github.com/sunpy/ablog/issues/%s", "issue %s"), "pull": ("https://github.com/sunpy/ablog/pull/%s", "pull request %s"), } -exclude_patterns = ["docs/manual/.ipynb_checkpoints/*"] rst_epilog = """ .. _Sphinx: http://sphinx-doc.org/ .. _Python: https://python.org diff --git a/docs/manual/ablog-configuration-options.rst b/docs/manual/ablog-configuration-options.rst index 20b0e284..bf10e68c 100644 --- a/docs/manual/ablog-configuration-options.rst +++ b/docs/manual/ablog-configuration-options.rst @@ -271,9 +271,9 @@ Sidebars that you see on the left are listed below in the same order: html_sidebars = { '**': [..., - 'postcard.html', 'recentposts.html', - 'tagcloud.html', 'categories.html', - 'archives.html', ] + 'ablog/postcard.html', 'ablog/recentposts.html', + 'ablog/tagcloud.html', 'ablog/categories.html', + 'ablog/archives.html', ] } diff --git a/docs/release/ablog-v0.11-released.rst b/docs/release/ablog-v0.11-released.rst new file mode 100644 index 00000000..c341b55f --- /dev/null +++ b/docs/release/ablog-v0.11-released.rst @@ -0,0 +1,26 @@ +ABlog v0.11 released +==================== + +.. post:: july 25, 2022 + :author: Nabil Freij + :category: Release + :location: World + +ABlog v0.11 is released with the main focus being to update and tweak the HTML templates allow themes to override the default templates. +In addition, all ablog elements in the templates wrapped in ``ablog__*`` divs to allow custom CSS rules. + +Added support for external links to be posts. + +There are several breaking changes: + +- 1. The template files are now in the `templates/ablog` folder. + Older templates are still in the old location but will raise a warning. +- 2. ``ablog`` has support for not injecting its own templates into the Sphinx build. + This is supported by add `skip_injecting_base_ablog_templates = True` to your configuration file. +- 3. Minimum version of Python is >=3.8 and Sphinx is >=5.0. + +Pull Requests merged in: + +`Template rework `__. + +`Add external links for posts `__ from `Chris Holdgraf `__. diff --git a/setup.cfg b/setup.cfg index 4b624104..edf6714a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ edit_on_github = True github_project = sunpy/ablog [options] -python_requires = >=3.7 +python_requires = >=3.8 packages = find: include_package_data = True setup_requires = @@ -21,7 +21,7 @@ install_requires = feedgen>=0.9.0 invoke>=1.6.0 python-dateutil>=2.8.0 - sphinx>=4.0.0 + sphinx>=5.0.0 watchdog>=2.0.0 [options.extras_require] @@ -50,8 +50,7 @@ filterwarnings = error # Do not fail on pytest config issues (i.e. missing plugins) but do show them always::pytest.PytestConfigWarning - # Update this when we depend on higher levels of Sphinx. - ignore:nodes.Node.traverse\(\) is obsoleted by Node.findall\(\) + [pycodestyle] max_line_length = 110 diff --git a/setup.py b/setup.py index 323297c5..c63402d9 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ "ablog": [ ("**.py", "python", None), ("templates/**.html", "jinja2", None), + ("templates/ablog/**.html", "jinja2", None), ], }, ) diff --git a/tox.ini b/tox.ini index d3128491..22f98437 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39,310}{-sphinx4,-sphinx5,-sphinxdev,-docs} + py{37,38,39,310}{-sphinx5,-sphinxdev,-docs} codestyle requires = setuptools >= 30.3.0 @@ -16,7 +16,6 @@ whitelist_externals= /usr/bin/make make deps = - sphinx4: sphinx>=4.0,<5.0 sphinx5: sphinx>=5.0,<6.0 sphinx6: sphinx>=6.0,<7.0 sphinxdev: git+https://github.com/sphinx-doc/sphinx