diff --git a/src/website/helpers/join.js b/src/website/helpers/join.js new file mode 100644 index 0000000..daee205 --- /dev/null +++ b/src/website/helpers/join.js @@ -0,0 +1,15 @@ +/* + Render elements of an array joined by a separator + Usage: + {{#join list ","}} + {{.}} + {{/join}} +*/ +module.exports = function (array, separator, options) { + const data = require('handlebars').createFrame({}) + const blocks = array.map((item, index) => { + data.index = index + return options.fn(item, {data: data}) + }) + return blocks.join(separator) +} diff --git a/src/website/template.js b/src/website/template.js index 7c60069..9073088 100644 --- a/src/website/template.js +++ b/src/website/template.js @@ -27,6 +27,7 @@ exports.create = function (options) { // common partials handlebars.registerPartial('analytics', compileTemplate(path.join(DIR_TEMPLATES, 'analytics.hbs'))) handlebars.registerPartial('thumbnail', compileTemplate(path.join(DIR_TEMPLATES, 'thumbnail.hbs'))) + handlebars.registerPartial('exif', compileTemplate(path.join(DIR_TEMPLATES, 'exif.hbs'))) // theme partials const partials = fs.readdirSync(DIR_THEME) diff --git a/templates/exif.hbs b/templates/exif.hbs new file mode 100644 index 0000000..bc8affa --- /dev/null +++ b/templates/exif.hbs @@ -0,0 +1,72 @@ +
+ Filename | +{{ filename }} | +
Date taken | +{{date date "DD MMM YYYY"}} | +
Resolution | +{{ width }} x {{ height }} | +
Camera | +{{ make }} | +
Model | +{{ model }} | +
ISO | +{{ iso }} | +
Aperture | +{{ aperture }} | +
Exposure | +{{ exposure }} | +
Flash | +{{ flash }} | +
GPS | +{{ lat }}, {{ long }} | +
Title | +{{ caption }} | +
Description | +{{ description }} | +
Keywords | +{{#join keywords ","}}{{.}}{{/join}} | +
Rating | +{{#times rating}}{{/times}} | +