Hatta Devel
changeset 836:ffea9e97265a
moving the html header generation into templates
| author | Radomir Dopieralski <hatta-dev@sheep.art.pl> |
|---|---|
| date | Wed Nov 10 22:43:21 2010 +0100 (18 months ago) |
| parents | 460137edebe9 |
| children | f9614072c7e8 |
| files | hatta/page.py hatta/templates/page.html |
line diff
1.1 --- a/hatta/page.py Wed Nov 10 22:19:28 2010 +0100 1.2 +++ b/hatta/page.py Wed Nov 10 22:43:21 2010 +0100 1.3 @@ -213,36 +213,6 @@ 1.4 class_ = None 1.5 yield self.wiki_link(link, label, class_=class_) 1.6 1.7 - def header(self, special_title): 1.8 - html = werkzeug.html 1.9 - if self.wiki.logo_page in self.storage: 1.10 - yield self.logo() 1.11 - yield self.search_form() 1.12 - yield html.div(u" ".join(self.menu()), class_="menu") 1.13 - yield html.h1(html(special_title or self.title)) 1.14 - 1.15 - def html_header(self, special_title, edit_url): 1.16 - e = lambda x: werkzeug.escape(x, quote=True) 1.17 - h = werkzeug.html 1.18 - yield h.title(u'%s - %s' % (e(special_title or self.title), 1.19 - e(self.wiki.site_name))) 1.20 - yield h.link(rel="stylesheet", type_="text/css", 1.21 - href=self.get_url(None, self.wiki.pygments_css)) 1.22 - yield h.link(rel="stylesheet", type_="text/css", 1.23 - href=self.get_url(None, self.wiki.style_css)) 1.24 - if special_title: 1.25 - yield h.meta(name="robots", content="NOINDEX,NOFOLLOW") 1.26 - if edit_url: 1.27 - yield h.link(rel="alternate", type_="application/wiki", 1.28 - href=edit_url) 1.29 - yield h.link(rel="shortcut icon", type_="image/x-icon", 1.30 - href=self.get_url(None, self.wiki.favicon_ico)) 1.31 - yield h.link(rel="alternate", type_="application/rss+xml", 1.32 - title=e("%s (ATOM)" % self.wiki.site_name), 1.33 - href=self.get_url(None, self.wiki.atom)) 1.34 - yield h.script(type_="text/javascript", 1.35 - src=self.get_url(None, self.wiki.scripts_js)) 1.36 - 1.37 def footer(self, special_title, edit_url): 1.38 _ = self.wiki.gettext 1.39 if special_title: 1.40 @@ -281,6 +251,7 @@ 1.41 'download_url': self.get_download_url, 1.42 'config': self.config, 1.43 'page': self, 1.44 + '_': self.wiki.gettext, 1.45 } 1.46 context.update(kwargs) 1.47 return template.generate(**context)
2.1 --- a/hatta/templates/page.html Wed Nov 10 22:19:28 2010 +0100 2.2 +++ b/hatta/templates/page.html Wed Nov 10 22:43:21 2010 +0100 2.3 @@ -1,17 +1,42 @@ 2.4 {% extends 'layout.html' %} 2.5 2.6 +{% block title %} 2.7 + {{ special_tile or title|e }} - {{ wiki.site_name|e }} 2.8 +{% endblock %} 2.9 + 2.10 {% block links %} 2.11 - {% for part in page.html_header(special_title, edit_url) %} 2.12 - {{ part }} 2.13 - {% endfor %} 2.14 + <link rel="stylesheet" type="text/css" 2.15 + href="{{ url(None, wiki.style_css) }}"> 2.16 + <link rel="stylesheet" type="text/css" 2.17 + href="{{ url(None, wiki.pygments_css) }}"> 2.18 + <link rel="shortcut icon" type="image/x-icon" 2.19 + href="{{ url(None, wiki.favicon_ico) }}"> 2.20 + <link rel="alternate" type="application/rss+xml" 2.21 + title="{{ wiki.site_name|e }} (ATOM)" 2.22 + href="{{ url(None, wiki.atom) }}"> 2.23 + {% if edit_url %} 2.24 + <link rel="alternate" type="application/wiki" 2.25 + href="{{ edit_url }}"> 2.26 + {% endif %} 2.27 +{% endblock %} 2.28 + 2.29 +{% block scripts %} 2.30 + <script type="text/javascript" 2.31 + src="{{ url(None, wiki.scripts_js) }}"></script> 2.32 +{% endblock %} 2.33 + 2.34 +{% block meta %} 2.35 + {% if special_title %} 2.36 + <meta name="robots" content="NOINDEX, NOFOLLOW"> 2.37 + {% endif %} 2.38 {% endblock %} 2.39 2.40 {% block header %} 2.41 - {% if wiki.logo_page %} 2.42 + {% if wiki.logo_page in page.storage %} 2.43 <a id="hatta-logo" 2.44 href="{{ url(wiki.front_page) }}"><img 2.45 src="{{ download_url(wiki.logo_page) }}" 2.46 - alt="[{{ wiki.logo_page }}]" 2.47 + alt="[{{ wiki.logo_page|e }}]" 2.48 ></a> 2.49 {% endif %} 2.50 <form action="/+search" id="hatta-search" method="GET" 2.51 @@ -22,7 +47,7 @@ 2.52 {% for part in page.menu() %} 2.53 {{ part }} 2.54 {% endfor %} 2.55 - </div><h1>{{ title }}</h1> 2.56 + </div><h1>{{ special_title or title|e }}</h1> 2.57 {% endblock %} 2.58 2.59 {% block content %}
