Add JSON output format for programmatic access

Implements structured JSON output with hierarchical schema including
book metadata, chapters, verses, and footnotes. All existing flags
(-F, -g, -L) are respected in JSON mode.
This commit is contained in:
2025-12-16 18:49:27 +01:00
parent 6432d37df3
commit 7ef782dda2
3 changed files with 228 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ Code largely based off of [https://github.com/bontibon/kjv.git](https://github.c
-F no footnotes
-g show only German (no Latin)
-L show only Latin (no German)
-j output as JSON
-h show help
Reference types:
@@ -55,6 +56,56 @@ The text includes footnotes marked with Unicode superscript numbers (e.g., ¹,
- Use `-F` flag to disable footnote display if desired
### JSON Output
allioli supports structured JSON output for programmatic access to bible verses and footnotes. The JSON schema provides a hierarchical structure with book information, chapters, verses, and associated footnotes.
- Use `-j` flag to output in JSON format
- All other flags (`-F`, `-g`, `-L`) are respected in JSON mode
- The JSON structure follows this schema:
```json
{
"book": {
"name": "Johannes",
"abbreviation": "Joh",
"number": 51
},
"chapter": 1,
"verses": [
{
"verse": 1,
"text": {
"latin": "...",
"german": "..."
},
"footnotes": [
{
"number": 1,
"text": "..."
}
]
}
]
}
```
**Examples:**
```bash
# Get John 1:1 as JSON
./allioli -j "Johannes 1:1"
# Get verses without footnotes
./allioli -j -F "Johannes 1:1-3"
# Get only Latin text (with footnotes)
./allioli -j -L "Johannes 1:1"
# Get only German text (with footnotes)
./allioli -j -g "Johannes 1:1-5"
```
## Install
### From Source