Permalink
Browse files

Change the way we refer to template variables

  • Loading branch information...
1 parent 0d017df commit 98223672640559c777c9e662dc574a20fe4b7b0f @thomaslee committed May 12, 2012
View
@@ -60,7 +60,8 @@ def copy_skeleton(basedir, targetdir, params):
break
if parse:
- data = data % params
+ for key, value in params.items():
+ data = data.replace("@%s@" % key.upper(), value)
ostream.write(data)
@@ -1,6 +1,6 @@
-# %(app)s
+# @APP@
-The %(app)s web application.
+The @APP@ web application.
## Usage
@@ -1,8 +1,8 @@
-(defproject %(app)s "0.0.1-SNAPSHOT"
- :description "The %(app)s Compojure application"
+(defproject @APP@ "0.0.1-SNAPSHOT"
+ :description "The @APP@ Compojure application"
:dependencies [[org.clojure/clojure "1.3.0"]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
:plugins [[lein-ring "0.7.0"]]
- :ring {:handler %(app)s.core/app})
+ :ring {:handler @APP@.core/app})
@@ -3780,7 +3780,7 @@ jQuery.fn.extend({
i = 0,
toggler = function( event ) {
// Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) %% i;
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
@@ -4559,11 +4559,11 @@ var Expr = Sizzle.selectors = {
},
even: function( elem, i ) {
- return i %% 2 === 0;
+ return i % 2 === 0;
},
odd: function( elem, i ) {
- return i %% 2 === 1;
+ return i % 2 === 1;
},
lt: function( elem, i, match ) {
@@ -4669,7 +4669,7 @@ var Expr = Sizzle.selectors = {
return diff === 0;
} else {
- return ( diff %% first === 0 && diff / first >= 0 );
+ return ( diff % first === 0 && diff / first >= 0 );
}
}
},
@@ -6815,7 +6815,7 @@ if ( jQuery.expr && jQuery.expr.filters ) {
-var r20 = /%%20/g,
+var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
@@ -8204,7 +8204,7 @@ if ( jQuery.support.ajax ) {
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%%]*)$/i,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
@@ -1,4 +1,4 @@
-(ns %(app)s.core
+(ns @APP@.core
(:use compojure.core)
(:use hiccup.core)
(:require [compojure.route :as route]
@@ -1,5 +1,5 @@
-(ns %(app)s.test.core
- (:use [%(app)s.core])
+(ns @APP@.test.core
+ (:use [@APP@.core])
(:use [clojure.test]))
(deftest replace-me ;; FIXME: write
View
@@ -4,7 +4,7 @@
from flask import Flask, render_template, request, redirect, url_for
-import %(app)s
+import @APP@
app = Flask(__name__)
@@ -57,7 +57,7 @@ input[type="submit"] {
}
#page {
- width: 90%%;
+ width: 90%;
margin: 0 auto;
}
@@ -1,9 +1,9 @@
-{%% extends "layout.html" %%}
-{%% block title %%}not found{%% endblock %%}
-{%% block content %%}
+{% extends "layout.html" %}
+{% block title %}not found{% endblock %}
+{% block content %}
<h1>not found</h1>
<p>Sorry, but that page doesn't exist!</p>
-{%% endblock %%}
+{% endblock %}
@@ -1,9 +1,9 @@
-{%% extends "layout.html" %%}
-{%% block title %%}home{%% endblock %%}
-{%% block content %%}
+{% extends "layout.html" %}
+{% block title %}home{% endblock %}
+{% block content %}
<h1><a href="/">Hello, World</a></h1>
<p>This is a simple Flask application</p>
-{%% endblock %%}
+{% endblock %}
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
-<title>%(app)s / {%% block title %%}untitled{%% endblock %%}</title>
+<title>@APP@ / {% block title %}untitled{% endblock %}</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
@@ -10,9 +10,9 @@
<li><a href="/">home</a></li>
</ul>
<div id="content">
- {%% block content %%}Content goes here{%% endblock %%}
+ {% block content %}Content goes here{% endblock %}
</div>
- <p id="footer">Copyright &copy; 2011 <a href="%(url)s">%(name)s</a></p>
+ <p id="footer">Copyright &copy; 2011 <a href="@URL@">@NAME@</a></p>
</div>
</body>
</html>
@@ -4,7 +4,7 @@
from flask import Flask, render_template, request, redirect, url_for
-import %(app)s
+import @APP@
app = Flask(__name__)
@@ -3780,7 +3780,7 @@ jQuery.fn.extend({
i = 0,
toggler = function( event ) {
// Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) %% i;
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
@@ -4559,11 +4559,11 @@ var Expr = Sizzle.selectors = {
},
even: function( elem, i ) {
- return i %% 2 === 0;
+ return i % 2 === 0;
},
odd: function( elem, i ) {
- return i %% 2 === 1;
+ return i % 2 === 1;
},
lt: function( elem, i, match ) {
@@ -4669,7 +4669,7 @@ var Expr = Sizzle.selectors = {
return diff === 0;
} else {
- return ( diff %% first === 0 && diff / first >= 0 );
+ return ( diff % first === 0 && diff / first >= 0 );
}
}
},
@@ -6815,7 +6815,7 @@ if ( jQuery.expr && jQuery.expr.filters ) {
-var r20 = /%%20/g,
+var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
@@ -8204,7 +8204,7 @@ if ( jQuery.support.ajax ) {
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%%]*)$/i,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
@@ -1,10 +1,10 @@
-{%% extends "layout.html" %%}
-{%% block title %%}not found{%% endblock %%}
-{%% block h1 %%}Not Found{%% endblock %%}
+{% extends "layout.html" %}
+{% block title %}not found{% endblock %}
+{% block h1 %}Not Found{% endblock %}
-{%% block sidebar %%}{{ %(app)s.local_nav() }}{%% endblock %%}
-{%% block content %%}
+{% block sidebar %}{{ @APP@.local_nav() }}{% endblock %}
+{% block content %}
<p>The thing you were looking for doesn't seem to exist</p>
-{%% endblock %%}
+{% endblock %}
@@ -1,8 +1,8 @@
-{%% import "macros.html" as m %%}
-{%% macro local_nav(active=None) %%}
- {%% call m.nav() %%}
+{% import "macros.html" as m %}
+{% macro local_nav(active=None) %}
+ {% call m.nav() %}
{{ m.navitem("Item 1", "/item1", active == "item1") }}
{{ m.navitem("Item 2", "/item2", active == "item2") }}
- {%% endcall %%}
-{%%- endmacro %%}
+ {% endcall %}
+{%- endmacro %}
@@ -1,10 +1,10 @@
-{%% extends "layout.html" %%}
-{%% block title %%}home{%% endblock %%}
-{%% block h1 %%}Home{%% endblock %%}
+{% extends "layout.html" %}
+{% block title %}home{% endblock %}
+{% block h1 %}Home{% endblock %}
-{%% block sidebar %%}{{ %(app)s.local_nav("item1") }}{%% endblock %%}
+{% block sidebar %}{{ @APP@.local_nav("item1") }}{% endblock %}
-{%% block content %%}
+{% block content %}
<div class="well">
<p>Hello, World!</p>
@@ -18,14 +18,14 @@ <h2>Hello World</h2>
</div>
<div class="modal-body">
<p>This is a modal</p>
- {%% call m.form("/foo") %%}
+ {% call m.form("/foo") %}
{{ m.text_field("Build #", build) }}
- {%% endcall %%}
+ {% endcall %}
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary">Save</a>
<a href="#" data-dismiss="modal" class="btn">Cancel</a>
</div>
</div>
-{%% endblock %%}
+{% endblock %}
@@ -1,10 +1,10 @@
-{%% import "macros.html" as m %%}
-{%% import "%(app)s_macros.html" as %(app)s %%}
+{% import "macros.html" as m %}
+{% import "@APP@_macros.html" as @APP@ %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
- <title>{%% block title %%}title{%% endblock %%} : %(app)s</title>
+ <title>{% block title %}title{% endblock %} : @APP@</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
@@ -16,7 +16,7 @@
}
</style>
<link href="/static/css/bootstrap-responsive.css" rel="stylesheet">
- <link href="/static/css/%(app)s.css" rel="stylesheet">
+ <link href="/static/css/@APP@.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
@@ -34,7 +34,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
- <a class="brand" href="/">%(app)s</a>
+ <a class="brand" href="/">@APP@</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
@@ -54,14 +54,14 @@
<div class="container">
- <h1>{%% block h1 %%}h1{%% endblock %%}</h1>
+ <h1>{% block h1 %}h1{% endblock %}</h1>
<div class="row">
<div class="span3">
- {%% block sidebar %%}Sidebar{%% endblock %%}
+ {% block sidebar %}Sidebar{% endblock %}
</div>
<div class="span9">
- {%% block content %%}Content{%% endblock %%}
+ {% block content %}Content{% endblock %}
</div>
</div>
@@ -70,7 +70,7 @@ <h1>{%% block h1 %%}h1{%% endblock %%}</h1>
<script src="/static/js/jquery.js"></script>
<script src="/static/js/bootstrap.js"></script>
- <script src="/static/js/%(app)s.js"></script>
- {%% block end_body %%}{%% endblock %%}
+ <script src="/static/js/@APP@.js"></script>
+ {% block end_body %}{% endblock %}
</body>
</html>
Oops, something went wrong.

0 comments on commit 9822367

Please sign in to comment.