eXist-db / templating

HTML Templating Library for eXist-db
GNU Lesser General Public License v2.1
5 stars 8 forks source link

[enhancement] allow filtering of templating specific data attributes from output #15

Closed line-o closed 2 years ago

line-o commented 2 years ago

Setting $templates:CONFIG_FILTER_ATTRIBUTES to true in the configuration map will filter templating specific data attributes from the output. The setting is off by default to keep backwards compatibility.

Add working XQSuite tests to ensure this works.

Example:

Default output:

<html>
    <body data-template="tt:tf" class="body" data-extra="7">2
        <ul>
            <li data-template="templates:each" data-template-from="data" data-template-to="item" data-extra="23" class="item">
                <span data-template="tt:n" data-extra="42" class="value">1</span>
            </li>
            <li data-template="templates:each" data-template-from="data" data-template-to="item" data-extra="23" class="item">
                <span data-template="tt:n" data-extra="42" class="value">3</span>
            </li>
        </ul>
    </body>
</html>

With filtered attributes:

<html>
    <body class="body" data-extra="7">2
        <ul>
            <li data-extra="23" class="item">
                <span data-extra="42" class="value">1</span>
            </li>
            <li data-extra="23" class="item">
                <span data-extra="42" class="value">3</span>
            </li>
        </ul>
    </body>
</html>