Browse Source

Issue #11

Rolled back the functionality added in r152 (Issue #9).
The idea of an auto-changing template root folder is going away 
because it is not the "Django way".  The Djnago way is to have
all include paths relative to a base folder (although they do
support many base folders, but I digress).

Trying to support both systems is too complex and introduces unnecessary
ambiguity about the current include path for those doing it the Django way.



git-svn-id: http://erlydtl.googlecode.com/svn/trunk@157 a5195066-8e3e-0410-a82a-05b01b1b9875
colm.dougan 16 years ago
parent
commit
b0f1c3ddff

+ 1 - 1
examples/docroot/path1/base1

@@ -1,4 +1,4 @@
-{% extends "../path2/base2" %}
+{% extends "path2/base2" %}
 
 {% block title2 %}block title 2 from  base1 {% endblock %}
 

+ 1 - 1
examples/docroot/path1/template1

@@ -2,4 +2,4 @@ This is template 1.
 
 {{ test_var }}
 
-{% include "../path2/template2" %}
+{% include "path2/template2" %}

+ 2 - 4
src/erlydtl/erlydtl_compiler.erl

@@ -293,8 +293,7 @@ body_ast([{extends, {string_literal, _Pos, String}} | ThisParseTree], Context, T
                     with_dependency({File, CheckSum}, body_ast(ParentParseTree, Context#dtl_context{
                         block_dict = dict:merge(fun(_Key, _ParentVal, ChildVal) -> ChildVal end,
                             BlockDict, Context#dtl_context.block_dict),
-                                parse_trail = [File | Context#dtl_context.parse_trail], 
-                                doc_root = filename:dirname(File)}, TreeWalker));
+                                parse_trail = [File | Context#dtl_context.parse_trail]}, TreeWalker));
                 Err ->
                     throw(Err)
             end        
@@ -450,8 +449,7 @@ include_ast(File, Context, TreeWalker) ->
     case parse(FilePath, Context) of
         {ok, InclusionParseTree, CheckSum} ->
             with_dependency({FilePath, CheckSum}, body_ast(InclusionParseTree, Context#dtl_context{
-                parse_trail = [FilePath | Context#dtl_context.parse_trail], 
-                doc_root = filename:dirname(FilePath) }, TreeWalker));
+                parse_trail = [FilePath | Context#dtl_context.parse_trail]}, TreeWalker));
         Err ->
             throw(Err)
     end.