Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add package.json

  • Loading branch information...
commit 407c6b00862c797bdad1b41247cfafffef0460f5 1 parent 1885034
@darobin authored
Showing with 40 additions and 0 deletions.
  1. +28 −0 lib/Template.js
  2. +12 −0 package.json
View
28 lib/Template.js
@@ -313,6 +313,34 @@ Template.prototype = {
return ret.replace(/^\s*([\s\S]*?)\s*$/, '$1');
+ },
+
+ /** section: Module
+ * exports.Template#processFile(file, params) -> String
+ * - file (String): the template toolkit file (looked for in INCLUDE_PATH) to parse
+ * - params (Object): params/stash/context for the template
+ *
+ * Parse the TT file using the given variables and return the processed
+ * output.
+ **/
+ processFile: function Template$prototype$processFile (files, params) {
+ var ctx = new Template.Context(this);
+
+ var contents;
+ for (var i in this.config.INCLUDE_PATH) {
+ try {
+ var f = this.config.INCLUDE_PATH[i] + '/' + file;
+ contents = this.load_file(f);
+ break;
+ }
+ catch (e) {
+ // try loading .tt too if the file
+ }
+ }
+
+
+ // load the file, account for INCLUDE_PATH and optional .tt
+ // get it as string and call process()
}
};
View
12 package.json
@@ -0,0 +1,12 @@
+{
+ "name": "Template",
+ "version": "0.4.0",
+ "main": "./lib/Template",
+ "modules": {
+ },
+ "dependencies": {
+ },
+ "engines": {
+ "node": ">=0.1.0"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.