Generator.get_files() returns a set, and the article, page, static, and
disabled-reader loops iterated it directly (the static generator iterates a
set union). Set iteration order depends on the interpreter's hash seed, so
the order of generator.staticfiles, and the order files are processed in,
changed from build to build.
Default output isn't affected, but anything that depends on that order is:
a plugin that lists static files gets a different file each build, and a
plugin that reads a static file's url during generation freezes its output
location, so which shared attachment gets frozen also varied.
Iterate in sorted order at the call sites. get_files() still returns a set,
so plugins using set operations on it are unaffected. Plugin-free output is
byte-identical before and after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
* 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>
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.
Folks tend to ignore the comments in issue templates and create new
issues, even when the issue template comments make it clear that we
would prefer that folks create discussions for topics outside of bug
reports, documentation issues, and feature requests.