You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
committed by
Laurent Cozic
parent
9a4f4cbb65
commit
ac4986b620
@ -4,18 +4,6 @@ const Mustache = require('mustache');
|
|||||||
|
|
||||||
const TemplateUtils = {};
|
const TemplateUtils = {};
|
||||||
|
|
||||||
// new template variables can be added here
|
|
||||||
// If there are too many, this should be moved to a new file
|
|
||||||
const view = {
|
|
||||||
date: time.formatMsToLocal(new Date().getTime(), time.dateFormat()),
|
|
||||||
time: time.formatMsToLocal(new Date().getTime(), time.timeFormat()),
|
|
||||||
datetime: time.formatMsToLocal(new Date().getTime()),
|
|
||||||
custom_datetime: () => {
|
|
||||||
return (text, render) => {
|
|
||||||
return render(time.formatMsToLocal(new Date().getTime(), text));
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Mustache escapes strings (including /) with the html code by default
|
// Mustache escapes strings (including /) with the html code by default
|
||||||
// This isn't useful for markdown so it's disabled
|
// This isn't useful for markdown so it's disabled
|
||||||
@ -24,6 +12,20 @@ Mustache.escape = text => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TemplateUtils.render = function(input) {
|
TemplateUtils.render = function(input) {
|
||||||
|
// new template variables can be added here
|
||||||
|
// If there are too many, this should be moved to a new file
|
||||||
|
// view needs to be set in this function so that the formats reflect settings
|
||||||
|
const view = {
|
||||||
|
date: time.formatMsToLocal(new Date().getTime(), time.dateFormat()),
|
||||||
|
time: time.formatMsToLocal(new Date().getTime(), time.timeFormat()),
|
||||||
|
datetime: time.formatMsToLocal(new Date().getTime()),
|
||||||
|
custom_datetime: () => {
|
||||||
|
return (text, render) => {
|
||||||
|
return render(time.formatMsToLocal(new Date().getTime(), text));
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return Mustache.render(input, view);
|
return Mustache.render(input, view);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user