|
1 | 1 | {% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %} |
2 | | - {% if dangerouslyDisableAutoEscaping -%} |
3 | | - {{ text | safe }} |
4 | | - {%- else -%} |
5 | | - {{ text }} |
6 | | - {%- endif %} |
| 2 | + {% if dangerouslyDisableAutoEscaping -%} |
| 3 | + {{ text | safe }} |
| 4 | + {%- else -%} |
| 5 | + {{ text }} |
| 6 | + {%- endif %} |
7 | 7 | {% endmacro %} |
8 | 8 | {% macro escapeTitle(title, url, dangerouslyDisableAutoEscaping=false, showTitleAsUrl=false) %} |
9 | | - {% if dangerouslyDisableAutoEscaping %} |
10 | | - {% if showTitleAsUrl %} |
11 | | - <a href="{{ url }}" |
12 | | - style="text-decoration:none; |
| 9 | + {% if dangerouslyDisableAutoEscaping %} |
| 10 | + {% if showTitleAsUrl %} |
| 11 | + <a |
| 12 | + href="{{ url }}" |
| 13 | + style="text-decoration:none; |
13 | 14 | color:#ffffff" |
14 | | - target="_blank">{{ title | safe }}</a> |
15 | | - {% else %} |
16 | | - {{ title | safe }} |
17 | | - {% endif %} |
| 15 | + target="_blank" |
| 16 | + >{{ title | safe }}</a |
| 17 | + > |
18 | 18 | {% else %} |
19 | | - {% if showTitleAsUrl %} |
20 | | - <a href="{{ url }}" |
21 | | - style="text-decoration:none; |
| 19 | + {{ title | safe }} |
| 20 | + {% endif %} |
| 21 | + {% else %} |
| 22 | + {% if showTitleAsUrl %} |
| 23 | + <a |
| 24 | + href="{{ url }}" |
| 25 | + style="text-decoration:none; |
22 | 26 | color:#ffffff" |
23 | | - target="_blank">{{ title }}</a> |
24 | | - {% else %} |
25 | | - {{ title }} |
26 | | - {% endif %} |
| 27 | + target="_blank" |
| 28 | + >{{ title }}</a |
| 29 | + > |
| 30 | + {% else %} |
| 31 | + {{ title }} |
27 | 32 | {% endif %} |
| 33 | + {% endif %} |
28 | 34 | {% endmacro %} |
29 | 35 | {% if loaded %} |
30 | | - {% if config.showAsList %} |
31 | | - <ul class="newsfeed-list"> |
32 | | - {% for item in items %} |
33 | | - <li> |
34 | | - {% if (config.showSourceTitle and item.sourceTitle) or config.showPublishDate %} |
35 | | - <div class="newsfeed-source light small dimmed"> |
36 | | - {% if item.sourceTitle and config.showSourceTitle %} |
37 | | - {{ item.sourceTitle }}{% if config.showPublishDate %}, {% else %}:{% endif %} |
38 | | - {% endif %} |
39 | | - {% if config.showPublishDate %}{{ item.publishDate }}:{% endif %} |
40 | | - </div> |
41 | | - {% endif %} |
42 | | - <div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}"> |
43 | | - {{ escapeTitle(item.title, item.url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }} |
44 | | - </div> |
45 | | - {% if config.showDescription %} |
46 | | - <div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}"> |
47 | | - {% if config.truncDescription %} |
48 | | - {{ escapeText(item.description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }} |
49 | | - {% else %} |
50 | | - {{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }} |
51 | | - {% endif %} |
52 | | - </div> |
53 | | - {% endif %} |
54 | | - </li> |
55 | | - {% endfor %} |
56 | | - </ul> |
57 | | - {% else %} |
58 | | - <div> |
59 | | - {% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %} |
60 | | - <div class="newsfeed-source light small dimmed"> |
61 | | - {% if sourceTitle and config.showSourceTitle %} |
62 | | - {{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %}, {% else %}:{% endif %} |
63 | | - {% endif %} |
64 | | - {% if config.showPublishDate %}{{ publishDate }}:{% endif %} |
65 | | - </div> |
66 | | - {% endif %} |
67 | | - <div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}"> |
68 | | - {{ escapeTitle(title, url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }} |
| 36 | + {% if config.showAsList %} |
| 37 | + <ul class="newsfeed-list"> |
| 38 | + {% for item in items %} |
| 39 | + <li> |
| 40 | + {% if (config.showSourceTitle and item.sourceTitle) or config.showPublishDate %} |
| 41 | + <div class="newsfeed-source light small dimmed"> |
| 42 | + {% if item.sourceTitle and config.showSourceTitle %} |
| 43 | + {{ item.sourceTitle }}{% if config.showPublishDate %},{% else %}:{% endif %} |
| 44 | + {% endif %} |
| 45 | + {% if config.showPublishDate %}{{ item.publishDate }}:{% endif %} |
69 | 46 | </div> |
70 | | - {% if config.showDescription %} |
71 | | - <div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}"> |
72 | | - {% if config.truncDescription %} |
73 | | - {{ escapeText(description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }} |
74 | | - {% else %} |
75 | | - {{ escapeText(description, config.dangerouslyDisableAutoEscaping) }} |
76 | | - {% endif %} |
77 | | - </div> |
78 | | - {% endif %} |
| 47 | + {% endif %} |
| 48 | + <div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">{{ escapeTitle(item.title, item.url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}</div> |
| 49 | + {% if config.showDescription %} |
| 50 | + <div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}"> |
| 51 | + {% if config.truncDescription %} |
| 52 | + {{ escapeText(item.description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }} |
| 53 | + {% else %} |
| 54 | + {{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }} |
| 55 | + {% endif %} |
| 56 | + </div> |
| 57 | + {% endif %} |
| 58 | + </li> |
| 59 | + {% endfor %} |
| 60 | + </ul> |
| 61 | + {% else %} |
| 62 | + <div> |
| 63 | + {% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %} |
| 64 | + <div class="newsfeed-source light small dimmed"> |
| 65 | + {% if sourceTitle and config.showSourceTitle %} |
| 66 | + {{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %},{% else %}:{% endif %} |
| 67 | + {% endif %} |
| 68 | + {% if config.showPublishDate %}{{ publishDate }}:{% endif %} |
79 | 69 | </div> |
80 | | - {% endif %} |
81 | | -{% elseif empty %} |
82 | | - <div class="small dimmed">{{ "NEWSFEED_NO_ITEMS" | translate | safe }}</div> |
83 | | -{% elseif error %} |
84 | | - <div class="small dimmed"> |
85 | | - {{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "Newsfeed", ERROR: error}) | safe }} |
| 70 | + {% endif %} |
| 71 | + <div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">{{ escapeTitle(title, url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}</div> |
| 72 | + {% if config.showDescription %} |
| 73 | + <div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}"> |
| 74 | + {% if config.truncDescription %} |
| 75 | + {{ escapeText(description | truncate(config.lengthDescription) , config.dangerouslyDisableAutoEscaping) }} |
| 76 | + {% else %} |
| 77 | + {{ escapeText(description, config.dangerouslyDisableAutoEscaping) }} |
| 78 | + {% endif %} |
| 79 | + </div> |
| 80 | + {% endif %} |
86 | 81 | </div> |
| 82 | + {% endif %} |
| 83 | + {% elseif empty %} |
| 84 | + <div class="small dimmed">{{ "NEWSFEED_NO_ITEMS" | translate | safe }}</div> |
| 85 | + {% elseif error %} |
| 86 | + <div class="small dimmed">{{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "Newsfeed", ERROR: error}) | safe }}</div> |
87 | 87 | {% else %} |
88 | | - <div class="small dimmed">{{ "LOADING" | translate | safe }}</div> |
| 88 | + <div class="small dimmed">{{ "LOADING" | translate | safe }}</div> |
89 | 89 | {% endif %} |
0 commit comments