Commit graph

4,034 commits

Author SHA1 Message Date
Paolo Melchiorre
c2fff5344b Add support for Python 3.15 2026-10-13 12:31:16 +02:00
GeorgeHu6
8b49151a22 Docs: update Chinese translation 2026-10-12 22:23:58 +02:00
rivassec
b9d5e08a21 Enable flake8-bandit (Ruff S) rule set
Addresses the `# TODO: "S"` marker in pyproject.toml. Adds a per-file
ignore for `pelican/tests/*` covering S-rules that are universally
appropriate to suppress in test code (S101 assert, S105/S106 hardcoded
test passwords, S108 /tmp paths, S311 non-cryptographic randomness,
S603/S607 subprocess fixtures, S104 loopback bindings).

Each remaining library finding gets a targeted `# noqa` with a
justification comment explaining why the call is acceptable in
context. Two `S101` suppressions in `pelican_import.py` and one
`S504` in `server.py` flag latent issues that warrant follow-up but
are intentionally deferred so this commit stays purely lint-enabling.

No behavior changes.
2026-10-12 22:19:38 +02:00
Justin Mayer
f5535a3ac6 fix: Clarify errors for missing or empty metadata
Report whether required metadata is missing, or present but empty,
instead of the vague "could not find information about" message, which
was misleading when a field such as `:title:` was present but empty.
2026-10-12 22:04:33 +02:00
Justin Mayer
4e8ee91ae3 fix: Skip content whose empty slug is used in paths
A title made only of punctuation, such as "???", slugifies to an empty
string. When URL patterns use `{slug}`, the content was written to
".html", and two such articles crashed the build. Skip content with such
titles with an error that suggests setting a slug. Patterns that don't
use the slug, such as date-based `ARTICLE_SAVE_AS` patterns, are
unaffected.
2026-10-12 22:04:33 +02:00
Justin Mayer
6f10e8f2b6 fix: Don't link to missing category pages
When `CATEGORY_SAVE_AS` is disabled but `CATEGORIES_SAVE_AS` is not,
the category index page was still generated, and its links pointed to
category pages that don't exist. This change shows category names
without links in the Simple and NotMyIdea themes in such cases and also
documents that both settings must be disabled to remove all
category-related output.
2026-10-12 22:00:25 +02:00
Justin Mayer
edd1f37cd4 fix: Always assign DEFAULT_CATEGORY
PR #3589 tied category assignment to `CATEGORY_SAVE_AS`, so disabling
category pages also removed article categories and broke `{category}`
in URL patterns (#3596). PR #3597 restored folder-based categories, but
articles outside a subfolder still lost `DEFAULT_CATEGORY`. This change
assigns it again, so `CATEGORY_SAVE_AS` only controls whether category
pages are generated. Setting `DEFAULT_CATEGORY = None` is now the
documented way to have no categories.

This also stops the Simple and NotMyIdea themes from linking to category
pages that don't exist.
2026-10-12 22:00:25 +02:00
Justin Mayer
e54689de4e test: Ensure empty and None titles are judged invalid
- Check that pages with an empty or `None` title fail validation.
- Use a fixed date in the article test.
- Add a reader-level test using the empty `:title:` source from #3566 to
  confirm readers produce an empty title that is then rejected.
2026-10-11 20:55:37 +02:00
noy-solvin
06b9afb3ab fix(contents): validate that mandatory properties are not empty or None 2026-10-11 20:55:37 +02:00
Aurélien Bompard
0a2fb1e7a9 Don't ignore article categories when CATEGORY_SAVE_AS is false
Fixes: #3596

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
2026-10-11 19:35:14 +02:00
Justin Mayer
fe9cb75137 ci: Update Pandoc version from 2.x to 3.x 2026-10-11 17:46:12 +02:00
Eklavya Sharma
38134a38d3
fix: Allow drafts without a category (#3600)
Co-authored-by: Justin Mayer <entroP@gmail.com>
2026-10-11 17:40:45 +02:00
botpub
3c69dc68d2 Release Pelican 4.12.0 4.12.0 2026-04-20 15:29:45 +00:00
Justin Mayer
f7fe7865c5 Prepare release 2026-04-20 17:26:41 +02:00
Justin Mayer
5672362f41 fix: Override server JS MIME type if text/plain
On systems such as Windows, JavaScript files can be incorrectly assigned
the "text/plain" MIME type in Python's mimetypes module. This overrides
this behavior when it occurs.
2026-04-20 10:14:29 +02:00
Justin Mayer
3e401f648c test: Ensure MIME type for JS is JavaScript 2026-04-20 10:14:29 +02:00
Matěj Cepl
c214906358 Use more specific exceptions instead of just Exception. 2026-04-18 08:18:02 +02:00
Matěj Cepl
85946e54b8 fix: typo in pyproject.toml 2026-04-18 08:15:52 +02:00
Justin Mayer
46ab131940
Merge pull request #3549 from getpelican/install-docs
docs: Add Pipx & `uv` as alternate install methods
2026-04-15 10:44:48 +02:00
Justin Mayer
8ad4e90170 docs: Overhaul installation instructions; add uv 2026-04-15 10:38:00 +02:00
Sam Bull
f941cb0885
Fix raising exceptions on filtered logs 2026-04-15 08:14:52 +02:00
Sam Bull
691995c142
Support CSS_FILE in Simple theme 2026-04-14 12:05:32 +02:00
Sam Bull
751dff90f4
Fix disabled category output 2026-04-14 12:02:25 +02:00
Russell
d6461130cc
Strip TOC elements from article summaries
* Strip TOC elements from article summaries

Automatically remove table of contents divs and toc-backref anchor links
from article summaries when displayed outside full article context
(e.g., on homepage, in RSS feeds).

ReStructuredText automatically generates anchor links in section headings
when a table of contents directive is present. These anchors work perfectly
on full article pages, but become broken links when article summaries appear
on homepage or in feeds - the anchor targets don't exist in that context.

This change adds a strip_toc_elements_from_html() function in pelican/utils.py
that uses regex to remove:
- TOC div blocks (<div class="contents">...</div>) containing broken navigation
- toc-backref anchor links from headings while preserving heading text

Both removals are necessary since TOC anchor targets don't exist in summary context.

The function is called automatically in Content.get_summary() so all
summaries are cleaned without requiring configuration or template changes.

Includes comprehensive unit tests covering various TOC formats, edge cases,
and case-insensitive matching.

---------

Co-authored-by: Justin Mayer <entroP@gmail.com>
2026-04-13 20:01:25 +02:00
MinchinWeb
763bf5224c Docs/Settings: update code formatting
to bring it more inline with current black/ruff formatting, particularly in the use of double (over single) quotes
2026-04-13 18:38:03 +02:00
MinchinWeb
d15460c060 Docs/Settings: more notes on how to extract metadata from filenames 2026-04-13 18:38:03 +02:00
MinchinWeb
ebfbc344df Docs/Plugins: document another signal 2026-04-13 18:38:03 +02:00
MinchinWeb
24350502c7 Docs: note that plugins and themes can be found on PyPI 2026-04-13 18:38:03 +02:00
MinchinWeb
871aa779d0 Better error messages with trying to (and failing) to overwrite files 2026-04-13 18:34:26 +02:00
MinchinWeb
6e3c51fd21 Use custom exception for (failing to) overwrite files 2026-04-13 18:34:26 +02:00
MinchinWeb
b70e610984 Log warnings on creating (tag) slugs directly 2026-04-13 18:34:26 +02:00
MinchinWeb
b4e2d6cc1f Better error message on bad slug 2026-04-13 18:34:26 +02:00
MinchinWeb
9f62408cdc If it fails to write a tag/catetory/author page, tell us which one we failed on 2026-04-13 18:34:26 +02:00
Sam Bull
a2570498ba
Use slug in category/tag feed title 2026-04-13 17:59:46 +02:00
Justin Mayer
ca460ee753 Ensure URLWrapper.__str__() returns a string
This could otherwise cause an error if a setting, such as `AUTHOR`, was
set to `None`.
2026-04-13 17:44:47 +02:00
Sam Bull
70767ca8ba
fix: Don't log feed warning if FEED_DOMAIN is set 2026-04-13 11:11:12 +02:00
Yash Srivastava
77e88ae3f2
fix: Move livereload import inside docserve() task
This fixes `invoke setup` failing in fresh virtual environments.
The top-level import of `livereload` caused tasks.py to fail before any
task could execute, since `livereload` is a development dependency only
installed by PDM as part of the setup task.
2026-04-05 20:21:51 +02:00
Justin Mayer
de6df5ef7a chore: Require Sphinx 9.0 and above 2026-03-31 14:18:33 +02:00
Justin Mayer
d50abb7319 chore: Require docutils 0.22 and above 2026-03-31 14:18:33 +02:00
Justin Mayer
74feb7c48b refactor: Upgrade code for Python 3.11 and above 2026-03-31 14:18:33 +02:00
Justin Mayer
68c341bd10 refactor: Require Python 3.11 and above 2026-03-31 14:18:33 +02:00
Sam Bull
862ac78310
Add page_content block for better template inheritance 2026-03-30 13:04:55 +02:00
Jan
c495634138
Add SSH_PORT to sftp_upload in Makefile template 2026-03-30 11:03:31 +02:00
Justin Mayer
e78a555fff fix: Appease linter 2026-03-30 10:59:20 +02:00
nkr
d9b76ac0e7 Use a city closer to the equator and that does not use daylight savings in tests 2026-03-30 10:51:50 +02:00
Sam Bull
4444f99c17 Don't render 'By' if no authors 2026-03-30 10:48:57 +02:00
Chris Rose
8b4d7475ea dev: Switch from PDM to standard dev-dependencies
PDM supports this specification (per https://pdm-project.org/latest/usage/dependency/#add-development-only-dependencies) and this lets other frontends (uv, baby!) make use of the same dependencies.
2026-03-27 08:44:10 +01:00
GeorgeHu
b5e20d7f6d
docs: Update Chinese translation (#3559) 2026-02-03 12:11:45 +01:00
Chad Smith
302f20a628 add pipx installation instructions and prefer venv 2025-12-26 22:03:57 +01:00
Justin Mayer
3d3265b74c ci: Increment checkout GitHub action to v6 2025-12-01 09:29:30 +01:00