Merge pull request #2830 from Kdecherf/striptags-title

Fix rendering of entry title in Twig views
This commit is contained in:
Nicolas Lœuillet 2017-02-17 09:28:56 +01:00 committed by GitHub
commit 2edc539581
5 changed files with 19 additions and 19 deletions

View file

@ -11,8 +11,8 @@
<div class="card-content"> <div class="card-content">
<span class="card-title dot-ellipsis dot-resize-update"> <span class="card-title dot-ellipsis dot-resize-update">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title| e | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title| striptags | e('html_attr') }}">
{{ entry.title | e | raw | striptags | truncate(80, true, '…') }} {{ entry.title | striptags | truncate(80, true, '…') | raw }}
</a> </a>
</span> </span>

View file

@ -2,7 +2,7 @@
<div class="card-stacked"> <div class="card-stacked">
<div class="card-content"> <div class="card-content">
<span class="card-title dot-ellipsis dot-resize-update"> <span class="card-title dot-ellipsis dot-resize-update">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}">
{{ entry.title| striptags | truncate(120, true, '…') | raw }} {{ entry.title| striptags | truncate(120, true, '…') | raw }}
</a> </a>
</span> </span>

View file

@ -2,8 +2,8 @@
<div class="card-body"> <div class="card-body">
<div class="card-content"> <div class="card-content">
<span class="card-title dot-ellipsis dot-resize-update"> <span class="card-title dot-ellipsis dot-resize-update">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}">
{{ entry.title | e | raw | striptags | truncate(80, true, '…') }} {{ entry.title | striptags | truncate(80, true, '…') | raw }}
</a> </a>
</span> </span>

View file

@ -13,8 +13,8 @@
<i class="grey-text text-darken-4 activator material-icons right">more_vert</i> <i class="grey-text text-darken-4 activator material-icons right">more_vert</i>
<span class="card-title dot-ellipsis dot-resize-update"> <span class="card-title dot-ellipsis dot-resize-update">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}">
{{ entry.title | e | striptags | truncate(80, true, '…') | raw }} {{ entry.title | striptags | truncate(80, true, '…') | raw }}
</a> </a>
</span> </span>
@ -29,8 +29,8 @@
<div class="card-reveal"> <div class="card-reveal">
<i class="card-title activator grey-text text-darken-4 material-icons right">clear</i> <i class="card-title activator grey-text text-darken-4 material-icons right">clear</i>
<span class="card-title"> <span class="card-title">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}">
{{ entry.title | e | raw | striptags | truncate(80, true, '…') }} {{ entry.title | striptags | truncate(80, true, '…') | raw }}
</a> </a>
</span> </span>

View file

@ -1,6 +1,6 @@
{% extends "WallabagCoreBundle::layout.html.twig" %} {% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|e|raw }} ({{ entry.domainName|removeWww }}){% endblock %} {% block title %}{{ entry.title|striptags|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
{% block body_class %}entry{% endblock %} {% block body_class %}entry{% endblock %}
@ -118,14 +118,14 @@
{% endif %} {% endif %}
{% if craue_setting('share_twitter') %} {% if craue_setting('share_twitter') %}
<li> <li>
<a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool icon-twitter" title="twitter"> <a href="https://twitter.com/home?status={{entry.title|striptags|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool icon-twitter" title="twitter">
<span>twitter</span> <span>twitter</span>
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if craue_setting('share_shaarli') %} {% if craue_setting('share_shaarli') %}
<li> <li>
<a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}&amp;tags={{ entry.tags|join(',')|url_encode }}" target="_blank"> <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}&amp;tags={{ entry.tags|join(',')|striptags|url_encode }}" target="_blank">
<i class="tool icon-image icon-image--shaarli" title="shaarli"></i> <i class="tool icon-image icon-image--shaarli" title="shaarli"></i>
<span>shaarli</span> <span>shaarli</span>
</a> </a>
@ -133,7 +133,7 @@
{% endif %} {% endif %}
{% if craue_setting('share_diaspora') %} {% if craue_setting('share_diaspora') %}
<li> <li>
<a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank"> <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}&amp;notes=&amp;v=1&amp;noui=1&amp;jump=doclose" target="_blank">
<i class="tool icon-image icon-image--diaspora" title="diaspora"></i> <i class="tool icon-image icon-image--diaspora" title="diaspora"></i>
<span>diaspora*</span> <span>diaspora*</span>
</a> </a>
@ -141,7 +141,7 @@
{% endif %} {% endif %}
{% if craue_setting('share_unmark') %} {% if craue_setting('share_unmark') %}
<li> <li>
<a href="{{ craue_setting('unmark_url') }}/mark/add?url={{ entry.url|url_encode }}&amp;title={{entry.title|url_encode}}&amp;v=6" target="_blank"> <a href="{{ craue_setting('unmark_url') }}/mark/add?url={{ entry.url|url_encode }}&amp;title={{entry.title|striptags|url_encode}}&amp;v=6" target="_blank">
<i class="tool icon-image icon-image--unmark" title="unmark"></i> <i class="tool icon-image icon-image--unmark" title="unmark"></i>
<span>unmark.it</span> <span>unmark.it</span>
</a> </a>
@ -149,7 +149,7 @@
{% endif %} {% endif %}
{% if craue_setting('carrot') %} {% if craue_setting('carrot') %}
<li> <li>
<a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" title="carrot"> <a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}" target="_blank" title="carrot">
<i class="tool icon-image icon-image--carrot"></i> <i class="tool icon-image icon-image--carrot"></i>
<span>Carrot</span> <span>Carrot</span>
</a> </a>
@ -157,7 +157,7 @@
{% endif %} {% endif %}
{% if craue_setting('share_mail') %} {% if craue_setting('share_mail') %}
<li> <li>
<a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool email icon icon-mail"> <a href="mailto:?subject={{ entry.title|striptags|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool email icon icon-mail">
<span>{{ 'entry.view.left_menu.share_email_label'|trans }}</span> <span>{{ 'entry.view.left_menu.share_email_label'|trans }}</span>
</a> </a>
</li> </li>
@ -209,7 +209,7 @@
{% block content %} {% block content %}
<div id="article"> <div id="article">
<header class="mbm"> <header class="mbm">
<h1>{{ entry.title|e|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{{ 'entry.view.edit_title'|trans }}">✎</a></h1> <h1>{{ entry.title|striptags|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{{ 'entry.view.edit_title'|trans }}">✎</a></h1>
</header> </header>
<aside> <aside>
<ul class="tools"> <ul class="tools">
@ -222,7 +222,7 @@
</li> </li>
<li> <li>
<i class="material-icons link">link</i> <i class="material-icons link">link</i>
<a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool"> <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|striptags }}" class="tool">
{{ entry.domainName|removeWww }} {{ entry.domainName|removeWww }}
</a> </a>
</li> </li>
@ -244,7 +244,7 @@
</div> </div>
{% if entry.previewPicture is not null %} {% if entry.previewPicture is not null %}
<div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|raw }}" /></div> <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|striptags|e('html_attr') }}" /></div>
{% endif %} {% endif %}
</aside> </aside>