Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sunpy/ablog into ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jan 6, 2024
2 parents 8b03e85 + de37cf0 commit fe5cccb
Show file tree
Hide file tree
Showing 37 changed files with 457 additions and 155 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
push:
branches:
- 'main'
- '*.*'
- '!*backport*'
tags:
- 'v*'
- '!*dev*'
- '!*pre*'
- '!*post*'
pull_request:
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 7 * * *' # Every day at 07:00 UTC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
core:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
submodules: false
coverage: codecov
libraries: |
apt:
- pandoc
- graphviz
envs: |
- linux: py312-sphinx7
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test:
needs: [core]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
submodules: false
coverage: codecov
libraries: |
brew:
- pandoc
- graphviz
choco:
- pandoc
- graphviz
apt:
- pandoc
- graphviz
envs: |
- linux: py311-sphinx6
- macos: py310-sphinx5
- windows: py39-sphinx5
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
submodules: false
pytest: false
envs: |
- linux: py312-docs
extras:
needs: [test]
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main
with:
default_python: '3.9'
submodules: false
coverage: codecov
libraries: |
apt:
- pandoc
- graphviz
envs: |
- linux: py312-sphinxdev
- linux: py312-conda
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,4 @@ test/
pydata-sphinx-theme/
_build
_version.py
demo/
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ci:
autofix_prs: false
autoupdate_schedule: "quarterly"
repos:
- repo: https://github.com/myint/docformatter
rev: v1.7.5
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: demo rebuild tests

demo:
rm -rf demo
rm -rf demo && mkdir demo
printf "demo\nABlog\nABlog Team\nhttps://ablog.readthedocs.io/" | ablog start

rebuild:
Expand Down
89 changes: 0 additions & 89 deletions azure-pipelines.yml

This file was deleted.

5 changes: 3 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from pathlib import Path

import docutils
import pytest
import sphinx
from sphinx.testing.path import path

# Load app, status and warning fixtures.
pytest_plugins = ["sphinx.testing.fixtures"]
Expand All @@ -18,7 +19,7 @@ def pytest_report_header(config):

@pytest.fixture(scope="session")
def rootdir():
return path(__file__).parent.abspath() / "roots"
return Path(__file__).parent.absolute() / "roots"


@pytest.fixture(autouse=True)
Expand Down
12 changes: 2 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from pathlib import Path

from pkg_resources import get_distribution
from packaging.version import parse as _parse
from sphinx import addnodes

import ablog
Expand All @@ -22,11 +22,7 @@
"myst_parser",
]

versionmod = get_distribution("ablog")
version = ".".join(versionmod.version.split(".")[:3])
release = versionmod.version.split("+")[0]
is_development = ".dev" in release

version = str(_parse(ablog.__version__))
project = "ABlog"
copyright = "2014-2022, ABlog Team"
master_doc = "index"
Expand All @@ -35,13 +31,11 @@
".md": "markdown",
}
exclude_patterns = ["_build", "docs/manual/.ipynb_checkpoints"]

html_title = "ABlog"
html_use_index = True
html_domain_indices = False
html_show_sourcelink = True
html_favicon = "_static/ablog.ico"

blog_title = "ABlog"
blog_baseurl = "https://ablog.readthedocs.io/"
blog_locations = {
Expand Down Expand Up @@ -74,7 +68,6 @@
disqus_shortname = "https-ablog-readthedocs-io"
disqus_pages = True
fontawesome_link_cdn = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"

html_style = "alabaster.css"
html_theme = "alabaster"
html_sidebars = {
Expand All @@ -98,7 +91,6 @@
"description": "ABlog for blogging with Sphinx",
"logo": "ablog.png",
}

intersphinx_mapping = {
"python": ("https://docs.python.org/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
Expand Down
4 changes: 4 additions & 0 deletions docs/manual/ablog-configuration-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ Post related

Date display format (default is ``'%b %d, %Y'``) for published posts that goes as input to :meth:`datetime.date.strftime`.

.. confval:: post_date_format_short

Date display format in recent posts (default is ``'%d %B'``) for published posts that goes as input to :meth:`datetime.date.strftime`.

.. confval:: post_auto_excerpt

Number of paragraphs (default is ``1``) that will be displayed as an excerpt from the post.
Expand Down
4 changes: 4 additions & 0 deletions docs/manual/posting-and-listing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Any page in a Sphinx_ project can be converted to a post using the following dir
You can change this behavior and also add an image to the excerpt.
To find out how, see :ref:`post-excerpts-and-images`.

**Canonical links**

If you re-publish content already existing on another URL (e.g., if you re-publish content from an employer's blog your personal one), use the ``canonical_link`` parameter to create a [canonical link relation](https://datatracker.ietf.org/doc/html/rfc6596) to the original version.

**External links**

If you'd like a post to point to an external website (e.g., if you host your posts on a blogging platform like Medium but wish to maintain a list of posts on your ``Ablog`` site), use the ``external_link`` parameter and this will be used instead.
Expand Down
48 changes: 45 additions & 3 deletions docs/release/ablog-v0.11-released.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ ABlog v0.11 released
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.

We also adopt `NEP29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>` and drop support for older versions of Python and package versions that are 24 months old or older at time of release.
We also adopt `NEP29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__ and drop support for older versions of Python and package versions that are 24 months old or older at time of release.

Added support for external links to be posts.

There are several breaking changes:

- 1. The template files are now in the `templates/ablog` folder.
- 1. The template files are now in the ``templates/ablog`` folder.
Older templates are still in the old location but will raise a warning.
These will be removed in a future version, please do not use them anymore.
You will need to update any paths to them to add "ablog/" to the path.
- 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.
This is supported by add ``skip_injecting_base_ablog_templates = True`` to your configuration file.
- 3. Minimum version of Python is >=3.9 and Sphinx is >=5.0.

Pull Requests merged in:
Expand All @@ -43,3 +43,45 @@ Pull Requests merged in:

`append posts to atom feed to keep post order from new to old <https://github.com/sunpy/ablog/pull/216>`__ from `lexming <https://github.com/lexming>`__.
`avoid spurious warning about posts with front-matter and post directive <https://github.com/sunpy/ablog/pull/214>`__ from `lexming <https://github.com/lexming>`__.

ABlog v0.11.3 released
----------------------

Pull Requests merged in:

`use fully qualified URLs for images in atom feed <https://github.com/sunpy/ablog/pull/218>`__ from `lexming <https://github.com/lexming>`__.

ABlog v0.11.4 released
----------------------

Pull Requests merged in:

`Use paragraph instead of container for blog post excerpts <https://github.com/sunpy/ablog/pull/226>`__ from `dstansby <https://github.com/dstansby>`__.

ABlog v0.11.5 released
----------------------

Pull Requests merged in:

`Fix incorrect /div when using discuss <https://github.com/sunpy/ablog/pull/251>`__ from `Cadair <https://github.com/Cadair>`__.

ABlog v0.11.6 released
----------------------

Pull Requests merged in:

`Adds IT locale <https://github.com/sunpy/ablog/pull/253>`__ from `Stefano David <https://github.com/stefanodavid>`__.

`Enables configuring a canonical_link for individual posts <https://github.com/sunpy/ablog/pull/258>`__ from `Hendrik Makait <https://github.com/hendrikmakait>`__.

ABlog v0.11.7 released
----------------------

Pull Requests merged in:

`Add stylesheet for tagcloud <https://github.com/sunpy/ablog/pull/268>`__ from `Shengyu Zhang <https://github.com/SilverRainZ>`__.

`Create demo/ before running ablog start <https://github.com/sunpy/ablog/pull/269>`__ from `Shengyu Zhang <https://github.com/SilverRainZ>`__.


`Add span to more items in templates <https://github.com/sunpy/ablog/pull/270>`__ from `Nabil Freij <https://github.com/nabobalis>`__.
9 changes: 9 additions & 0 deletions roots/test-canonical/canonical.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. post:: 2021-12-01
:tags: Canonical
:canonical_link: https://canonical.example.org/foo.html

Canonical post
=============

This post will get generated, but its [canonical link](https://datatracker.ietf.org/doc/html/rfc6596)
in the header will point to ``canonical_link``.
20 changes: 20 additions & 0 deletions roots/test-canonical/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extensions = ["ablog"]

# Enable Atom feed generation
blog_baseurl = "https://blog.example.com/"
# Include full post in feeds
blog_feed_fulltext = True
# Add a social media Atom feed
blog_feed_templates = {
# Use defaults, no templates
"atom": {},
# 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 %}",
},
}
# Sphinx creates canonical links pointing to this base URL by default
html_baseurl = blog_baseurl
2 changes: 2 additions & 0 deletions roots/test-canonical/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test-external
=============
Loading

0 comments on commit fe5cccb

Please sign in to comment.