Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom ignore fragment with surrounding code block and decoding of entities #893

Closed
JanSellner opened this issue Mar 15, 2018 · 0 comments · Fixed by #894
Closed

Custom ignore fragment with surrounding code block and decoding of entities #893

JanSellner opened this issue Mar 15, 2018 · 0 comments · Fixed by #894

Comments

@JanSellner
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant