-
Notifications
You must be signed in to change notification settings - Fork 63
MVP html5 incl. Base-Class #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: html5
Are you sure you want to change the base?
Conversation
|
I'll take a closer look tomorrow. |
|
Hi. Yes I'll move the files. Yes. GitHub copilot. Together with visual studio code it's pretty awesome. Give it a try. Otherwise I weren't that fast. You need to check the code; sure but the quality is imho 80-90% of a real |
|
Moved to #625. |
Phase 3: Headers & Footers Configuration - Parse pdf.formats config and generate dynamic @page CSS rules - Support metadata substitution (%{title}, %{page}, %{artist}, etc.) - Handle three-part format arrays (left, center, right) - Generate proper CSS counter() and string() functions for page numbers and titles Bug Fixes: - Fix chord spacing: Added cp-chord-only class with margin-right for chords without lyrics - Fix lyrics-only lines: Skip chord span generation when line has no chords - Fix verse/chorus containers: Moved structurize() call to ChordPro.pm for consistent handling Architectural Improvements: - Centralize structurize() in ChordPro.pm before backend generation - All backends now receive structured data by default (verse/chorus containers) - Backends can opt out with --backend-option structure=unstructured - Remove duplicate structurize() calls from individual backends Tests: All existing tests pass (Markdown, HTML, HTML5Paged)
Updated metadata handling and layout directives in HTML5 backends SVG chord diagram generation integrated into HTML5 and HTML5Paged outputs Added vscode-devcontainer for faster startup in dev-env; Updated .gitignore to include new config files
Complete Phase 3 of template migration following LaTeX.pm pattern. All HTML generation now template-driven with zero hardcoded markup in backend code. Changes: - Add render_gridline() method to HTML5.pm for chord grid notation * Handles margin, tokens (bars/chords/symbols), and comment rendering * Supports multiple chord object types with cascading type checks - Fix template array checks in song.tt to avoid numeric warnings * Changed from `.size > 0` to `.0` or truthiness checks * Applies to subtitle, artist, composer, album, arranger, lyricist, etc. - Reorganize templates: separate CSS from structural HTML * Move CSS templates to html5/css/ and html5paged/css/ subdirectories * Update template includes: 'html5/css/base.tt', 'html5/css/typography.tt' * Update config references to new paths * Improves discoverability for users customizing templates - Fix HTML5Paged template key: 'css' instead of 'base' - Remove obsolete generate_chord_diagram_svg() method (replaced by templates) - Update .github/copilot-instructions.md with lessons learned: * Template array check patterns (pitfall ChordPro#19) * Chord object type handling (pitfall ChordPro#20) * Grid element structure reference (pitfall ChordPro#21) * Template organization in css/ subdirectories (pitfall ChordPro#22) Template structure: lib/ChordPro/res/templates/ html5/ songbook.tt, song.tt, songline.tt, comment.tt, image.tt, chord-diagrams.tt css/base.tt, typography.tt, songlines.tt, sections.tt, tab-grid.tt, etc. html5paged/ songbook.tt, song.tt (overrides) css/base.tt, string-set.tt, page-setup.tt, typography.tt, layout.tt, etc. Benefits: - Zero hardcoded HTML/CSS in backend code - User-customizable templates via config - Modular, maintainable template organization - Consistent pattern across backends Tests: All 108 tests passing (2998 assertions) Refs: ai-docs/HTML5_TEMPLATE_MIGRATION_COMPLETE.md, ai-docs/complete_templates.md
- Add Common Pitfall ChordPro#24: Backend Module Override Pattern - Document {format}.module config pattern and timing - Add Step 5 to Recent Additions section (Feb 2026) - Capture key lesson: check for existing patterns first - Document backend selection precedence: CLI > config > extension Related: Step 5 implementation (commit 16f495e)
…its integrated - **Step 1**: ✅ Fixed template path resolution (Bug 1) - CP->findresdirs() implemented - **Step 2**: ✅ Config::Data.pm regenerated with html5 section - **Step 3**: ✅ Fixed songline first-word positioning bug (Bug 2) - display:none fix - **Step 4**:⚠️ Object::Pad :common (Bug 3) - DEFERRED due to segfaults - **Step 5**: ✅ Config-driven backend selection (html.module option) - COMPLETED
- Comprehensive analysis of HTML5 vs HTML5Paged architecture - Assessed implementation readiness: GREEN (ready to proceed) - Detailed 7-phase implementation plan (~6 hours estimated) - Recommends Option C: Responsive by default with mode flag - Includes rollback strategy and success criteria - Documents all file changes and testing approach Key findings: - HTML5Paged has 13 unique methods (522 lines total) - Well-architected code with clean separation - Template system makes mode-based rendering straightforward - No red flags - ready for implementation Next: Execute Step 6 following this plan Related: ai-docs/changes-bugs.md (Step 6-7 detailed requirements)
Template Consolidation: - Move HTML5 paged templates from html5paged/ to html5/paged/ structure - Delete HTML5Paged.pm backend (functionality merged into HTML5.pm) - Remove duplicate typography.tt and variables.tt from paged templates - Rename HTML5Paged/FormatGenerator.pm to HTML5Helper/FormatGenerator.pm - Update all template paths in chordpro.json and Config.pod Test Suite Improvements: - Fix t/76_html5paged.t to use config file instead of inline JSON - Add t/77_html5_bug1_template_paths.t (8 tests) - verify template path resolution - Add t/78_html5_bug2_chord_empty.t (7 tests) - verify chord-empty CSS fix - Add t/79_html5_bugfixes_integration.t (11 tests) - integration test for both fixes - Update all html5paged/ unit test references to use new paths Documentation: - Update copilot-instructions.md with template consolidation details - Remove obsolete ai-docs (HTML5_CONSOLIDATION.md, STEP5_IMPLEMENTATION_SUMMARY.md, changes-bugs.md) Bug Coverage: - Bug 1: Template path resolution (templates now found via INCLUDE_PATH) - Bug 2: Chord-empty styling (display:none instead of visibility:hidden) All 26 new tests passing. Total: -2856 lines, +385 lines. Net reduction of 2471 lines through consolidation and cleanup.
Distilled from .github/copilot-instructions.md and codebase exploration into a concise reference covering build/test commands, code layout, architecture patterns, conventions, and common pitfalls. https://claude.ai/code/session_012mFT6c3H5P8J1StQ9VPZg4
Co-authored-by: JoeRu <5239765+JoeRu@users.noreply.github.com>
Co-authored-by: JoeRu <5239765+JoeRu@users.noreply.github.com>
Comprehensive comparison of HTML5 vs PDF backend features identifying 25 feature gaps with detailed implementation plans for 17 features, organized in 4 phases. Key findings: paged mode infrastructure exists but is never activated, FormatGenerator is complete but unused, and several features (rechorus, delegates, comment_box) are trivially fixable. https://claude.ai/code/session_018gz2XKc1934uqugFQq6272
…analyze-html5-print-feature
Replace 5 separate documentation files with: - HTML5_PRINT_Missing_Features.xml: Comprehensive plan with 18 features organized into 3 parallel execution branches, each with implementation details, risks, and verification steps - Management-Summary-Missing_feature.md: Executive summary with branch architecture and critical path Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add CLAUDE.md with project development guide Distilled from .github/copilot-instructions.md and codebase exploration into a concise reference covering build/test commands, code layout, architecture patterns, conventions, and common pitfalls. https://claude.ai/code/session_012mFT6c3H5P8J1StQ9VPZg4 * Initial plan * Remove ai-docs from .gitignore and add documentation files Co-authored-by: JoeRu <5239765+JoeRu@users.noreply.github.com> * Update analysis: Add ABC/Lilypond gap, verify grids/images work Co-authored-by: JoeRu <5239765+JoeRu@users.noreply.github.com> * Add HTML5 print feature gap analysis and implementation plan Comprehensive comparison of HTML5 vs PDF backend features identifying 25 feature gaps with detailed implementation plans for 17 features, organized in 4 phases. Key findings: paged mode infrastructure exists but is never activated, FormatGenerator is complete but unused, and several features (rechorus, delegates, comment_box) are trivially fixable. https://claude.ai/code/session_018gz2XKc1934uqugFQq6272 * Consolidate HTML5 print feature docs into single implementation plan Replace 5 separate documentation files with: - HTML5_PRINT_Missing_Features.xml: Comprehensive plan with 18 features organized into 3 parallel execution branches, each with implementation details, risks, and verification steps - Management-Summary-Missing_feature.md: Executive summary with branch architecture and critical path Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JoeRu <5239765+JoeRu@users.noreply.github.com> Co-authored-by: Johannes Rumpf <johannes.rumpf@gmail.com>
HTML5 Backend - Phase 1-4 Complete
Overview
Modern HTML5 output backends for ChordPro with clean separation of content and presentation. Includes HTML5 (continuous output) and HTML5Paged (print-optimized with paged.js) backends. All features through Phase 4 (PDF config compatibility) are complete.
Files Created
1. lib/ChordPro/Output/HTML5.pm (646 lines)
The main HTML5 backend module that integrates with ChordPro's output system.
Key Features:
Features:
3. Base Classes
lib/ChordPro/Output/ChordProBase.pm- Base class for non-PDF backends (handler registry, markup processing)4. Templates (32 files)
5. Tests (114 production tests)
6. Documentation (6 comprehensive guides)
Core Innovation: Flexbox Chord Positioning
The breakthrough solution for positioning chords above lyrics with different fonts:
Why This Works:
CSS Variables for Customization
Users can easily customize appearance:
Supported Features
✅ Phase 1: MVP (Complete)
✅ Phase 2: Chord Diagrams (Complete)
✅ Phase 3: HTML5Paged Backend (Complete)
✅ Phase 4: PDF Config Compatibility (Complete)
✅ Additional Features (Complete)
⏸️ Deliberately Not Implemented (PDF-specific)
🔮 Future Enhancements (Not Required for Completeness)
Usage
HTML5 Backend (Continuous)
HTML5Paged Backend (Print/PDF)
Configuration Examples
Theme Colors (config.json):
{ "pdf": { "theme": { "foreground": "#000000", "foreground-medium": "#555555", "foreground-light": "#999999", "background": "#FFFFFF" } } }Spacing Multipliers:
{ "html5": { "paged": { "spacing": { "lyrics": 1.2, "chords": 1.5, "title": 2.0 } } } }Chorus Bar Styling:
{ "pdf": { "chorus": { "bar": { "offset": 8, "width": 1, "color": "#0000FF" } } } }Architecture
Pipeline
Song.pm)Design Patterns
Object::Pad Architecture (Modern)
ChordProBasebase class%element_handlersmaps element types to methodsrender_songline(),render_chorus(), etc.Element Processing
Config Resolution (Phase 4 Hybrid)
html5.paged.* > pdf.* > defaultshtml5.* > pdf.* > defaultsBackend Comparison
html5.*withpdf.*fallbackhtml5.paged.*withpdf.*fallbackTemplate System
Structure:
Benefits:
html5.templates.songbook = "custom/mysongbook.tt"Integration:
Success Criteria ✅
Phase 1 (MVP) - Complete:
Phase 2 (Chord Diagrams) - Complete:
Phase 3 (HTML5Paged) - Complete:
Phase 4 (PDF Config Compatibility) - Complete:
Production Ready:
Code Quality
Maintainability
Testability
Performance
Extensibility
Browser Compatibility
Tested Features:
Target Browsers:
Not Supported:
Migration from PDF Backend
HTML5/HTML5Paged support most PDF configuration options via hybrid precedence:
Supported (Phase 4):
pdf.theme.*→ CSS color variablespdf.spacing.*→ CSS spacing multiplierspdf.chorus.bar.*→ Chorus bar stylingpdf.diagrams.symbols.color→ Grid symbol colorspdf.chordgrid.volta.color→ Volta colorspdf.headspace/pdf.footspace→ Page margin sizingpdf.formats.*→ Header/footer format stringsNot Applicable:
pdf.fonts.*→ Use CSS @font-face insteadpdf.assets.*→ File embedding not needed in HTMLpdf.delegates.abc.*→ ABC rendering via separate delegatepdf.delegates.lilypond.*→ LilyPond rendering via separate delegateMigration Example:
{ "pdf": { "theme": { "foreground": "#333" }, "spacing": { "lyrics": 1.2 }, "chorus": { "bar": { "color": "#0000FF" } } } }This config works with both PDF and HTML5Paged backends without modification.
Fallback:
Users with ancient browsers can use PDF backend.
Known Limitations
Technical Constraints
Deferred Features (Future Phases)
Non-Applicable PDF Features
These PDF backend features are intentionally not implemented because they don't apply to HTML or have better HTML alternatives:
Font Management (
pdf.fonts.*):pdf.fonts.text.file,pdf.fonts.text.name, font embedding@font-facedeclarations insteadAsset Embedding (
pdf.assets.*):pdf.assets.pathfor bundling images/resourcesDelegate Configuration (
pdf.delegates.*):pdf.delegates.abc.type,pdf.delegates.lilypond.typeFont Size Specifications:
pdf.fonts.*.size(exact point sizes)font-sizein em/rem for better scalabilityAdvanced Layout:
pdf.columns.balanced, complex flow algorithmsPrint Support
The CSS includes
@media printrules:Relationship to Other Backends
Architecture Evolution:
Next Steps (Post Phase 4)
Potential Phase 5: Enhanced Interactivity
Potential Phase 6: Advanced Layout
Potential Phase 7: Progressive Web App
Integration Tasks
--generatehelp text (works via backend registration)Community Feedback
Deliverable Status
✅ Phase 1 MVP - Complete
✅ Phase 2 Chord Diagrams - Complete
✅ Phase 3 HTML5Paged - Complete
✅ Phase 4 PDF Config - Complete
All original goals achieved plus extensive enhancements. Ready for production use.
Files Summary
Core Modules (2 backends + 2 supporting)
Templates (32 files)
Tests (114 production tests)
Total: ~1,900 lines of backend code + ~3,500 lines of templates + 114 tests + 6 comprehensive docs
Conclusion
The HTML5 and HTML5Paged backends are production-ready after completing Phase 1-4:
What Works:
Use Cases:
Migration Path from PDF:
Users can switch from PDF to HTML5Paged with minimal config changes. Most
pdf.*settings work via hybrid precedence. Fonts need CSS conversion (@font-facedeclarations), but structure/styling transfer directly.Code Quality:
Modern Object::Pad architecture with complete template separation makes maintenance straightforward. Adding new features requires:
The backends follow ChordPro's architectural direction: move away from monolithic code toward modular, template-driven systems.
Status: Phase 1-4 Complete | 114 Tests Passing | Production Ready
Last Updated: December 2025