diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2017-02-01 23:39:34 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2017-02-02 21:54:15 +0100 |
commit | 1bb7bdc8b399abe573dfa4e2c04fafa19991c487 (patch) | |
tree | 5c43340eeefe9999df3d9fd29d4c127e072a474a /src/Wallabag | |
parent | 8a098044bfbe00fa2bd08b01a6d19871b03f28b7 (diff) | |
download | wallabag-1bb7bdc8b399abe573dfa4e2c04fafa19991c487.tar.gz wallabag-1bb7bdc8b399abe573dfa4e2c04fafa19991c487.tar.zst wallabag-1bb7bdc8b399abe573dfa4e2c04fafa19991c487.zip |
Fix rendering of entry title in Twig views
This commit provides some improvements on the rendering of entry title
on entries list and entry views and refactors filter calls:
- Remove escape filter from apparent title, striptags is enough
- Move raw filter to the end of apparent title as it's ignored if not
placed as the last filter
- Replace raw filter with e('html_attr') for title used in attributes,
fixing possible issue and/or glitch
- Add striptags to entry.title used for link sharing to respect the
apparent title
Fixes #2802
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag')
5 files changed, 19 insertions, 19 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_full_image.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_full_image.html.twig index 91a1bac0..58757158 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_full_image.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_full_image.html.twig | |||
@@ -11,8 +11,8 @@ | |||
11 | 11 | ||
12 | <div class="card-content"> | 12 | <div class="card-content"> |
13 | <span class="card-title dot-ellipsis dot-resize-update"> | 13 | <span class="card-title dot-ellipsis dot-resize-update"> |
14 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title| e | raw | striptags }}"> | 14 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title| striptags | e('html_attr') }}"> |
15 | {{ entry.title | e | raw | striptags | truncate(80, true, '…') }} | 15 | {{ entry.title | striptags | truncate(80, true, '…') | raw }} |
16 | </a> | 16 | </a> |
17 | </span> | 17 | </span> |
18 | 18 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig index bb9b64ce..3ba6253a 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_list.html.twig | |||
@@ -2,7 +2,7 @@ | |||
2 | <div class="card-stacked"> | 2 | <div class="card-stacked"> |
3 | <div class="card-content"> | 3 | <div class="card-content"> |
4 | <span class="card-title dot-ellipsis dot-resize-update"> | 4 | <span class="card-title dot-ellipsis dot-resize-update"> |
5 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | raw | striptags }}"> | 5 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}"> |
6 | {{ entry.title| striptags | truncate(120, true, '…') | raw }} | 6 | {{ entry.title| striptags | truncate(120, true, '…') | raw }} |
7 | </a> | 7 | </a> |
8 | </span> | 8 | </span> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_no_preview.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_no_preview.html.twig index ed916e79..eb158659 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_no_preview.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_no_preview.html.twig | |||
@@ -2,8 +2,8 @@ | |||
2 | <div class="card-body"> | 2 | <div class="card-body"> |
3 | <div class="card-content"> | 3 | <div class="card-content"> |
4 | <span class="card-title dot-ellipsis dot-resize-update"> | 4 | <span class="card-title dot-ellipsis dot-resize-update"> |
5 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> | 5 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}"> |
6 | {{ entry.title | e | raw | striptags | truncate(80, true, '…') }} | 6 | {{ entry.title | striptags | truncate(80, true, '…') | raw }} |
7 | </a> | 7 | </a> |
8 | </span> | 8 | </span> |
9 | 9 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_preview.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_preview.html.twig index d23be4d0..fb5301c8 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_preview.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_preview.html.twig | |||
@@ -13,8 +13,8 @@ | |||
13 | <i class="grey-text text-darken-4 activator material-icons right">more_vert</i> | 13 | <i class="grey-text text-darken-4 activator material-icons right">more_vert</i> |
14 | 14 | ||
15 | <span class="card-title dot-ellipsis dot-resize-update"> | 15 | <span class="card-title dot-ellipsis dot-resize-update"> |
16 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> | 16 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}"> |
17 | {{ entry.title | e | striptags | truncate(80, true, '…') | raw }} | 17 | {{ entry.title | striptags | truncate(80, true, '…') | raw }} |
18 | </a> | 18 | </a> |
19 | </span> | 19 | </span> |
20 | 20 | ||
@@ -29,8 +29,8 @@ | |||
29 | <div class="card-reveal"> | 29 | <div class="card-reveal"> |
30 | <i class="card-title activator grey-text text-darken-4 material-icons right">clear</i> | 30 | <i class="card-title activator grey-text text-darken-4 material-icons right">clear</i> |
31 | <span class="card-title"> | 31 | <span class="card-title"> |
32 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | e | raw | striptags }}"> | 32 | <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | striptags | e('html_attr') }}"> |
33 | {{ entry.title | e | raw | striptags | truncate(80, true, '…') }} | 33 | {{ entry.title | striptags | truncate(80, true, '…') | raw }} |
34 | </a> | 34 | </a> |
35 | </span> | 35 | </span> |
36 | 36 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 15428b92..3e8da09c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | |||
@@ -1,6 +1,6 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %}{{ entry.title|e|raw }} ({{ entry.domainName|removeWww }}){% endblock %} | 3 | {% block title %}{{ entry.title|striptags|raw }} ({{ entry.domainName|removeWww }}){% endblock %} |
4 | 4 | ||
5 | {% block body_class %}entry{% endblock %} | 5 | {% block body_class %}entry{% endblock %} |
6 | 6 | ||
@@ -118,14 +118,14 @@ | |||
118 | {% endif %} | 118 | {% endif %} |
119 | {% if craue_setting('share_twitter') %} | 119 | {% if craue_setting('share_twitter') %} |
120 | <li> | 120 | <li> |
121 | <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"> | 121 | <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"> |
122 | <span>twitter</span> | 122 | <span>twitter</span> |
123 | </a> | 123 | </a> |
124 | </li> | 124 | </li> |
125 | {% endif %} | 125 | {% endif %} |
126 | {% if craue_setting('share_shaarli') %} | 126 | {% if craue_setting('share_shaarli') %} |
127 | <li> | 127 | <li> |
128 | <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&tags={{ entry.tags|join(',')|url_encode }}" target="_blank"> | 128 | <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&title={{ entry.title|striptags|url_encode }}&tags={{ entry.tags|join(',')|striptags|url_encode }}" target="_blank"> |
129 | <i class="tool icon-image icon-image--shaarli" title="shaarli"></i> | 129 | <i class="tool icon-image icon-image--shaarli" title="shaarli"></i> |
130 | <span>shaarli</span> | 130 | <span>shaarli</span> |
131 | </a> | 131 | </a> |
@@ -133,7 +133,7 @@ | |||
133 | {% endif %} | 133 | {% endif %} |
134 | {% if craue_setting('share_diaspora') %} | 134 | {% if craue_setting('share_diaspora') %} |
135 | <li> | 135 | <li> |
136 | <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}¬es=&v=1&noui=1&jump=doclose" target="_blank"> | 136 | <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|striptags|url_encode }}¬es=&v=1&noui=1&jump=doclose" target="_blank"> |
137 | <i class="tool icon-image icon-image--diaspora" title="diaspora"></i> | 137 | <i class="tool icon-image icon-image--diaspora" title="diaspora"></i> |
138 | <span>diaspora*</span> | 138 | <span>diaspora*</span> |
139 | </a> | 139 | </a> |
@@ -141,7 +141,7 @@ | |||
141 | {% endif %} | 141 | {% endif %} |
142 | {% if craue_setting('share_unmark') %} | 142 | {% if craue_setting('share_unmark') %} |
143 | <li> | 143 | <li> |
144 | <a href="{{ craue_setting('unmark_url') }}/mark/add?url={{ entry.url|url_encode }}&title={{entry.title|url_encode}}&v=6" target="_blank"> | 144 | <a href="{{ craue_setting('unmark_url') }}/mark/add?url={{ entry.url|url_encode }}&title={{entry.title|striptags|url_encode}}&v=6" target="_blank"> |
145 | <i class="tool icon-image icon-image--unmark" title="unmark"></i> | 145 | <i class="tool icon-image icon-image--unmark" title="unmark"></i> |
146 | <span>unmark.it</span> | 146 | <span>unmark.it</span> |
147 | </a> | 147 | </a> |
@@ -149,7 +149,7 @@ | |||
149 | {% endif %} | 149 | {% endif %} |
150 | {% if craue_setting('carrot') %} | 150 | {% if craue_setting('carrot') %} |
151 | <li> | 151 | <li> |
152 | <a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" title="carrot"> | 152 | <a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|striptags|url_encode }}" target="_blank" title="carrot"> |
153 | <i class="tool icon-image icon-image--carrot"></i> | 153 | <i class="tool icon-image icon-image--carrot"></i> |
154 | <span>Carrot</span> | 154 | <span>Carrot</span> |
155 | </a> | 155 | </a> |
@@ -157,7 +157,7 @@ | |||
157 | {% endif %} | 157 | {% endif %} |
158 | {% if craue_setting('share_mail') %} | 158 | {% if craue_setting('share_mail') %} |
159 | <li> | 159 | <li> |
160 | <a href="mailto:?subject={{ entry.title|url_encode }}&body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool email icon icon-mail"> | 160 | <a href="mailto:?subject={{ entry.title|striptags|url_encode }}&body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool email icon icon-mail"> |
161 | <span>{{ 'entry.view.left_menu.share_email_label'|trans }}</span> | 161 | <span>{{ 'entry.view.left_menu.share_email_label'|trans }}</span> |
162 | </a> | 162 | </a> |
163 | </li> | 163 | </li> |
@@ -209,7 +209,7 @@ | |||
209 | {% block content %} | 209 | {% block content %} |
210 | <div id="article"> | 210 | <div id="article"> |
211 | <header class="mbm"> | 211 | <header class="mbm"> |
212 | <h1>{{ entry.title|e|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{{ 'entry.view.edit_title'|trans }}">✎</a></h1> | 212 | <h1>{{ entry.title|striptags|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{{ 'entry.view.edit_title'|trans }}">✎</a></h1> |
213 | </header> | 213 | </header> |
214 | <aside> | 214 | <aside> |
215 | <ul class="tools"> | 215 | <ul class="tools"> |
@@ -222,7 +222,7 @@ | |||
222 | </li> | 222 | </li> |
223 | <li> | 223 | <li> |
224 | <i class="material-icons link">link</i> | 224 | <i class="material-icons link">link</i> |
225 | <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool"> | 225 | <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|striptags }}" class="tool"> |
226 | {{ entry.domainName|removeWww }} | 226 | {{ entry.domainName|removeWww }} |
227 | </a> | 227 | </a> |
228 | </li> | 228 | </li> |
@@ -244,7 +244,7 @@ | |||
244 | </div> | 244 | </div> |
245 | 245 | ||
246 | {% if entry.previewPicture is not null %} | 246 | {% if entry.previewPicture is not null %} |
247 | <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|raw }}" /></div> | 247 | <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|striptags|e('html_attr') }}" /></div> |
248 | {% endif %} | 248 | {% endif %} |
249 | 249 | ||
250 | </aside> | 250 | </aside> |