mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
parent
f909937e01
commit
59ab496fbf
3 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
||||||
import handlebars from 'handlebars/dist/handlebars';
|
import handlebars from 'handlebars/dist/handlebars';
|
||||||
export default function replaceVars(str, args = {}, vars = {}) {
|
export default function replaceVars(str, args = {}, vars = {}) {
|
||||||
try {
|
try {
|
||||||
const template = handlebars.compile(str);
|
const template = handlebars.compile(str, { knownHelpersOnly: true });
|
||||||
return template(_.assign({}, vars, { args }));
|
return template(_.assign({}, vars, { args }));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return str;
|
return str;
|
||||||
|
|
|
@ -10,7 +10,7 @@ const formatLookup = {
|
||||||
|
|
||||||
export default (format = '0,0.[00]', template) => {
|
export default (format = '0,0.[00]', template) => {
|
||||||
if (!template) template = '{{value}}';
|
if (!template) template = '{{value}}';
|
||||||
const render = handlebars.compile(template);
|
const render = handlebars.compile(template, { knownHelpersOnly: true });
|
||||||
return (val) => {
|
return (val) => {
|
||||||
const formatString = formatLookup[format] || format;
|
const formatString = formatLookup[format] || format;
|
||||||
let value;
|
let value;
|
||||||
|
|
|
@ -37,7 +37,7 @@ async function buildGallery(comparisons) {
|
||||||
|
|
||||||
const template = Handlebars.compile(await readFileAsync(
|
const template = Handlebars.compile(await readFileAsync(
|
||||||
path.resolve('./utilities/templates/visual_regression_gallery.handlebars')
|
path.resolve('./utilities/templates/visual_regression_gallery.handlebars')
|
||||||
, 'utf8'));
|
, 'utf8'), { knownHelpersOnly: true });
|
||||||
|
|
||||||
const html = template({
|
const html = template({
|
||||||
date: moment().format('MMMM Do YYYY, h:mm:ss a'),
|
date: moment().format('MMMM Do YYYY, h:mm:ss a'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue