From e9f262b9dfc4febf7610d6ab77e99a80db6c7795 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 16 Oct 2012 10:14:41 +0100 Subject: [PATCH] Remove the experimental template mapping system Unnecessarily complicated and JSONy --- core/modules/macros/story/story.js | 42 ++----------------------- core/templates/EditTemplateMappings.tid | 5 --- core/templates/ViewTemplateMappings.tid | 5 --- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 core/templates/EditTemplateMappings.tid delete mode 100644 core/templates/ViewTemplateMappings.tid diff --git a/core/modules/macros/story/story.js b/core/modules/macros/story/story.js index 962b660b8..2520a0472 100644 --- a/core/modules/macros/story/story.js +++ b/core/modules/macros/story/story.js @@ -41,8 +41,6 @@ exports.info = { params: { story: {byName: "default", type: "tiddler"}, history: {byName: "default", type: "tiddler"}, - viewTemplateMappings: {byName: true, type: "filter"}, - editTemplateMappings: {byName: true, type: "filter"}, viewTemplate: {byName: true, type: "tiddler"}, editTemplate: {byName: true, type: "tiddler"}, storyviewTiddler: {byName: true, type: "tiddler"}, @@ -61,47 +59,11 @@ exports.getHistory = function() { this.history = this.wiki.getTiddlerData(this.params.history,{stack: []}); }; -exports.getTemplate = function(title,mappingFilter) { - var tiddler = this.wiki.getTiddler(title), tiddlers = {}; - // Get the mapping tiddlers - var mappingTiddlers = this.wiki.filterTiddlers(mappingFilter), - rules = [], t, json, r, rule; - // Pull out the rules from each tiddler - for(t=0; t=0; r--) { - rule = rules[r]; - if(this.wiki.filterTiddlers(rule.filter,null,tiddlers).length > 0) { - return rule.template; - } - } - } else { - for(r=rules.length-1; r>=0; r--) { - rule = rules[r]; - if(rule.missingTiddler) { - return rule.template; - } - } - } - return null; -}; - exports.getViewTemplate = function(title) { if(this.hasParameter("viewTemplate")) { return this.params.viewTemplate; } else { - return this.getTemplate(title,this.params.viewTemplateMappings || "[tag[$:/tag/view-template-mapping]]"); + return "$:/templates/ViewTemplate"; } }; @@ -109,7 +71,7 @@ exports.getEditTemplate = function(title) { if(this.hasParameter("editTemplate")) { return this.params.editTemplate; } else { - return this.getTemplate(title,this.params.editTemplateMappings || "[tag[$:/tag/edit-template-mapping]]"); + return "$:/templates/EditTemplate"; } }; diff --git a/core/templates/EditTemplateMappings.tid b/core/templates/EditTemplateMappings.tid deleted file mode 100644 index b933c74b6..000000000 --- a/core/templates/EditTemplateMappings.tid +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/templates/EditTemplateMappings -tags: $:/tag/edit-template-mapping -type: application/json - -{"rules":[{"filter":"[has[title]]","template":"$:/templates/EditTemplate","missingTiddler":true,"priority":0}]} \ No newline at end of file diff --git a/core/templates/ViewTemplateMappings.tid b/core/templates/ViewTemplateMappings.tid deleted file mode 100644 index 8c1dbb45c..000000000 --- a/core/templates/ViewTemplateMappings.tid +++ /dev/null @@ -1,5 +0,0 @@ -title: $:/templates/ViewTemplateMappings -tags: $:/tag/view-template-mapping -type: application/json - -{"rules":[{"filter":"[has[title]]","template":"$:/templates/ViewTemplate","missingTiddler":true,"priority":0}]} \ No newline at end of file