Forráskód Böngészése

initial rough version of new theme

Philip Cheang 11 éve
szülő
commit
7c333fda2c

+ 1 - 0
themes/pleasant2/assets/css/rst.css

@@ -0,0 +1 @@
+../../../default/assets/css/rst.css

+ 211 - 0
themes/pleasant2/assets/css/theme.css

@@ -0,0 +1,211 @@
+/* because standards */
+@viewport {
+	width: device-width;
+}
+
+@-ms-viewport {
+	width: device-width;
+}
+
+body {
+	font-family: "Museo Sans", "museo-sans", sans-serif;
+	font-size: 100%;
+	color: #534741;
+	line-height: 1.25;
+	background: #F2EDE6;
+	margin: 0;
+}
+
+@media (max-width: 600px) {
+	body {
+		font-size: 100%;
+	}
+}
+
+/* force android webkit to use relative header size */
+body h1 {
+	font-family: "Museo", "museo", sans-serif;
+	font-weight: 500;
+}
+
+p {
+	hyphens: auto;
+	-moz-hyphens: auto;
+	word-wrap: break-word;
+}
+
+hr {
+	border-color: #D3D3D3;
+}
+
+a {
+	color: #6495ED;
+	text-decoration: none;
+}
+
+
+code, pre {
+	font-family: Monaco, Menlo, Consolas, monospace;
+	font-size: 75%;
+}
+
+code {
+	background: #FFFFE0;
+	padding: 0px 0.2em;
+	border-radius: 0.25em;
+}
+
+.code {
+	padding: 0em 0.5em;
+	border-radius: 0.25em;
+}
+
+.code pre {
+	padding: 0.25em 0em;
+	overflow-x: auto;
+}
+
+table {
+	border-collapse: collapse;
+}
+
+td {
+	padding: 0px 0.5em;
+}
+
+thead tr {
+	font-weight: bold;
+	border-bottom: solid 1px #808080;
+}
+
+.clearfix:after {
+   content: " ";
+   display: block;
+   height: 0;
+   clear: both;
+}
+
+.header {
+	background: #F0E5D8;
+	text-align: center;
+	padding: 20px 0;
+}
+
+/* TODO: Fix this shit. */
+
+.header h1 {
+	/*float: left;*/
+	/*display: inline-block;*/
+	font-size: 1.75em;
+	margin: 0.125em auto;
+	text-transform: lowercase;
+	font-weight: 300;
+}
+
+.header img {
+	width: 128px;
+	height: 128px;
+	border: 2px solid #534741;
+	border-radius: 50%;
+}
+
+.header > a {
+	font-family: "Museo";
+	color: #534741;
+	display: inline-block;
+	border-bottom: 1px solid transparent;
+	transition: all 0.4s;
+}
+
+.header > a:hover {
+	text-decoration: none;
+	border-bottom: 1px solid black;
+}
+
+.header .twitter {
+	font-size: 1.25em;
+	font-weight: 100;
+}
+
+.nav {
+	float: right;
+	display: inline-block;
+	padding: 0px;
+	margin: 0px;
+}
+
+.nav li {
+	list-style: none;
+	margin: 0.5em 0.2em;
+	display: inline;
+	font-size: 80%;
+}
+
+@media (max-width: 800px) {
+	.header {
+		/*margin: 1em 0px;*/
+	}
+
+	.header > h1 {
+		display: block;
+		float: none;
+	}
+
+	.nav {
+		display: block;
+		float: none;
+	}
+
+	.nav li {
+		display: block;
+		font-size: 100%;
+	}
+}
+
+.container {
+	max-width: 800px;
+	margin: 0 auto;
+}
+
+.footer {
+	text-align: center;
+}
+
+.postbox {
+	margin-top: 2em;
+	font-size: 1.2em;
+	line-height: 1.8;
+}
+
+.postbox img {
+	max-width: 100%;
+}
+
+.postbox .title h1 a {
+	color: black;
+}
+
+.postbox .title h1 small {
+	float: right;
+	font-size: 50%;
+	font-weight: normal;
+	color: #808080;
+}
+
+.pager {
+	list-style: none;
+	text-align: center;
+	padding: 0px;
+}
+
+.pager li > a {
+	display: inline-block;
+}
+
+.pager .previous a {
+	float: left;
+}
+
+.pager .next a {
+	float: right;
+}

BIN
themes/pleasant2/assets/img/thomas.png


+ 1 - 0
themes/pleasant2/bundles

@@ -0,0 +1 @@
+assets/css/all.css=rst.css,code.css,theme.css

+ 47 - 0
themes/pleasant2/templates/base.tmpl

@@ -0,0 +1,47 @@
+## -*- coding: utf-8 -*-
+<%namespace file="base_helper.tmpl" import="*"/>
+${set_locale(lang)}
+<!DOCTYPE html>
+<html lang="${lang}">
+<head>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    ${html_head()}
+    <%block name="extra_head">
+    </%block>
+    ${extra_head_data}
+</head>
+<body>
+    <div class="header">
+        ## TODO: fix this shit
+        <a href="${abs_link('/')}" title="${blog_title}">
+            <img src="/assets/img/thomas.png" alt="pleasant thomas">
+            <h1 id="blog-title">
+                ${blog_title}
+            </h1>
+        </a>
+        <br />
+            ## ${html_sidebar_links()}
+        <a class="twitter" href="http://twitter.com/pleasantprog">@pleasantprog</a>
+
+        <%block name="belowtitle">
+            %if len(translations) > 1:
+            <small>
+                ${(messages("Also available in"))}:&nbsp;
+                ${html_translations()}
+            </small>
+            %endif
+        </%block>
+    </div>
+    <div class="container">
+        <div class="content">
+            <%block name="content"></%block>
+        </div>
+
+        <div class="footer"><small>${content_footer}</small></div>
+    </div>
+
+    %if add_this_buttons:
+    <script type="text/javascript">var addthis_config={"ui_language":"${lang}"};</script>
+    % endif
+    ${analytics}
+</body>

+ 79 - 0
themes/pleasant2/templates/base_helper.tmpl

@@ -0,0 +1,79 @@
+## -*- coding: utf-8 -*-
+<%def name="html_head()">
+    <meta charset="utf-8">
+    <meta name="description" content="${description}" >
+    <meta name="author" content="${blog_author}">
+    <title>${title} | ${blog_title}</title>
+    ${mathjax_config}
+    %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/colorbox.css" rel="stylesheet" type="text/css"/>
+        <link href="/assets/css/theme.css" rel="stylesheet" type="text/css"/>
+        ## where is this specified?
+        ## %if has_custom_css:
+            ## <link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
+        ## %endif
+    %endif
+    ## sorry about the typekit, thomas. it's pretty!
+    <script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+    <!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
+    <![endif]-->
+    %if rss_link:
+        ${rss_link}
+    %else:
+        %for language in translations:
+            <link rel="alternate" type="application/rss+xml" title="RSS (${language})" href="${_link('rss', None, language)}">
+        %endfor
+    %endif
+    %if favicons:
+        %for name, file, size in favicons:
+            <link rel="${name}" href="${file}" sizes="${size}"/>
+        %endfor
+    %endif
+</%def>
+
+
+<%def name="html_social()">
+%if add_this_buttons:
+    <!-- Social buttons -->
+    <div id="addthisbox" class="addthis_toolbox addthis_peekaboo_style addthis_default_style addthis_label_style addthis_32x32_style">
+    <a class="addthis_button_more">Share</a>
+    <ul><li><a class="addthis_button_facebook"></a>
+    <li><a class="addthis_button_google_plusone_share"></a>
+    <li><a class="addthis_button_linkedin"></a>
+    <li><a class="addthis_button_twitter"></a>
+    </ul>
+    </div>
+    <script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4f7088a56bb93798"></script>
+    <!-- End of social buttons -->
+%endif
+</%def>
+
+
+<%def name="html_sidebar_links()">
+    %for url, text in sidebar_links[lang]:
+        % if rel_link(permalink, url) == "#":
+            <li class="active"><a href="${url}">${text}</a>
+        %else:
+            <li><a href="${url}">${text}</a>
+        %endif
+    %endfor
+</%def>
+
+
+<%def name="html_translations()">
+    %for langname in translations.keys():
+        %if langname != lang:
+            <a href="${_link("index", None, langname)}">${messages("LANGUAGE", langname)}</a>
+        %endif
+    %endfor
+</%def>

+ 43 - 0
themes/pleasant2/templates/disqus_helper.tmpl

@@ -0,0 +1,43 @@
+## -*- coding: utf-8 -*-
+<%!
+    import json
+    translations = {
+        'es': 'es_ES',
+    }
+%>
+<%def name="html_disqus(url, title, identifier)">
+    %if disqus_forum:
+        <div id="disqus_thread"></div>
+        <script type="text/javascript">
+        var disqus_shortname ="${disqus_forum}";
+        %if url:
+            var disqus_url="${url}";
+        %endif
+        var disqus_title=${json.dumps(title)};
+        var disqus_identifier="${identifier}";
+        var disqus_config = function () {
+            this.language = "${translations.get(lang, lang)}";
+        };
+        (function() {
+            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+            dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+        })();
+    </script>
+    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+    %endif
+</%def>
+
+<%def name="html_disqus_link(link, identifier)">
+    <p>
+    %if disqus_forum:
+        <a href="${link}" data-disqus-identifier="${identifier}">Comments</a>
+    %endif
+</%def>
+
+
+<%def name="html_disqus_script()">
+    %if disqus_forum:
+       <script type="text/javascript">var disqus_shortname="${disqus_forum}";(function(){var a=document.createElement("script");a.async=true;a.type="text/javascript";a.src="http://"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("HEAD")[0]||document.getElementsByTagName("BODY")[0]).appendChild(a)}());</script>
+    %endif
+</%def>

+ 31 - 0
themes/pleasant2/templates/gallery.tmpl

@@ -0,0 +1,31 @@
+## -*- coding: utf-8 -*-
+<%inherit file="base.tmpl"/>
+<%namespace name="disqus" file="disqus_helper.tmpl"/>
+<%block name="sourcelink"></%block>
+
+<%block name="content">
+    <ul class="breadcrumb">
+        % for link, crumb in crumbs:
+            <li><a href="${link}">/ ${crumb}</a></li>
+        % endfor
+    </ul>
+    %if text:
+    <p>
+        ${text}
+    </p>
+    %endif
+    <ul>
+    % for folder in folders:
+        <li><a href="${folder}"><i class="icon-folder-open"></i>&nbsp;${folder}</a></li>
+    % endfor
+    </ul>
+    <ul class="thumbnails">
+        %for image in images:
+            <li><a href="${image[0]}" class="thumbnail image-reference" ${image[2]}>
+                <img src="${image[1]}" /></a></li>
+        %endfor
+    </ul>
+%if enable_comments:
+    ${disqus.html_disqus(None, permalink, title)}
+%endif
+</%block>

+ 23 - 0
themes/pleasant2/templates/index.tmpl

@@ -0,0 +1,23 @@
+## -*- coding: utf-8 -*-
+<%namespace name="helper" file="index_helper.tmpl"/>
+<%namespace name="disqus" file="disqus_helper.tmpl"/>
+<%inherit file="base.tmpl"/>
+<%block name="content">
+    % for post in posts:
+        <div class="postbox">
+        <div class="title">
+            <h1><a href="${post.permalink()}">${post.title()}</a>
+            <small>&nbsp;&nbsp;
+                 ${messages("Posted")}: ${post.formatted_date(date_format)}
+            </small></h1>
+        </div>
+        ## <hr>
+        ${post.text(teaser_only=index_teasers)}
+        % if not post.meta('nocomments'):
+            ${disqus.html_disqus_link(post.permalink()+"#disqus_thread", post.base_path)}
+        % endif
+        </div>
+    % endfor
+    ${helper.html_pager()}
+    ${disqus.html_disqus_script()}
+</%block>

+ 17 - 0
themes/pleasant2/templates/index_helper.tmpl

@@ -0,0 +1,17 @@
+## -*- coding: utf-8 -*-
+<%def name="html_pager()">
+<div>
+<ul class="pager clearfix">
+  %if prevlink:
+    <li class="previous">
+        <a href="${prevlink}">&larr; ${messages("Newer posts")}</a>
+    </li>
+  %endif
+  %if nextlink:
+    <li class="next">
+        <a href="${nextlink}">${messages("Older posts")} &rarr;</a>
+    </li>
+  %endif
+</ul>
+</div>
+</%def>

+ 14 - 0
themes/pleasant2/templates/list.tmpl

@@ -0,0 +1,14 @@
+## -*- coding: utf-8 -*-
+<%inherit file="base.tmpl"/>
+<%block name="content">
+        <!--Body content-->
+        <div class="postbox">
+        <h1>${title}</h1>
+        <ul class="unstyled">
+        % for text, link in items:
+            <li><a href="${link}">${text}</a>
+        % endfor
+        </ul>
+        </div>
+        <!--End of body content-->
+</%block>

+ 14 - 0
themes/pleasant2/templates/list_post.tmpl

@@ -0,0 +1,14 @@
+## -*- coding: utf-8 -*-
+<%inherit file="base.tmpl"/>
+<%block name="content">
+        <!--Body content-->
+        <div class="postbox">
+        <h1>${title}</h1>
+        <ul class="unstyled">
+        % for post in posts:
+            <li><a href="${post.permalink()}">[${post.formatted_date(date_format)}] ${post.title()}</a>
+        % endfor
+        </ul>
+        </div>
+        <!--End of body content-->
+</%block>

+ 10 - 0
themes/pleasant2/templates/listing.tmpl

@@ -0,0 +1,10 @@
+## -*- coding: utf-8 -*-
+<%inherit file="base.tmpl"/>
+<%block name="content">
+<ul class="breadcrumb">
+    % for link, crumb in crumbs:
+        <li><a href="${link}">/ ${crumb}</a></li>
+    % endfor
+</ul>
+${code}
+</%block>

+ 21 - 0
themes/pleasant2/templates/post.tmpl

@@ -0,0 +1,21 @@
+## -*- coding: utf-8 -*-
+<%namespace name="helper" file="post_helper.tmpl"/>
+<%namespace name="disqus" file="disqus_helper.tmpl"/>
+<%inherit file="base.tmpl"/>
+<%block name="content">
+    <div class="postbox">
+    <div class="title">
+        ${helper.html_title()}
+        <small>
+            ${messages("Posted")}: ${post.formatted_date(date_format)}
+            ${helper.html_translations(post)}
+            ${helper.html_tags(post)}
+        </small>
+    </div>
+    ${post.text()}
+    ${helper.html_pager(post)}
+    % if not post.meta('nocomments'):
+        ${disqus.html_disqus(post.permalink(absolute=True), post.title(), post.base_path)}
+    % endif
+    </div>
+</%block>

+ 73 - 0
themes/pleasant2/templates/post_helper.tmpl

@@ -0,0 +1,73 @@
+## -*- coding: utf-8 -*-
+<%def name="html_title()">
+    <h1>${title}</h1>
+    % if link:
+            <p><a href='${link}'>${messages("Original site")}</a></p>
+    % endif
+</%def>
+
+
+<%def name="html_translations(post)">
+    %if len(translations) > 1:
+        %for langname in translations.keys():
+            %if langname != lang and post.is_translation_available(langname):
+                &nbsp;&nbsp;|&nbsp;&nbsp;
+                <a href="${post.permalink(langname)}">${messages("Read in English", langname)}</a>
+            %endif
+        %endfor
+    %endif
+</%def>
+
+
+<%def name="html_tags(post)">
+    %if post.tags:
+        &nbsp;&nbsp;|&nbsp;&nbsp;${messages("More posts about")}
+        %for tag in post.tags:
+            <a class="tag" href="${_link('tag', tag)}"><span class="badge badge-info">${tag}</span></a>
+        %endfor
+    %endif
+</%def>
+
+<%def name="html_pager(post)">
+    <ul class="pager clearfix">
+    %if post.prev_post:
+        <li class="previous">
+            <a href="${post.prev_post.permalink()}">&larr; ${messages("Previous post")}</a>
+        </li>
+    %endif
+    %if post.next_post:
+        <li class="next">
+            <a href="${post.next_post.permalink()}">${messages("Next post")} &rarr;</a>
+        </li>
+    %endif
+    </ul>
+</%def>
+
+<%def name="twitter_card_information(post)">
+    %if twitter_card and twitter_card['use_twitter_cards']:
+        <meta name="twitter:card" content="${twitter_card.get('card', 'summary')|h}">
+        <meta name="og:url" content="${post.permalink(absolute=True)}">
+        %if 'site:id' in twitter_card:
+            <meta name="twitter:site:id" content="${twitter_card['site:id']}">
+        %elif 'site' in twitter_card:
+            <meta name="twitter:site" content="${twitter_card['site']}">
+        %endif
+        %if 'creator:id' in twitter_card:
+            <meta name="twitter:creator:id" content="${twitter_card['creator:id']}">
+        %elif 'creator' in twitter_card:
+            <meta name="twitter:creator" content="${twitter_card['creator']}">
+        %endif
+        <meta name="og:title" content="${post.title()[:70]|h}">
+        %if post.description():
+            <meta name="og:description" content="${post.description()[:200]|h}">
+        %else:
+            <meta name="og:description" content="${post.text(strip_html=True)[:200]|h}">
+        %endif
+    %endif
+</%def>
+
+<%def name="mathjax_script(post)">
+    %if post.is_mathjax:
+        <script src="/assets/js/mathjax.js" type="text/javascript"></script>
+    %endif
+</%def>

+ 15 - 0
themes/pleasant2/templates/story.tmpl

@@ -0,0 +1,15 @@
+## -*- coding: utf-8 -*-
+<%inherit file="post.tmpl"/>
+<%namespace name="helper" file="post_helper.tmpl"/>
+<%block name="extra_head">
+${helper.twitter_card_information(post)}
+</%block>
+<%block name="content">
+%if title:
+    <h1>${title}</h1>
+%endif
+    ${post.text()}
+%if enable_comments and not post.meta('nocomments'):
+    ${disqus.html_disqus(post.permalink(absolute=True), post.title(), post.base_path)}
+%endif
+</%block>

+ 7 - 0
themes/pleasant2/templates/tag.tmpl

@@ -0,0 +1,7 @@
+## -*- coding: utf-8 -*-
+<%inherit file="list_post.tmpl"/>
+<%block name="extra_head">
+        %for language in translations:
+            <link rel="alternate" type="application/rss+xml" type="application/rss+xml" title="RSS for tag ${tag} (${language})" href="${_link("tag_rss", tag, language)}">
+        %endfor
+</%block>

+ 14 - 0
themes/pleasant2/templates/tags.tmpl

@@ -0,0 +1,14 @@
+## -*- coding: utf-8 -*-
+<%inherit file="base.tmpl"/>
+<%block name="content">
+    <div class="postbox">
+        <!--Body content-->
+        <h1>${title}</h1>
+        <ul class="unstyled">
+        % for text, link in items:
+            <li><a class="tag" href="${link}"><span class="badge badge-info">${text}</span></a>
+        % endfor
+        </ul>
+        <!--End of body content-->
+    </div>
+</%block>