Skip to content

Don't use the deprecated spaceless filter #182

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

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/Templates/default/html/figure.html.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{#
Overridden to fix lack of figclass support (class attribute on <figure)
#}
{% apply spaceless %}
<figure
{% if figureNode.classes is not empty %}
class="{{ figureNode.classesString }}"
{% endif %}
>
<figure {% if figureNode.classes is not empty %}class="{{ figureNode.classesString }}"{% endif %}>
{{ figureNode.image.render()|raw }}

{% if figureNode.document %}
Expand All @@ -17,4 +12,3 @@ Overridden to fix lack of figclass support (class attribute on <figure)
{% endif %}
{% endif %}
</figure>
{% endapply %}
2 changes: 0 additions & 2 deletions src/Templates/default/html/link.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% apply spaceless %}
{% set domElement = attributes.domElement|default %}
{% set class = (attributes.class|default ? attributes.class ~ ' ' : '') ~ 'reference ' ~ (('://' in url) ? 'external' : 'internal') %}
<a href="{{ url|raw }}" class="{{ class }}"{% for key, value in attributes|filter((v, key) => key != 'domElement' and key != 'class') %} {{ key }}="{{ value }}"{% endfor %}>{% if domElement %}<{{ domElement }}>{% endif %}{{ title|raw }}{% if domElement %}</{{ domElement }}>{% endif %}</a>
{% endapply %}
12 changes: 5 additions & 7 deletions src/Templates/default/html/toc-level.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% apply spaceless %}
<ul class="toctree toctree-level-{{ toc_deep_level ?? 1 }} toctree-length-{{ tocItems|length }}">
{% for tocItem in tocItems %}
{% include "toc-item.html.twig" with { toc_deep_level: 1 } %}
{% endfor %}
</ul>
{% endapply %}
<ul class="toctree toctree-level-{{ toc_deep_level ?? 1 }} toctree-length-{{ tocItems|length }}">
{% for tocItem in tocItems %}
{% include "toc-item.html.twig" with { toc_deep_level: 1 } %}
{% endfor %}
</ul>
10 changes: 4 additions & 6 deletions src/Templates/default/html/toc.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{% apply spaceless %}
{% set toc_options = toc_options(tocItems) %}
<div class="toctree-wrapper toc-size-{{ toc_options.size }}">
{% include "toc-level.html.twig" %}
</div>
{% endapply %}
{% set toc_options = toc_options(tocItems) %}
<div class="toctree-wrapper toc-size-{{ toc_options.size }}">
{% include "toc-level.html.twig" %}
</div>
4 changes: 2 additions & 2 deletions tests/fixtures/expected/build-pdf/book.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ <h1 id="book-index-book">Book</h1>
<p>Here is a link to the <a href="#index" class="reference internal">main index</a></p>
<div class="toctree-wrapper toc-size-md">
<ul class="toctree toctree-level-1 toctree-length-2">
<li><a href="https://symfony.com/doc/4.0/book/first-page.html">First page</a></li>
<li><a href="https://symfony.com/doc/4.0/book/second-page.html">Second page</a></li>
<li> <a href="https://symfony.com/doc/4.0/book/first-page.html">First page</a> </li>
<li> <a href="https://symfony.com/doc/4.0/book/second-page.html">Second page</a> </li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/expected/main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="section">
<h1 id="some-test-docs"><a class="headerlink" href="#some-test-docs" title="Permalink to this headline">Some Test Docs!</a></h1>
<img src="_images/symfony-logo.png" />
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li><a href="datetime.html">DateTimeType Field</a><ul class="toctree toctree-level-2 toctree-length-4"><li><a href="datetime.html#field-options">Field Options</a></li><li><a href="datetime.html#overridden-options">Overridden Options</a></li><li><a href="datetime.html#field-variables">Field Variables</a></li><li><a href="datetime.html#url-checker-errors">Url checker errors</a></li></ul></li><li><a href="form/form_type.html">FormType Documentation</a></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li><a href="datetime.html">DateTimeType Field</a><ul class="toctree toctree-level-2 toctree-length-4"><li> <a href="datetime.html#field-options">Field Options</a> </li><li> <a href="datetime.html#overridden-options">Overridden Options</a> </li><li> <a href="datetime.html#field-variables">Field Variables</a> </li><li> <a href="datetime.html#url-checker-errors">Url checker errors</a> </li></ul></li><li> <a href="form/form_type.html">FormType Documentation</a> </li></ul></div>
<span id="reference-forms-type-date-format"></span>
<div class="section">
<h2 id="a-header"><a class="headerlink" href="#a-header" title="Permalink to this headline">A header</a></h2>
Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/expected/toctree/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<body>
<div class="section">
<h1 id="toctree"><a class="headerlink" href="#toctree" title="Permalink to this headline">Toctree</a></h1>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li><a href="file.html">Title</a><ul class="toctree toctree-level-2 toctree-length-1"><li><a href="file.html#sub-title">Sub title</a></li></ul></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li><a href="file.html">Title</a></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li><a href="directory/another_file.html">Another file</a></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li><a href="directory/another_file.html">Another file</a></li><li><a href="file.html">Title</a><ul class="toctree toctree-level-2 toctree-length-1"><li><a href="file.html#sub-title">Sub title</a></li></ul></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li><a href="file.html">Title</a><ul class="toctree toctree-level-2 toctree-length-1"><li><a href="file.html#sub-title">Sub title</a></li></ul></li><li><a href="directory/another_file.html">Another file</a></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li><a href="file.html">Title</a><ul class="toctree toctree-level-2 toctree-length-1"><li> <a href="file.html#sub-title">Sub title</a> </li></ul></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li> <a href="file.html">Title</a> </li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-1"><li> <a href="directory/another_file.html">Another file</a> </li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li> <a href="directory/another_file.html">Another file</a> </li><li><a href="file.html">Title</a><ul class="toctree toctree-level-2 toctree-length-1"><li> <a href="file.html#sub-title">Sub title</a> </li></ul></li></ul></div>
<div class="toctree-wrapper toc-size-md"><ul class="toctree toctree-level-1 toctree-length-2"><li> <a href="file.html">Title</a> <ul class="toctree toctree-level-2 toctree-length-1"><li> <a href="file.html#sub-title">Sub title</a> </li></ul></li><li> <a href="directory/another_file.html">Another file</a> </li></ul></div>

</div>

Expand Down