Files
biblical-guide.com/scripts/clean-json-text.js
andupetcu 686f498300 Create comprehensive bookmarks management page
Add complete bookmarks page with navigation functionality:

Features:
- Dedicated /bookmarks page for viewing all saved bookmarks
- Support for both chapter and verse bookmarks in unified view
- Statistics dashboard showing total, chapter, and verse bookmark counts
- Tabbed filtering (All, Chapters, Verses) for easy organization
- Direct navigation to Bible reading page with URL parameters
- Delete functionality for individual bookmarks
- Empty state with call-to-action to start reading

Navigation Integration:
- Add Bookmarks to main navigation menu (authenticated users only)
- Add Bookmarks to user profile dropdown menu
- Dynamic navigation based on authentication state

Bible Page Enhancements:
- URL parameter support for bookmark navigation (book, chapter, verse)
- Verse highlighting when navigating from bookmarks
- Auto-clear highlight after 3 seconds for better UX

API Endpoints:
- /api/bookmarks/all - Unified endpoint for all user bookmarks
- Returns transformed data optimized for frontend consumption

Multilingual Support:
- Full Romanian and English translations
- Consistent messaging across all bookmark interfaces

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 01:29:46 +03:00

48 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const ABBR = (process.env.EN_ABBR || 'WEB').toUpperCase();
const ROOT = process.env.OUTPUT_DIR || path.join('data','en_bible', ABBR);
function cleanText(s){
return s
// remove \+w/\w wrappers and closing tags
.replace(/\\\+?w\s+/gi,'')
.replace(/\|strong="[^"]*"/gi,'')
.replace(/\\\+?w\*/gi,'')
// remove footnotes / cross-refs blocks
.replace(/\\f\s+.*?\\f\*/gis,' ')
.replace(/\\x\s+.*?\\x\*/gis,' ')
// remove +wh blocks and similar wrappers
.replace(/\\\+wh\s+.*?\\\+wh\*/gis,' ')
// remove inline verse-note blocks like "+ 1:1 ... *"
.replace(/\+\s*\d+:\d+.*?\*/g,' ')
// remove stray asterisks left after stripping tags
.replace(/\*/g,'')
// remove any other inline tags like \\qs, \\add, etc.
.replace(/\\[a-z0-9-]+\s*/gi,' ')
.replace(/\s+/g,' ').trim();
}
function processFile(file){
const p = path.join(ROOT, file);
if(!fs.existsSync(p)){
console.error('Missing', p);
process.exit(1);
}
const j = JSON.parse(fs.readFileSync(p,'utf-8'));
for(const b of j.books||[]){
for(const c of b.chapters||[]){
for(const v of c.verses||[]){
if(v.text) v.text = cleanText(String(v.text));
}
}
}
fs.writeFileSync(p, JSON.stringify(j,null,2),'utf-8');
console.log('Cleaned', p);
}
processFile('old_testament.json');
processFile('new_testament.json');