wdpr
    Preparing search index...

    Module parser/rules/block/module/listpages/compiler

    Template compiler for the ListPages module.

    Compiles ListPages template strings (e.g., "%%title%% by %%created_by%%") into executable functions that can be called repeatedly with different page data for fast rendering. The compilation step splits the template into static string segments and dynamic getter functions, avoiding repeated regex matching during rendering.

    Supported variable syntax:

    • %%name%% - Simple variable (e.g., %%title%%, %%rating%%)
    • %%name{param}%% - Parameterized variable (e.g., %%content{2}%%, %%form_data{color}%%)
    • %%name(param)%% - Parenthesized parameter (e.g., %%preview(100)%%)
    • %%name|format%% - Formatted variable (e.g., %%created_at|%Y-%m-%d%%, %%tags_linked|/tag/%%)

    The compiled function is a closure over the parsed template parts, providing O(n) rendering time proportional to the number of template segments.

    Functions

    compileTemplate