Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change the way we refer to template variables

  • Loading branch information...
commit 98223672640559c777c9e662dc574a20fe4b7b0f 1 parent 0d017df
@thomaslee authored
View
3  gener.in
@@ -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)
View
4 skel/compojure-bootstrap/README
@@ -1,6 +1,6 @@
-# %(app)s
+# @APP@
-The %(app)s web application.
+The @APP@ web application.
## Usage
View
6 skel/compojure-bootstrap/project.clj
@@ -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})
View
12 skel/compojure-bootstrap/resources/public/js/jquery.js
@@ -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
View
2  skel/compojure-bootstrap/src/__APP__/core.clj
@@ -1,4 +1,4 @@
-(ns %(app)s.core
+(ns @APP@.core
(:use compojure.core)
(:use hiccup.core)
(:require [compojure.route :as route]
View
4 skel/compojure-bootstrap/test/__APP__/test/core.clj
@@ -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
2  skel/flask-app/app.py
@@ -4,7 +4,7 @@
from flask import Flask, render_template, request, redirect, url_for
-import %(app)s
+import @APP@
app = Flask(__name__)
View
2  skel/flask-app/static/style.css
@@ -57,7 +57,7 @@ input[type="submit"] {
}
#page {
- width: 90%%;
+ width: 90%;
margin: 0 auto;
}
View
8 skel/flask-app/templates/404.html
@@ -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 %}
View
8 skel/flask-app/templates/index.html
@@ -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 %}
View
6 skel/flask-app/templates/layout.html
@@ -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>
View
2  skel/flask-bootstrap/app.py
@@ -4,7 +4,7 @@
from flask import Flask, render_template, request, redirect, url_for
-import %(app)s
+import @APP@
app = Flask(__name__)
View
12 skel/flask-bootstrap/static/js/jquery.js
@@ -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
View
12 skel/flask-bootstrap/templates/404.html
@@ -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 %}
View
10 skel/flask-bootstrap/templates/__APP___macros.html
@@ -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 %}
View
16 skel/flask-bootstrap/templates/index.html
@@ -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 @@
</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 %}
View
20 skel/flask-bootstrap/templates/layout.html
@@ -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 @@
<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>
View
52 skel/flask-bootstrap/templates/macros.html
@@ -1,60 +1,60 @@
-{%% macro navitem(text, href, active=False, icon=None) %%}
-<li{%% if active %%} class="active"{%% endif %%}><a href="{{href}}">{%% if icon %%}<i class="icon-{{icon}}{%% if active %%} icon-white{%% endif %%}"></i>{%% endif %%} {{text|e}}</a></li>
-{%%- endmacro %%}
+{% macro navitem(text, href, active=False, icon=None) %}
+<li{% if active %} class="active"{% endif %}><a href="{{href}}">{% if icon %}<i class="icon-{{icon}}{% if active %} icon-white{% endif %}"></i>{% endif %} {{text|e}}</a></li>
+{%- endmacro %}
-{%% macro nav() %%}
+{% macro nav() %}
<div class="well sidebar-nav">
<ol class="nav nav-list">
{{ caller() }}
</ol>
</div>
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro field(label, id, help) %%}
+{% macro field(label, id, help) %}
<div class="control-group">
<label class="control-label" for="{{id}}">{{label|e}}</label>
<div class="controls">
{{ caller() }}
- {%% if help %%}<p class="help-block">{{help|e}}{%% endif %%}
+ {% if help %}<p class="help-block">{{help|e}}{% endif %}
</div>
</div>
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro input_field(label, id, value, type, css_class, help) %%}
- {%% call field(label, id, help) %%}
+{% macro input_field(label, id, value, type, css_class, help) %}
+ {% call field(label, id, help) %}
<input type="{{type}}" class="{{css_class}}" id="{{id}}" value="{{value}}">
- {%% endcall %%}
-{%%- endmacro %%}
+ {% endcall %}
+{%- endmacro %}
-{%% macro text_field(label, id, value, size="large", help=None) %%}
+{% macro text_field(label, id, value, size="large", help=None) %}
{{ input_field(label, id, value, "text", "input-" + size, help) }}
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro password_field(label, id, size="large", help=None) %%}
+{% macro password_field(label, id, size="large", help=None) %}
{{ input_field(label, id, "", "password", "input-" + size, help) }}
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro text_area(label, id, value="", size="large", help=None) %%}
- {%% call field(label, id, help) %%}
+{% macro text_area(label, id, value="", size="large", help=None) %}
+ {% call field(label, id, help) %}
<textarea name="{{id}}" id="{{id}}" class="input-{{size}}">{{value}}</textarea>
- {%% endcall %%}
-{%%- endmacro %%}
+ {% endcall %}
+{%- endmacro %}
-{%% macro submit_button(label) %%}
+{% macro submit_button(label) %}
<input type="submit" class="btn btn-primary" value="{{label|e}}">
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro form(action, type="form-horizontal", method="post") %%}
+{% macro form(action, type="form-horizontal", method="post") %}
<form method="{{method}}" action="{{action}}" class="{{type}}">
<fieldset>
{{ caller() }}
</fieldset>
</form>
-{%%- endmacro %%}
+{%- endmacro %}
-{%% macro form_actions() %%}
+{% macro form_actions() %}
<div class="form-actions">
{{ caller() }}
</div>
-{%%- endmacro %%}
+{%- endmacro %}
Please sign in to comment.
Something went wrong with that request. Please try again.