feat: v1.4.0 Phase 4 - Enhanced Feed Media
Implement Phase 4 of v1.4.0 Media release - Enhanced Feed Media support. RSS Feed Enhancements (starpunk/feeds/rss.py): - Wrap size variants in <media:group> elements - Add <media:content> for large/medium/small variants with attributes: url, type, medium, isDefault, width, height, fileSize - Add <media:thumbnail> for thumb variant with dimensions - Add <media:title type="plain"> for image captions - Implement isDefault logic: largest available variant (large→medium→small fallback) - Maintain backwards compatibility for media without variants (legacy fallback) JSON Feed Enhancements (starpunk/feeds/json_feed.py): - Add _starpunk.about URL (configurable via STARPUNK_ABOUT_URL config) - Add _starpunk.media_variants array with variant data when variants exist - Each variant entry includes: url, width, height, size_in_bytes, mime_type ATOM Feed Enhancements (starpunk/feeds/atom.py): - Add title attribute to enclosure links for captions - Keep simple (no variants in ATOM per design decision) Test Updates (tests/test_feeds_rss.py): - Update streaming media test to search descendants for media:content - Now inside media:group for images with variants (v1.4.0 behavior) Per design document: /docs/design/v1.4.0/media-implementation-design.md Following ADR-059: Full Feed Media Standardization Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -184,12 +184,18 @@ def generate_atom_streaming(
|
||||
yield f' <category term="{_escape_xml(tag["name"])}" label="{_escape_xml(tag["display_name"])}"/>\n'
|
||||
|
||||
# Media enclosures (v1.2.0 Phase 3, per Q24 and ADR-057)
|
||||
# Enhanced with title attribute for captions (v1.4.0 Phase 4)
|
||||
if hasattr(note, 'media') and note.media:
|
||||
for item in note.media:
|
||||
media_url = f"{site_url}/media/{item['path']}"
|
||||
mime_type = item.get('mime_type', 'image/jpeg')
|
||||
size = item.get('size', 0)
|
||||
yield f' <link rel="enclosure" type="{_escape_xml(mime_type)}" href="{_escape_xml(media_url)}" length="{size}"/>\n'
|
||||
caption = item.get('caption', '')
|
||||
|
||||
# Include title attribute for caption
|
||||
title_attr = f' title="{_escape_xml(caption)}"' if caption else ''
|
||||
|
||||
yield f' <link rel="enclosure" type="{_escape_xml(mime_type)}" href="{_escape_xml(media_url)}" length="{size}"{title_attr}/>\n'
|
||||
|
||||
# Content - include media as HTML (per Q24)
|
||||
if note.html:
|
||||
|
||||
Reference in New Issue
Block a user