mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #2736 from rejas/issue_2712
Allow dangerouslyDisablingAutoEscaping in newsfeed items
This commit is contained in:
commit
9d0cab01d5
@ -23,6 +23,7 @@ _This release is scheduled to be released on 2022-01-01._
|
|||||||
- Replace spectron with playwright, update dependencies including electron update to v16.
|
- Replace spectron with playwright, update dependencies including electron update to v16.
|
||||||
- Added lithuanian language to translations.js
|
- Added lithuanian language to translations.js
|
||||||
- Show info message if newsfeed is empty (fixes #2731)
|
- Show info message if newsfeed is empty (fixes #2731)
|
||||||
|
- Added dangerouslyDisableAutoEscaping config option for newsfeed templates (fixes #2712)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ Module.register("newsfeed", {
|
|||||||
endTags: [],
|
endTags: [],
|
||||||
prohibitedWords: [],
|
prohibitedWords: [],
|
||||||
scrollLength: 500,
|
scrollLength: 500,
|
||||||
logFeedWarnings: false
|
logFeedWarnings: false,
|
||||||
|
dangerouslyDisableAutoEscaping: false
|
||||||
},
|
},
|
||||||
|
|
||||||
// Define required scripts.
|
// Define required scripts.
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
{% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %}
|
||||||
|
{% if dangerouslyDisableAutoEscaping %}
|
||||||
|
{{ text | safe}}
|
||||||
|
{% else %}
|
||||||
|
{{ text }}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% if loaded %}
|
{% if loaded %}
|
||||||
{% if config.showAsList %}
|
{% if config.showAsList %}
|
||||||
<ul class="newsfeed-list">
|
<ul class="newsfeed-list">
|
||||||
@ -14,14 +22,14 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
||||||
{{ item.title }}
|
{{ escapeText(item.title, config.dangerouslyDisableAutoEscaping) }}
|
||||||
</div>
|
</div>
|
||||||
{% if config.showDescription %}
|
{% if config.showDescription %}
|
||||||
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
||||||
{% if config.truncDescription %}
|
{% if config.truncDescription %}
|
||||||
{{ item.description | truncate(config.lengthDescription) }}
|
{{ escapeText(item.description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ item.description }}
|
{{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -33,7 +41,7 @@
|
|||||||
{% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %}
|
{% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %}
|
||||||
<div class="newsfeed-source light small dimmed">
|
<div class="newsfeed-source light small dimmed">
|
||||||
{% if sourceTitle and config.showSourceTitle %}
|
{% if sourceTitle and config.showSourceTitle %}
|
||||||
{{ sourceTitle }}{% if config.showPublishDate %}, {% else %}: {% endif %}
|
{{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %}, {% else %}: {% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if config.showPublishDate %}
|
{% if config.showPublishDate %}
|
||||||
{{ publishDate }}:
|
{{ publishDate }}:
|
||||||
@ -41,14 +49,14 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
|
||||||
{{ title }}
|
{{ escapeText(title, config.dangerouslyDisableAutoEscaping) }}
|
||||||
</div>
|
</div>
|
||||||
{% if config.showDescription %}
|
{% if config.showDescription %}
|
||||||
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
|
||||||
{% if config.truncDescription %}
|
{% if config.truncDescription %}
|
||||||
{{ description | truncate(config.lengthDescription) }}
|
{{ escapeText(description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ description }}
|
{{ escapeText(description, config.dangerouslyDisableAutoEscaping) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user