Added page title as primary heading
Added read more links to newsfeed Better templates for news in test folder Smaller cleanups
This commit is contained in:
parent
1a760e43a9
commit
d2fe5d01d5
|
@ -6,6 +6,7 @@
|
||||||
{{menu}}
|
{{menu}}
|
||||||
<br/>
|
<br/>
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<h1 class="mainheading">{{page_title}}</h1>
|
||||||
{{content}}
|
{{content}}
|
||||||
<br/>
|
<br/>
|
||||||
Created: {{content_creation_time.strftime('%d.%m.%Y %H:%M:%S')}}</br>
|
Created: {{content_creation_time.strftime('%d.%m.%Y %H:%M:%S')}}</br>
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{{items | pprint}}
|
{% for item in items %}
|
||||||
|
<div>
|
||||||
|
<h2>{{item.title}}</h2>
|
||||||
|
{{item.content}}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1 +1,13 @@
|
||||||
{{items | pprint}}
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
{% for item in items %}
|
||||||
|
<item>
|
||||||
|
<title>{{item.title}}</title>
|
||||||
|
<url>{{item.url}}</url>
|
||||||
|
<description>{{item.content}}</description>
|
||||||
|
<pubDate>{{item.creation_time.strftime('%d.%m.%Y %H:%M:%S')}}</pubDate>
|
||||||
|
</item>
|
||||||
|
{% endfor %}
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
|
|
|
@ -8,3 +8,4 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.sane_lists',
|
||||||
|
|
||||||
|
|
||||||
SERVE_PORT = 8000
|
SERVE_PORT = 8000
|
||||||
|
SERVE_BIND_ADDRESS = "0.0.0.0"
|
||||||
|
|
|
@ -66,8 +66,6 @@ class NewsFeed(MenuItemMixin, TemplateMixin, AssetsMixin):
|
||||||
rendered_items = sorted(rendered_items, key=lambda item: item['creation_time'], reverse=True)
|
rendered_items = sorted(rendered_items, key=lambda item: item['creation_time'], reverse=True)
|
||||||
context['items'] = rendered_items
|
context['items'] = rendered_items
|
||||||
|
|
||||||
print rendered_items
|
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ class Page(MenuItemMixin, NewsItemMixin, TemplateMixin, AssetsMixin):
|
||||||
lines = self.content['content'].split('\n')
|
lines = self.content['content'].split('\n')
|
||||||
elipsized_content = '\n'.join(lines[0:self.news_item_len])
|
elipsized_content = '\n'.join(lines[0:self.news_item_len])
|
||||||
|
|
||||||
|
elipsized_content += '\n\n Read [more](%s) ...' % self.url
|
||||||
|
|
||||||
item = {
|
item = {
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
'content': elipsized_content,
|
'content': elipsized_content,
|
||||||
|
|
|
@ -9,7 +9,7 @@ from SimpleHTTPServer import SimpleHTTPRequestHandler
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from constants import OUTPUT_DIRECTORY, TEMPLATE_DIRECTORY, SERVE_PORT
|
from constants import OUTPUT_DIRECTORY, TEMPLATE_DIRECTORY, SERVE_PORT, SERVE_BIND_ADDRESS
|
||||||
|
|
||||||
class Verdandi(object):
|
class Verdandi(object):
|
||||||
|
|
||||||
|
@ -58,5 +58,6 @@ class Verdandi(object):
|
||||||
|
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == 'serve':
|
if len(sys.argv) > 1 and sys.argv[1] == 'serve':
|
||||||
os.chdir(self.output_directory)
|
os.chdir(self.output_directory)
|
||||||
httpd = SocketServer.TCPServer(("0.0.0.0", SERVE_PORT), SimpleHTTPRequestHandler)
|
httpd = SocketServer.TCPServer((SERVE_BIND_ADDRESS, SERVE_PORT), SimpleHTTPRequestHandler)
|
||||||
|
print "Serving under %s:%d" % (SERVE_BIND_ADDRESS, SERVE_PORT)
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
Loading…
Reference in New Issue