ficgen 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ficgen-0.1.0/LICENSE +21 -0
- ficgen-0.1.0/MANIFEST.in +5 -0
- ficgen-0.1.0/PKG-INFO +368 -0
- ficgen-0.1.0/README.md +341 -0
- ficgen-0.1.0/ficgen/__init__.py +77 -0
- ficgen-0.1.0/ficgen/__main__.py +8 -0
- ficgen-0.1.0/ficgen/cli.py +499 -0
- ficgen-0.1.0/ficgen/generator.py +265 -0
- ficgen-0.1.0/ficgen/importer.py +290 -0
- ficgen-0.1.0/ficgen/kdlMeta.py +203 -0
- ficgen-0.1.0/ficgen/markdownExt.py +241 -0
- ficgen-0.1.0/ficgen/models.py +245 -0
- ficgen-0.1.0/ficgen/parser.py +598 -0
- ficgen-0.1.0/ficgen/py.typed +0 -0
- ficgen-0.1.0/ficgen/scaffolder.py +168 -0
- ficgen-0.1.0/ficgen/stamper.py +301 -0
- ficgen-0.1.0/ficgen/static/style.css +1220 -0
- ficgen-0.1.0/ficgen/t.py +51 -0
- ficgen-0.1.0/ficgen/templates/_chapter_nav.html +33 -0
- ficgen-0.1.0/ficgen/templates/_meta_block.html +90 -0
- ficgen-0.1.0/ficgen/templates/_story_card.html +76 -0
- ficgen-0.1.0/ficgen/templates/base.html +78 -0
- ficgen-0.1.0/ficgen/templates/browse_detail.html +28 -0
- ficgen-0.1.0/ficgen/templates/browse_index.html +34 -0
- ficgen-0.1.0/ficgen/templates/feed.xml +31 -0
- ficgen-0.1.0/ficgen/templates/index.html +30 -0
- ficgen-0.1.0/ficgen/templates/story_all.html +116 -0
- ficgen-0.1.0/ficgen/templates/story_chapter.html +64 -0
- ficgen-0.1.0/ficgen/templates/story_single.html +55 -0
- ficgen-0.1.0/ficgen/templates/story_toc.html +79 -0
- ficgen-0.1.0/ficgen.egg-info/PKG-INFO +368 -0
- ficgen-0.1.0/ficgen.egg-info/SOURCES.txt +43 -0
- ficgen-0.1.0/ficgen.egg-info/dependency_links.txt +1 -0
- ficgen-0.1.0/ficgen.egg-info/entry_points.txt +2 -0
- ficgen-0.1.0/ficgen.egg-info/requires.txt +5 -0
- ficgen-0.1.0/ficgen.egg-info/top_level.txt +1 -0
- ficgen-0.1.0/pyproject.toml +151 -0
- ficgen-0.1.0/semver.txt +1 -0
- ficgen-0.1.0/setup.cfg +4 -0
- ficgen-0.1.0/tests/test_generator.py +366 -0
- ficgen-0.1.0/tests/test_importer.py +274 -0
- ficgen-0.1.0/tests/test_markdown.py +78 -0
- ficgen-0.1.0/tests/test_parser.py +164 -0
- ficgen-0.1.0/tests/test_scaffolder.py +147 -0
- ficgen-0.1.0/tests/test_stamper.py +130 -0
ficgen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tab Atkins-Bittner
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ficgen-0.1.0/MANIFEST.in
ADDED
ficgen-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ficgen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Static site generator for personal fiction archives using Markdown and KDL metadata
|
|
5
|
+
Author: Tab Atkins-Bittner
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tabatkins/ficgen
|
|
8
|
+
Project-URL: Repository, https://github.com/tabatkins/ficgen
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: ao3fetch>=0.1.0
|
|
22
|
+
Requires-Dist: jinja2>=3.1
|
|
23
|
+
Requires-Dist: kdl-py>=1.2
|
|
24
|
+
Requires-Dist: linkify-it-py>=2.0
|
|
25
|
+
Requires-Dist: markdown-it-py>=3.0
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# ficgen
|
|
29
|
+
|
|
30
|
+
A static site generator for personal fiction archives. Reads Markdown story documents and KDL metadata (`kdl-py`) from a `stories/` directory and outputs clean, literary static HTML, CSS (with light/dark mode), static taxonomy browse pages, and an Atom 1.0 feed.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Requires Python 3.12+.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install ficgen
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or install globally as a CLI tool with `pipx`:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pipx install ficgen
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For local development inside a virtual environment:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
pip install -r requirements-dev.txt
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 1. The `ficgen` Command
|
|
55
|
+
|
|
56
|
+
`ficgen` (also runnable as `python -m ficgen`) has four subcommands: `build` (the default when no subcommand is given), `new` (alias `init`), `import`, and `stamp`.
|
|
57
|
+
|
|
58
|
+
### Building the Archive (`ficgen` / `ficgen build`)
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
ficgen # build published stories from ./stories into .
|
|
62
|
+
ficgen build # explicit equivalent
|
|
63
|
+
ficgen --drafts # include published false stories and chapters
|
|
64
|
+
ficgen --stories path/to/stories --output path/to/out
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### Build Options
|
|
68
|
+
|
|
69
|
+
| Flag | Default | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `--stories PATH` | `./stories` (or `../stories`) | Source directory containing story subdirectories. |
|
|
72
|
+
| `--output PATH` | `.` (or `..`) | Output directory for generated HTML, CSS, and feed. |
|
|
73
|
+
| `--config PATH` | `<stories>/../site.kdl` if present | Optional KDL site configuration file. |
|
|
74
|
+
| `--title TEXT` | `"Fiction Archive"` | Archive title (overrides `site.kdl`). |
|
|
75
|
+
| `--subtitle TEXT` | `""` | Subtitle shown on the archive index page. |
|
|
76
|
+
| `--author TEXT` | `""` | Default author name for stories and Atom feed entries. |
|
|
77
|
+
| `--base-url URL` | `"https://example.com/"` | Canonical base URL used for Atom `<id>` and `<link>` elements. |
|
|
78
|
+
| `--drafts` | `false` | Include stories and chapters marked `published false`, with `[Draft]` badges. |
|
|
79
|
+
|
|
80
|
+
#### Site Configuration (`site.kdl`)
|
|
81
|
+
|
|
82
|
+
If `site.kdl` exists next to `stories/`, `ficgen` loads it automatically. CLI flags override values in `site.kdl`.
|
|
83
|
+
|
|
84
|
+
```kdl
|
|
85
|
+
title "My Fiction Archive"
|
|
86
|
+
subtitle "Original fiction and fanworks."
|
|
87
|
+
author "Alex Rivera"
|
|
88
|
+
base-url "https://example.com/fic/"
|
|
89
|
+
// include-drafts false
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Generated Output
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
output/
|
|
96
|
+
├── index.html # Main Table of Contents listing all stories
|
|
97
|
+
├── style.css # Shared stylesheet (light/dark mode)
|
|
98
|
+
├── feed.xml # Atom 1.0 feed of published stories & chapters
|
|
99
|
+
├── browse/
|
|
100
|
+
│ ├── index.html # Hub listing all fandoms, categories, ships, characters, tags
|
|
101
|
+
│ └── <kind>/<slug>.html # Static filtered listing for each taxonomy value
|
|
102
|
+
├── <single-doc-slug>/
|
|
103
|
+
│ └── index.html # Complete one-shot reading page
|
|
104
|
+
└── <multi-chapter-slug>/
|
|
105
|
+
├── index.html # Story overview, metadata, and chapter list
|
|
106
|
+
├── ch1.html, ch2.html, ... # Individual chapter pages with prev/next/picker nav
|
|
107
|
+
└── all.html # "Entire Work" combined view
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Rebuilding cleans stale `.html` files inside known story folders and regenerates `browse/` from scratch, while leaving `stories/` and non-HTML files untouched. If any published story or chapter is missing an explicit `date` metadata node, `ficgen` logs a `WARNING` to `stderr` via Python's `logging` module suggesting `ficgen stamp`.
|
|
111
|
+
|
|
112
|
+
### Initializing a New Story (`ficgen new` / `ficgen init`)
|
|
113
|
+
|
|
114
|
+
Creates a new story folder under `stories/<slug>/` with valid KDL metadata and starter Markdown files:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
ficgen new "Midnight Rain" # one-shot: stories/midnight-rain/index.md (draft)
|
|
118
|
+
ficgen new --multi "Starlight Drift" # multi-chapter: story.kdl + ch1.md (draft)
|
|
119
|
+
ficgen new --chapters 3 "Long Arc" # multi-chapter: story.kdl + ch1.md..ch3.md
|
|
120
|
+
ficgen new "Quick Shot" --published --fandom "Original Work" --category "F/F" --tag "fluff"
|
|
121
|
+
ficgen init "Alias Example" --slug custom-slug # `init` is an alias for `new`
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### New Story Options
|
|
125
|
+
|
|
126
|
+
| Flag | Default | Description |
|
|
127
|
+
| --- | --- | --- |
|
|
128
|
+
| `--slug SLUG` | slugified from title | Explicit folder/URL slug (lowercase letters, digits, hyphens). |
|
|
129
|
+
| `-m`, `--multi` | `false` | Create a multi-chapter layout (`story.kdl` + `ch1.md`) instead of `index.md`. |
|
|
130
|
+
| `--chapters N` | `1` | Number of starter chapter files (`ch1.md`..`chN.md`); implies `--multi` when `> 1`. |
|
|
131
|
+
| `--published` | `false` | Omit `published false` and stamp today's `date` (default starts stories as drafts). |
|
|
132
|
+
| `--date DATE` | `""` | Explicit ISO-8601 `date` to include in starter metadata. |
|
|
133
|
+
| `--fandom`, `--category`, `--relationship`, `--character`, `--tag` | `""` | Repeatable metadata tags to pre-populate. |
|
|
134
|
+
| `--stories PATH` | `./stories` (or `../stories`) | Stories directory where the new folder is created. |
|
|
135
|
+
|
|
136
|
+
### Importing from AO3-Compatible Archives (`ficgen import`)
|
|
137
|
+
|
|
138
|
+
Imports stories directly from AO3, any AO3-compatible archive (such as Superlove or SquidgeWorld), or local AO3 `.epub` downloads into `stories/<slug>/` using [`ao3fetch`](https://github.com/tabatkins/ao3fetch):
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
ficgen import https://archiveofourown.org/works/123456
|
|
142
|
+
ficgen import https://superlove.sayitditto.net/works/1269
|
|
143
|
+
ficgen import 123456 --archive https://archiveofourown.org
|
|
144
|
+
ficgen import path/to/downloaded-work.epub --draft
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Import Options
|
|
148
|
+
|
|
149
|
+
| Flag | Default | Description |
|
|
150
|
+
| --- | --- | --- |
|
|
151
|
+
| `--archive URL` | `https://archiveofourown.org` | Archive base URL used for bare numeric work IDs (full URLs auto-detect their host). |
|
|
152
|
+
| `--slug SLUG` | slugified from title | Custom directory/URL slug (when importing a single work). |
|
|
153
|
+
| `--stories PATH` | `./stories` (or `../stories`) | Destination stories directory. |
|
|
154
|
+
| `--draft` | `false` | Mark imported story/chapters as `published false`. |
|
|
155
|
+
| `--force` | `false` | Overwrite an existing `stories/<slug>/` directory. |
|
|
156
|
+
| `--cookie COOKIE` | `""` | Optional `Cookie` header for importing restricted/logged-in works. |
|
|
157
|
+
|
|
158
|
+
Import behavior:
|
|
159
|
+
- Automatically wraps network fetches in `withCache(withRetry(...))` to respect `429 Retry-After` rate limits and transient `5xx` errors.
|
|
160
|
+
- Converts work/chapter prose, summaries, and start/end notes from HTML into clean Markdown.
|
|
161
|
+
- Writes single-chapter works to `index.md` and multi-chapter works to `story.kdl` + `ch1.md`, `ch2.md`, ..., pulling per-chapter publication dates from `/works/<id>/navigate` when available.
|
|
162
|
+
|
|
163
|
+
### Stamping Publication Dates (`ficgen stamp`)
|
|
164
|
+
|
|
165
|
+
Inserts `date "YYYY-MM-DD"` into the KDL metadata blocks of undated story/chapter source files:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
ficgen stamp --dry-run # preview which files would be modified
|
|
169
|
+
ficgen stamp # stamp all published, undated stories/chapters with today's date
|
|
170
|
+
ficgen stamp starlight-drift --date 2026-10-12 # stamp a specific story slug, directory, or .md file
|
|
171
|
+
ficgen stamp stories/midnight-rain/index.md --date 2026-08-03
|
|
172
|
+
ficgen stamp --force --date 2026-10-12 # overwrite existing date entries
|
|
173
|
+
ficgen stamp --drafts # also stamp files marked published false
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### Stamp Behavior
|
|
177
|
+
|
|
178
|
+
- **Targets:** With no positional arguments, scans every story folder in `--stories`. Positional arguments accept story slugs (resolved inside `--stories`), directory paths, or individual `.md` files.
|
|
179
|
+
- **Single-doc vs. multi-chapter:** Stamps `index.md` for single-doc stories, and stamps chapter files (`chN.md`) for multi-chapter stories (leaving `story.kdl` untouched, since story `Published` and `Updated` dates derive automatically from chapter dates).
|
|
180
|
+
- **Idempotent & draft-safe:** Parses KDL with `kdl-py` (so `//` comments and `/-` slashdashed nodes are ignored), skips files that already have a non-empty `date` / `published-date` node (unless `--force` is set), fills `date null` / empty nodes in place, and skips `published false` files (unless `--drafts` is set).
|
|
181
|
+
- **Formatting preservation:** Only modifies the KDL metadata block (or inserts one after `# Title` / at the top if absent), preserving prose, KDL comments, and line endings.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 2. Story Structure & KDL Metadata
|
|
186
|
+
|
|
187
|
+
Each story lives in its own subdirectory under `stories/<slug>/`. The directory name becomes the story's URL slug (`/<slug>/`). Directories starting with `.` or `_` are ignored.
|
|
188
|
+
|
|
189
|
+
### Single-Document Stories (One-Shots)
|
|
190
|
+
|
|
191
|
+
A folder containing `index.md` with an inline KDL metadata block (` ```metadata ` or a leading ` ```kdl ` fence):
|
|
192
|
+
|
|
193
|
+
```text
|
|
194
|
+
stories/midnight-rain/
|
|
195
|
+
└── index.md
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
````markdown
|
|
199
|
+
# Midnight Rain
|
|
200
|
+
|
|
201
|
+
```metadata
|
|
202
|
+
fandoms "Original Work"
|
|
203
|
+
categories "F/F"
|
|
204
|
+
characters "Elena" "Sora"
|
|
205
|
+
relationships "Elena/Sora"
|
|
206
|
+
tags "rain" "slice of life" "yearning"
|
|
207
|
+
date "2026-08-02"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
<endnotes>
|
|
211
|
+
Inspiration track: https://example.com/playlist
|
|
212
|
+
|
|
213
|
+
Author's endnote here.
|
|
214
|
+
</endnotes>
|
|
215
|
+
|
|
216
|
+
Story prose begins here...
|
|
217
|
+
````
|
|
218
|
+
|
|
219
|
+
### Multi-Chapter Stories
|
|
220
|
+
|
|
221
|
+
A folder containing a whole-work KDL file (`story.kdl`) plus chapter Markdown files (`ch1.md`, `ch2.md`, ...):
|
|
222
|
+
|
|
223
|
+
```text
|
|
224
|
+
stories/starlight-drift/
|
|
225
|
+
├── story.kdl # Whole-work title, shared metadata, optional work-level summary/notes
|
|
226
|
+
├── ch1.md # Chapter 1 metadata, optional chapter notes, prose
|
|
227
|
+
└── ch2.md # Chapter 2 (can be marked published false while in progress)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**`story.kdl`:**
|
|
231
|
+
|
|
232
|
+
```kdl
|
|
233
|
+
title "Starlight Drift"
|
|
234
|
+
fandoms "Original Work"
|
|
235
|
+
categories "F/F"
|
|
236
|
+
characters "Nadia" "Kira"
|
|
237
|
+
relationships "Nadia/Kira"
|
|
238
|
+
tags "Sci-Fi" "Slow Burn" "Space Station"
|
|
239
|
+
// summary "Optional work-level summary in Markdown."
|
|
240
|
+
// notes "Optional work-level top notes."
|
|
241
|
+
// endnotes "Optional work-level endnotes."
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**`ch1.md`:**
|
|
245
|
+
|
|
246
|
+
````markdown
|
|
247
|
+
# Docking Bay Nine
|
|
248
|
+
|
|
249
|
+
```metadata
|
|
250
|
+
chapter 1
|
|
251
|
+
date "2026-03-11"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
<notes>
|
|
255
|
+
Welcome to chapter one!
|
|
256
|
+
</notes>
|
|
257
|
+
|
|
258
|
+
Chapter prose begins here...
|
|
259
|
+
````
|
|
260
|
+
|
|
261
|
+
Notes on multi-chapter stories:
|
|
262
|
+
- Whole-work metadata lives in `story.kdl` (also accepts `meta.kdl` or `index.kdl` if `story.kdl` isn't present).
|
|
263
|
+
- Chapter headings (`# ...`) are optional; if omitted (or identical to the story title), the chapter is titled `Chapter N`. Otherwise it displays as `Chapter N: <Chapter Title>`.
|
|
264
|
+
- Chapter order uses the `chapter` integer first, falling back to natural numeric filename order (`ch2.md` before `ch10.md`). Duplicate chapter numbers raise an error.
|
|
265
|
+
- Any `fandoms`, `categories`, `relationships`, `characters`, or `tags` placed on an included chapter are merged (deduplicated) into the story's metadata.
|
|
266
|
+
|
|
267
|
+
### KDL Metadata Reference
|
|
268
|
+
|
|
269
|
+
All metadata uses KDL syntax parsed with `kdl-py`. Node names are matched case-insensitively with spaces/underscores normalized to hyphens (so `planned-chapters`, `planned_chapters`, and `"Planned Chapters"` all match).
|
|
270
|
+
|
|
271
|
+
List fields accept multiple positional arguments, repeated nodes, or child blocks:
|
|
272
|
+
|
|
273
|
+
```kdl
|
|
274
|
+
// Positional arguments
|
|
275
|
+
tags "Slow Burn" "Space Station"
|
|
276
|
+
|
|
277
|
+
// Repeated nodes
|
|
278
|
+
tag "Slow Burn"
|
|
279
|
+
tag "Space Station"
|
|
280
|
+
|
|
281
|
+
// Child block
|
|
282
|
+
tags {
|
|
283
|
+
- "Slow Burn"
|
|
284
|
+
- "Space Station"
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
| Node | Aliases | KDL Value / Default | Description |
|
|
289
|
+
| --- | --- | --- | --- |
|
|
290
|
+
| `title` | *(or leading `# Heading`)* | string | Overrides `# Heading` (or humanized folder slug). Required in `story.kdl` if different from slug. |
|
|
291
|
+
| `author` | — | string (default: `site.kdl` `author`) | Per-story author override. |
|
|
292
|
+
| `fandoms` | `fandom` | list of strings | Fandom tags (indexed under `browse/fandoms/`). |
|
|
293
|
+
| `categories` | `relationship-categories`, `category` | list of strings | e.g. `"F/F"`, `"M/M"`, `"F/M"`, `"Gen"`, `"Multi"`, `"Other"` (`browse/categories/`). |
|
|
294
|
+
| `relationships` | `relationship`, `ships` | list of strings | Ship tags (`browse/relationships/`). |
|
|
295
|
+
| `characters` | `character` | list of strings | Character tags (`browse/characters/`). |
|
|
296
|
+
| `tags` | `tag`, `additional-tags` | list of strings | Freeform tags (`browse/tags/`). |
|
|
297
|
+
| `rating` | — | string | Optional rating label shown in the story metadata block. |
|
|
298
|
+
| `warnings` | `archive-warnings` | list of strings | Highlighted warning pills shown in cards and headers. |
|
|
299
|
+
| `summary` | *(or `<summary>...</summary>`)* | Markdown string | Story or chapter summary (shown on index cards, TOC, and story headers). |
|
|
300
|
+
| `notes` | `startnotes`, `beginnotes` *(or `<notes>`)* | Markdown string | Work-level or chapter-level top notes. |
|
|
301
|
+
| `endnotes` | *(or `<endnotes>`)* | Markdown string | Work-level or chapter-level end notes. |
|
|
302
|
+
| `date` | `published-date` | `"YYYY-MM-DD"`, `(date)"YYYY-MM-DD"`, or `(date-time)"..."` | Publication date. Multi-chapter stories default to the earliest explicit chapter `date`. Falls back to file `mtime` for Atom feeds only (HTML hides dates unless explicitly set). |
|
|
303
|
+
| `updated` | `updated-date` | ISO-8601 string or `(date)` / `(date-time)` | Last updated date. Defaults to `date` for one-shots, or latest chapter `date` for multi-chapter works. Shown in HTML only when different from `Published`. |
|
|
304
|
+
| `published` | — | boolean (`true` / `false`, default `true`) | Set `false` to mark a story or chapter as a draft. |
|
|
305
|
+
| `complete` | `status` | boolean (`true` / `false`) or `"Complete"` / `"In Progress"` | Defaults to `true` for one-shots and `false` for multi-chapter stories. |
|
|
306
|
+
| `planned-chapters` | `total-chapters` | integer ≥ 1 | Sets the denominator in chapter counts (e.g. `2/5` instead of `2/?`). |
|
|
307
|
+
| `chapter` | — | integer ≥ 1 | Explicit chapter number for chapter files (inferred from `chN.md` if omitted). |
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 3. Special Features
|
|
312
|
+
|
|
313
|
+
### Text-Message Chat Bubbles
|
|
314
|
+
|
|
315
|
+
Lines wrapped in `\<...|` (or unescaped `<...|`) and `|...>` render as styled SMS/chat bubbles:
|
|
316
|
+
|
|
317
|
+
```markdown
|
|
318
|
+
\<Hey, on my way back from the station now.|
|
|
319
|
+
|
|
320
|
+
|Sounds good! Dinner is almost ready.>
|
|
321
|
+
|
|
322
|
+
\<Be there in ten.|
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
- Consecutive chat lines—even when separated by blank lines—are grouped into a single `<div class="chat" role="region" aria-label="Text messages">` container.
|
|
326
|
+
- `\<...|` / `<...|` renders as `.chat-msg.chat-left` (left-aligned bubble); `|...>` renders as `.chat-msg.chat-right` (right-aligned accent bubble).
|
|
327
|
+
- Full inline Markdown (`_italics_`, `**bold**`, smart quotes, emoji, auto-linked URLs) works inside bubbles.
|
|
328
|
+
- Chat syntax inside fenced code blocks is ignored.
|
|
329
|
+
|
|
330
|
+
### Author's Notes & Summary Blocks
|
|
331
|
+
|
|
332
|
+
Place `<notes>`, `<endnotes>`, or `<summary>` tags anywhere in a story or chapter Markdown file (outside fenced code blocks), or specify `notes`, `endnotes`, or `summary` strings in `story.kdl`:
|
|
333
|
+
|
|
334
|
+
- **`<notes>...</notes>`** (aliases: `<startnotes>`, `<beginnotes>`): Rendered in a styled **Notes** box above the prose.
|
|
335
|
+
- **`<endnotes>...</endnotes>`**: Extracted and rendered in an **End Notes** box below the prose (`id="endnotes"`), with an automatic jump link (`See the end of the story/chapter for notes.`) placed in the header.
|
|
336
|
+
- **`<summary>...</summary>`**: Multi-paragraph Markdown summary (combined with any `summary` KDL node).
|
|
337
|
+
|
|
338
|
+
All three support full Markdown formatting and auto-linked URLs.
|
|
339
|
+
|
|
340
|
+
### Smart Typography & Auto-Linking
|
|
341
|
+
|
|
342
|
+
- **Curly quotes & apostrophes:** Straight `"..."` and `'...'` convert to typographic `“...”`, `‘...’`, and `’`, including opening quotes immediately preceding ellipses (`"...Wait` → `“…Wait`).
|
|
343
|
+
- **Dashes & ellipses:** Prose `--` and `---` convert to em-dashes (`—`), numeric ranges like `1990--1995` convert to en-dashes (`–`), and `...` converts to `…`.
|
|
344
|
+
- **Auto-linked URLs:** Bare `http://` and `https://` URLs are automatically turned into hyperlinks in prose and notes.
|
|
345
|
+
- **Scene breaks:** Standard Markdown horizontal rules (`---`, `* * *`, etc.) render as centered `✦ ✦ ✦` ornaments.
|
|
346
|
+
|
|
347
|
+
### Word Counts, Taxonomies, Atom Feed & Theming
|
|
348
|
+
|
|
349
|
+
- **Word counts:** Calculated from rendered story/chapter prose only (excluding metadata and author's notes), ignoring standalone punctuation tokens.
|
|
350
|
+
- **Static taxonomy browsing:** Every fandom, category, relationship, character, and tag gets a collision-safe static page under `browse/<kind>/<slug>.html` linked from every story card and metadata header.
|
|
351
|
+
- **Atom 1.0 feed:** `feed.xml` publishes one entry per one-shot story and one entry per published chapter of multi-chapter works, ordered newest-first, and is linked via `<link rel="alternate" type="application/atom+xml">` on every page.
|
|
352
|
+
- **Light & dark mode:** Styled with modern CSS `color-scheme: light dark` and `light-dark()`, following OS preference by default with a progressive-enhancement Light/Dark toggle persisted in `localStorage`.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Development
|
|
357
|
+
|
|
358
|
+
```sh
|
|
359
|
+
pip install -r requirements-dev.txt
|
|
360
|
+
./lint # runs ruff, black, mypy, pylint (10/10), check-manifest, and pytest
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for coding conventions.
|
|
364
|
+
|
|
365
|
+
## Credits & License
|
|
366
|
+
|
|
367
|
+
Created by Tab Atkins-Bittner (originally for [xanthir.com/fic](https://xanthir.com/fic/)).
|
|
368
|
+
MIT License — see [LICENSE](LICENSE).
|