summaryrefslogtreecommitdiff
path: root/js/codeq/template.js
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-15 20:01:29 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-15 20:01:29 +0100
commit75d719b67f15e4457162c3ef3bd1db2ef62e55e3 (patch)
tree6a8f527eb255648870d0f48fbec86a21bc2bd46e /js/codeq/template.js
parent07d17ee13777c1ea5ce00b26437ff4e778e19b22 (diff)
Support resource templates in language/group/problem descriptions
Diffstat (limited to 'js/codeq/template.js')
-rw-r--r--js/codeq/template.js10
1 files changed, 10 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>. */
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);
+ }
}
};
})();