Divan-owned content: works edited in Divan, plus the content management model #53

Merged
anas merged 1 commits from feature/divan-owned-content into main 2026-10-08 22:34:40 +00:00
Owner

Part of #30 (with anas/divan-data's PR of the same name). Step 5b: Divan's copy takes precedence over Wikisource.

Code

  • api/src/owned.ts:
    • fromPoem turns any work into Divan text (the starting point of an edit);
    • writeOwned writes the .dtx source and the generated .json (title, verses, who edited and when) into divan-data/divan/<work url>;
    • a CLI writes one by hand (node src/owned.ts <divan-data> <work url> <file.dtx> [editor]).
  • Divan text now has chapter headings and sub-headings with levels (== باب ==, === فصل ===) as their own entries.

Checks

  • All 11,087 works convert to Divan text and back unchanged. The only clean-ups are repeated spaces, and raw == … == markers in prose becoming real headings.
  • End to end (with the divan-data PR):
    1. a Divan edit to Ghalib's یہ نہ تھی ہماری قسمت (one misra changed) was written;
    2. the full Wikisource export ran;
    3. the edit survived, marked DivanOwned with editor and time, with radif, matla and maqta recomputed;
    4. removing it restored Wikisource's text. The test edit was not committed.
  • npm test: 33 pass.

Design (docs/content-model.md, new section Content management model, owner direction):

  • Identified entities: poet, intro, book, chapter and sub-chapter, work, and inside a work heading, sub-heading, couplet, misra, stanza, paragraph, footnote, variant and word; also dictionary entries and tags.
  • Versions (#51): per-entity revisions with who, when, summary and status; history, diffs, revert; a moderation log.
  • Tags (#52): typed tags on any entity, tag pages, tag filter and search.
  • Storage: PostgreSQL for working state; divan-data for the published versions.

Next: the revisions table and the L2 → L1 → admin pipeline (#31, #51).

🤖 Generated with Claude Code

Part of #30 (with anas/divan-data's PR of the same name). Step 5b: Divan's copy takes precedence over Wikisource. **Code** - `api/src/owned.ts`: - `fromPoem` turns any work into Divan text (the starting point of an edit); - `writeOwned` writes the `.dtx` source and the generated `.json` (title, verses, who edited and when) into `divan-data/divan/<work url>`; - a CLI writes one by hand (`node src/owned.ts <divan-data> <work url> <file.dtx> [editor]`). - Divan text now has **chapter headings and sub-headings** with levels (`== باب ==`, `=== فصل ===`) as their own entries. **Checks** - **All 11,087 works** convert to Divan text and back unchanged. The only clean-ups are repeated spaces, and raw `== … ==` markers in prose becoming real headings. - End to end (with the divan-data PR): 1. a Divan edit to Ghalib's یہ نہ تھی ہماری قسمت (one misra changed) was written; 2. the full Wikisource export ran; 3. the edit survived, marked `DivanOwned` with editor and time, with radif, matla and maqta recomputed; 4. removing it restored Wikisource's text. The test edit was not committed. - `npm test`: 33 pass. **Design** (`docs/content-model.md`, new section **Content management model**, owner direction): - **Identified entities**: poet, intro, book, chapter and sub-chapter, work, and inside a work heading, sub-heading, couplet, misra, stanza, paragraph, footnote, variant and word; also dictionary entries and tags. - **Versions** (#51): per-entity revisions with who, when, summary and status; history, diffs, revert; a moderation log. - **Tags** (#52): typed tags on any entity, tag pages, tag filter and search. - **Storage**: PostgreSQL for working state; divan-data for the published versions. Next: the revisions table and the L2 → L1 → admin pipeline (#31, #51). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
anas added 1 commit 2026-10-08 22:22:50 +00:00
- api/src/owned.ts: fromPoem (a work as Divan text, the start of an edit) and writeOwned (the .dtx
  source and the generated .json into divan-data/divan/); a CLI for writing one by hand.
- Divan text: chapter headings and sub-headings with levels, as their own verse entries.
- All 11,087 works convert to Divan text and back unchanged (apart from repeated spaces, and raw
  '== … ==' markers in prose becoming headings).
- docs/content-model.md: the content management model (what is identified, versions and who did
  what (#51), tags and tag search (#52), storage).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anas merged commit 835df62aad into main 2026-10-08 22:34:40 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: anas/divan#53
No description provided.