seogeneratorserver/debug_instructions.js
StillHammer dbf1a3de8c Add technical plan for multi-format export system
Added plan.md with complete architecture for format-agnostic content generation:
- Support for Markdown, HTML, Plain Text, JSON formats
- New FormatExporter module with neutral data structure
- Integration strategy with existing ContentAssembly and ArticleStorage
- Bonus features: SEO metadata generation, readability scoring, WordPress Gutenberg format
- Implementation roadmap with 4 phases (6h total estimated)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 16:14:29 +08:00

32 lines
1.4 KiB
JavaScript

// Test debug pour voir l'extraction des instructions
const templateTest = `|Titre_Principal{{T0}}{Rédige un titre H1 accrocheur de maximum 10 mots pour {{MC0}}. Style {{personality.style}}}|`;
console.log('🔍 TEST EXTRACTION INSTRUCTIONS');
console.log('Template test:', templateTest);
// Reproduction de la logique ElementExtraction.js
const regex = /\|([^|]+)\|/g;
let match;
while ((match = regex.exec(templateTest)) !== null) {
const fullMatch = match[1]; // Tout entre les |pipes|
console.log('FullMatch:', fullMatch);
// Extraction des composants (ligne 23-25 ElementExtraction.js)
const nameMatch = fullMatch.match(/^([^{]+)/);
const variablesMatch = fullMatch.match(/\{\{([^}]+)\}\}/g);
const instructionsMatch = fullMatch.match(/\{([^}]+)\}/);
console.log('nameMatch:', nameMatch ? nameMatch[1] : null);
console.log('variablesMatch:', variablesMatch);
console.log('instructionsMatch:', instructionsMatch ? instructionsMatch[1] : null);
console.log('\n--- PROBLÈME IDENTIFIÉ ---');
console.log('La regex instructionsMatch cherche {single} mais on a {{double}} ET {single}');
console.log('Il faut une regex qui évite les {{double}} braces');
// Test regex corrigée
const instructionsMatchFixed = fullMatch.match(/\{(?!\{)([^}]+)(?<!\})\}/);
console.log('instructionsMatchFixed:', instructionsMatchFixed ? instructionsMatchFixed[1] : null);
}