Files
biblical-guide.com/scripts/old/clean-json-text.js
Andrei 95070e5369 Add comprehensive page management system to admin dashboard
Features added:
- Database schema for pages and media files with content types (Rich Text, HTML, Markdown)
- Admin API routes for full page CRUD operations
- Image upload functionality with file management
- Rich text editor using TinyMCE with image insertion
- Admin interface for creating/editing pages with SEO options
- Dynamic navigation and footer integration
- Public page display routes with proper SEO metadata
- Support for featured images and content excerpts

Admin features:
- Create/edit/delete pages with rich content editor
- Upload and manage images through media library
- Configure pages to appear in navigation or footer
- Set page status (Draft, Published, Archived)
- SEO title and description management
- Real-time preview of content changes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 07:26:25 +00: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');