From 75d719b67f15e4457162c3ef3bd1db2ef62e55e3 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 15 Feb 2016 20:01:29 +0100 Subject: Support resource templates in language/group/problem descriptions --- js/codeq/template.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/codeq/template.js') diff --git a/js/codeq/template.js b/js/codeq/template.js index 361811b..90b4db3 100644 --- a/js/codeq/template.js +++ b/js/codeq/template.js @@ -276,9 +276,19 @@ along with this program. If not, see . */ resources = newResources; }, + // instantiate a template 'process': function (template, templatePath, args) { var fn = templator(template, templatePath); return fn(args); + }, + + // instantiate templates in a lang→template dictionary + 'processDictionary': function (dict, templatePath, args) { + var lang; + for (lang in dict) { + if (!dict.hasOwnProperty(lang)) continue; + dict[lang] = codeq.template.process(dict[lang], templatePath, args); + } } }; })(); -- cgit v1.2.1