🎨 manage comics via yaml files
This commit is contained in:
23
data/comics/001.yaml
Normal file
23
data/comics/001.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Comic #1
|
||||
number: 1
|
||||
title: "First Comic"
|
||||
filename: comic-001.jpg
|
||||
mobile_filename: comic-001-mobile.jpg # Optional: mobile version of the comic
|
||||
date: "2025-01-01"
|
||||
alt_text: "The very first comic"
|
||||
|
||||
# Author notes (choose one method):
|
||||
# Option 1: Plain text note
|
||||
author_note: "This is where your comic journey begins!"
|
||||
|
||||
# Option 2: Markdown file (overrides author_note if present)
|
||||
# Just a filename looks in content/author_notes/
|
||||
# Or use a path like "special/note.md" relative to content/
|
||||
author_note_md: "2025-01-01.md"
|
||||
|
||||
# Display settings (override global defaults)
|
||||
full_width: true
|
||||
plain: true
|
||||
|
||||
# Section header (optional - only add to first comic of a new section)
|
||||
section: "Chapter 1: The Beginning"
|
||||
9
data/comics/002.yaml
Normal file
9
data/comics/002.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
# Comic #2
|
||||
number: 2
|
||||
filename: comic-002.jpg
|
||||
date: "2025-01-08"
|
||||
alt_text: "The second comic"
|
||||
|
||||
# Display settings
|
||||
full_width: true
|
||||
plain: true
|
||||
7
data/comics/003.yaml
Normal file
7
data/comics/003.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
# Comic #3
|
||||
number: 3
|
||||
title: "Third Comic"
|
||||
filename: comic-003.jpg
|
||||
date: "2025-01-15"
|
||||
alt_text: "The third comic"
|
||||
author_note: "Things are getting interesting!"
|
||||
89
data/comics/README.md
Normal file
89
data/comics/README.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Comic Data Directory
|
||||
|
||||
This directory contains YAML files for managing individual comics. Each comic gets its own `.yaml` file.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Adding a New Comic
|
||||
|
||||
1. **Copy the template:**
|
||||
```bash
|
||||
cp TEMPLATE.yaml 004.yaml
|
||||
```
|
||||
|
||||
2. **Edit the file** with your comic's information:
|
||||
- Update `number`, `filename`, `date`, and `alt_text` (required)
|
||||
- Add optional fields like `title`, `author_note`, etc.
|
||||
|
||||
3. **Save the file** and restart your application
|
||||
|
||||
The comics will be automatically loaded and sorted by comic number.
|
||||
|
||||
## File Naming
|
||||
|
||||
You can name files anything you want (e.g., `001.yaml`, `first-comic.yaml`, `2025-01-01.yaml`), but using the comic number is recommended for easy organization.
|
||||
|
||||
## Required Fields
|
||||
|
||||
Every comic MUST have:
|
||||
- `number` - Sequential comic number (integer)
|
||||
- `filename` - Image filename (string) or list of filenames for multi-image comics
|
||||
- `date` - Publication date in YYYY-MM-DD format (string)
|
||||
- `alt_text` - Accessibility description (string or list for multi-image)
|
||||
|
||||
## Optional Fields
|
||||
|
||||
- `title` - Comic title (defaults to "#X" if not provided)
|
||||
- `mobile_filename` - Mobile-optimized version
|
||||
- `author_note` - Plain text note below the comic
|
||||
- `author_note_md` - Markdown file for author note (overrides `author_note`)
|
||||
- `full_width` - Override global width setting (boolean)
|
||||
- `plain` - Override global plain mode (boolean)
|
||||
- `section` - Start a new section/chapter (string, add only to first comic of section)
|
||||
|
||||
## Multi-Image Comics (Webtoon Style)
|
||||
|
||||
For vertical scrolling comics with multiple images:
|
||||
|
||||
```yaml
|
||||
number: 42
|
||||
filename:
|
||||
- page1.png
|
||||
- page2.png
|
||||
- page3.png
|
||||
alt_text:
|
||||
- "First panel description"
|
||||
- "Second panel description"
|
||||
- "Third panel description"
|
||||
date: "2025-01-01"
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
number: 4
|
||||
title: "The Adventure Begins"
|
||||
filename: comic-004.jpg
|
||||
date: "2025-01-22"
|
||||
alt_text: "A hero stands at the edge of a cliff, looking at the horizon"
|
||||
author_note: "This is where things get interesting!"
|
||||
full_width: true
|
||||
section: "Chapter 2: The Journey"
|
||||
```
|
||||
|
||||
## Validation
|
||||
|
||||
The data loader will:
|
||||
- Skip files with missing required fields (with warnings)
|
||||
- Check for duplicate comic numbers
|
||||
- Warn about gaps in numbering
|
||||
- Sort comics by number automatically
|
||||
|
||||
## Testing Your Changes
|
||||
|
||||
Test the loader directly:
|
||||
```bash
|
||||
python data_loader.py
|
||||
```
|
||||
|
||||
This will show you all loaded comics and any validation warnings.
|
||||
51
data/comics/TEMPLATE.yaml
Normal file
51
data/comics/TEMPLATE.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
# Template for creating new comics
|
||||
# Copy this file and rename it to match your comic number (e.g., 004.yaml, 005.yaml)
|
||||
# Fields marked as REQUIRED must be included
|
||||
# All other fields are optional
|
||||
|
||||
# REQUIRED: Sequential comic number
|
||||
number: 999
|
||||
|
||||
# REQUIRED: Image filename(s) in static/images/comics/
|
||||
# Single image:
|
||||
filename: comic-999.jpg
|
||||
# OR multi-image (webtoon style):
|
||||
# filename:
|
||||
# - page1.png
|
||||
# - page2.png
|
||||
# - page3.png
|
||||
|
||||
# Optional: Mobile-optimized version of the comic
|
||||
# mobile_filename: comic-999-mobile.jpg
|
||||
|
||||
# REQUIRED: Publication date (YYYY-MM-DD format)
|
||||
date: "2025-01-01"
|
||||
|
||||
# REQUIRED: Accessibility text for screen readers
|
||||
# Single alt text (for single or multi-image):
|
||||
alt_text: "Description of what happens in this comic"
|
||||
# OR individual alt texts for multi-image comics:
|
||||
# alt_text:
|
||||
# - "Description of first image"
|
||||
# - "Description of second image"
|
||||
# - "Description of third image"
|
||||
|
||||
# Optional: Comic title (defaults to "#X" if not provided)
|
||||
title: "Title of Your Comic"
|
||||
|
||||
# Optional: Plain text author note
|
||||
author_note: "Your thoughts about this comic."
|
||||
|
||||
# Optional: Markdown author note file (overrides author_note if present)
|
||||
# Just filename looks in content/author_notes/
|
||||
# Or use path like "special/note.md" relative to content/
|
||||
# author_note_md: "2025-01-01.md"
|
||||
|
||||
# Optional: Override global FULL_WIDTH_DEFAULT setting
|
||||
# full_width: true
|
||||
|
||||
# Optional: Override global PLAIN_DEFAULT setting (hides header/border)
|
||||
# plain: true
|
||||
|
||||
# Optional: Section/chapter title (only add to first comic of a new section)
|
||||
# section: "Chapter 2: New Adventures"
|
||||
Reference in New Issue
Block a user