<?php

namespace Miruni\Merge_Syntax;

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

use Miruni\Merge_Syntax\Miruni_Merge_Processor;
use Miruni\Merge_Syntax\Handlers\Miruni_Attachment_Url_Preview_Handler;


/**
 * Summary of Miruni\Merge_Syntax\process_merge_syntax
 * @param string $content
 * @param array<mixed> $context
 * @return string
 */
function miruni_process_merge_syntax_for_preview(string $content, array $context = []): string
{
    $parser = new Miruni_Merge_Processor();
    $parser->register_handler(new Miruni_Attachment_Url_Preview_Handler());

    return $parser->process($content, $context);
}

/**
 * Summary of Miruni\Merge_Syntax\miruni_process_merge_syntax_for_publish
 * @param string $content
 * @param array<mixed> $context
 * @return string
 */
function miruni_process_merge_syntax_for_publish(string $content, array $context = []): string
{
    $parser = new Miruni_Merge_Processor();

    // Register publish-time handlers here as needed
    if (class_exists(Handlers\Miruni_Attachment_Url_Publish_Handler::class)) {
        $parser->register_handler(new Handlers\Miruni_Attachment_Url_Publish_Handler());
    }

    return $parser->process($content, $context);
}