From: Jason Skomorowski Date: Mon, 7 Jul 2014 23:30:04 +0000 (-0400) Subject: Merge branch 'master' into templateallthemarkup X-Git-Tag: 1.0.0~324^2~58 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=cda7d85862a85b0841478d87a086582cb02ba002;p=mkws-moved-to-github.git Merge branch 'master' into templateallthemarkup Conflicts: src/.gitignore src/mkws-core.js src/mkws-team.js src/mkws-widget-termlists.js tools/htdocs/Makefile --- cda7d85862a85b0841478d87a086582cb02ba002 diff --cc src/mkws-team.js index d209e43,f4e0c88..52f2ee5 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@@ -386,36 -386,41 +386,36 @@@ function team($, teamName) }; - function loadTemplate(name) { + function loadTemplate(name, fallbackString) { var template = m_template[name]; - - if (template === undefined) { - // Fall back to generic template if there is no team-specific one + if (template === undefined && Handlebars.compile) { var source; var node = $(".mkwsTemplate_" + name + " .mkwsTeam_" + that.name()); if (node && node.length < 1) { node = $(".mkwsTemplate_" + name); } - if (node) { - source = node.html(); - } - - // If the template is not defined in HTML, check the following - // in order: template registered in the team by a widget; - // fallback string provided on this invocation; global default. - if (!source) { - source = m_templateText[name]; - } - if (!source) { - source = fallbackString; - } - if (!source) { - source = mkws.defaultTemplate(name); + if (node) source = node.html(); + if (!source) source = m_templateText[name]; + if (source) { + template = Handlebars.compile(source); + log("compiled template '" + name + "'"); } - - if (!source) return null; - template = Handlebars.compile(source); - log("compiled template '" + name + "'"); + } + //if (template === undefined) template = mkws_templatesbyteam[m_teamName][name]; + if (template === undefined && Handlebars.templates) { + template = Handlebars.templates[name]; + } + if (template === undefined && mkws.defaultTemplates) { + template = mkws.defaultTemplates[name]; + } + if (template) { m_template[name] = template; + return template; } - - return template; + else { + alert("Missing MKWS template for " + name); + } - } + } that.loadTemplate = loadTemplate; diff --cc src/mkws-templates.js index 0000000,0000000..86150aa new file mode 100644 --- /dev/null +++ b/src/mkws-templates.js @@@ -1,0 -1,0 +1,388 @@@ ++(function() { ++ var template = Handlebars.template, templates = mkws.defaultTemplates = mkws.defaultTemplates || {}; ++templates['Image'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing; ++ ++function program1(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n \n "; ++ stack1 = (helper = helpers['mkws-first'] || (depth0 && depth0['mkws-first']),options={hash:{},inverse:self.noop,fn:self.programWithDepth(2, program2, data, depth0),data:data},helper ? helper.call(depth0, (depth0 && depth0['md-thumburl']), options) : helperMissing.call(depth0, "mkws-first", (depth0 && depth0['md-thumburl']), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n
\n
\n"; ++ return buffer; ++ } ++function program2(depth0,data,depth1) { ++ ++ var buffer = "", stack1; ++ buffer += "\n \""\n "; ++ return buffer; ++ } ++ ++ buffer += "\n"; ++ stack1 = helpers.each.call(depth0, (depth0 && depth0.hits), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ return buffer; ++ }); ++templates['Record'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this; ++ ++function program1(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n ("; ++ if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + ")\n "; ++ return buffer; ++ } ++ ++function program3(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n "; ++ if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n "; ++ return buffer; ++ } ++ ++function program5(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n \n " ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Date", options) : helperMissing.call(depth0, "mkws-translate", "Date", options))) ++ + "\n "; ++ if (helper = helpers['md-date']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-date']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n \n "; ++ return buffer; ++ } ++ ++function program7(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n \n " ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Author", options) : helperMissing.call(depth0, "mkws-translate", "Author", options))) ++ + "\n "; ++ if (helper = helpers['md-author']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-author']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n \n "; ++ return buffer; ++ } ++ ++function program9(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n \n " ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Links", options) : helperMissing.call(depth0, "mkws-translate", "Links", options))) ++ + "\n \n "; ++ stack1 = helpers.each.call(depth0, (depth0 && depth0['md-electronic-url']), {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n \n \n "; ++ return buffer; ++ } ++function program10(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n Link"; ++ if (helper = helpers['mkws-index1']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['mkws-index1']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n "; ++ return buffer; ++ } ++ ++function program12(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n \n " ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Subject", options) : helperMissing.call(depth0, "mkws-translate", "Subject", options))) ++ + "\n \n "; ++ stack1 = (helper = helpers['mkws-first'] || (depth0 && depth0['mkws-first']),options={hash:{ ++ 'having': ("md-subject") ++ },inverse:self.noop,fn:self.program(13, program13, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-first", (depth0 && depth0.location), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n \n \n "; ++ return buffer; ++ } ++function program13(depth0,data) { ++ ++ var buffer = "", stack1; ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-subject']), {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ return buffer; ++ } ++function program14(depth0,data) { ++ ++ var buffer = "", stack1, helper, options; ++ buffer += "\n "; ++ stack1 = (helper = helpers['mkws-commaList'] || (depth0 && depth0['mkws-commaList']),options={hash:{},inverse:self.noop,fn:self.program(15, program15, data),data:data},helper ? helper.call(depth0, (depth0 && depth0['md-subject']), options) : helperMissing.call(depth0, "mkws-commaList", (depth0 && depth0['md-subject']), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ return buffer; ++ } ++function program15(depth0,data) { ++ ++ var buffer = ""; ++ buffer += "\n " ++ + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0)); ++ return buffer; ++ } ++ ++function program17(depth0,data) { ++ ++ var buffer = "", helper, options; ++ buffer += "\n " ++ + escapeExpression((helper = helpers['mkws-attr'] || (depth0 && depth0['mkws-attr']),options={hash:{},data:data},helper ? helper.call(depth0, "@name", options) : helperMissing.call(depth0, "mkws-attr", "@name", options))); ++ return buffer; ++ } ++ ++ buffer += "\n\n \n \n \n \n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-date']), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-author']), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-electronic-url']), {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = (helper = helpers['mkws-if-any'] || (depth0 && depth0['mkws-if-any']),options={hash:{ ++ 'having': ("md-subject") ++ },inverse:self.noop,fn:self.program(12, program12, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-if-any", (depth0 && depth0.location), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n \n \n \n \n
" ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Title", options) : helperMissing.call(depth0, "mkws-translate", "Title", options))) ++ + "\n "; ++ if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n
" ++ + escapeExpression((helper = helpers['mkws-translate'] || (depth0 && depth0['mkws-translate']),options={hash:{},data:data},helper ? helper.call(depth0, "Locations", options) : helperMissing.call(depth0, "mkws-translate", "Locations", options))) ++ + "\n "; ++ stack1 = (helper = helpers['mkws-commaList'] || (depth0 && depth0['mkws-commaList']),options={hash:{},inverse:self.noop,fn:self.program(17, program17, data),data:data},helper ? helper.call(depth0, (depth0 && depth0.location), options) : helperMissing.call(depth0, "mkws-commaList", (depth0 && depth0.location), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n
\n"; ++ return buffer; ++ }); ++templates['Records'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; ++ ++function program1(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n
\n \n "; ++ if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n \n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0.renderedDetails), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n
\n"; ++ return buffer; ++ } ++function program2(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n "; ++ if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n "; ++ return buffer; ++ } ++ ++function program4(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n "; ++ if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n "; ++ return buffer; ++ } ++ ++function program6(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n "; ++ if (helper = helpers.renderedDetails) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0.renderedDetails); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n "; ++ return buffer; ++ } ++ ++ buffer += "\n"; ++ stack1 = helpers.each.call(depth0, (depth0 && depth0.hits), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ return buffer; ++ }); ++templates['Reference'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing; ++ ++function program1(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n"; ++ if (helper = helpers['md-title-remainder']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-remainder']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n"; ++ return buffer; ++ } ++ ++function program3(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n"; ++ if (helper = helpers['md-title-responsibility']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title-responsibility']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n"; ++ return buffer; ++ } ++ ++ buffer += "\n\"";\n

"; ++ if (helper = helpers['md-title']) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0['md-title']); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "

\n"; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-remainder']), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ stack1 = helpers['if'].call(depth0, (depth0 && depth0['md-title-responsibility']), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ stack1 = (helper = helpers['mkws-paragraphs'] || (depth0 && depth0['mkws-paragraphs']),options={hash:{},data:data},helper ? helper.call(depth0, (depth0 && depth0['md-description']), (depth0 && depth0.paragraphs), (depth0 && depth0.sentences), options) : helperMissing.call(depth0, "mkws-paragraphs", (depth0 && depth0['md-description']), (depth0 && depth0.paragraphs), (depth0 && depth0.sentences), options)); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n

Wikipedia

\n"; ++ return buffer; ++ }); ++templates['Facet'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this; ++ ++function program1(depth0,data) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n
\n "; ++ if (helper = helpers.term) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0.term); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + " "; ++ if (helper = helpers.count) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0.count); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "\n
\n"; ++ return buffer; ++ } ++ ++ buffer += "\n\n
"; ++ if (helper = helpers.caption) { stack1 = helper.call(depth0, {hash:{},data:data}); } ++ else { helper = (depth0 && depth0.caption); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; } ++ buffer += escapeExpression(stack1) ++ + "
\n"; ++ stack1 = helpers.each.call(depth0, (depth0 && depth0.terms), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ return buffer; ++ }); ++templates['Termlists'] = template(function (Handlebars,depth0,helpers,partials,data) { ++ this.compilerInfo = [4,'>= 1.0.0']; ++helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; ++ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; ++ ++function program1(depth0,data,depth1) { ++ ++ var buffer = "", stack1, helper; ++ buffer += "\n
\n"; ++ return buffer; ++ } ++ ++ buffer += "\n\n
Termlists
\n"; ++ stack1 = helpers.each.call(depth0, (depth0 && depth0.facets), {hash:{},inverse:self.noop,fn:self.programWithDepth(1, program1, data, depth0),data:data}); ++ if(stack1 || stack1 === 0) { buffer += stack1; } ++ buffer += "\n"; ++ return buffer; ++ }); ++})(); diff --cc tools/htdocs/Makefile index 0000000,388a4b8..02d64f8 mode 000000,100644..100644 --- a/tools/htdocs/Makefile +++ b/tools/htdocs/Makefile @@@ -1,0 -1,98 +1,102 @@@ + # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com + + SRC= ../../src + + HANDLEBARS_FILE = handlebars-v1.1.2.js + JQUERY_FILE = jquery-1.10.0.min.js + JQUERY_JSON_FILE = jquery.json-2.4.js + PP2_FILE = pz2.js + + HANDLEBARS_URL = http://builds.handlebarsjs.com.s3.amazonaws.com/${HANDLEBARS_FILE} + JQUERY_URL = http://code.jquery.com/${JQUERY_FILE} + JQUERY_JSON_URL = https://jquery-json.googlecode.com/files/${JQUERY_JSON_FILE} + PP2_URL = http://git.indexdata.com/?p=pazpar2.git;a=blob_plain;f=js/${PP2_FILE};hb=HEAD + + JQUERY_UI_URL = http://code.jquery.com/ui/1.10.3/jquery-ui.js + VERSION = $(shell tr -d '\012' < ${SRC}/VERSION) + + COMPONENTS = ${SRC}/mkws-handlebars.js \ + ${SRC}/mkws-core.js ${SRC}/mkws-team.js ${SRC}/mkws-filter.js \ ++ ${SRC}/mkws-templates.js \ + ${SRC}/mkws-widget.js ${SRC}/mkws-widget-main.js ${SRC}/mkws-widget-termlists.js \ + ${SRC}/mkws-widget-authname.js ${SRC}/mkws-widget-categories.js ${SRC}/mkws-widget-log.js \ + ${SRC}/mkws-widget-record.js ${SRC}/mkws-widget-reference.js ${SRC}/mkws-widget-builder.js + + GENERATED = ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} \ - mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js ++ mkws.js mkws.min.js mkws-complete.js mkws-complete.min.js mkws-templates.js + + **make-default**: all + + all: mkws.min.js mkws-complete.min.js + + mkws-js mkws-complete.js: Makefile mkws.js ${SRC}/mkws-jquery.js ${HANDLEBARS_FILE} ${JQUERY_FILE} ${JQUERY_JSON_FILE} ${PP2_FILE} + ( set -e; \ + echo "/*! Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com"; \ + echo " Licence: GPL, http://www.indexdata.com/licences/gpl"; \ + echo " created at: $$(date)"; \ + echo " MKWS GIT id: $$(git show | head -n 1 | perl -npe 's,\S+\s+,,')"; \ + echo " pz2.js GIT id: $$(curl -sSf 'http://git.indexdata.com/?p=pazpar2.git;a=rss' | egrep ',')"; \ + echo "*/"; \ + cat ${JQUERY_FILE}; \ + cat ${JQUERY_JSON_FILE}; \ + echo 'mkws_jQuery = jQuery.noConflict(true);'; \ + cat ${HANDLEBARS_FILE}; \ + cat ${PP2_FILE}; \ + cat mkws.js; \ + cat ${SRC}/mkws-jquery.js; \ + ) > mkws-complete.js.tmp + mv -f mkws-complete.js.tmp mkws-complete.js + + %.min.js: %.js + yui-compressor $? > $@.tmp + mv -f $@.tmp $@ + + mkws-syntax-check: + yui-compressor mkws.js >/dev/null + + ${HANDLEBARS_FILE}: + curl -sSf ${HANDLEBARS_URL} -o $@.tmp + mv -f $@.tmp $@ + + ${JQUERY_FILE}: + curl -sSf ${JQUERY_URL} -o $@.tmp + perl -npe 's,sourceMappingURL=jquery.*map,,' $@.tmp > $@ + rm -f $@.tmp + + ${JQUERY_JSON_FILE}: + curl -sSf ${JQUERY_JSON_URL} -o $@.tmp + mv -f $@.tmp $@ + + ${PP2_FILE}: + curl -sSf "${PP2_URL}" -o $@.tmp + mv -f $@.tmp $@ + + release: mkws.js mkws-complete.js mkws.min.js mkws-complete.min.js + @if [ -f ${SRC}/releases/mkws-$(VERSION).js ]; then \ + echo "*** There is already a release $(VERSION)"; \ + else \ + cp -p mkws.js ${SRC}/releases/mkws-$(VERSION).js; \ + cp -p mkws.min.js ${SRC}/releases/mkws-$(VERSION).min.js; \ + cp -p mkws-complete.js ${SRC}/releases/mkws-complete-$(VERSION).js; \ + cp -p mkws-complete.min.js ${SRC}/releases/mkws-complete-$(VERSION).min.js; \ + echo "Made release $(VERSION)"; \ + fi + -mkws.js: $(COMPONENTS) Makefile ++mkws.js: mkws-templates.js $(COMPONENTS) Makefile + rm -f $@ + cat ${COMPONENTS} > $@.tmp + mv -f $@.tmp $@ + chmod 444 $@ + ++mkws-templates.js: ++ handlebars -n mkws.defaultTemplates ${SRC}/*.templates/*.handlebars -f ${SRC}/mkws-templates.js ++ + distclean: clean + @echo "(No need for distclean, 'make clean' is fine)" + + clean: + rm -f ${GENERATED} + + help: + @echo "make [ all | release | clean | distclean ]" + @echo " [ mkws-syntax-check ]"