8000 Custom ignore fragment with surrounding code block and decoding of entities · Issue #893 · kangax/html-minifier · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Custom ignore fragment with surrounding code block and decoding of entities #893
Closed
@JanSellner

Description

@JanSellner

This is a follow-up issue for #836 (btw: thanks for the fix).

Using a slightly different example as in the referenced issue:

<html>
<head></head>
<body>
    \begin{alignat*}{2}% Use alignat when you wish to have individual equation numbering
        &amp;l_{00} y_{0}                               &amp;&amp; = b_{0} \\
        &amp;l_{10} y_{0} + l_{11} y_{1}                &amp;&amp; = b_{1} \\
        &amp;l_{20} y_{0} + l_{21} y_{1} + l_{22} y_{2} &amp;&amp; = b_{2}
    \end{alignat*}
    <pre>
    <code class="language-latex">
    \documentclass{scrartcl}
    \usepackage{amsmath}

    \begin{document}

    \begin{alignat*}{2}% Use alignat when you wish to have individual equation numbering
        &amp;l_{00} y_{0}                               &amp;&amp; = b_{0} \\
        &amp;l_{10} y_{0} + l_{11} y_{1}                &amp;&amp; = b_{1} \\
        &amp;l_{20} y_{0} + l_{21} y_{1} + l_{22} y_{2} &amp;&amp; = b_{2}
    \end{alignat*}

    \end{document}
    </code>
    </pre>
</body>
</html>

and calling the CLI-version (3.5.11) via html-minifier --minify-js --minify-css --remove-comments --remove-empty-attributes --remove-redundant-attributes --collapse-whitespace --ignore-custom-fragments "\\begin{alignat\*}[\s\S]*?\\end{alignat\*}" --decode-entities input.html (note the additional parameter --decode-entities) produces the following output:

<html><head></head><body> \begin{alignat*}{2}% Use alignat when you wish to have individual equation numbering
        &amp;l_{00} y_{0}                               &amp;&amp; = b_{0} \\
        &amp;l_{10} y_{0} + l_{11} y_{1}                &amp;&amp; = b_{1} \\
        &amp;l_{20} y_{0} + l_{21} y_{1} + l_{22} y_{2} &amp;&amp; = b_{2}
    \end{alignat*} <pre>
    <code class="language-latex">
    \documentclass{scrartcl}
    \usepackage{amsmath}

    \begin{document}

    \begin{alignat*}{2}% Use alignat when you wish to have individual equation numbering
        &ampamp;l_{00} y_{0}                               &ampamp;&ampamp; = b_{0} \\
        &ampamp;l_{10} y_{0} + l_{11} y_{1}                &ampamp;&ampamp; = b_{1} \\
        &ampamp;l_{20} y_{0} + l_{21} y_{1} + l_{22} y_{2} &ampamp;&ampamp; = b_{2}
    \end{alignat*}

    \end{document}
    </code>
    </pre></body></html>

The whitespace inside the code-block stays now untouched but, unfortunately, the entity &amp; gets messed up. This seems to be related to the custom ignore fragment inside the code-block, though, since in the first alignat environment (without a surrounding code-block) the entities remain unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0