]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Unescape content for Material card 1642/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 3 Feb 2016 19:45:15 +0000 (20:45 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 3 Feb 2016 19:45:15 +0000 (20:45 +0100)
Using slice & striptags, the content is automatically escaped.
If some html character need to be displayed, they'll be escape too, sth like `&amp;`.
Using |raw, the content isn't escape twice and is well displayed.

src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig

index 6de800b94fb57d94b4aabf3148f9b1f111c49aae..0c35de2d40bb65dd0657edccb423289dff6bda6a 100644 (file)
                                 <i class="card-title grey-text text-darken-4 activator mdi-navigation-more-vert right"></i>
                             {% endif %}
 
-                            <span class="card-title"><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw|striptags|slice(0, 42) }}</a></span>
+                            <span class="card-title"><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|striptags|slice(0, 42)|raw }}</a></span>
 
-                            {% if entry.readingTime > 0 %}
-                                <div class="estimatedTime grey-text"><span class="tool reading-time">{% trans %}estimated reading time{% endtrans %}: {{ entry.readingTime }} min</span></div>
-                            {% else %}
-                                <div class="estimatedTime grey-text"><span class="tool reading-time">{% trans %}estimated reading time{% endtrans %}: <small class="inferieur">&lt;</small> 1 min</span></div>
-                            {% endif %}
+                            <div class="estimatedTime grey-text">
+                                <span class="tool reading-time">
+                                    {% trans %}estimated reading time{% endtrans %}:
+                                    {% if entry.readingTime > 0 %}{{ entry.readingTime }}{% else %}<small class="inferieur">&lt;</small> 1{% endif %} min
+                                </span>
+                            </div>
 
                             {% if entry.previewPicture is null %}
-                                <p>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p>
+                                <p>{{ entry.content|striptags|slice(0, 300)|raw }}&hellip;</p>
                             {% endif %}
                         </div>
                     </div>
                             <i class="card-title grey-text text-darken-4 mdi-card-close right"></i>
                             <span class="card-title"><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></span>
 
-                            {% if entry.readingTime > 0 %}
-                                <div class="estimatedTime grey-text"><span class="tool reading-time">{% trans %}estimated reading time{% endtrans %}: {{ entry.readingTime }} min</span></div>
-                            {% else %}
-                                <div class="estimatedTime grey-text"><span class="tool reading-time">{% trans %}estimated reading time{% endtrans %}: <small class="inferieur">&lt;</small> 1 min</span></div>
-                            {% endif %}
+                            <div class="estimatedTime grey-text">
+                                <span class="tool reading-time">
+                                    {% trans %}estimated reading time{% endtrans %}:
+                                    {% if entry.readingTime > 0 %}{{ entry.readingTime }}{% else %}<small class="inferieur">&lt;</small> 1{% endif %} min
+                                </span>
+                            </div>
 
-                            <p>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p>
+                            <p>{{ entry.content|striptags|slice(0, 300)|raw }}&hellip;</p>
                         </div>
                     {% endif %}