This commit implements the first three phases of v1.1.2 Phase 2 Feed Formats, adding ATOM 1.0 and JSON Feed 1.1 support alongside the existing RSS feed. CRITICAL BUG FIX: - Fixed RSS streaming feed ordering (was showing oldest-first instead of newest-first) - Streaming RSS removed incorrect reversed() call at line 198 - Feedgen RSS kept correct reversed() to compensate for library behavior NEW FEATURES: - ATOM 1.0 feed generation (RFC 4287 compliant) - Proper XML namespacing and RFC 3339 dates - Streaming and non-streaming methods - 11 comprehensive tests - JSON Feed 1.1 generation (JSON Feed spec compliant) - RFC 3339 dates and UTF-8 JSON output - Custom _starpunk extension with permalink_path and word_count - 13 comprehensive tests REFACTORING: - Restructured feed code into starpunk/feeds/ module - feeds/rss.py - RSS 2.0 (moved from feed.py) - feeds/atom.py - ATOM 1.0 (new) - feeds/json_feed.py - JSON Feed 1.1 (new) - Backward compatible feed.py shim for existing imports - Business metrics integrated into all feed generators TESTING: - Created shared test helper tests/helpers/feed_ordering.py - Helper validates newest-first ordering across all formats - 48 total feed tests, all passing - RSS: 24 tests - ATOM: 11 tests - JSON Feed: 13 tests FILES CHANGED: - Modified: starpunk/feed.py (now compatibility shim) - New: starpunk/feeds/ module with rss.py, atom.py, json_feed.py - New: tests/helpers/feed_ordering.py (shared test helper) - New: tests/test_feeds_atom.py, tests/test_feeds_json.py - Modified: CHANGELOG.md (Phase 2 entries) - New: docs/reports/2025-11-26-v1.1.2-phase2-feed-formats-partial.md NEXT STEPS: Phase 2.4 (Content Negotiation) pending - will add /feed endpoint with Accept header negotiation and explicit format endpoints. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""
|
|
Feed generation module for StarPunk
|
|
|
|
This module provides feed generation in multiple formats (RSS, ATOM, JSON Feed)
|
|
with content negotiation and caching support.
|
|
|
|
Exports:
|
|
generate_rss: Generate RSS 2.0 feed
|
|
generate_rss_streaming: Generate RSS 2.0 feed with streaming
|
|
generate_atom: Generate ATOM 1.0 feed (coming in Phase 2.2)
|
|
generate_atom_streaming: Generate ATOM 1.0 feed with streaming (coming in Phase 2.2)
|
|
generate_json_feed: Generate JSON Feed 1.1 (coming in Phase 2.3)
|
|
generate_json_feed_streaming: Generate JSON Feed 1.1 with streaming (coming in Phase 2.3)
|
|
"""
|
|
|
|
from .rss import (
|
|
generate_rss,
|
|
generate_rss_streaming,
|
|
format_rfc822_date,
|
|
get_note_title,
|
|
clean_html_for_rss,
|
|
)
|
|
|
|
from .atom import (
|
|
generate_atom,
|
|
generate_atom_streaming,
|
|
)
|
|
|
|
from .json_feed import (
|
|
generate_json_feed,
|
|
generate_json_feed_streaming,
|
|
)
|
|
|
|
__all__ = [
|
|
# RSS functions
|
|
"generate_rss",
|
|
"generate_rss_streaming",
|
|
"format_rfc822_date",
|
|
"get_note_title",
|
|
"clean_html_for_rss",
|
|
# ATOM functions
|
|
"generate_atom",
|
|
"generate_atom_streaming",
|
|
# JSON Feed functions
|
|
"generate_json_feed",
|
|
"generate_json_feed_streaming",
|
|
]
|