Advanced HTML article template engine generating professional intelligence reports with semantic markup compliance and accessibility standards. This module implements template-based content generation for automated news articles, maintaining consistent visual hierarchy and information architecture across all 14 supported languages.
The template engine provides intelligent document structure rendering:
Semantic HTML5 Structure:
- Article headers with publication metadata and source attribution
- Navigation breadcrumbs with language-localized labels
- Event calendar grid visualization (for Week Ahead article type)
- Content sections with intelligent hierarchy (h2-h4)
- Context boxes for supplementary intelligence (facts, quotes, analysis)
- Related links section pointing to source documents
- Watch section extracting critical points and risk indicators
- Footer with publication metadata and change history
Design System Integration:
- Cyberpunk visual theme with custom CSS variables
- Responsive grid layout (CSS Grid, 320px-1440px+ viewport support)
- Dark theme optimization for reduced eye strain during extended reading
- Accessibility features: ARIA landmarks, semantic heading hierarchy, color contrast
- Print-friendly styling preserving readability in physical distribution
Multi-Language Rendering (14 languages):
- Dynamic breadcrumb translation for navigation
- Localized date formatting and timezone handling
- RTL language support (Arabic, Hebrew) with automatic text direction
- Language-specific typography and character spacing adjustments
- Multi-language footer labels and publication information
Article Type Templates:
- Week Ahead: Event grid with day-by-day parliamentary schedule
- Committee Reports: Structured committee analysis with member lists
- Propositions: Government proposal analysis with impact assessment
- Motions: Parliamentary motion analysis with voting predictions
- Breaking: Rapid-response template with minimal processing delay
SEO Optimization:
- Structured data (Schema.org JSON-LD) for search engine discovery
- Meta tag generation (OpenGraph, Twitter Card) for social sharing
- Canonical URL prevention of duplicate content penalties
- Keyword placement in headers, metadata, and internal linking
- Version:
- 2.0.0
- License:
- Apache-2.0
- Source:
- See:
-
- ./html-utils.js HTML sanitization utilities (escapeHtml)
- ./data-transformers.js Data transformation producing template input
- ./generate-news-enhanced.js Article generation orchestration
- ./editorial-pillars.js Editorial structure definitions
- docs/TEMPLATE_ARCHITECTURE.md Template design documentation
- docs/ACCESSIBILITY_STANDARDS.md WCAG 2.1 AA compliance guide
- docs/SEO_OPTIMIZATION.md Search engine optimization strategy
Members
(inner, constant) BREADCRUMB_TRANSLATIONS
Breadcrumb translations for all supported languages
- Source:
(inner, constant) EVENT_CALENDAR_TITLES
Generate event calendar section
- Source:
(inner, constant) FOOTER_LABELS
Footer label translations for all 14 languages
- Source:
(inner, constant) LOCALE_MAP
Locale map for all 14 supported languages
- Source:
(inner, constant) OG_LOCALE_MAP
OG locale map for all 14 languages
- Source:
(inner, constant) SITE_TAGLINE
Site tagline translations for all 14 languages
- Source:
(inner, constant) WATCH_SECTION_TITLES
Generate "Watch Section" with key points
- Source:
Methods
(inner) formatDate()
Helper: Format date for display using locale-appropriate formatting
- Source:
(inner) formatDateRange()
Helper: Format date range for calendar title
- Source:
(inner) getBreadcrumbName(lang, type) → {string}
Get breadcrumb name for a given language
Parameters:
| Name | Type | Description |
|---|---|---|
lang |
string | Language code |
type |
string | Breadcrumb type ('home' or 'news') |
- Source:
Returns:
Translated breadcrumb name
- Type
- string
(inner) sanitizeArticleBody(htmlContent) → {string}
Sanitize article body content for JSON-LD structured data Removes newlines and normalizes whitespace to prevent invalid JSON
Parameters:
| Name | Type | Description |
|---|---|---|
htmlContent |
string | Article HTML content |
- Source:
Returns:
Sanitized content suitable for JSON-LD
- Type
- string