Permalink
Browse files

fix bug in logic to set default template namespace from file import name

  • Loading branch information...
1 parent c378a58 commit 1cdf7d5fbe65576da1fc9f0aaf1b94a13ed6e0ed @nateps nateps committed Aug 7, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/files.js
View
@@ -426,9 +426,10 @@ function parseTemplateFile(root, dir, path, calls, files, templates, instances,
// If 'as' is specified, import into the current namespace
ns = currentNs;
} else {
- // If no namespace is specified, use the src as a namespace.
- // Remove leading '.' and '/' characters
- srcNs = src.replace(/^[.\/]*/, '');
+ // If no namespace is specified, use the src file name
+ // as the default namespace
+ i = src.lastIndexOf('/');
+ srcNs = i ? src.slice(i + 1) : src;
ns = currentNs ? currentNs + ':' + srcNs : srcNs;
}
ns = ns.toLowerCase();

0 comments on commit 1cdf7d5

Please sign in to comment.