use Python 2.4 compatible script; update Smarty templates

This commit is contained in:
Zach Prezkuta 2013-01-10 22:34:23 -07:00
parent eb6c46a303
commit cd017282e4
19 changed files with 29 additions and 26 deletions

View file

@ -77,7 +77,7 @@ def fix_element(element):
if parts[first+1][0] == '$': if parts[first+1][0] == '$':
# This takes care of elements where the filename is a variable, e.g. {{ inc $file }} # This takes care of elements where the filename is a variable, e.g. {{ inc $file }}
element += 'file:' + ldelim + parts[first+1].rstrip('}') + rdelim element += ldelim + parts[first+1].rstrip('}') + rdelim
else: else:
# This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }} # This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }}
element += parts[first+1].rstrip('}') element += parts[first+1].rstrip('}')
@ -189,10 +189,14 @@ for a_file in files:
filename = os.path.join(path,a_file) filename = os.path.join(path,a_file)
ext = a_file.split('.')[-1] ext = a_file.split('.')[-1]
if os.path.isfile(filename) and ext == 'tpl': if os.path.isfile(filename) and ext == 'tpl':
with open(filename, 'r') as f: f = open(filename, 'r')
newfilename = os.path.join(outpath,a_file) newfilename = os.path.join(outpath,a_file)
with open(newfilename, 'w') as outf: outf = open(newfilename, 'w')
print "Converting " + filename + " to " + newfilename print "Converting " + filename + " to " + newfilename
convert(f, outf, php_tpl) convert(f, outf, php_tpl)
outf.close()
f.close()

View file

@ -11,7 +11,7 @@
{{/if}} {{/if}}
{{if $item.comment_lastcollapsed}}</div>{{/if}} {{if $item.comment_lastcollapsed}}</div>{{/if}}
{{include file="file:{{$item.template}}"}} {{include file="{{$item.template}}"}}
{{/foreach}} {{/foreach}}

View file

@ -1,7 +1,7 @@
{{$live_update}} {{$live_update}}
{{foreach $threads as $thread}} {{foreach $threads as $thread}}
{{include file="file:{{$thread.template}}" item=$thread}} {{include file="{{$thread.template}}" item=$thread}}
{{/foreach}} {{/foreach}}
<div id="conversation-end"></div> <div id="conversation-end"></div>

View file

@ -132,7 +132,7 @@ class="icon recycle wall-item-share-buttons" title="{{$item.vote.share.0}}" onc
<div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div> <div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div>
</div> </div>
{{foreach $item.children as $child}} {{foreach $item.children as $child}}
{{include file="file:{{$child.template}}" item=$child}} {{include file="{{$child.template}}" item=$child}}
{{/foreach}} {{/foreach}}
</div> </div>

View file

@ -11,7 +11,7 @@
{{/if}} {{/if}}
{{if $item.comment_lastcollapsed}}</div>{{/if}} {{if $item.comment_lastcollapsed}}</div>{{/if}}
{{include file="file:{{$item.template}}"}} {{include file="{{$item.template}}"}}
{{/foreach}} {{/foreach}}

View file

@ -11,7 +11,7 @@
<p id="register-realpeople">{{$realpeople}}</p> <p id="register-realpeople">{{$realpeople}}</p>
<br /> <br />
{{if $oidlabel }} {{if $oidlabel}}
<div id="register-openid-wrapper" > <div id="register-openid-wrapper" >
<label for="register-openid" id="label-register-openid" >{{$oidlabel}}</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="{{$openid}}" > <label for="register-openid" id="label-register-openid" >{{$oidlabel}}</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="{{$openid}}" >
</div> </div>

View file

@ -1,7 +1,7 @@
{{$live_update}} {{$live_update}}
{{foreach $threads as $thread}} {{foreach $threads as $thread}}
{{include file="file:{{$thread.template}}" item=$thread}} {{include file="{{$thread.template}}" item=$thread}}
{{/foreach}} {{/foreach}}
<div id="conversation-end"></div> <div id="conversation-end"></div>

View file

@ -113,7 +113,7 @@
<!--<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>--> <!--<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>-->
<!--</div>--> <!--</div>-->
{{foreach $item.children as $child}} {{foreach $item.children as $child}}
{{include file="file:{{$child.template}}" item=$child}} {{include file="{{$child.template}}" item=$child}}
{{/foreach}} {{/foreach}}
{{if $item.flatten}} {{if $item.flatten}}

View file

@ -9,7 +9,6 @@
</div> </div>
<div class="acl-list-item" rel="acl-template" style="display:none"> <div class="acl-list-item" rel="acl-template" style="display:none">
<img data-src="{0}"><p>{1}</p>
<a href="#" class='acl-button-show'>{{$show}}</a> <a href="#" class='acl-button-show'>{{$show}}</a>
<a href="#" class='acl-button-hide'>{{$hide}}</a> <a href="#" class='acl-button-hide'>{{$hide}}</a>
</div> </div>

View file

@ -11,7 +11,7 @@
<p id="register-realpeople">{{$realpeople}}</p> <p id="register-realpeople">{{$realpeople}}</p>
<br /> <br />
{{if $oidlabel }} {{if $oidlabel}}
<div id="register-openid-wrapper" > <div id="register-openid-wrapper" >
<label for="register-openid" id="label-register-openid" >{{$oidlabel}}</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="{{$openid}}" > <label for="register-openid" id="label-register-openid" >{{$oidlabel}}</label><input type="text" maxlength="60" size="32" name="openid_url" class="openid" id="register-openid" value="{{$openid}}" >
</div> </div>

View file

@ -13,7 +13,7 @@
{{$live_update}} {{$live_update}}
{{foreach $threads as $thread}} {{foreach $threads as $thread}}
{{include file="file:{{$thread.template}}" item=$thread}} {{include file="{{$thread.template}}" item=$thread}}
{{/foreach}} {{/foreach}}
<div id="conversation-end"></div> <div id="conversation-end"></div>

View file

@ -112,7 +112,7 @@
<!--<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>--> <!--<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>-->
<!--</div>--> <!--</div>-->
{{foreach $item.children as $child}} {{foreach $item.children as $child}}
{{include file="file:{{$child.template}}" item=$child}} {{include file="{{$child.template}}" item=$child}}
{{/foreach}} {{/foreach}}
{{if $item.flatten}} {{if $item.flatten}}

View file

@ -17,7 +17,7 @@
{{if $item.type == tag}} {{if $item.type == tag}}
{{include file="wall_item_tag.tpl"}} {{include file="wall_item_tag.tpl"}}
{{else}} {{else}}
{{include file="file:{{$item.template}}"}} {{include file="{{$item.template}}"}}
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}

View file

@ -8,7 +8,7 @@
{{if $thread.type == tag}} {{if $thread.type == tag}}
{{include file="wall_item_tag.tpl" item=$thread}} {{include file="wall_item_tag.tpl" item=$thread}}
{{else}} {{else}}
{{include file="file:{{$thread.template}}" item=$thread}} {{include file="{{$thread.template}}" item=$thread}}
{{/if}} {{/if}}
</div> </div>

View file

@ -149,7 +149,7 @@
{{if $child.type == tag}} {{if $child.type == tag}}
{{include file="wall_item_tag.tpl" item=$child}} {{include file="wall_item_tag.tpl" item=$child}}
{{else}} {{else}}
{{include file="file:{{$item.template}}" item=$child}} {{include file="{{$item.template}}" item=$child}}
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}

View file

@ -148,7 +148,7 @@
<div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div> <div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div>
{{foreach $item.children as $child}} {{foreach $item.children as $child}}
{{include file="file:{{$child.template}}" item=$child}} {{include file="{{$child.template}}" item=$child}}
{{/foreach}} {{/foreach}}
{{if $item.flatten}} {{if $item.flatten}}

View file

@ -95,7 +95,7 @@
<div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div> <div class="wall-item-outside-wrapper-end {{$item.indent}} {{$item.shiny}}" ></div>
{{foreach $item.children as $child}} {{foreach $item.children as $child}}
{{include file="file:{{$child.template}}" item=$child}} {{include file="{{$child.template}}" item=$child}}
{{/foreach}} {{/foreach}}
{{if $item.flatten}} {{if $item.flatten}}

View file

@ -8,7 +8,7 @@
{{if $thread.type == tag}} {{if $thread.type == tag}}
{{include file="wall_item_tag.tpl" item=$thread}} {{include file="wall_item_tag.tpl" item=$thread}}
{{else}} {{else}}
{{include file="file:{{$thread.template}}" item=$thread}} {{include file="{{$thread.template}}" item=$thread}}
{{/if}} {{/if}}
</div> </div>

View file

@ -150,7 +150,7 @@
{{if $item.type == tag}} {{if $item.type == tag}}
{{include file="wall_item_tag.tpl" item=$child}} {{include file="wall_item_tag.tpl" item=$child}}
{{else}} {{else}}
{{include file="file:{{$item.template}}" item=$child}} {{include file="{{$item.template}}" item=$child}}
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}