diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2017-03-24 21:53:13 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2017-03-24 21:54:01 +0100 |
commit | 46832b96a5ed60a1299f4450a01688d74e56d17e (patch) | |
tree | 25853b68bf98343e0fafdfe6df2de8a2a43f65aa /templates | |
parent | c834b5b515f3abbd417c2d6beb39329b786a67ff (diff) |
Replaced cheetah templates with jinja2 templates.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/__init__.py | 3 | ||||
-rw-r--r-- | templates/base.html (renamed from templates/base.tmpl) | 12 | ||||
-rw-r--r-- | templates/message.html | 5 | ||||
-rw-r--r-- | templates/message.tmpl | 5 | ||||
-rw-r--r-- | templates/paste.html (renamed from templates/paste.tmpl) | 28 | ||||
-rw-r--r-- | templates/view.html | 26 | ||||
-rw-r--r-- | templates/view.tmpl | 29 |
7 files changed, 51 insertions, 57 deletions
diff --git a/templates/__init__.py b/templates/__init__.py deleted file mode 100644 index defb657..0000000 --- a/templates/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from paste import paste -from view import view -from message import message diff --git a/templates/base.tmpl b/templates/base.html index 6374752..196a03e 100644 --- a/templates/base.tmpl +++ b/templates/base.html @@ -1,19 +1,19 @@ <!DOCTYPE html> <html lang="en"> <head> - <title>$title</title> + <title>{{ title }}</title> <link rel="StyleSheet" href="/static/paste.css" type="text/css"> -#block head -#end block +{% block head %} +{% endblock %} </head> <body> <div id="page"> <div id="page-header"> - <h1><a href="/">$header</a></h1> + <h1><a href="/">{{ header }}</a></h1> </div> <div id="page-content"> -#block content -#end block +{% block content %} +{% endblock %} </div> </div> </body> diff --git a/templates/message.html b/templates/message.html new file mode 100644 index 0000000..540b64a --- /dev/null +++ b/templates/message.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} +{% block content %} + <p><a href="/">New paste</a></p> + {{ text }} +{% endblock %} diff --git a/templates/message.tmpl b/templates/message.tmpl deleted file mode 100644 index 9f69ebc..0000000 --- a/templates/message.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -#extends templates.base -#def content - <p><a href="/">New paste</a></p> - $text -#end def diff --git a/templates/paste.tmpl b/templates/paste.html index f9c9504..e22f76d 100644 --- a/templates/paste.tmpl +++ b/templates/paste.html @@ -1,26 +1,26 @@ -#extends templates.base -#def head +{% extends "base.html" %} +{% block head %} <script src="/static/edit.js" type="text/javascript"></script> -#end def -#def content +{% endblock %} +{% block content %} <form action="/paste" method="post" id="pasteform"> <ul> <li id="syntaxli"> <select name="syntax" id="syntax"> -#for cat, ls in $lexers - <optgroup label="$cat"> -#for k, v in $ls - <option value="$v"#if $v == $syntax# selected="selected"#end if#>$k</option> -#end for + {% for cat, ls in lexers %} + <optgroup label="{{ cat }}"> + {% for k, v in ls %} + <option value="{{ v }}"{% if v == syntax %} selected="selected"{% endif %}>{{ k }}</option> + {% endfor %} </optgroup> -#end for + {% endfor %} </select> - <input type="checkbox" name="remember_syntax" id="remember_syntax" #if $remember_syntax#checked #end if#> + <input type="checkbox" name="remember_syntax" id="remember_syntax"{% if remember_syntax %} checked{% endif %}> <label for="remember_syntax">Remember syntax</label> </li> <li> - <input type="text" name="nick" id="nick" value="$nick"> - <input type="checkbox" name="remember_me" id="remember_me" #if $remember_me#checked #end if#> + <input type="text" name="nick" id="nick" value="{{ nick }}"> + <input type="checkbox" name="remember_me" id="remember_me"{% if remember_me %} checked{% endif %}> <label for="remember_me">Remember me</label> </li> <li><input type="text" name="title" id="title" value="Untitled"></li> @@ -31,4 +31,4 @@ </li> </ul> </form> -#end def +{% endblock %} diff --git a/templates/view.html b/templates/view.html new file mode 100644 index 0000000..0a20a62 --- /dev/null +++ b/templates/view.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% block head %} + <link rel="StyleSheet" href="/highlight_stylesheet" type="text/css"> + <script type="text/javascript" src="/static/view.js"></script> +{% endblock %} +{% block content %} + <p><a href="/">New paste</a></p> + <div id="paste"> + <h3>{{ pastetitle }}</h3> + <div id="info">Pasted by <span id="nick">{{ nick }}</span> on <span id="date">{{date }}</span> + {% if syntax %} as <span id="syntax-type">{{ syntax }}</span>{% endif %} + </div> + <div id="alt-links"> + {% if hash %} + <a href="/raw/{{ hash }}">Download as plain text</a> + {% endif %} + </div> + {% if rendered %} + <div class="paste-rendered"> + {% endif %} + {{ text }} + {% if rendered %} + </div> + {% endif %} + </div> +{% endblock %} diff --git a/templates/view.tmpl b/templates/view.tmpl deleted file mode 100644 index a23c36e..0000000 --- a/templates/view.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -#extends templates.base -#def head - <link rel="StyleSheet" href="/highlight_stylesheet" type="text/css"> - <script type="text/javascript" src="/static/view.js"></script> -#end def -#def content - <p><a href="/">New paste</a></p> - <div id="paste"> - <h3>$pastetitle</h3> - <div id="info">Pasted by <span id="nick">$nick</span> on <span id="date">$date</span>#slurp -#if $syntax - as <span id="syntax-type">$syntax</span>#slurp -#end if -. -</div> - <div id="alt-links"> -#if $hash - <a href="/raw/$hash">Download as plain text</a> -#end if - </div> -#if $rendered - <div class="paste-rendered"> -#end if - $text -#if $rendered - </div> -#end if - </div> -#end def |