Merge branch 'master' into site

Conflicts:
	_config.yml
This commit is contained in:
Brandon Mathis 2011-09-21 14:01:11 -05:00
commit 480b60ddf1
28 changed files with 162 additions and 148 deletions

4
.gitignore vendored
View File

@ -1,8 +1,8 @@
.bundle .bundle
.DS_Store .DS_Store
.sass-cache .sass-cache
_gist_cache .gist-cache
_code_cache .pygments-cache
_deploy _deploy
public public
sass.old sass.old

View File

@ -41,7 +41,7 @@ body {
max-width: $max-width; max-width: $max-width;
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
> header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav[role=pagination] { > header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav.pagination {
@extend .group; @extend .group;
padding-left: $pad-min; padding-left: $pad-min;
padding-right: $pad-min; padding-right: $pad-min;
@ -67,7 +67,7 @@ body {
#content { > div, > article { width: 100%; }} #content { > div, > article { width: 100%; }}
aside[role=sidebar] { aside.sidebar {
float: none; float: none;
padding: 0 $pad-min 1px; padding: 0 $pad-min 1px;
background-color: lighten($sidebar-bg, 2); background-color: lighten($sidebar-bg, 2);
@ -88,7 +88,7 @@ aside[role=sidebar] {
body.sidebar-footer { body.sidebar-footer {
@media only screen and (min-width: 750px) { @media only screen and (min-width: 750px) {
aside[role=sidebar]{ @include collapse-sidebar; } aside.sidebar{ @include collapse-sidebar; }
} }
#content { margin-right: 0px; } #content { margin-right: 0px; }
.toggle-sidebar { display: none; } .toggle-sidebar { display: none; }
@ -98,7 +98,7 @@ body.sidebar-footer {
body > header { font-size: 1em; } body > header { font-size: 1em; }
} }
@media only screen and (min-width: 750px) { @media only screen and (min-width: 750px) {
aside[role=sidebar] { @include collapse-sidebar; } aside.sidebar { @include collapse-sidebar; }
} }
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {
body { -webkit-text-size-adjust: auto; } body { -webkit-text-size-adjust: auto; }
@ -120,7 +120,7 @@ body.sidebar-footer {
float: left; float: left;
} }
} }
aside[role=sidebar] { aside.sidebar {
@extend .group; @extend .group;
width: $sidebar-width-medium - $sidebar-pad-medium*2; width: $sidebar-width-medium - $sidebar-pad-medium*2;
padding: 0 $sidebar-pad-medium $sidebar-pad-medium; padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
@ -147,7 +147,7 @@ body.sidebar-footer {
padding-bottom: $pad-wide/2; padding-bottom: $pad-wide/2;
} }
} }
aside[role=sidebar] { aside.sidebar {
width: $sidebar-width-wide - $sidebar-pad-wide*2; width: $sidebar-width-wide - $sidebar-pad-wide*2;
padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide; padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
.collapse-sidebar & { .collapse-sidebar & {

View File

@ -60,7 +60,7 @@ $page-border-bottom: darken($footer-bg, 5) !default;
a { a {
@include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active); @include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active);
} }
aside[role=sidebar] a { aside.sidebar a {
@include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active); @include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active);
} }
a { a {

View File

@ -121,7 +121,7 @@ article + article {
display: inline-block; display: inline-block;
} }
#content nav[role=pagination] { #content nav.pagination {
text-align: center; text-align: center;
font-size: .95em; font-size: .95em;
div { div {

View File

@ -31,8 +31,8 @@ body > nav {
} }
} }
} }
fieldset[role=site-search]{ float: right; width: 48%; } fieldset[role=search]{ float: right; width: 48%; }
fieldset[role=mobile-nav]{ float: left; width: 48%; fieldset.mobile-nav{ float: left; width: 48%;
select{ width: 100%; font-size: .8em; border: 1px solid #888;} select{ width: 100%; font-size: .8em; border: 1px solid #888;}
} }
ul { display: none; } ul { display: none; }
@ -44,7 +44,7 @@ body > nav {
display: block; display: block;
padding-top: .15em; padding-top: .15em;
} }
ul[role=subscription] { ul.subscription {
margin-left: .8em; margin-left: .8em;
float: right; float: right;
li:last-child a { padding-right: 0; } li:last-child a { padding-right: 0; }
@ -85,8 +85,8 @@ body > nav {
width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px; width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px;
.search { width: 91%; } .search { width: 91%; }
} }
fieldset[role=mobile-nav] { display: none; } fieldset.mobile-nav { display: none; }
fieldset[role=site-search]{ width: 99%; } fieldset[role=search]{ width: 99%; }
} }
@media only screen and (min-width: 992px) { @media only screen and (min-width: 992px) {
form { form {
@ -130,7 +130,7 @@ body > nav {
} }
} }
} }
ul[role=subscription] { position: relative; top: .2em; li, a { border: 0; padding: 0; }} ul.subscription { position: relative; top: .2em; li, a { border: 0; padding: 0; }}
a[rel=subscribe-rss]{ @include mask-subscription-nav('rss.png'); } a[rel=subscribe-rss]{ @include mask-subscription-nav('rss.png'); }
a[rel=subscribe-email]{ @include mask-subscription-nav('email.png'); } a[rel=subscribe-email]{ @include mask-subscription-nav('email.png'); }
} }

View File

@ -201,7 +201,7 @@ pre, .highlight, .gist-highlight {
} }
.highlight code { @extend .pre-code; background: #000;} .highlight code { @extend .pre-code; background: #000;}
figure[role=code] { figure.code {
background: none; background: none;
padding: 0; padding: 0;
border: 0; border: 0;

View File

@ -1,7 +1,7 @@
.side-shadow-border { .side-shadow-border {
@include box-shadow(lighten($sidebar-bg, 5) 0 1px); @include box-shadow(lighten($sidebar-bg, 5) 0 1px);
} }
aside[role=sidebar] { aside.sidebar {
color: $sidebar-color; color: $sidebar-color;
text-shadow: lighten($sidebar-bg, 8) 0 1px; text-shadow: lighten($sidebar-bg, 8) 0 1px;
a { @extend .force-wrap; } a { @extend .force-wrap; }

View File

@ -6,7 +6,12 @@
<h1 class="entry-title">{{ page.title | titlecase }}</h1> <h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% endif %} {% endif %}
{% unless page.meta == false %} {% unless page.meta == false %}
<p class="meta">{% include post/date.html %}{{ time }}</p> <p class="meta">
{% include post/date.html %}{{ time }}
{% if site.disqus_short_name and page.comments != false and site.disqus_show_comment_count == true %}
| <a href="{% if index %}{{ root_url }}{{ post.url }}{% endif %}#disqus_thread">Comments</a>
{% endif %}
</p>
{% endunless %} {% endunless %}
</header> </header>
{% endunless %} {% endunless %}

View File

@ -1,7 +1,7 @@
{% if site.delicious_user %} {% if site.delicious_user %}
<section> <section>
<h1>On Delicious</h1> <h1>On Delicious</h1>
<script type="text/javascript" src="http://feeds.delicious.com/v2/js/{{ site.delicious_user }}?title=&count={{ site.delicious_count }}&sort=date&extended"></script> <script type="text/javascript" src="http://feeds.delicious.com/v2/js/{{ site.delicious_user }}?title=&amp;count={{ site.delicious_count }}&amp;sort=date&amp;extended"></script>
<p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks &raquo;</a></p> <p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks &raquo;</a></p>
</section> </section>
{% endif %} {% endif %}

View File

@ -1,3 +1,3 @@
<!--Fonts from Google's Web font directory at http://google.com/webfonts --> <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> <link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> <link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">

View File

@ -1,4 +1,4 @@
<ul role=main-navigation> <ul class="main-navigation">
<li><a href="{{ root_url }}/">Blog</a></li> <li><a href="{{ root_url }}/">Blog</a></li>
<li><a href="{{ root_url }}/blog/archives">Archives</a></li> <li><a href="{{ root_url }}/blog/archives">Archives</a></li>
</ul> </ul>

View File

@ -0,0 +1,22 @@
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %}
{% if site.disqus_short_name and page.comments != false %}
<script type="text/javascript">
(function () {
var disqus_shortname = '{{ site.disqus_short_name }}';
{% if page.comments == true %}
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %}
// var disqus_developer = 1;
var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}';
var disqus_script = 'embed.js'
{% else %}
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %}
var disqus_script = 'count.js'
{% endif %}
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
{% endif %}

View File

@ -4,27 +4,25 @@
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--> <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{% if page.title %}{{page.title}} - {% endif %}{{site.title}}</title> <title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="author" content="{{site.author}}"> <meta name="author" content="{{ site.author }}">
{% if page.description %}
<meta name="description" content="{{page.description}}"/> {% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %}
{% endif %} <meta name="description" content="{{ description | strip_newlines | strip_html | truncate:150 }}">
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %}
<!-- http://t.co/dKP3o1e --> <!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True"> <meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{% if page.keywords %}
<meta name="keywords" content="{{page.keywords}}"/>
{% endif %}
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}"> <link rel="canonical" href="{{ canonical }}">
<link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> <link href="{{ root_url }}/favicon.png" rel="icon">
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script>
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> <script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
<script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script>
<link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> <link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml">
{% include custom/head.html %} {% include custom/head.html %}
</head> </head>

View File

@ -1,11 +1,11 @@
<ul role=subscription data-subscription="rss{% if site.subscribe_email %} email{% endif %}"> <ul class="subscription" data-subscription="rss{% if site.subscribe_email %} email{% endif %}">
<li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li> <li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
{% if site.subscribe_email %} {% if site.subscribe_email %}
<li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li> <li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li>
{% endif %} {% endif %}
</ul> </ul>
<form action="{{ site.simple_search }}" method="get"> <form action="{{ site.simple_search }}" method="get">
<fieldset role="site-search"> <fieldset role="search">
<input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" /> <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/> <input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset> </fieldset>

View File

@ -1,13 +1 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_short_name }}';
var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}';
//var disqus_developer = 1;
(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> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

View File

@ -1,14 +1,15 @@
{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %} {% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
{% include head.html %} {% include head.html %}
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}> <body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}>
<header>{% include header.html %}</header> <header role="banner">{% include header.html %}</header>
<nav role=navigation>{% include navigation.html %}</nav> <nav role="navigation">{% include navigation.html %}</nav>
<div id="main"> <div id="main">
<div id="content"> <div id="content">
{{ content | expand_urls: root_url }} {{ content | expand_urls: root_url }}
</div> </div>
</div> </div>
<footer>{% include footer.html %}</footer> <footer role="contentinfo">{% include footer.html %}</footer>
{% include disqus.html %}
{% include google_analytics.html %} {% include google_analytics.html %}
{% include google_plus_one.html %} {% include google_plus_one.html %}
{% include twitter_sharing.html %} {% include twitter_sharing.html %}

View File

@ -3,7 +3,7 @@ layout: default
--- ---
<div> <div>
<article> <article role="article">
{% if page.title %} {% if page.title %}
<header> <header>
<h1 class="entry-title">{{ page.title | titlecase }}</h1> <h1 class="entry-title">{{ page.title | titlecase }}</h1>
@ -27,12 +27,12 @@ layout: default
{% if site.disqus_short_name and page.comments == true %} {% if site.disqus_short_name and page.comments == true %}
<section> <section>
<h1>Comments</h1> <h1>Comments</h1>
<div id="disqus_thread">{% include post/disqus_thread.html %}</div> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section> </section>
{% endif %} {% endif %}
</div> </div>
{% unless page.sidebar == false %} {% unless page.sidebar == false %}
<aside role=sidebar> <aside class="sidebar">
{% if site.page_asides.size %} {% if site.page_asides.size %}
{% include_array page_asides %} {% include_array page_asides %}
{% else %} {% else %}

View File

@ -4,7 +4,7 @@ single: true
--- ---
<div> <div>
<article class="hentry"> <article class="hentry" role="article">
{% include article.html %} {% include article.html %}
<footer> <footer>
<p class="meta"> <p class="meta">
@ -17,15 +17,15 @@ single: true
{% endunless %} {% endunless %}
</footer> </footer>
</article> </article>
{% if site.disqus_short_name and page.comments != false %} {% if site.disqus_short_name and page.comments == true %}
<section> <section>
<h1>Comments</h1> <h1>Comments</h1>
<div id="disqus_thread">{% include post/disqus_thread.html %}</div> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section> </section>
{% endif %} {% endif %}
</div> </div>
{% unless page.sidebar == false %} {% unless page.sidebar == false %}
<aside role=sidebar> <aside class="sidebar">
{% if site.post_asides.size %} {% if site.post_asides.size %}
{% include_array post_asides %} {% include_array post_asides %}
{% else %} {% else %}

View File

@ -3,14 +3,14 @@ layout: default
--- ---
<div class="blog-index"> <div class="blog-index">
{% assign index = true %} {% assign index = true %}
{% for post in paginator.posts %} {% for post in paginator.posts %}
{% assign content = post.content %} {% assign content = post.content %}
<article> <article>
{% include article.html %} {% include article.html %}
</article> </article>
{% endfor %} {% endfor %}
<nav role="pagination"> <nav class="pagination">
<div> <div>
{% if paginator.next_page %} {% if paginator.next_page %}
<a class="prev" href="{{paginator.next_page}}">&larr; Older</a> <a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
@ -20,20 +20,9 @@ layout: default
<a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a> <a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
{% endif %} {% endif %}
</div> </div>
</nav> </nav>
{% if site.disqus_short_name %}
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_short_name }}';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
{% endif %}
</div> </div>
<aside role=sidebar> <aside class="sidebar">
{% if site.blog_index_asides.size %} {% if site.blog_index_asides.size %}
{% include_array blog_index_asides %} {% include_array blog_index_asides %}
{% else %} {% else %}

View File

@ -1,38 +1,40 @@
function getNav(){ function getNav() {
var mobileNav = $('nav[role=navigation] fieldset[role=site-search]').after('<fieldset role="mobile-nav"></fieldset>').next().append('<select></select>'); var mobileNav = $('nav[role=navigation] fieldset[role=search]').after('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>');
mobileNav.children('select').append('<option value="">Navigate&hellip;</option>'); mobileNav.children('select').append('<option value="">Navigate&hellip;</option>');
$($('ul[role=main-navigation] a')).each(function(link) { $('ul.main-navigation a').each(function(link) {
mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>') mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>');
}); });
mobileNav.children('select').bind('change', function(event){ mobileNav.children('select').bind('change', function(event) {
if (event.target.value) window.location.href = event.target.value; if (event.target.value) window.location.href = event.target.value;
}); });
} }
function addSidebarToggler() { function addSidebarToggler() {
$('#content').append('<span class="toggle-sidebar"></span>'); $('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e){ $('.toggle-sidebar').bind('click', function(e) {
e.preventDefault(); e.preventDefault();
if($('body').hasClass('collapse-sidebar')){ if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar'); $('body').removeClass('collapse-sidebar');
} else { } else {
$('body').addClass('collapse-sidebar'); $('body').addClass('collapse-sidebar');
} }
}); });
sections = $('aside[role=sidebar] > section') var sections = $('aside.sidebar > section');
if(sections.length > 1){ if (sections.length > 1) {
sections.each(function(section, index){ sections.each(function(section, index){
if ((sections.length >= 3) && index % 3 == 0) { if ((sections.length >= 3) && index % 3 === 0) {
$(section).addClass("first"); $(section).addClass("first");
} }
count = ((index +1) % 2) ? "odd" : "even"; var count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count); $(section).addClass(count);
}); });
} }
if(sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds') } if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
} }
function testFeatures() { function testFeatures() {
var features = ['maskImage']; var features = ['maskImage'];
$(features).map(function(feature){ $(features).map(function(feature) {
if (Modernizr.testAllProps(feature)) { if (Modernizr.testAllProps(feature)) {
$('html').addClass(feature); $('html').addClass(feature);
} else { } else {
@ -46,18 +48,18 @@ function testFeatures() {
} }
} }
function addCodeLineNumbers(){ function addCodeLineNumbers() {
if (navigator.appName == 'Microsoft Internet Explorer') { return } if (navigator.appName == 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(code){ $('div.gist-highlight').each(function(code) {
var tableStart = '<table cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter">'; var tableStart = '<table><tbody><tr><td class="gutter">',
var lineNumbers = '<pre class="line-numbers">'; lineNumbers = '<pre class="line-numbers">',
var tableMiddle = '</pre></td><td class="code" width="100%">'; tableMiddle = '</pre></td><td class="code">',
var tableEnd = '</td></tr></tbody></table>'; tableEnd = '</td></tr></tbody></table>',
var count = $('div.line', code).length; count = $('span.line', code).length;
for (i=1;i<=count; i++){ for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line">'+i+'</span>\n'; lineNumbers += '<span class="line-number">'+i+'</span>\n';
} }
table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd; var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
$(code).html(table); $(code).html(table);
}); });
} }
@ -67,38 +69,39 @@ function flashVideoFallback(){
flashplayerskin = "/assets/jwplayer/glow/glow.xml"; flashplayerskin = "/assets/jwplayer/glow/glow.xml";
$('video').each(function(video){ $('video').each(function(video){
video = $(video); video = $(video);
if(!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){ if (!Modernizr.video.h264 && swfobject.getFlashPlayerVersion() || window.location.hash.indexOf("flash-test") != -1){
video.children('source[src$=mp4]').first().map(function(source){; video.children('source[src$=mp4]').first().map(function(source){
var src = $(source).attr('src'), var src = $(source).attr('src'),
id = 'video_'+Math.round(1 + Math.random()*(100000)), id = 'video_'+Math.round(1 + Math.random()*(100000)),
width = video.attr('width'), width = video.attr('width'),
height = parseInt(video.attr('height')) + 30; height = parseInt(video.attr('height'), 10) + 30;
video.after('<div class="flash-video"><div><div id='+id+'>'); video.after('<div class="flash-video"><div><div id='+id+'>');
swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0", swfobject.embedSWF(flashplayerlocation, id, width, height + 30, "9.0.0",
{ file : src, image : video.attr('poster'), skin : flashplayerskin } , { file : src, image : video.attr('poster'), skin : flashplayerskin } ,
{ movie : src, wmode : "opaque", allowfullscreen : "true" }); { movie : src, wmode : "opaque", allowfullscreen : "true" }
);
}); });
video.remove(); video.remove();
} }
}); });
} }
function wrapFlashVideos(){ function wrapFlashVideos() {
$('object').each(function(object){ $('object').each(function(object) {
object = $(object); object = $(object);
if(object.children('param[name=movie]')){ if (object.children('param[name=movie]')) {
var wrapper = object.before('<div class="flash-video"><div>').previous(); var wrapper = object.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(object); $(wrapper).children().append(object);
} }
}); });
$('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe){ $('iframe[src*=vimeo],iframe[src*=youtube]').each(function(iframe) {
iframe = $(iframe); iframe = $(iframe);
var wrapper = iframe.before('<div class="flash-video"><div>').previous(); var wrapper = iframe.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(iframe); $(wrapper).children().append(iframe);
}); });
} }
$.domReady(function(){ $.domReady(function() {
testFeatures(); testFeatures();
wrapFlashVideos(); wrapFlashVideos();
flashVideoFallback(); flashVideoFallback();
@ -123,7 +126,7 @@ $.domReady(function(){
} }
if ((meta = meta[meta.length - 1]) && addEvent in doc) { if ((meta = meta[meta.length - 1]) && addEvent in doc) {
fix(); fix();
scales = [.25, 1.6]; scales = [0.25, 1.6];
doc[addEvent](type, fix, true); doc[addEvent](type, fix, true);
} }
}(document)); }(document));

View File

@ -156,9 +156,9 @@ task :integrate do
FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), "#{source_dir}/#{posts_dir}/" FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), "#{source_dir}/#{posts_dir}/"
end end
desc "Clean out caches: _code_cache, _gist_cache, .sass-cache" desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache"
task :clean do task :clean do
rm_rf ["_code_cache/**", "_gist_cache/**", ".sass-cache/**", "source/stylesheets/screen.css"] rm_rf [".pygments-cache/**", ".gist-cache/**", ".sass-cache/**", "source/stylesheets/screen.css"]
end end
desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom" desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom"
@ -209,7 +209,7 @@ desc "copy dot files for deployment"
task :copydot do task :copydot do
exclusions = [".", "..", ".DS_Store"] exclusions = [".", "..", ".DS_Store"]
Dir["#{source_dir}/**/.*"].each do |file| Dir["#{source_dir}/**/.*"].each do |file|
if !File.directory?(file) && !exclusions.include?(file) if !File.directory?(file) && !exclusions.include?(File.basename(file))
cp(file, file.gsub(/#{source_dir}/, "#{public_dir}")); cp(file, file.gsub(/#{source_dir}/, "#{public_dir}"));
end end
end end
@ -225,14 +225,14 @@ desc "deploy public directory to github pages"
multitask :push do multitask :push do
puts "## Deploying branch to Github Pages " puts "## Deploying branch to Github Pages "
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
system "cp -R #{public_dir}/* #{deploy_dir}" system "cp -R #{public_dir}/ #{deploy_dir}"
puts "\n## copying #{public_dir} to #{deploy_dir}" puts "\n## copying #{public_dir} to #{deploy_dir}"
cd "#{deploy_dir}" do cd "#{deploy_dir}" do
system "git add ." system "git add ."
system "git add -u" system "git add -u"
puts "\n## Commiting: Site updated at #{Time.now.utc}" puts "\n## Commiting: Site updated at #{Time.now.utc}"
message = "Site updated at #{Time.now.utc}" message = "Site updated at #{Time.now.utc}"
system "git commit -m '#{message}'" system "git commit -m \"#{message}\""
puts "\n## Pushing generated #{deploy_dir} website" puts "\n## Pushing generated #{deploy_dir} website"
system "git push origin #{deploy_branch}" system "git push origin #{deploy_branch}"
puts "\n## Github Pages deploy complete" puts "\n## Github Pages deploy complete"
@ -284,7 +284,7 @@ task :config_deploy, :branch do |t, args|
system "git clean -fdx" system "git clean -fdx"
system "echo 'My Octopress Page is coming soon &hellip;' > index.html" system "echo 'My Octopress Page is coming soon &hellip;' > index.html"
system "git add ." system "git add ."
system "git commit -m 'Octopress init'" system "git commit -m \"Octopress init\""
rakefile = IO.read(__FILE__) rakefile = IO.read(__FILE__)
rakefile.sub!(/deploy_branch(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_branch\\1=\\2\\3#{args.branch}\\3") rakefile.sub!(/deploy_branch(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_branch\\1=\\2\\3#{args.branch}\\3")
rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push\\3") rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push\\3")

View File

@ -77,6 +77,7 @@ delicious_count: 3
# Disqus Comments # Disqus Comments
disqus_short_name: octopress disqus_short_name: octopress
disqus_show_comment_count: false
# Google Analytics # Google Analytics
google_analytics_tracking_id: UA-10876422-2 google_analytics_tracking_id: UA-10876422-2

View File

@ -27,7 +27,7 @@ module BacktickCodeBlock
end end
if @lang.nil? || @lang == 'plain' if @lang.nil? || @lang == 'plain'
code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;')) code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
"<figure role=code>#{@caption}#{code}</figure>" "<figure class='code'>#{@caption}#{code}</figure>"
else else
if @lang.include? "-raw" if @lang.include? "-raw"
raw = "``` #{@options.sub('-raw', '')}\n" raw = "``` #{@options.sub('-raw', '')}\n"
@ -35,7 +35,7 @@ module BacktickCodeBlock
raw += "\n```\n" raw += "\n```\n"
else else
code = highlight(str, @lang) code = highlight(str, @lang)
"<figure role=code>#{@caption}#{code}</figure>" "<figure class='code'>#{@caption}#{code}</figure>"
end end
end end
end end

View File

@ -24,7 +24,7 @@
# #
# Output: # Output:
# #
# <figure role=code> # <figure class='code'>
# <figcaption><span>Got pain? painrelief.sh</span> <a href="http://site.com/painrelief.sh">Download it!</a> # <figcaption><span>Got pain? painrelief.sh</span> <a href="http://site.com/painrelief.sh">Download it!</a>
# <div class="highlight"><pre><code class="sh"> # <div class="highlight"><pre><code class="sh">
# -- nicely escaped highlighted code -- # -- nicely escaped highlighted code --
@ -37,7 +37,7 @@
# <sarcasm>Ooooh, sarcasm... How original!</sarcasm> # <sarcasm>Ooooh, sarcasm... How original!</sarcasm>
# {% endcodeblock %} # {% endcodeblock %}
# #
# <figure role=code> # <figure class='code'>
# <pre><code>&lt;sarcasm> Ooooh, sarcasm... How original!&lt;/sarcasm></code></pre> # <pre><code>&lt;sarcasm> Ooooh, sarcasm... How original!&lt;/sarcasm></code></pre>
# </figure> # </figure>
# #
@ -80,7 +80,7 @@ module Jekyll
def render(context) def render(context)
output = super output = super
code = super.join code = super.join
source = "<figure role=code>" source = "<figure class='code'>"
source += @caption if @caption source += @caption if @caption
if @filetype if @filetype
source += " #{highlight(code, @filetype)}</figure>" source += " #{highlight(code, @filetype)}</figure>"

View File

@ -16,7 +16,7 @@ module Jekyll
super super
@text = text @text = text
@cache_disabled = false @cache_disabled = false
@cache_folder = File.expand_path "../_gist_cache", File.dirname(__FILE__) @cache_folder = File.expand_path "../.gist-cache", File.dirname(__FILE__)
FileUtils.mkdir_p @cache_folder FileUtils.mkdir_p @cache_folder
end end

View File

@ -61,7 +61,7 @@ module Jekyll
@filetype = file.extname.sub('.','') if @filetype.nil? @filetype = file.extname.sub('.','') if @filetype.nil?
title = @title ? "#{@title} (#{file.basename})" : file.basename title = @title ? "#{@title} (#{file.basename})" : file.basename
url = "/#{code_dir}/#{@file}" url = "/#{code_dir}/#{@file}"
source = "<figure role=code><figcaption><span>#{title}</span> <a href='#{url}'>download</a></figcaption>\n" source = "<figure class='code'><figcaption><span>#{title}</span> <a href='#{url}'>download</a></figcaption>\n"
source += " #{highlight(code, @filetype)}</figure>" source += " #{highlight(code, @filetype)}</figure>"
safe_wrap(source) safe_wrap(source)
end end

View File

@ -56,6 +56,13 @@ module OctopressLiquidFilters
end end
end end
# Extracts raw content DIV from template, used for page description as {{ content }}
# contains complete sub-template code on main page level
def raw_content(input)
/<div class="entry-content">(?<content>[\s\S]*?)<\/div>\s*<(footer|\/article)>/ =~ input
return (content.nil?) ? input : content
end
# Replaces relative urls with full urls # Replaces relative urls with full urls
def expand_urls(input, url='') def expand_urls(input, url='')
url ||= '/' url ||= '/'

View File

@ -2,7 +2,7 @@ require 'pygments'
require 'fileutils' require 'fileutils'
require 'digest/md5' require 'digest/md5'
PYGMENTS_CACHE_DIR = File.expand_path('../../_code_cache', __FILE__) PYGMENTS_CACHE_DIR = File.expand_path('../../.pygments-cache', __FILE__)
FileUtils.mkdir_p(PYGMENTS_CACHE_DIR) FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
module HighlightCode module HighlightCode
@ -30,12 +30,12 @@ module HighlightCode
highlighted_code highlighted_code
end end
def tableize_code (str, lang = '') def tableize_code (str, lang = '')
table = '<div class="highlight"><table cellpadding="0" cellspacing="0"><tr><td class="gutter"><pre class="line-numbers">' table = '<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers">'
code = '' code = ''
str.lines.each_with_index do |line,index| str.lines.each_with_index do |line,index|
table += "<span class='line'>#{index+1}</span>\n" table += "<span class='line-number'>#{index+1}</span>\n"
code += "<div class='line'>#{line}</div>" code += "<span class='line'>#{line}</span>"
end end
table += "</pre></td><td class='code' width='100%'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>" table += "</pre></td><td class='code'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>"
end end
end end