Skip to content

Commit

Permalink
New Hemingway theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Alsina committed May 16, 2017
1 parent df1211e commit 34c6b14
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 0 deletions.
9 changes: 9 additions & 0 deletions v7/hemingway/LICENSE
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2016 Asuka Suzuki

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions v7/hemingway/README.md
@@ -0,0 +1,8 @@
A port of Hugo's Hemingway theme by tanksuzuki to Nikola.

Original theme: https://themes.gohugo.io/hemingway/

License is MIT

The navigation menu has no text, only ``(link, class)`` where class
is a Font Awesome class, like ``"fa fa-github"``
1 change: 1 addition & 0 deletions v7/hemingway/assets/css/style.css

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions v7/hemingway/conf.py.sample
@@ -0,0 +1,8 @@
INDEX_READ_MORE_LINK = '<a class="button is-link" href="{link}" style="height:28px"> {read_more} <span class="icon is-small"> <i class="fa fa-angle-double-right"></i></span></a>'
NAVIGATION_LINKS = {
DEFAULT_LANG: (
("http://twitter.com/getnikola", "fa fa-twitter"),
("http://github.com/getnikola", "fa fa-github"),
("/rss.xml", "fa fa-rss"),
),
}
1 change: 1 addition & 0 deletions v7/hemingway/parent
@@ -0,0 +1 @@
base
64 changes: 64 additions & 0 deletions v7/hemingway/templates/base.tmpl
@@ -0,0 +1,64 @@
## -*- coding: utf-8 -*-
<%namespace name="base" file="base_helper.tmpl" import="*"/>
<%namespace name="header" file="base_header.tmpl" import="*"/>
<%namespace name="footer" file="base_footer.tmpl" import="*"/>
<%namespace name="annotations" file="annotation_helper.tmpl"/>
${set_locale(lang)}

<link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
<link href="/assets/css/code.css" rel="stylesheet" type="text/css">
<link href="/assets/css/theme.css" rel="stylesheet" type="text/css">
%if has_custom_css:
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
%endif
% if needs_ipython_css:
<link href="/assets/css/ipython.min.css" rel="stylesheet" type="text/css">
<link href="/assets/css/nikola_ipython.css" rel="stylesheet" type="text/css">
% endif
<link rel="stylesheet" href="/assets/css/style.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<%block name="extra_head">
### Leave this block alone.
</%block>
${template_hooks['extra_head']()}
</head>
<body>

<section class="section">
<div class="container">
<nav class="nav">
<div class="nav-left">
<a class="nav-item" href="${blog_url}"><h1 class="title is-4">${blog_title}</h1></a>
</div>
<div class="nav-right">
<nav class="nav-item level is-mobile">
% for link, icon in navigation_links[lang]:
<a class="level-item" href="${link}">
<span class="icon">
<i class="${icon}"></i>
</span>
</a>
% endfor
</nav>
</div>
</nav>
</div>
</section>

<%block name="content"></%block>

<section class="section">
%if content_footer:
<div class="container has-text-centered">
<p>${content_footer}</p>
${template_hooks['page_footer']()}
</div>
%endif
</section>

${base.late_load_js()}
<%block name="extra_js"></%block>
${body_end}
${template_hooks['body_end']()}
</body>
</html>
44 changes: 44 additions & 0 deletions v7/hemingway/templates/index.tmpl
@@ -0,0 +1,44 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="index_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="pagination" file="pagination_helper.tmpl"/>
<%inherit file="base.tmpl"/>

<%block name="extra_head">
${parent.extra_head()}
% if posts and (permalink == '/' or permalink == '/' + index_file):
<link rel="prefetch" href="${posts[0].permalink()}" type="text/html">
% endif
${math.math_styles_ifposts(posts)}
</%block>

<%block name="content">
<%block name="content_header"></%block>
% if 'main_index' in pagekind:
${front_index_header}
% endif
% if page_links:
${pagination.page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed)}
% endif
<section>
<div class="container">
% for post in posts:

<article>
<h2 class="subtitle is-6">${post.formatted_date(date_format)|h}</h2>
<h1 class="title"><a href="${post.permalink()}">${post.title()|h}</a></h1>
<div class="content">
%if index_teasers:
${post.text(teaser_only=True)}
%else:
${post.text(teaser_only=False)}
%endif
</div>
</article>
% endfor

</div>
</section>
${helper.html_pager()}
</%block>
48 changes: 48 additions & 0 deletions v7/hemingway/templates/post.tmpl
@@ -0,0 +1,48 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%inherit file="base.tmpl"/>

<%block name="extra_head">
${parent.extra_head()}
% if post.meta('keywords'):
<meta name="keywords" content="${post.meta('keywords')|h}">
% endif
<meta name="author" content="${post.author()|h}">
%if post.prev_post:
<link rel="prev" href="${post.prev_post.permalink()}" title="${post.prev_post.title()|h}" type="text/html">
%endif
%if post.next_post:
<link rel="next" href="${post.next_post.permalink()}" title="${post.next_post.title()|h}" type="text/html">
%endif
% if post.is_draft:
<meta name="robots" content="noindex">
% endif
${helper.open_graph_metadata(post)}
${helper.twitter_card_information(post)}
${helper.meta_translations(post)}
${math.math_styles_ifpost(post)}
</%block>

<%block name="content">

<section class="section">
<div class="container">
<h2 class="subtitle is-6">${post.formatted_date(date_format)|h}</h2>
<h1 class="title">${post.title()|h}</h1>
<div class="content">
${post.text()}
</div>
</div>
</section>
% if not post.meta('nocomments') and site_has_comments:
<section class="section comments hidden-print">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
</section>
% endif
${math.math_styles_ifpost(post)}
${comments.comment_link_script()}
</%block>
26 changes: 26 additions & 0 deletions v7/hemingway/templates/story.tmpl
@@ -0,0 +1,26 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="math" file="math_helper.tmpl"/>
<%inherit file="post.tmpl"/>

<%block name="content">
<section class="section">
<div class="container">
<h2 class="subtitle is-6">${post.formatted_date(date_format)|h}</h2>
<h1 class="title">${post.title()|h}</h1>
<div class="content">
${post.text()}
</div>
</div>
</section>
% if not post.meta('nocomments') and site_has_comments:
<section class="section comments hidden-print">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
</section>
% endif
${math.math_styles_ifpost(post)}
${comments.comment_link_script()}
</%block>

0 comments on commit 34c6b14

Please sign in to comment.