# All files / src/lib/quality-validator/reporters/html HtmlHeader.ts

0% Statements 0/90
0% Branches 0/1
0% Functions 0/1
0% Lines 0/90

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91

     /**
     * HTML Report Header Module
     * Generates the HTML document structure, meta tags, and header section
     */

    import { getStyles } from './HtmlStyleSheet.js';

    /**
     * Generate the complete HTML head section
     *
     * @param {string} projectName - Name of the project
     * @param {string} timestamp - ISO timestamp of report generation
     * @returns {string} HTML head element with meta tags and styles
     *
     * @description
     * Creates a standards-compliant HTML head with:
     * - Character encoding and viewport meta tags
     * - SEO meta tags
     * - Embedded CSS stylesheet
     * - Document title
     */
    export function generateHead(projectName: string, timestamp: string): string {
      const formattedDate = timestamp.substring(0, 10);
      const css = getStyles();

      return `<head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="Quality validation report for ${projectName}">
      <meta name="generator" content="Quality Validator v1.0.0">
      <meta name="created" content="${timestamp}">
      <title>Quality Validation Report - ${formattedDate}</title>
      <style>${css}</style>
    </head>`;
    }

    /**
     * Generate the HTML header body section
     *
     * @param {string} projectName - Name of the project
     * @param {string} timestamp - ISO timestamp string
     * @returns {string} HTML header element with project info
     *
     * @description
     * Creates the visual header with gradient background containing:
     * - Main title
     * - Project name
     * - Generation timestamp
     */
    export function generateHeaderBody(projectName: string, timestamp: string): string {
      return `<header class="header">
      <div class="header-content">
        <h1>Quality Validation Report</h1>
        <p class="project-name">Project: ${projectName}</p>
        <p class="timestamp">Generated: ${timestamp}</p>
      </div>
    </header>`;
    }

    /**
     * Generate the HTML document opening tags and structure
     *
     * @param {string} projectName - Project name for title
     * @param {string} timestamp - Timestamp for generation time
     * @returns {string} Opening HTML and head section
     *
     * @description
     * Creates the complete document header with DOCTYPE and opening body tag
     */
    export function generateOpeningTags(projectName: string, timestamp: string): string {
      return `<!DOCTYPE html>
    <html lang="en">
    ${generateHead(projectName, timestamp)}
    <body>
      <div class="container">
    ${generateHeaderBody(projectName, timestamp)}
        <main class="main">`;
    }

    /**
     * Generate the footer tag and closing HTML
     *
     * @returns {string} Closing HTML tags
     */
    export function generateClosingTags(): string {
      return `    </main>
      </div>
    </body>
    </html>`;
    }