diff --git a/.circleci/config.yml b/.circleci/config.yml index 88b4b96c..45a8ffec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,13 +2,13 @@ version: 2 jobs: twine-check: docker: - - image: circleci/python:3.8 + - image: cimg/python:3.12 steps: - checkout - - run: python setup.py sdist - - run: python -m pip install -U --user --force-reinstall twine + - run: python -m pip install -U --user build + - run: python -m build . --sdist + - run: python -m pip install -U --user twine - run: python -m twine check dist/* - workflows: version: 2 twine-check: diff --git a/.codecov.yaml b/.codecov.yaml new file mode 100644 index 00000000..12e27d05 --- /dev/null +++ b/.codecov.yaml @@ -0,0 +1,8 @@ +codecov: + token: a0dfd87f-8eb9-4a41-9e4e-a06919f216cd +comment: off +coverage: + status: + project: + default: + threshold: 0.2% diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e36af018..fc4339d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,23 +3,23 @@ name: CI on: push: branches: - - 'main' - - '*.*' - - '!*backport*' + - "main" + - "*.*" + - "!*backport*" tags: - - 'v*' - - '!*dev*' - - '!*pre*' - - '!*post*' + - "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 + # ┌───────── 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 }} @@ -36,11 +36,11 @@ jobs: - pandoc - graphviz envs: | - - linux: py312-sphinx7 + - linux: py312-sphinx8 secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - test: + tests: needs: [core] uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main with: @@ -57,35 +57,48 @@ jobs: - pandoc - graphviz envs: | - - linux: py311-sphinx6 - - macos: py310-sphinx5 - - windows: py39-sphinx5 + - macos: py311-sphinx7 + - windows: py310-sphinx7 + - linux: py39-sphinx6 + - linux: py312-devdeps 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] + needs: [tests] uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@main with: - default_python: '3.9' submodules: false - coverage: codecov + pytest: false libraries: | apt: - pandoc - graphviz envs: | - - linux: py312-sphinxdev - - linux: py312-conda - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - linux: py312-docs + - linux: pydata-sphinx-theme-dev + - linux: py312-linkcheck + + conda: + needs: [tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + - uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: ablog-test + environment-file: ablog-conda-test-env.yml + python-version: "3.12" + - name: Install ablog + shell: bash -el {0} + run: | + pip install --no-deps --no-build-isolation . + - name: Run test + shell: bash -el {0} + run: | + conda list + pytest -vvv -r a --pyargs ablog + make tests diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 26518b6c..1458db42 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -8,19 +8,19 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -U --user --force-reinstall pep517 setuptools_scm twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - python -m pep517.build --binary --source --out-dir wheelhouse . - python -m twine upload --skip-existing wheelhouse/* + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -U --user --force-reinstall pep517 setuptools_scm twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python -m pep517.build --binary --source --out-dir wheelhouse . + python -m twine upload --skip-existing wheelhouse/* diff --git a/.gitignore b/.gitignore index 0bcd7e3b..ff1e26e3 100644 --- a/.gitignore +++ b/.gitignore @@ -63,9 +63,6 @@ instance/ # Scrapy stuff: .scrapy -# Sphinx documentation -docs/_build/ - # PyBuilder target/ @@ -138,24 +135,10 @@ Icon ### MacOS: https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd -.Spotlight-V100 .TemporaryItems -.Trashes .VolumeIcon.icns .com.apple.timemachine.donotpresent @@ -195,29 +178,14 @@ $RECYCLE.BIN/ ### VScode: https://raw.githubusercontent.com/github/gitignore/master/Global/VisualStudioCode.gitignore .vscode/* -### Extra Python Items and SunPy Specific -.hypothesis -.pytest_cache -sunpydata.sqlite -sunpydata.sqlite-journal -sunpy/_compiler.c -sunpy/cython_version.py -docs/_build -docs/generated -docs/api/ -docs/whatsnew/latest_changelog.txt -examples/**/*.asdf -# This is incase you run the figure tests -figure_test_images* -tags - ### Pycharm(?) .idea -# Release script +# Ablog .github_cache - +src/ablog/version.py docs/_build/ +docs/api/ docs/.doctrees/ docs/_website/ docs/_latex/ @@ -226,5 +194,4 @@ test/ .history/ pydata-sphinx-theme/ _build -_version.py demo/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04e6c440..f07d3874 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,47 +1,49 @@ ci: - autofix_prs: false - autoupdate_schedule: "quarterly" + autofix_prs: false + autoupdate_schedule: "quarterly" repos: -- repo: https://github.com/PyCQA/autoflake - rev: v2.3.1 + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.5 hooks: - - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] -- repo: https://github.com/PyCQA/isort - rev: 5.13.2 + - id: docformatter + args: ["--in-place", "--pre-summary-newline", "--make-summary-multi"] + - repo: https://github.com/PyCQA/autoflake + rev: v2.3.1 hooks: - - id: isort -- repo: https://github.com/psf/black - rev: 24.4.0 + - id: autoflake + args: + [ + "--in-place", + "--remove-all-unused-imports", + "--remove-unused-variable", + ] + exclude: ".*(.fits|.fts|.fit|.txt|tca.*|extern.*|.rst|.md|docs/conf.py)$" + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.5.0" hooks: - - id: black -- repo: https://github.com/pre-commit/pre-commit-hooks + - id: ruff + args: ["--fix", "--unsafe-fixes"] + - id: ruff-format + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: check-ast - - id: check-case-conflict - - id: trailing-whitespace - - id: mixed-line-ending - - id: end-of-file-fixer - - id: check-yaml - - id: debug-statements -- repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.3.7' - hooks: - - id: ruff - args: ['--fix'] -- repo: https://github.com/awebdeveloper/pre-commit-stylelint - rev: '0.0.2' + - id: check-ast + - id: check-case-conflict + - id: trailing-whitespace + exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" + - id: mixed-line-ending + exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" + - id: end-of-file-fixer + exclude: ".*(.fits|.fts|.fit|.txt|.csv)$" + - id: check-yaml + - id: debug-statements + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 hooks: - - id: stylelint - additional_dependencies: ['stylelint@14.9.1', 'stylelint-config-standard@26.0.0'] -- repo: https://github.com/pre-commit/mirrors-prettier + - id: codespell + additional_dependencies: + - tomli + - repo: https://github.com/pre-commit/mirrors-prettier rev: v4.0.0-alpha.8 hooks: - - id: prettier - types_or: [css, scss, javascript] -- repo: https://github.com/Riverside-Healthcare/djLint - rev: v1.34.1 - hooks: - - id: djlint-jinja - types_or: ["html"] + - id: prettier diff --git a/.readthedocs.yml b/.readthedocs.yml index 358072f1..ba5a3a3c 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,8 +1,8 @@ version: 2 build: - os: ubuntu-22.04 + os: ubuntu-lts-latest tools: - python: "mambaforge-4.10" + python: "mambaforge-latest" jobs: pre_install: - git update-index --assume-unchanged .rtd-environment.yml docs/conf.py @@ -13,9 +13,9 @@ sphinx: configuration: docs/conf.py fail_on_warning: false python: - install: - - method: pip - extra_requirements: + install: + - method: pip + extra_requirements: - all - docs - path: . + path: . diff --git a/.rtd-environment.yml b/.rtd-environment.yml index 4d3fa42e..f2c4dd23 100644 --- a/.rtd-environment.yml +++ b/.rtd-environment.yml @@ -2,7 +2,7 @@ name: rtd_ablog channels: - conda-forge dependencies: - - python=3.10 + - python=3.12 - pip - graphviz - make diff --git a/.stylelintrc.json b/.stylelintrc.json index 7cad7a12..40db42c6 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -1,3 +1,3 @@ { - "extends": "stylelint-config-standard" + "extends": "stylelint-config-standard" } diff --git a/Makefile b/Makefile index fc86bab1..b8ddd5f0 100644 --- a/Makefile +++ b/Makefile @@ -8,21 +8,21 @@ rebuild: cd docs; watchmedo shell-command --patterns='*.rst' --command='ablog build' --recursive test: - set -e; cd docs; ablog build -T -W; git clean -xfd; cd .. + set -e; cd docs; git clean -xfd; ablog build -T -W; git clean -xfd; cd .. test1: - set -e; cd docs; ablog build -T -W -b json; git clean -xfd; cd .. + set -e; cd docs; git clean -xfd; ablog build -T -W -b json; git clean -xfd; cd .. test2: - set -e; cd docs; ablog build -T -W -b pickle; git clean -xfd; cd .. + set -e; cd docs; git clean -xfd; ablog build -T -W -b pickle; git clean -xfd; cd .. test3: - set -e; mkdir -p test; cd test; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.io/" | ablog start; ablog build -W; cd ..; rm -rf test + set -e; mkdir -p test; cd test; git clean -xfd; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.io/" | ablog start; ablog build -W; cd ..; rm -rf test test4: - set -e; mkdir -p testablog; cd testablog; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.io/" | ablog start; ablog build -W; cd ..; rm -rf testablog + set -e; mkdir -p testablog; cd testablog; git clean -xfd; printf "\nABlog\nABlog Team\nhttps://ablog.readthedocs.io/" | ablog start; ablog build -W; cd ..; rm -rf testablog test5: - set -e; cd docs; ablog build -W -b latex -T -d .doctrees -w _latex; git clean -xfd; cd .. + set -e; cd docs; git clean -xfd; ablog build -W -b latex -T -d .doctrees -w _latex; git clean -xfd; cd .. tests: test test1 test2 test3 test4 test5 diff --git a/README.rst b/README.rst index bbd63a41..34953258 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,8 @@ ABlog for Sphinx ================ -|Build Status| - -.. |Build Status| image:: https://dev.azure.com/sunpy/ablog/_apis/build/status/sunpy.ablog?repoName=sunpy%2Fablog&branchName=main - :target: https://dev.azure.com/sunpy/ablog/_build/latest?definitionId=17&repoName=sunpy%2Fablog&branchName=main +[![CI](https://github.com/sunpy/ablog/actions/workflows/ci.yml/badge.svg)](https://github.com/sunpy/ablog/actions/workflows/ci.yml) +[![Upload Python Package](https://github.com/sunpy/ablog/actions/workflows/pythonpublish.yml/badge.svg)](https://github.com/sunpy/ablog/actions/workflows/pythonpublish.yml) ABlog is a Sphinx extension that converts any documentation or personal website project into a full-fledged blog @@ -19,6 +17,6 @@ The original project is no longer maintained and the `SunPy Project `__. -`Fix typo in "extennsion" `__. +`Fix typo in "extension" `__. `Catalan translation `__. `Fix ablog post `__. diff --git a/docs/release/ablog-v0.11-released.rst b/docs/release/ablog-v0.11-released.rst index 39709800..7935a927 100644 --- a/docs/release/ablog-v0.11-released.rst +++ b/docs/release/ablog-v0.11-released.rst @@ -90,3 +90,8 @@ ABlog v0.11.8 released ---------------------- Added support for ``sphinx`` >=7.3.0 + +ABlog v0.11.9 released +---------------------- + +`Make '_strip' function return as list not set. `__ from `Joe Ziminski `__. diff --git a/docs/release/ablog-v0.12-released.rst b/docs/release/ablog-v0.12-released.rst new file mode 100644 index 00000000..100ea5f2 --- /dev/null +++ b/docs/release/ablog-v0.12-released.rst @@ -0,0 +1,30 @@ +ABlog v0.12 released +==================== + +.. post:: Nov 23, 2024 + :author: Nabil Freij + :category: Release + :location: World + +ABlog v0.12 is released with the main focus being retemplating the library. + +Features +-------- + +- None + +Internal Fixes +-------------- + +- ``pyproject.toml`` is now the source of package information. +- ``ruff`` has been widely deployed to fix any underlying issues found. +- Internal process rewritten to follow modern sphinx. +- Increaseed pytest coverage + +Breaking Changes +---------------- + +- Dropped support for Python 3.9 +- Dropped support for Sphinx 5 +- Removed non-ablog scoped templates +- Removed the myriad of language config options diff --git a/pyproject.toml b/pyproject.toml index 0114f87f..c3d0ee8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,57 +1,87 @@ [build-system] -requires = ["setuptools", "setuptools_scm", "wheel"] +requires = [ + "setuptools", + "setuptools_scm[toml]", + "wheel", +] build-backend = 'setuptools.build_meta' -[tool.black] -line-length = 120 -include = '\.pyi?$' -exclude = ''' -( - /( - \.eggs - | \.git - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - | astropy_helpers - | docs - | .history - )/ - | ah_bootstrap.py -) -''' -target-version = ['py39'] - -[tool.ruff] -# Enable Pyflakes `E` and `F` codes by default. -select = ["E", "F"] -ignore = ["E501", "E741"] - -# Allow autofix for all enabled rules (when `--fix`) is provided. -fixable = ["A", "B", "C", "D", "E", "F"] - -exclude = [ - ".eggs", - ".git", - ".mypy_cache", - ".ruff_cache", - ".tox", - ".venv", - "__pypackages__", - "_build", - "build", - "dist", - "node_modules", - "venv", +[project] +name = "ablog" +dynamic = ["version"] +description = "A Sphinx extension that converts any documentation or personal website project into a full-fledged blog." +readme = "README.rst" +requires-python = ">=3.9" +license = {file = "LICENSE.rst"} +keywords = [ + "ablog", + "blog", + "blogging", + "sphinx", + ] +authors = [ + {email = "sunpy@googlegroups.com", name = "The SunPy Community"}, + {email = "nabil.freij@gmail.com", name = "Nabil Freij"}, + {name = "Ahmet Bakan"}, +] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Communications", +] +dependencies = [ + "docutils>=0.18", + "feedgen>=0.9.0", + "invoke>=1.6.0", + "packaging>=19.0", + "python-dateutil>=2.8.2", + "sphinx>=6.0.0", + "watchdog>=2.1.0", +] + +[project.optional-dependencies] +all = ["ablog[markdown,notebook]"] +notebook = [ + "ipython>=7.30.0", + "nbsphinx>=0.8.0", +] +markdown = ["myst-parser>=0.17.0"] +docs = [ + "sunpy-sphinx-theme", + "sphinx-automodapi", ] +tests = [ + "defusedxml>=0.8.0rc2", + "pytest-cov", + "pytest", +] + +[project.urls] +changelog = "https://ablog.readthedocs.io/en/stable/blog/category/release.html" +documentation = "https://ablog.readthedocs.io/en/stable/" +homepage = "https://github.com/sunpy/ablog" +issue_tracker = "https://github.com/sunpy/ablog/issues" +repository = "https://github.com/sunpy/ablog" + +[project.scripts] +ablog = "ablog.commands:ablog_main" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools_scm] +write_to = "src/ablog/version.py" -# Same as Black. -line-length = 120 -target-version = "py39" +[tool.codespell] +skip = "*cache*,*egg*,*extern*,.git,.idea,.tox,*.svg,.history,*sphinx.po" -# Allow unused variables when underscore-prefixed. -dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +[tool.djlint] +files=["*.html"] diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..d74d0e00 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,21 @@ +[pytest] +minversion = 7.0 +testpaths = + src + docs +norecursedirs = + .tox + build + docs/_build + docs/generated + *.egg-info + examples + .history +addopts = -p no:unraisableexception -p no:threadexception +filterwarnings = + error + # Do not fail on pytest config issues (i.e. missing plugins) but do show them + always::pytest.PytestConfigWarning + # A list of warnings to ignore follows. If you add to this list, you MUST + # add a comment or ideally a link to an issue that explains why the warning + # is being ignored diff --git a/roots/test-build/conf.py b/roots/test-build/conf.py index 8633f6bf..47578dae 100644 --- a/roots/test-build/conf.py +++ b/roots/test-build/conf.py @@ -11,8 +11,6 @@ # 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 %}", + "content": "{{ title }}{% for tag in post.tags %} #{{ tag.name|trim()|replace(' ', '') }} {% endfor %}", }, } diff --git a/roots/test-canonical/conf.py b/roots/test-canonical/conf.py index 781e7747..c285db61 100644 --- a/roots/test-canonical/conf.py +++ b/roots/test-canonical/conf.py @@ -11,9 +11,7 @@ # 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 %}", + "content": "{{ title }}{% for tag in post.tags %} #{{ tag.name|trim()|replace(' ', '') }} {% endfor %}", }, } # Sphinx creates canonical links pointing to this base URL by default diff --git a/roots/test-external/conf.py b/roots/test-external/conf.py index 8633f6bf..47578dae 100644 --- a/roots/test-external/conf.py +++ b/roots/test-external/conf.py @@ -11,8 +11,6 @@ # 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 %}", + "content": "{{ title }}{% for tag in post.tags %} #{{ tag.name|trim()|replace(' ', '') }} {% endfor %}", }, } diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..6ce48ca8 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,83 @@ +# Allow unused variables when underscore-prefixed. +lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +target-version = "py310" +line-length = 120 +exclude=[ + ".git,", + "__pycache__", + "build", + "tools/**", +] +lint.select = [ + "A", + "ARG", + "ASYNC", + "B", + "BLE", + "C4", +# "C90", + "COM", +# "D", + "DTZ", + "E", + "EM", + "ERA", + "EXE", + "F", + "FBT", + "FLY", +# "FURB", + "G", + "I", + "ICN", + "INP", + "INT", + "ISC", + "LOG", +# "N", + "NPY", + "PERF", + "PGH", + "PIE", +# "PL", + "PLE", + "PT", + "PTH", + "PYI", + "Q", + "RET", + "RSE", + "RUF", +# "S", + "SIM", + "SLF", + "SLOT", + "T10", + "T20", + "TCH", + "TID", + "TRIO", + "TRY", + "UP", + "W", + "YTT", +] +lint.extend-ignore = [ + "E501", # Line too long + "T201", # We need print for now + "COM812", # May cause conflicts when used with the formatter + "ISC001", # May cause conflicts when used with the formatter +] + +[lint.per-file-ignores] +"docs/conf.py" = [ + "INP001", # conf.py is part of an implicit namespace package +] + +[lint.pydocstyle] +convention = "numpy" + +[format] +docstring-code-format = true +indent-style = "space" +quote-style = "double" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d8f208b5..00000000 --- a/setup.cfg +++ /dev/null @@ -1,111 +0,0 @@ -[metadata] -name = ablog -author = The SunPy Community -author_email = sunpy@googlegroups.com -description = A Sphinx extension that converts any documentation or personal website project into a full-fledged blog. -long_description = file: README.rst -long_description_content_type = text/x-rst -license = MIT -url = https://ablog.readthedocs.io/ -edit_on_github = True -github_project = sunpy/ablog - -[options] -python_requires = >=3.9 -package_dir= - =src -packages=find: -include_package_data = True -setup_requires = - setuptools_scm -install_requires = - docutils>=0.18 - feedgen>=0.9.0 - invoke>=1.6.0 - packaging>=19.0 - python-dateutil>=2.8.2 - sphinx>=5.0.0 - watchdog>=2.1.0 - -[options.packages.find] -where=src - -[options.extras_require] -notebook = - ipython>=7.30.0 - nbsphinx>=0.8.0 -markdown = - myst-parser>=0.17.0 -docs = - alabaster - sphinx-automodapi -tests = - pytest - -[options.entry_points] -console_scripts = - ablog = ablog.commands:ablog_main - -[tool:pytest] -testpaths = "tests" -norecursedirs = ".tox" "build" "docs[\/]_build" "docs[\/]generated" "*.egg-info" ".history" -markers = - sphinx -addopts = -p no:unraisableexception -p no:threadexception -filterwarnings = - error - # Do not fail on pytest config issues (i.e. missing plugins) but do show them - always::pytest.PytestConfigWarning - # Sphinx and other packages raise these - ignore:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning - # python-datetuil - ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning - -[pycodestyle] -max_line_length = 120 - -[flake8] -max-line-length = 120 - -[isort] -default_section = THIRDPARTY -force_grid_wrap = 0 -include_trailing_comma = true -known_first_party = ablog -length_sort = False -length_sort_sections = stdlib -line_length = 120 -multi_line_output = 3 -skip = .history -sections = FUTURE, STDLIB, THIRDPARTY, FIRSTPARTY, LOCALFOLDER - -[coverage:run] -omit = - */ablog/__init__* - */ablog/*/tests/* - */ablog/*setup* - */ablog/conftest.py - */ablog/cython_version* - */ablog/extern/* - */ablog/version* - ablog/__init__* - ablog/*/tests/* - ablog/*setup* - ablog/conftest.py - ablog/cython_version* - ablog/extern/* - ablog/version* - -[coverage:report] -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain about packages we have installed - except ImportError - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - # Don't complain about script hooks - def main\(.*\): - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} diff --git a/setup.py b/setup.py index 24662f37..574c5e60 100644 --- a/setup.py +++ b/setup.py @@ -1,30 +1,5 @@ -#!/usr/bin/env python -from setuptools import setup # isort:skip -import os -from itertools import chain +from setuptools import setup -try: - # Recommended for setuptools 61.0.0+ - # (though may disappear in the future) - from setuptools.config.setupcfg import read_configuration -except ImportError: - from setuptools.config import read_configuration - -################################################################################ -# Programmatically generate some extras combos. -################################################################################ -extras = read_configuration("setup.cfg")["options"]["extras_require"] - -# Dev is everything -extras["dev"] = list(chain(*extras.values())) - -# All is everything but tests and docs -exclude_keys = ("tests", "docs", "dev") -ex_extras = dict(filter(lambda i: i[0] not in exclude_keys, extras.items())) -# Concatenate all the values together for 'all' -extras["all"] = list(chain.from_iterable(ex_extras.values())) - -setup( - extras_require=extras, - use_scm_version={"write_to": os.path.join("src", "ablog", "_version.py")}, -) +# We keep this around as of time of writing, I do not know how to avoid +# having this if we want to run extract_messages for the translations +setup() diff --git a/src/ablog/__init__.py b/src/ablog/__init__.py index e6c295e4..bf29e1ce 100755 --- a/src/ablog/__init__.py +++ b/src/ablog/__init__.py @@ -2,9 +2,10 @@ ABlog for Sphinx. """ +import logging import os from glob import glob -from pathlib import PurePath +from pathlib import Path, PurePath from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.errors import ThemeError @@ -27,20 +28,19 @@ ) from .version import version as __version__ -__all__ = ["setup", "__version__"] +__all__ = ["setup", "logger", "__version__"] -PKGDIR = os.path.abspath(os.path.dirname(__file__)) +logger = logging.getLogger("ablog") # Name used for the *.pot, *.po and *.mo files MESSAGE_CATALOG_NAME = "sphinx" -_ = get_translation(MESSAGE_CATALOG_NAME) # NOQA +_ = get_translation(MESSAGE_CATALOG_NAME) 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") + return str(Path(__file__).parent.resolve() / "templates") def anchor(post): @@ -73,7 +73,7 @@ def html_page_context(app, pagename, templatename, context, doctree): context["anchor"] = anchor if pagename in blog and blog[pagename].canonical_link: context["pageurl"] = blog[pagename].canonical_link - # following is already available for archive pages + # Following is already available for archive pages if blog.blog_baseurl and "feed_path" not in context: context["feed_path"] = blog.blog_path context["feed_title"] = blog.blog_title @@ -101,21 +101,27 @@ 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( + msg = ( "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( + msg, + ) + if get_html_templates_path() in app.config.templates_path: + msg = ( "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." ) + raise Exception( + msg, + ) theme = app.builder.theme loaders = app.builder.templates.loaders templatepathlen = app.builder.templates.templatepathlen @@ -161,7 +167,6 @@ def setup(app): html=(lambda s, n: s.visit_admonition(n), lambda s, n: s.depart_admonition(n)), latex=(lambda s, n: s.visit_admonition(n), lambda s, n: s.depart_admonition(n)), ) - pkgdir = os.path.abspath(os.path.dirname(__file__)) - locale_dir = os.path.join(pkgdir, "locales") + locale_dir = str(Path(__file__).parent.resolve() / "locales") app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir) - return {"version": __version__} # identifies the version of our extension + return {"version": __version__, "parallel_read_safe": True} diff --git a/src/ablog/blog.py b/src/ablog/blog.py index afadd70b..44d4aaf4 100644 --- a/src/ablog/blog.py +++ b/src/ablog/blog.py @@ -2,14 +2,14 @@ Classes for handling posts and archives. """ +import datetime as dtmod import os import re -import datetime as dtmod +from collections.abc import Container from datetime import datetime from operator import attrgetter from unicodedata import normalize from urllib.parse import urljoin -from collections.abc import Container from docutils import nodes from docutils.io import StringOutput @@ -218,7 +218,8 @@ def __getattr__(self, name): try: attr = self.config[name] except KeyError: - raise AttributeError(f"ABlog has no configuration option {repr(name)}") + msg = f"ABlog has no configuration option {name!r}" + raise AttributeError(msg) return attr def __getitem__(self, key): @@ -277,6 +278,7 @@ def page_id(self, pagename): pagename = pagename[:-5] pagename = pagename.strip("/") return "/" + pagename + ("/" if pagename else "") + return None def page_url(self, pagename): """ @@ -291,6 +293,7 @@ def page_url(self, pagename): if url.endswith("index"): url = url[:-5] return url + return None def html_builder_write_doc(self, docname, doctree, img_url=False): @@ -335,7 +338,7 @@ def blog(self): @property def title(self): - return getattr(self, "name", getattr(self, "_title")) + return getattr(self, "name", self._title) class Post(BlogPageMixin): @@ -600,8 +603,7 @@ def relsize(self, maxsize=5, minsize=1): diff = maxsize - minsize if len(self.catalog) == 1 or min_ == max_: return int(round(diff / 2.0 + minsize)) - size = int(1.0 * (len(self) - min_) / (max_ - min_) * diff + minsize) - return size + return int(1.0 * (len(self) - min_) / (max_ - min_) * diff + minsize) @property def docname(self): diff --git a/src/ablog/commands.py b/src/ablog/commands.py index 43e7e808..3c74f739 100644 --- a/src/ablog/commands.py +++ b/src/ablog/commands.py @@ -1,20 +1,20 @@ -import os -import sys +import argparse import glob +import os import shutil -import argparse -import webbrowser import socketserver -from os import path -from http import server -from os.path import join, isfile, abspath +import sys +import webbrowser from datetime import date +from http import server +from os import path +from os.path import abspath, isfile, join from invoke import run from watchdog.observers import Observer from watchdog.tricks import ShellCommandTrick -import ablog +from ablog import __version__, logger from ablog.start import ablog_start __all__ = ["ablog_build", "ablog_clean", "ablog_serve", "ablog_deploy", "ablog_main"] @@ -47,7 +47,7 @@ def parent(d): if isfile(conf) and "ablog" in open(conf).read(): return confdir else: - sys.exit("Current directory and its parents doesn't " "contain configuration file (conf.py).") + sys.exit("Current directory and its parents doesn't contain configuration file (conf.py).") def read_conf(confdir): @@ -62,9 +62,9 @@ def read_conf(confdir): parser = argparse.ArgumentParser( description="ABlog for blogging with Sphinx", - epilog="See 'ablog -h' for more information on a specific " "command.", + epilog="See 'ablog -h' for more information on a specific command.", ) -parser.add_argument("-v", "--version", help="print ABlog version and exit", action="version", version=ablog.__version__) +parser.add_argument("-v", "--version", help="print ABlog version and exit", action="version", version=__version__) commands = ablog_commands = parser.add_subparsers(title="commands") @@ -151,7 +151,7 @@ def arg_doctrees(func): "-s", dest="sourcedir", type=str, - help="root path for source files, " "default is path to the folder that contains conf.py", + help="root path for source files, default is path to the folder that contains conf.py", ) @arg("-b", dest="builder", type=str, help="builder to use, default `ablog_builder` or dirhtml") @arg( @@ -164,7 +164,7 @@ def arg_doctrees(func): @cmd( name="build", help="build your blog project", - description="Path options can be set in conf.py. " "Default values of paths are relative to conf.py.", + description="Path options can be set in conf.py. Default values of paths are relative to conf.py.", ) def ablog_build( builder=None, @@ -224,7 +224,7 @@ def ablog_build( @cmd( name="clean", help="clean your blog build files", - description="Path options can be set in conf.py. " "Default values of paths are relative to conf.py.", + description="Path options can be set in conf.py. Default values of paths are relative to conf.py.", ) def ablog_clean(website=None, doctrees=None, deep=False, **kwargs): confdir = find_confdir() @@ -234,14 +234,14 @@ def ablog_clean(website=None, doctrees=None, deep=False, **kwargs): nothing = True if glob.glob(os.path.join(website, "*")): shutil.rmtree(website) - print(f"Removed {os.path.relpath(website)}.") + logger.info(f"Removed {os.path.relpath(website)}.") nothing = False if deep and glob.glob(os.path.join(doctrees, "*")): shutil.rmtree(doctrees) - print(f"Removed {os.path.relpath(doctrees)}.") + logger.info(f"Removed {os.path.relpath(doctrees)}.") nothing = False if nothing: - print("Nothing to clean.") + logger.info("Nothing to clean.") @arg("--patterns", dest="patterns", default="*.rst;*.txt", help="patterns for triggering rebuilds") @@ -258,7 +258,7 @@ def ablog_clean(website=None, doctrees=None, deep=False, **kwargs): @cmd( name="serve", help="serve and view your project", - description="Serve options can be set in conf.py. " "Default values of paths are relative to conf.py.", + description="Serve options can be set in conf.py. Default values of paths are relative to conf.py.", ) def ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns="*.rst;*.txt", **kwargs): confdir = find_confdir() @@ -268,8 +268,8 @@ def ablog_serve(website=None, port=8000, view=True, rebuild=False, patterns="*.r Handler = server.SimpleHTTPRequestHandler httpd = socketserver.TCPServer(("", port), Handler) ip, port = httpd.socket.getsockname() - print(f"Serving HTTP on {ip}:{port}.") - print("Quit the server with Control-C.") + logger.info(f"Serving HTTP on {ip}:{port}.") + logger.info("Quit the server with Control-C.") website = website or os.path.join(confdir, getattr(conf, "ablog_website", "_website")) os.chdir(website) if rebuild: @@ -321,7 +321,7 @@ def ablog_post(filename, title=None, **kwargs): with open(filename, "w", encoding="utf-8") as out: post_text = POST_TEMPLATE.format(**pars) out.write(post_text) - print(f"Blog post created: {filename}") + logger.info(f"Blog post created: {filename}") @arg( @@ -358,7 +358,7 @@ def ablog_post(filename, title=None, **kwargs): dest="push_force", action="store_true", default=False, - help="owerwrite last commit, i.e. `commit --amend; push -f`", + help="overwrite last commit, i.e. `commit --amend; push -f`", ) @arg("-m", dest="message", type=str, help="commit message") @arg("-g", dest="github_pages", type=str, help="GitHub username for deploying to GitHub pages") @@ -373,7 +373,7 @@ def ablog_post(filename, title=None, **kwargs): @cmd( name="deploy", help="deploy your website build files", - description="Path options can be set in conf.py. " "Default values of paths are relative to conf.py.", + description="Path options can be set in conf.py. Default values of paths are relative to conf.py.", ) def ablog_deploy( website, @@ -397,7 +397,7 @@ def ablog_deploy( website = website or os.path.join(confdir, getattr(conf, "ablog_builddir", "_website")) tomove = glob.glob(os.path.join(website, "*")) if not tomove: - print("Nothing to deploy, build first.") + logger.info("Nothing to deploy, build first.") return if github_pages: if repodir is None: @@ -409,12 +409,12 @@ def ablog_deploy( run( "git clone " + ("https://github.com/" if github_is_http else github_url) - + "{0}/{0}.github.io.git {1}".format(github_pages, repodir), + + f"{github_pages}/{github_pages}.github.io.git {repodir}", echo=True, ) git_add = [] - for tm in tomove: - for root, dirnames, filenames in os.walk(website): + for _tm in tomove: + for root, _dirnames, filenames in os.walk(website): for filename in filenames: fn = os.path.join(root, filename) fnnew = fn.replace(website, repodir) @@ -428,16 +428,16 @@ def ablog_deploy( os.renames(fn, fnnew) git_add.append(fnnew) - print(f"Moved {len(git_add)} files to {github_pages}.github.io") + logger.info(f"Moved {len(git_add)} files to {github_pages}.github.io") os.chdir(repodir) - run("git add -f " + " ".join(['"{}"'.format(os.path.relpath(p)) for p in git_add]), echo=True) + run("git add -f " + " ".join([f'"{os.path.relpath(p)}"' for p in git_add]), echo=True) if not os.path.isfile(".nojekyll"): open(".nojekyll", "w") run("git add -f .nojekyll") # Check to see if anything has actually been committed result = run("git diff --cached --name-status HEAD") if not result.stdout: - print("Nothing changed from last deployment") + logger.info("Nothing changed from last deployment") return commit = f"git commit -m \"{message or 'Updates.'}\"" if push_force: @@ -455,7 +455,7 @@ def ablog_deploy( push += f" origin {github_branch}" run(push, echo=True) else: - print("No place to deploy.") + logger.info("No place to deploy.") def ablog_main(): diff --git a/conftest.py b/src/ablog/conftest.py similarity index 93% rename from conftest.py rename to src/ablog/conftest.py index 8a58b65c..fa383537 100644 --- a/conftest.py +++ b/src/ablog/conftest.py @@ -22,7 +22,7 @@ def rootdir(): return Path(__file__).parent.absolute() / "roots" -@pytest.fixture(scope="function", autouse=True) +@pytest.fixture(autouse=True) def reset_blog_config(): # Reset cached configurations to enable confoverrides from ablog.blog import Blog diff --git a/src/ablog/post.py b/src/ablog/post.py index a010a2aa..454dc7b4 100644 --- a/src/ablog/post.py +++ b/src/ablog/post.py @@ -1,7 +1,7 @@ -import os import logging -from string import Formatter +import os from datetime import datetime +from string import Formatter import jinja2 from dateutil.parser import parse as date_parser @@ -34,11 +34,11 @@ # Name used for the *.pot, *.po and *.mo files MESSAGE_CATALOG_NAME = "sphinx" -_ = get_translation(MESSAGE_CATALOG_NAME) # NOQA +_ = get_translation(MESSAGE_CATALOG_NAME) def _split(a): - return {s.strip() for s in (a or "").split(",")} + return [s.strip() for s in (a or "").split(",")] class PostNode(nodes.Element): @@ -162,26 +162,25 @@ def apply(self): # Check if page-level metadata has been given docinfo = list(self.document.findall(nodes.docinfo)) if not docinfo: - return None + return 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.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. - # like ["a", "b", "c"] # remove [] and quotes tags = tags.strip().lstrip("[").rstrip("]") metadata["tags"] = ",".join( - [t.strip().lstrip('"').lstrip("'").rstrip('"').rstrip("'") for t in tags.split(",")] + [t.strip().lstrip('"').lstrip("'").rstrip('"').rstrip("'") for t in tags.split(",")], ) if list(docinfo.findall(nodes.author)): - metadata["author"] = list(docinfo.findall(nodes.author))[0].astext() + metadata["author"] = next(iter(docinfo.findall(nodes.author))).astext() # These two fields are special-cased in docutils if list(docinfo.findall(nodes.date)): - metadata["date"] = list(docinfo.findall(nodes.date))[0].astext() + metadata["date"] = next(iter(docinfo.findall(nodes.date))).astext() if "blogpost" not in metadata and self.env.docname not in self.config.matched_blog_posts: - return None + return for node in self.document.findall(PostNode): if node: logging.warning("Found blog post front-matter as well as post directive, using post directive.") @@ -247,7 +246,8 @@ def _get_section_title(section): """ for title in section.findall(nodes.title): return title.astext() - raise Exception("Missing title") + msg = "Missing title" + raise Exception(msg) # A problem with the following is that title may contain pending # references, e.g. :ref:`tag-tips` @@ -271,7 +271,7 @@ def _get_update_dates(section, docname, post_date_format): raise ValueError( f"invalid post date ({update_node['date']}) in " + docname - + f". Expected format: {post_date_format}" + + f". Expected format: {post_date_format}", ) # Insert a new title element which contains the `Updated on {date}` logic. substitute = nodes.title("", _("Updated on ") + update.strftime(post_date_format)) @@ -360,7 +360,7 @@ def process_posts(app, doctree): raise ValueError("invalid post date in: " + docname) else: raise ValueError( - f"invalid post date ({date}) in " + docname + f". Expected format: {post_date_format}" + f"invalid post date ({date}) in " + docname + f". Expected format: {post_date_format}", ) else: date = None @@ -382,10 +382,7 @@ def process_posts(app, doctree): # ! this does not work for sections app.env.domains["std"].data["labels"][label] = (docname, label, title) app.env.domains["std"].data["anonlabels"][label] = (docname, label) - if section.parent is doctree: - section_copy = section[0].deepcopy() - else: - section_copy = section.deepcopy() + section_copy = section[0].deepcopy() if section.parent is doctree else section.deepcopy() # multiple posting may result having post nodes for nn in section_copy.findall(PostNode): if nn["exclude"]: @@ -397,7 +394,7 @@ def process_posts(app, doctree): "section": section_name, "order": order, "date": date, - "update": max(update_dates + [date]), + "update": max([*update_dates, date]), "title": title, "excerpt": excerpt, "tags": node["tags"], @@ -419,7 +416,7 @@ def process_posts(app, doctree): # instantiate catalogs and collections here # so that references are created and no warnings are issued if app.builder.format == "html": - stdlabel = env.domains["std"].data["labels"] # NOQA + stdlabel = env.domains["std"].data["labels"] else: if hasattr(env, "intersphinx_inventory"): stdlabel = env.intersphinx_inventory.setdefault("std:label", {}) # NOQA @@ -428,7 +425,7 @@ def process_posts(app, doctree): for key in ["tags", "author", "category", "location", "language"]: catalog = blog.catalogs[key] for label in postinfo[key]: - coll = catalog[label] # NOQA + coll = catalog[label] if postinfo["date"]: coll = blog.archive[postinfo["date"].year] # NOQA @@ -461,9 +458,10 @@ def process_postlist(app, doctree, docname): posts.sort() # in reverse chronological order, so no reverse=True fmts = list(Formatter().parse(node.attributes["format"])) not_in = {"date", "title", "author", "location", "language", "category", "tags", None} - for text, key, __, __ in fmts: + for _text, key, __, __ in fmts: if key not in not_in: - raise KeyError(f"{key} is not recognized in postlist format") + msg = f"{key} is not recognized in postlist format" + raise KeyError(msg) excerpts = node.attributes["excerpts"] expand = node.attributes["expand"] date_format = node.attributes["date"] or _(blog.post_date_format_short) @@ -484,10 +482,7 @@ def process_postlist(app, doctree, docname): if key == "date": par.append(nodes.Text(post.date.strftime(date_format))) else: - if key == "title": - items = [post] - else: - items = getattr(post, key) + items = [post] if key == "title" else getattr(post, key) for i, item in enumerate(items, start=1): if key == "title": @@ -554,6 +549,7 @@ def _missing_reference(app, target, refdoc, contnode=None, refexplicit=False): newnode.append(emp) emp.append(nodes.Text(str(dispname))) return newnode + return None def generate_archive_pages(app): @@ -662,7 +658,7 @@ def generate_atom_feeds(app): blog.blog_title + " - " + header + " " + str(coll), os_path_join(base_url, coll.path, feed_root + ".xml"), feed_templates, - ) + ), ) # Config options feed_length = blog.blog_feed_length @@ -683,10 +679,7 @@ def generate_atom_feeds(app): post_url = os_path_join(base_url, app.builder.get_target_uri(post.docname)) if post.section: post_url += "#" + post.section - if blog.blog_feed_titles: - content = None - else: - content = post.to_html(pagename, fulltext=feed_fulltext, img_url=True) + content = None if blog.blog_feed_titles else post.to_html(pagename, fulltext=feed_fulltext, img_url=True) feed_entry = feed.add_entry(order="append") feed_entry.id(post_url) feed_entry.link(href=post_url) @@ -695,10 +688,10 @@ def generate_atom_feeds(app): feed_entry.updated(post.update.astimezone()) for tag in sorted(post.tags): feed_entry.category( - dict( - term=tag.name.strip().replace(" ", ""), - label=tag.label, - ) + { + "term": tag.name.strip().replace(" ", ""), + "label": tag.label, + }, ) # Entry values that support templates title = post.title diff --git a/src/ablog/start.py b/src/ablog/start.py index 7bd92d68..1dc12b73 100644 --- a/src/ablog/start.py +++ b/src/ablog/start.py @@ -1,6 +1,6 @@ +import datetime import sys import time -import datetime from os import path from textwrap import wrap @@ -128,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 = {{ - '**': [ 'ablog/postcard.html', 'navigation.html', + '**': [ 'ablog/postcard.html', 'ablog/recentposts.html', 'ablog/tagcloud.html', 'ablog/categories.html', 'ablog/archives.html', - 'searchbox.html', ], }} @@ -492,7 +491,7 @@ def generate(d, overwrite=True, silent=False): def write_file(fpath, content, newline=None): if overwrite or not path.isfile(fpath): print(f"Creating file {fpath}.") - f = open(fpath, "wt", encoding="utf-8", newline=newline) + f = open(fpath, "w", encoding="utf-8", newline=newline) try: f.write(content) finally: diff --git a/src/ablog/templates/ablog/about.html b/src/ablog/templates/ablog/about.html new file mode 100644 index 00000000..8f27ef90 --- /dev/null +++ b/src/ablog/templates/ablog/about.html @@ -0,0 +1,19 @@ + diff --git a/src/ablog/templates/ablog/archives.html b/src/ablog/templates/ablog/archives.html index d846d137..9915c87f 100644 --- a/src/ablog/templates/ablog/archives.html +++ b/src/ablog/templates/ablog/archives.html @@ -1,16 +1,14 @@ {% if ablog.archive %}
-

- {{ gettext('Archives') }} -

- +

+ {{ gettext("Archives") }} +

+
{% endif %} diff --git a/src/ablog/templates/ablog/authors.html b/src/ablog/templates/ablog/authors.html index fbf0bf5a..7265612c 100644 --- a/src/ablog/templates/ablog/authors.html +++ b/src/ablog/templates/ablog/authors.html @@ -1,12 +1,14 @@ {% if ablog.author %}
-

{{ gettext('Authors') }}

- +

+ {{ gettext("Authors") }} +

+
{% endif %} diff --git a/src/ablog/templates/ablog/catalog.html b/src/ablog/templates/ablog/catalog.html index 7aa0c703..5f746a01 100644 --- a/src/ablog/templates/ablog/catalog.html +++ b/src/ablog/templates/ablog/catalog.html @@ -1,19 +1,13 @@ -{%- extends "page.html" %} -{% macro postlink(post) -%} - {% if post.external_link -%} - {{- post.external_link -}} - {% else %} - {{- pathto(post.docname) }}{{ anchor(post) -}} - {%- endif %} -{%- endmacro %} -{% block body %} -{% for collection in catalog %} -{% if collection %} +{%- extends "page.html" %} {% macro postlink(post) -%} {% if post.external_link +-%} {{- post.external_link -}} {% else %} {{- pathto(post.docname) }}{{ +anchor(post) -}} {%- endif %} {%- endmacro %} {% block body %} {% for collection +in catalog %} {% if collection %}

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

{% for post in collection %}
@@ -22,15 +16,10 @@

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

{% endfor %}
-{% endif %} -{% endfor %} -{% endblock body %} +{% endif %} {% endfor %} {% endblock body %} diff --git a/src/ablog/templates/ablog/categories.html b/src/ablog/templates/ablog/categories.html index 5396b0a4..0738c0a4 100644 --- a/src/ablog/templates/ablog/categories.html +++ b/src/ablog/templates/ablog/categories.html @@ -1,16 +1,14 @@ {% if ablog.category %}
-

- {{ gettext('Categories') }} -

- +

+ {{ gettext("Categories") }} +

+
{% endif %} diff --git a/src/ablog/templates/ablog/collection.html b/src/ablog/templates/ablog/collection.html index f089604a..e4ff0ed7 100644 --- a/src/ablog/templates/ablog/collection.html +++ b/src/ablog/templates/ablog/collection.html @@ -1,71 +1,55 @@ -{%- extends "page.html" %} -{% block body %} -{% macro postlink(post) -%} - {% if post.external_link -%} - {{- post.external_link -}} - {% else %} - {{- pathto(post.docname) }}{{ anchor(post) -}} - {%- endif %} -{%- endmacro %} +{%- extends "page.html" %} {% block body %} {% macro postlink(post) -%} {% if +post.external_link -%} {{- post.external_link -}} {% else %} {{- +pathto(post.docname) }}{{ anchor(post) -}} {%- endif %} {%- endmacro %}

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

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

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

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

{{ post.title }}

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

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

-
+

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

+
- {% endfor %} - {% endif %} + {% endfor %} {% endif %}
{% endblock body %} diff --git a/src/ablog/templates/ablog/languages.html b/src/ablog/templates/ablog/languages.html index ee5c5cef..76fb07ea 100644 --- a/src/ablog/templates/ablog/languages.html +++ b/src/ablog/templates/ablog/languages.html @@ -1,14 +1,14 @@ {% if ablog.language %}
-

- {{ gettext('Languages') }} -

- +

+ {{ gettext("Languages") }} +

+
{% endif %} diff --git a/src/ablog/templates/ablog/locations.html b/src/ablog/templates/ablog/locations.html index ad7ba184..3b53f810 100644 --- a/src/ablog/templates/ablog/locations.html +++ b/src/ablog/templates/ablog/locations.html @@ -1,16 +1,14 @@ {% if ablog.location %}
-

- {{ gettext('Locations') }} -

- +

+ {{ gettext("Locations") }} +

+
{% endif %} diff --git a/src/ablog/templates/ablog/postcard.html b/src/ablog/templates/ablog/postcard.html index 56d5650e..342e27ea 100644 --- a/src/ablog/templates/ablog/postcard.html +++ b/src/ablog/templates/ablog/postcard.html @@ -1,26 +1,18 @@ {% 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 %} -

-
    - {% include "ablog/postcard2.html" %} -
+ {% 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 %} +

+
    + {% include "ablog/postcard2.html" %} +
{% endif %} diff --git a/src/ablog/templates/ablog/postcard2.html b/src/ablog/templates/ablog/postcard2.html index 9c35461d..ec3dc341 100644 --- a/src/ablog/templates/ablog/postcard2.html +++ b/src/ablog/templates/ablog/postcard2.html @@ -1,165 +1,103 @@
-{% if post.published and post.date != post.update %} -
  • - - {% if fa %} - - {% else %} - {{ gettext('Update') }}: - {% endif %} + {% 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 %} + {{ 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.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.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.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.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 %} - + (function () { + var s = document.createElement("script"); + s.async = true; + s.type = "text/javascript"; + s.src = "//" + disqus_shortname + ".disqus.com/count.js"; + ( + document.getElementsByTagName("HEAD")[0] || + document.getElementsByTagName("BODY")[0] + ).appendChild(s); + })(); + + {% if fa %}{% endif %} + + {% if not fa %}Comments{% endif %} + +
  • {% endif %} - - {% if not fa %} - Comments - {% endif %} - - -{% endif %}
    diff --git a/src/ablog/templates/ablog/postnavy.html b/src/ablog/templates/ablog/postnavy.html index 34a5f438..682e6fbf 100644 --- a/src/ablog/templates/ablog/postnavy.html +++ b/src/ablog/templates/ablog/postnavy.html @@ -1,11 +1,8 @@ -{# prev/next are not set for drafts #} -{% set post = ablog[pagename] %} -{% if post.published and ablog.post_show_prev_next %} +{# 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 %} @@ -17,14 +14,12 @@   - {% 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 %} {% endif %} diff --git a/src/ablog/templates/ablog/recentposts.html b/src/ablog/templates/ablog/recentposts.html index fe49c7b6..31eab471 100644 --- a/src/ablog/templates/ablog/recentposts.html +++ b/src/ablog/templates/ablog/recentposts.html @@ -1,17 +1,17 @@ {% if ablog %}
    -

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

    - +

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

    +
    {% endif %} diff --git a/src/ablog/templates/ablog/redirect.html b/src/ablog/templates/ablog/redirect.html index 79f7468e..e2ce7929 100644 --- a/src/ablog/templates/ablog/redirect.html +++ b/src/ablog/templates/ablog/redirect.html @@ -1,8 +1,8 @@ -{%- extends "!layout.html" %} -{%- block extrahead %} -{{ super() }} - -{% endblock extrahead %} -{% block body %} -You are being redirected to {{ post.title }} in {{ ablog.post_redirect_refresh }} seconds; -{% endblock body %} +{%- extends "!layout.html" %} {%- block extrahead %} {{ super() }} + +{% endblock extrahead %} {% block body %} You are being redirected to +{{ post.title }} in {{ +ablog.post_redirect_refresh }} seconds; {% endblock body %} diff --git a/src/ablog/templates/ablog/tagcloud.html b/src/ablog/templates/ablog/tagcloud.html index 3a9eb07c..b3e65d16 100644 --- a/src/ablog/templates/ablog/tagcloud.html +++ b/src/ablog/templates/ablog/tagcloud.html @@ -1,15 +1,19 @@ {% if ablog.tags %}
    - -

    {{ gettext('Tags') }}

    -
      - {% for coll in ablog.tags %} - {% if coll %} -
    • - {{ coll }} -
    • - {% endif %} - {% endfor %} -
    + +

    + {{ gettext("Tags") }} +

    +
      + {% for coll in ablog.tags %} {% if coll %} +
    • + {{ coll }} +
    • + {% endif %} {% endfor %} +
    {% endif %} diff --git a/src/ablog/templates/archives.html b/src/ablog/templates/archives.html deleted file mode 100644 index b26e94fe..00000000 --- a/src/ablog/templates/archives.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ 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/src/ablog/templates/authors.html b/src/ablog/templates/authors.html deleted file mode 100644 index 4ac4ad43..00000000 --- a/src/ablog/templates/authors.html +++ /dev/null @@ -1,13 +0,0 @@ -{{ 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/src/ablog/templates/catalog.html b/src/ablog/templates/catalog.html deleted file mode 100644 index dfb5ba16..00000000 --- a/src/ablog/templates/catalog.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ warning("catalog.html is an old template path, that is no longer used by ablog. Please use ablog/catalog.html instead.") }} -{%- extends "page.html" %} -{% macro postlink(post) -%} - {% if post.external_link -%} - {{- post.external_link -}} - {% else %} - {{- pathto(post.docname) }}{{ anchor(post) -}} - {%- endif %} -{%- endmacro %} -{% 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 body %} diff --git a/src/ablog/templates/categories.html b/src/ablog/templates/categories.html deleted file mode 100644 index b5d0e9a7..00000000 --- a/src/ablog/templates/categories.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ 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') }} -

    - -
    -{% endif %} diff --git a/src/ablog/templates/collection.html b/src/ablog/templates/collection.html deleted file mode 100644 index a7cf5e0e..00000000 --- a/src/ablog/templates/collection.html +++ /dev/null @@ -1,73 +0,0 @@ -{{ 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 %} -{% macro postlink(post) -%} - {% if post.external_link -%} - {{- post.external_link -}} - {% else %} - {{- pathto(post.docname) }}{{ anchor(post) -}} - {%- endif %} -{%- endmacro %} -{% endmacro %} -
    -

    - {% 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 }} -

    -
      -
    • - {% 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 "ablog/postcard2.html" %} -
    - {{ post.to_html(collection.docname) }} -

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

    -
    -
    - {% endfor %} - {% endif %} -
    -{% endblock body %} diff --git a/src/ablog/templates/languages.html b/src/ablog/templates/languages.html deleted file mode 100644 index 4f7effd8..00000000 --- a/src/ablog/templates/languages.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ 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') }} -

    - -
    -{% endif %} diff --git a/src/ablog/templates/locations.html b/src/ablog/templates/locations.html deleted file mode 100644 index 98dc56ff..00000000 --- a/src/ablog/templates/locations.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ 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') }} -

    - -
    -{% endif %} diff --git a/src/ablog/templates/page.html b/src/ablog/templates/page.html deleted file mode 100644 index f360992c..00000000 --- a/src/ablog/templates/page.html +++ /dev/null @@ -1,60 +0,0 @@ -{%- extends "layout.html" %} -{% set fa = ablog.fontawesome %} -{%- block extrahead %} -{{ super() }} -{% if feed_path %} - -{% endif %} -{% if ablog.fontawesome_link_cdn %} - -{% elif ablog.fontawesome_css_file %} - -{% endif %} -{% endblock extrahead %} -{% 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 - -
    - {% endif %} -
    -{% endblock body %} diff --git a/src/ablog/templates/postcard.html b/src/ablog/templates/postcard.html deleted file mode 100644 index 137ae98e..00000000 --- a/src/ablog/templates/postcard.html +++ /dev/null @@ -1,27 +0,0 @@ -{{ 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 %} -

    -
      - {% include "ablog/postcard2.html" %} -
    -
    -{% endif %} diff --git a/src/ablog/templates/postcard2.html b/src/ablog/templates/postcard2.html deleted file mode 100644 index e43f9180..00000000 --- a/src/ablog/templates/postcard2.html +++ /dev/null @@ -1,166 +0,0 @@ -{{ 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 %} - - {{ 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/src/ablog/templates/postnavy.html b/src/ablog/templates/postnavy.html deleted file mode 100644 index a8c8978b..00000000 --- a/src/ablog/templates/postnavy.html +++ /dev/null @@ -1,34 +0,0 @@ -{{ 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') }}: - {% 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/src/ablog/templates/recentposts.html b/src/ablog/templates/recentposts.html deleted file mode 100644 index 5a7dad64..00000000 --- a/src/ablog/templates/recentposts.html +++ /dev/null @@ -1,18 +0,0 @@ -{{ 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/src/ablog/templates/redirect.html b/src/ablog/templates/redirect.html deleted file mode 100644 index 83ab0032..00000000 --- a/src/ablog/templates/redirect.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ 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 extrahead %} -{% block body %} -You are being redirected to {{ post.title }} in {{ ablog.post_redirect_refresh }} seconds; -{% endblock body %} diff --git a/src/ablog/templates/tagcloud.html b/src/ablog/templates/tagcloud.html deleted file mode 100644 index c6b3d87f..00000000 --- a/src/ablog/templates/tagcloud.html +++ /dev/null @@ -1,16 +0,0 @@ -{{ 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 %} -
    • - {{ coll }} -
    • - {% endif %} - {% endfor %} -
    -
    -{% endif %} diff --git a/src/ablog/version.py b/src/ablog/version.py deleted file mode 100644 index e86557ff..00000000 --- a/src/ablog/version.py +++ /dev/null @@ -1,17 +0,0 @@ -try: - from ._version import version -except Exception: - import warnings - - warnings.warn(f'could not determine {__name__.split(".")[0]} package version; this indicates a broken installation') - del warnings - - version = "0.0.0" - -from packaging.version import parse as _parse - -_version = _parse(version) -major, minor, bugfix = [*_version.release, 0][:3] -release = not _version.is_devrelease - -__all__ = ["version", "major", "minor", "bugfix", "release"] diff --git a/tox.ini b/tox.ini index 8c4c5326..98b50bec 100644 --- a/tox.ini +++ b/tox.ini @@ -1,41 +1,26 @@ [tox] envlist = - py{39,310,311,312}{-sphinx5,-sphinx6,-sphinx7,-sphinx8,-sphinxdev,-docs,-linkcheck} - + py{39,310,311,312}{-sphinx6,-sphinx7,-sphinx8,-sphinx9,-devdeps,-docs,-linkcheck} [testenv] allowlist_externals = - conda make git -deps = - pytest-cov extras = - dev + all + docs + tests commands = # Have to do this here as myst-parser in the install step forces the version. - sphinx5: pip install -U "sphinx>=5.0,<6.0" sphinx6: pip install -U "sphinx>=6.0,<7.0" sphinx7: pip install -U "sphinx>=7.0,<8.0" sphinx8: pip install -U "sphinx>=8.0,<9.0" - sphinxdev: pip install -U "git+https://repo.or.cz/docutils.git#egg=docutils&subdirectory=docutils" - sphinxdev: pip install -U "git+https://github.com/sphinx-doc/sphinx" + sphinx9: pip install -U "sphinx>=9.0,<10.0" + devdeps: pip install -U "docutils @ git+https://github.com/docutils/docutils.git\#\&subdirectory=docutils" + devdeps: pip install -U "git+https://github.com/sphinx-doc/sphinx" pip freeze --all --no-input pytest -vvv -r a --pyargs ablog make tests -[testenv:pydata-sphinx-theme] -deps = - git+https://github.com/pydata/pydata-sphinx-theme.git - pytest-cov -extras = - dev -commands = - rm -rf pydata-sphinx-theme || true - git clone git@github.com:pydata/pydata-sphinx-theme.git --depth 1 pydata-sphinx-theme - pip install -e "pydata-sphinx-theme/.[dev]" - pip freeze --all --no-input - sphinx-build --color -W --keep-going -b html -d _build/.doctrees pydata-sphinx-theme/docs pydata-sphinx-theme/docs/_build/html {posargs} - [testenv:docs] changedir = docs description = Invoke sphinx-build to build the HTML docs @@ -48,33 +33,3 @@ changedir = docs description = Invoke sphinx-build to check linkcheck works commands = sphinx-build --color -W --keep-going -b linkcheck . _build/html {posargs} - -# Requires tox-conda -[testenv:py{39,310,311}-conda] -extras = -deps = -conda_deps = - alabaster - docutils - feedgen - graphviz - invoke - make - myst-parser - nbsphinx - packaging - pandoc - pip - pytest - python-dateutil - setuptools - setuptools-scm - sphinx - sphinx-automodapi - watchdog -conda_channels = conda-forge -install_command = pip install --no-deps --no-build-isolation {opts} {packages} -commands = - conda list - pytest -vvv -r a --pyargs ablog - make tests