Skip to content

Commit

Permalink
hpstr
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 29, 2015
1 parent 3e42e73 commit f7b4ef7
Show file tree
Hide file tree
Showing 13 changed files with 436 additions and 0 deletions.
11 changes: 11 additions & 0 deletions v7/hpstr/README.md
@@ -0,0 +1,11 @@
This theme is a quick port of the [HPSTR theme by Michael Rose](http://mmistakes.github.io/hpstr-jekyll-theme/) Everything that's good in it
is Michael Rose's fault, everything bad is mine.

Known Issues:

* Not all features of Nikola are tested.
* Galleries will work better when [Issue #1764](https://github.com/getnikola/nikola/issues/1764) is fixed.
* CDNs are not used regardless of ``USE_CDN``
* It doesn't yet support configuring the entry image in the frontpage
* It doesn't yet support posts with "feature images"
* It doesn't support USE_BUNDLES = True
51 changes: 51 additions & 0 deletions v7/hpstr/assets/css/extra.css
@@ -0,0 +1,51 @@
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}

.breadcrumb {
padding: 8px 15px;
margin-bottom: 20px;
list-style: none;
}

.breadcrumb > li {
display: inline-block;
margin-right: 0;
margin-left: 0;
}

.breadcrumb > li:after {
content: ' / ';
color: #888;
}

.breadcrumb > li:last-of-type:after {
content: '';
margin-left: 0;
}

.thumbnails > li {
display: inline-block;
margin-right: 10px;
}

.thumbnails > li:last-of-type {
margin-right: 0;
}
4 changes: 4 additions & 0 deletions v7/hpstr/assets/css/main.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions v7/hpstr/assets/js/modernizr-2.6.2.custom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions v7/hpstr/assets/js/scripts.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions v7/hpstr/parent
@@ -0,0 +1 @@
base
24 changes: 24 additions & 0 deletions v7/hpstr/templates/base.tmpl
@@ -0,0 +1,24 @@
## -*- 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)}
${base.html_headstart()}
<%block name="extra_head">
### Leave this block alone.
</%block>
${template_hooks['extra_head']()}
</head>
<body id="post-index" class="feature">
<a href="#content" class="sr-only sr-only-focusable">${messages("Skip to main content")}</a>
${header.html_header()}
<div id="main" role="main">
<%block name="content"></%block>
</div>
${footer.html_footer()}
${body_end}
${template_hooks['body_end']()}
${base.late_load_js()}
</body>
</html>
13 changes: 13 additions & 0 deletions v7/hpstr/templates/base_footer.tmpl
@@ -0,0 +1,13 @@
## -*- coding: utf-8 -*-
<%namespace name="base" file="base_helper.tmpl" import="*"/>

<%def name="html_footer()">
%if content_footer:
<div class="footer-wrapper">
<footer role="contentinfo">
<p>${content_footer}</p>
${template_hooks['page_footer']()}
</footer>
</div>
%endif
</%def>
56 changes: 56 additions & 0 deletions v7/hpstr/templates/base_header.tmpl
@@ -0,0 +1,56 @@
## -*- coding: utf-8 -*-
<%namespace name="base" file="base_helper.tmpl" import="*"/>

<%def name="html_header()">
${html_navigation_links()}
<div class="entry-header">
<!-- FIXME: get credit from settings -->
<div class="image-credit">Image source: <a href="http://www.dargadgetz.com/ios-7-abstract-wallpaper-pack-for-iphone-5-and-ipod-touch-retina/">dargadgetz</a></div><!-- /.image-credit -->
<div class="entry-image">
<img src="//mmistakes.github.io/hpstr-jekyll-theme/images/abstract-1.jpg" alt="Latest Posts">
</div><!-- /.entry-image -->
${html_site_title()}
</div><!-- /.entry-header -->
</%def>

<%def name="html_site_title()">
<div class="header-title">
<div class="header-title-wrap">
<h1 id="brand"><a href="${abs_link(_link("root", None, lang))}" title="${blog_title}" rel="home">
${blog_title}</a></h1>
<h2>${title}</h2>
</div><!-- /.header-title-wrap -->
</div><!-- /.header-title -->
</%def>

<%def name="html_navigation_links()">
<nav id="dl-menu" class="dl-menuwrapper" role="navigation">
<button class="dl-trigger">Open Menu</button>
<ul class="dl-menu">
%for url, text in navigation_links[lang]:
% if isinstance(url, tuple):
<li>
<a href="#">${text}</a>
<ul class="dl-submenu">
%for suburl, text in url:
<li><a href="${suburl}">${text}</a></li>
%endfor
</ul>
% else:
<li><a href="${url}">${text}</a></li>
% endif
%endfor
${template_hooks['menu']()}
${template_hooks['menu_alt']()}
</ul>
</nav>
</%def>

<%def name="html_translation_header()">
%if len(translations) > 1:
<div id="toptranslations">
<h2>${messages("Languages:")}</h2>
${base.html_translations()}
</div>
%endif
</%def>
129 changes: 129 additions & 0 deletions v7/hpstr/templates/base_helper.tmpl
@@ -0,0 +1,129 @@
## -*- coding: utf-8 -*-

<%def name="html_headstart()">
<!DOCTYPE html>
<html \
prefix='\
%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']):
og: http://ogp.me/ns# article: http://ogp.me/ns/article# \
%endif
%if comment_system == 'facebook':
fb: http://ogp.me/ns/fb#
%endif
' \
%if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']):
vocab="http://ogp.me/ns" \
%endif
% if is_rtl:
dir="rtl" \
% endif
\
lang="${lang}">
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
%if description:
<meta name="description" content="${description}">
%endif
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title|striphtml} | ${blog_title|striphtml}</title>


${html_stylesheets()}
<!-- Load Modernizr -->
<script src="//mmistakes.github.io/hpstr-jekyll-theme/assets/js/vendor/modernizr-2.6.2.custom.min.js"></script>
${html_feedlinks()}
%if permalink:
<link rel="canonical" href="${abs_link(permalink)}">
%endif

%if favicons:
%for name, file, size in favicons:
<link rel="${name}" href="${file}" sizes="${size}"/>
%endfor
%endif

% if comment_system == 'facebook':
<meta property="fb:app_id" content="${comment_system_id}">
% endif

%if prevlink:
<link rel="prev" href="${prevlink}" type="text/html">
%endif
%if nextlink:
<link rel="next" href="${nextlink}" type="text/html">
%endif

${mathjax_config}
%if use_cdn:
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
%else:
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
%endif

${extra_head_data}
</%def>

<%def name="late_load_js()">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="/assets/js/scripts.min.js"></script>
</%def>

<%def name="html_stylesheets()">
%if use_bundles:
%if use_cdn:
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
%else:
<link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
%endif
%else:
<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/main.css" rel="stylesheet" type="text/css">
<link href="/assets/css/extra.css" rel="stylesheet" type="text/css">
%if has_custom_css:
<link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
%endif
%endif
<!-- Webfonts -->
<link href="//fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic" rel="stylesheet" type="text/css">
</%def>

<%def name="html_feedlinks()">
%if rss_link:
${rss_link}
%elif generate_rss:
%if len(translations) > 1:
%for language in translations:
<link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
%endfor
%else:
<link rel="alternate" type="application/rss+xml" title="RSS" href="${_link('rss', None)}">
%endif
%endif
%if generate_atom:
%if len(translations) > 1:
%for language in translations:
<link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link('index_atom', None, language)}">
%endfor
%else:
<link rel="alternate" type="application/atom+xml" title="Atom" href="${_link('index_atom', None)}">
%endif
%endif
</%def>

<%def name="html_translations()">
<ul class="translations">
%for langname in translations.keys():
%if langname != lang:
<li><a href="${abs_link(_link("root", None, langname))}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></li>
%endif
%endfor
</ul>
</%def>
42 changes: 42 additions & 0 deletions v7/hpstr/templates/index.tmpl
@@ -0,0 +1,42 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="index_helper.tmpl"/>
<%namespace name="comments" file="comments_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
</%block>

<%block name="content">
<%block name="content_header"></%block>
% for post in posts:
<article class="hentry">
<header>
<div class="entry-meta">
<span class="entry-date date published updated">
<time datetime="${post.date.isoformat()}" title="${post.formatted_date(date_format)}">${post.formatted_date(date_format)}</time>
</span>&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<span class="byline author vcard">${post.author()}</span>
% if not post.meta('nocomments') and site_has_comments:
&nbsp;&nbsp;&middot;&nbsp;&nbsp;<span class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
</div>
<h1 class="p-name entry-title"><a href="${post.permalink()}" class="u-url">${post.title()|h}</a></h1>
</header>
%if index_teasers:
<div class="p-summary entry-summary">
${post.text(teaser_only=True)}
%else:
<div class="e-content entry-content">
${post.text(teaser_only=False)}
%endif
</div>
</article>
% endfor
${helper.html_pager()}
${comments.comment_link_script()}
${helper.mathjax_script(posts)}
</%block>

0 comments on commit f7b4ef7

Please sign in to comment.