Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wtf committed Mar 30, 2017
1 parent d9b5dc4 commit 2a234a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ function fillTemplates(sheet) {
teLog(["buildTemplate(%s): WARNING: given %s sourceTemplates; potential collision error", sourceTemplates.length],3);
teLog(["buildTemplate(%s): WARNING: URLs are ", sourceTemplates.map(function(st){ return st.url }).join(", ")],3);
}
var sourceTemplate = sourceTemplates[0];
// if multiple source templates are found, pick the last one
var sourceTemplate = sourceTemplates[sourceTemplates.length-1];
var newTemplate = obtainTemplate_(sourceTemplate.url, sourceTemplate.nocache, readmeDoc);
newTemplate.data = templatedata; // NOTE: this is the first global inside the XML context
newTemplate.data.sheet = sheet; // NOTE: this is the second global inside the XML context
Expand Down Expand Up @@ -710,9 +711,10 @@ function include(name, data, _include, _include2) {
teLog(["include(): found %s: %s", filtered[i].name, filtered[i].url]);
}
if (filtered.length > 1) {
teLog(["include(): found multiple (%s) %s templates; picking the last one.", filtered.length, name],5);
filtered = [filtered.pop()];
teLog(["include(): template url = %s", filtered[0].url],5);
// if multiple templates of the same name are found, pick the last one
teLog(["include(): found multiple (%s) %s templates; picking the last one.", filtered.length, name],5);
filtered = [filtered.pop()];
teLog(["include(): template url = %s", filtered[0].url],5);
}
if (filtered.length == 1) {
var template = filtered[0];
Expand Down

0 comments on commit 2a234a4

Please sign in to comment.