Skip to content

Commit 02c8f6a

Browse files
committed
minor #182 Don't use the deprecated spaceless filter (javiereguiluz)
This PR was merged into the main branch. Discussion ---------- Don't use the deprecated spaceless filter This fixes the following deprecations that are making CI to fail: ``` Remaining indirect deprecation notices (3) 1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/toc.html.twig at line 1. 1x in BuildDocsCommandTest::testBuildDocsDefault from App\Tests\Command 1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/link.html.twig at line 1. 1x in BuildDocsCommandTest::testBuildDocsDefault from App\Tests\Command 1x: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated in /home/runner/work/docs-builder/docs-builder/src/Templates/default/html/figure.html.twig at line 4. 1x in IntegrationTest::testParseUnitBlock from SymfonyDocsBuilder\Tests ``` Commits ------- f34b7a7 Don't use the deprecated spaceless filter
2 parents caacb35 + f34b7a7 commit 02c8f6a

File tree

7 files changed

+18
-30
lines changed

7 files changed

+18
-30
lines changed
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{#
22
Overridden to fix lack of figclass support (class attribute on <figure)
33
#}
4-
{% apply spaceless %}
5-
<figure
6-
{% if figureNode.classes is not empty %}
7-
class="{{ figureNode.classesString }}"
8-
{% endif %}
9-
>
4+
<figure {% if figureNode.classes is not empty %}class="{{ figureNode.classesString }}"{% endif %}>
105
{{ figureNode.image.render()|raw }}
116

127
{% if figureNode.document %}
@@ -17,4 +12,3 @@ Overridden to fix lack of figclass support (class attribute on <figure)
1712
{% endif %}
1813
{% endif %}
1914
</figure>
20-
{% endapply %}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{% apply spaceless %}
21
{% set domElement = attributes.domElement|default %}
32
{% set class = (attributes.class|default ? attributes.class ~ ' ' : '') ~ 'reference ' ~ (('://' in url) ? 'external' : 'internal') %}
43
<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>
5-
{% endapply %}
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
{% apply spaceless %}
2-
<ul class="toctree toctree-level-{{ toc_deep_level ?? 1 }} toctree-length-{{ tocItems|length }}">
3-
{% for tocItem in tocItems %}
4-
{% include "toc-item.html.twig" with { toc_deep_level: 1 } %}
5-
{% endfor %}
6-
</ul>
7-
{% endapply %}
1+
<ul class="toctree toctree-level-{{ toc_deep_level ?? 1 }} toctree-length-{{ tocItems|length }}">
2+
{% for tocItem in tocItems %}
3+
{% include "toc-item.html.twig" with { toc_deep_level: 1 } %}
4+
{% endfor %}
5+
</ul>
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
{% apply spaceless %}
2-
{% set toc_options = toc_options(tocItems) %}
3-
<div class="toctree-wrapper toc-size-{{ toc_options.size }}">
4-
{% include "toc-level.html.twig" %}
5-
</div>
6-
{% endapply %}
1+
{% set toc_options = toc_options(tocItems) %}
2+
<div class="toctree-wrapper toc-size-{{ toc_options.size }}">
3+
{% include "toc-level.html.twig" %}
4+
</div>

tests/fixtures/expected/build-pdf/book.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ <h1 id="book-index-book">Book</h1>
88
<p>Here is a link to the <a href="#index" class="reference internal">main index</a></p>
99
<div class="toctree-wrapper toc-size-md">
1010
<ul class="toctree toctree-level-1 toctree-length-2">
11-
<li><a href="https://symfony.com/doc/4.0/book/first-page.html">First page</a></li>
12-
<li><a href="https://symfony.com/doc/4.0/book/second-page.html">Second page</a></li>
11+
<li> <a href="https://symfony.com/doc/4.0/book/first-page.html">First page</a> </li>
12+
<li> <a href="https://symfony.com/doc/4.0/book/second-page.html">Second page</a> </li>
1313
</ul>
1414
</div>
1515
</div>

tests/fixtures/expected/main/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="section">
1111
<h1 id="some-test-docs"><a class="headerlink" href="#some-test-docs" title="Permalink to this headline">Some Test Docs!</a></h1>
1212
<img src="_images/symfony-logo.png" />
13-
<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>
13+
<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>
1414
<span id="reference-forms-type-date-format"></span>
1515
<div class="section">
1616
<h2 id="a-header"><a class="headerlink" href="#a-header" title="Permalink to this headline">A header</a></h2>

tests/fixtures/expected/toctree/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<body>
1010
<div class="section">
1111
<h1 id="toctree"><a class="headerlink" href="#toctree" title="Permalink to this headline">Toctree</a></h1>
12-
<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>
13-
<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>
14-
<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>
15-
<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>
16-
<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>
12+
<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>
13+
<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>
14+
<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>
15+
<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>
16+
<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>
1717

1818
</div>
1919

0 commit comments

Comments
 (0)