diff --git a/lib/couchrest/helper/app-template/forms/example-form.js b/lib/couchrest/helper/app-template/forms/example-form.js index 5f3079f..e145fc5 100644 --- a/lib/couchrest/helper/app-template/forms/example-form.js +++ b/lib/couchrest/helper/app-template/forms/example-form.js @@ -1,7 +1,6 @@ function(doc, req) { - // !include lib.templates - - // !require lib.helpers.template + // !code lib.helpers.template + // !json lib.templates respondWith(req, { html : function() { diff --git a/lib/couchrest/helper/app-template/views/example/map.js b/lib/couchrest/helper/app-template/views/example/map.js index 11668f5..ead196b 100644 --- a/lib/couchrest/helper/app-template/views/example/map.js +++ b/lib/couchrest/helper/app-template/views/example/map.js @@ -1,6 +1,6 @@ // an example map function, emits the doc id // and the list of keys it contains -// !require lib.helpers.math +// !code lib.helpers.math function(doc) { var k, keys = [] diff --git a/lib/couchrest/helper/file_manager.rb b/lib/couchrest/helper/file_manager.rb index 2ec0e6e..f4440e4 100644 --- a/lib/couchrest/helper/file_manager.rb +++ b/lib/couchrest/helper/file_manager.rb @@ -172,7 +172,7 @@ module CouchRest # process requires def process_require(f_string) - f_string.gsub /(\/\/|#)\ ?!require (.*)/ do + f_string.gsub /(\/\/|#)\ ?!code (.*)/ do fields = $2.split('.') library = @doc fields.each do |field| @@ -188,7 +188,7 @@ module CouchRest # process includes included = {} - f_string.gsub /(\/\/|#)\ ?!include (.*)/ do + f_string.gsub /(\/\/|#)\ ?!json (.*)/ do fields = $2.split('.') library = @doc include_to = included @@ -214,7 +214,8 @@ module CouchRest varstrings = included.collect do |k, v| "var #{k} = #{v.to_json};" end - f_string.sub /(\/\/|#)\ ?!include (.*)/, varstrings.join("\n") + # just replace the first instance of the macro + f_string.sub /(\/\/|#)\ ?!json (.*)/, varstrings.join("\n") end rval