Skip to content

Commit

Permalink
Rename json to safedump
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jul 1, 2020
1 parent 53a220f commit 1905443
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion layout/_partials/head/head-unique.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<script{{ pjax }} id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: {{ page.sidebar | json }},
sidebar: {{ page.sidebar | safedump }},
isHome : {{ is_home() }},
isPost : {{ is_post() }},
lang : '{{ page.lang }}'
Expand Down
2 changes: 1 addition & 1 deletion layout/_scripts/pages/schedule.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
};

// Read config form theme config file
Object.assign(calendar, {{ theme.calendar | json }});
Object.assign(calendar, {{ theme.calendar | safedump }});

var now = new Date();
var timeMax = new Date();
Expand Down
6 changes: 3 additions & 3 deletions layout/_third-party/comments/disqus.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
{%- if page.comments %}
<script>
var disqus_config = function() {
this.page.url = {{ page.permalink | json }};
this.page.identifier = {{ page.path | json }};
this.page.title = {{ page.title | json }};
this.page.url = {{ page.permalink | safedump }};
this.page.identifier = {{ page.path | safedump }};
this.page.title = {{ page.title | safedump }};
{% if __('disqus') !== 'disqus' -%}
this.language = '{{ __('disqus') }}';
{% endif -%}
Expand Down
6 changes: 3 additions & 3 deletions layout/_third-party/comments/disqusjs.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
api : '{{ theme.disqusjs.api }}' || 'https://disqus.com/api/',
apikey : '{{ theme.disqusjs.apikey }}',
shortname : '{{ theme.disqusjs.shortname }}',
url : {{ page.permalink | json }},
identifier: {{ page.path | json }},
title : {{ page.title | json }},
url : {{ page.permalink | safedump }},
identifier: {{ page.path | safedump }},
title : {{ page.title | safedump }},
});
}, window.DisqusJS);
});
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/comments/valine.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
new Valine(Object.assign({
el : '#valine-comments',
path: location.pathname,
}, {{ theme.valine | json }}
}, {{ theme.valine | safedump }}
));
}, window.Valine);
});
Expand Down
2 changes: 1 addition & 1 deletion layout/_third-party/statistics/lean-analytics.njk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
});
}

let { app_id, app_key, server_url } = {{ theme.leancloud_visitors | json }};
let { app_id, app_key, server_url } = {{ theme.leancloud_visitors | safedump }};
function fetchData(api_server) {
var Counter = (method, url, data) => {
return fetch(`${api_server}/1.1${url}`, {
Expand Down
2 changes: 1 addition & 1 deletion scripts/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function njkCompile(data) {
const env = nunjucks.configure(templateDir, {
autoescape: false
});
env.addFilter('json', dictionary => {
env.addFilter('safedump', dictionary => {
if (typeof dictionary !== 'undefined' && dictionary !== null) {
return JSON.stringify(dictionary);
}
Expand Down

0 comments on commit 1905443

Please sign in to comment.