Merge branch 'site' of github.com:imathis/octopress into site

Conflicts:
	Rakefile
This commit is contained in:
Frederic Hemberger 2011-09-29 09:24:21 +02:00
commit 26aa0c7272
16 changed files with 241 additions and 177 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ source.old
source/_stash
source/stylesheets/screen.css
vendor
node_modules

View File

@ -1,4 +1,5 @@
.highlight, html .gist .gist-file .gist-syntax .gist-highlight {
table td.code { width: 100%; }
.line-numbers {
text-align: right;
font-size: 13px;
@ -85,19 +86,21 @@ h3.filename {
+ pre { @include border-top-radius(0px); }
}
p code,
li code {
@extend .mono;
display: inline-block;
white-space: no-wrap;
background: #fff;
font-size: .8em;
line-height: 1.5em;
color: #555;
border: 1px solid #ddd;
@include border-radius(.4em);
padding: 0 .3em;
margin: -1px 0;
p, li {
code {
@extend .mono;
display: inline-block;
white-space: no-wrap;
background: #fff;
font-size: .8em;
line-height: 1.5em;
color: #555;
border: 1px solid #ddd;
@include border-radius(.4em);
padding: 0 .3em;
margin: -1px 0;
}
pre code { font-size: 1em !important; background: none; border: none; }
}
.pre-code {
@ -216,6 +219,7 @@ figure.code {
margin-bottom: 0;
}
}
.code-title {
text-align: center;
font-size: 13px;
@ -243,3 +247,4 @@ figure.code {
text-shadow: #cbcccc 0 1px 0;
padding-left: 3em;
}

View File

@ -1,6 +1,6 @@
{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
{% include head.html %}
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %} {% if page.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}>
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %} {% if page.sidebar == 'collapse' or site.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}>
<header role="banner">{% include header.html %}</header>
<nav role="navigation">{% include navigation.html %}</nav>
<div id="main">

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ function addCodeLineNumbers() {
lineNumbers = '<pre class="line-numbers">',
tableMiddle = '</pre></td><td class="code">',
tableEnd = '</td></tr></tbody></table>',
count = $('span.line', code).length;
count = $('.line', code).length;
for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line-number">'+i+'</span>\n';
}

View File

@ -1,11 +1,6 @@
// JSON-P Twitter fetcher for Octopress
// (c) Brandon Mathis // MIT Lisence
// jXHR.js (JSON-P XHR) | v0.1 (c) Kyle Simpson | MIT License | http://mulletxhr.com/
// uncompressed version available in source/javascripts/libs/jXHR.js
(function(c){var b=c.setTimeout,d=c.document,a=0;c.jXHR=function(){var e,g,n,h,m=null;function l(){try{h.parentNode.removeChild(h)}catch(o){}}function k(){g=false;e="";l();h=null;i(0)}function f(p){try{m.onerror.call(m,p,e)}catch(o){throw new Error(p)}}function j(){if((this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded")||g){return}this.onload=this.onreadystatechange=null;g=true;if(m.readyState!==4){f("Script failed to load ["+e+"].")}l()}function i(o,p){p=p||[];m.readyState=o;if(typeof m.onreadystatechange==="function"){m.onreadystatechange.apply(m,p)}}m={onerror:null,onreadystatechange:null,readyState:0,open:function(p,o){k();internal_callback="cb"+(a++);(function(q){c.jXHR[q]=function(){try{i.call(m,4,arguments)}catch(r){m.readyState=-1;f("Script failed to run ["+e+"].")}c.jXHR[q]=null}})(internal_callback);e=o.replace(/=\?/,"=jXHR."+internal_callback);i(1)},send:function(){b(function(){h=d.createElement("script");h.setAttribute("type","text/javascript");h.onload=h.onreadystatechange=function(){j.call(h)};h.setAttribute("src",e);d.getElementsByTagName("head")[0].appendChild(h)},0);i(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};k();return m}})(window);
/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
function prettyDate(time) {
if (navigator.appName === 'Microsoft Internet Explorer') {
@ -44,12 +39,20 @@ function prettyDate(time) {
}
function linkifyTweet(text, url) {
for (var u in url) {
var shortUrl = new RegExp(url[u].url, 'g');
text = text.replace(shortUrl, '<a href="' + url[u].expanded_url + '">' + url[u].expanded_url.replace(/https?:\/\//, '') + '</a>');
}
return text.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
// Linkify urls, usernames, hashtags
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
// Use twitter's api to replace t.co shortened urls with expanded ones.
for (var u in url) {
if(url[u].expanded_url != null){
var shortUrl = new RegExp( url[u].url.replace(/https?:\/\//, ''), 'g');
text = text.replace(shortUrl, url[u].display_url);
console.log(text);
}
}
return text
}
function showTwitterFeed(tweets, twitter_user) {
@ -63,15 +66,11 @@ function showTwitterFeed(tweets, twitter_user) {
}
function getTwitterFeed(user, count, replies) {
var feed = new jXHR();
feed.onerror = function (msg,url) {
$('#tweets li.loading').addClass('error').text("Twitter's busted");
};
feed.onreadystatechange = function(data){
if (feed.readyState === 4) { showTwitterFeed(data, user); }
};
$.ajax({
url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (parseInt(count, 10)) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
, type: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { showTwitterFeed(data, user); }
})
}
// Documentation: https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
feed.open("GET","http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (parseInt(count, 10)) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?");
feed.send();
}

View File

@ -4,8 +4,10 @@ require "stringex"
## -- Rsync Deploy config -- ##
# Be sure your public key is listed in your server's ~/.ssh/authorized_keys file
ssh_user = "mathisweb@octopress.org"
ssh_user = "imathis@octopress.org"
document_root = "~/octopress.org/"
ssh_port = "22"
deploy_default = "rsync"
# This will be configured for you when you run config_deploy

View File

@ -30,9 +30,9 @@ module Jekyll
@img['title'] = title
@img['alt'] = alt
else
@img['alt'] = @img['title'].gsub!(/"/, '&#34;')
@img['alt'] = @img['title'].gsub!(/"/, '&#34;') if @img['title']
end
@img['class'].gsub!(/"/, '')
@img['class'].gsub!(/"/, '') if @img['class']
end
super
end

View File

@ -1,4 +1,5 @@
.highlight, html .gist .gist-file .gist-syntax .gist-highlight {
table td.code { width: 100%; }
.line-numbers {
text-align: right;
font-size: 13px;
@ -85,19 +86,21 @@ h3.filename {
+ pre { @include border-top-radius(0px); }
}
p code,
li code {
@extend .mono;
display: inline-block;
white-space: no-wrap;
background: #fff;
font-size: .8em;
line-height: 1.5em;
color: #555;
border: 1px solid #ddd;
@include border-radius(.4em);
padding: 0 .3em;
margin: -1px 0;
p, li {
code {
@extend .mono;
display: inline-block;
white-space: no-wrap;
background: #fff;
font-size: .8em;
line-height: 1.5em;
color: #555;
border: 1px solid #ddd;
@include border-radius(.4em);
padding: 0 .3em;
margin: -1px 0;
}
pre code { font-size: 1em !important; background: none; border: none; }
}
.pre-code {
@ -216,6 +219,7 @@ figure.code {
margin-bottom: 0;
}
}
.code-title {
text-align: center;
font-size: 13px;

View File

@ -1,7 +1,8 @@
{% if site.delicious_user %}
<section>
<h1>On Delicious</h1>
<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>
<div id="delicious"></div>
<script type="text/javascript" src="http://feeds.delicious.com/v1/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&amp;sort=date&amp;callback=renderDeliciousLinks"></script>
<p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks &raquo;</a></p>
</section>
{% endif %}
{% endif %}

View File

@ -21,7 +21,7 @@
<link href="{{ root_url }}/favicon.png" rel="icon">
<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="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
<script src="{{ root_url }}/javascripts/ender.js"></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">
{% include custom/head.html %}

View File

@ -1,6 +1,6 @@
{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
{% 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 %} {% if page.sidebar == 'collapse' or site.sidebar == 'collapse' %} class="collapse-sidebar sidebar-footer" {% endif %}>
<header role="banner">{% include header.html %}</header>
<nav role="navigation">{% include navigation.html %}</nav>
<div id="main">

File diff suppressed because one or more lines are too long

View File

@ -1,43 +1,39 @@
github = (function(){
function render(target, repos){
var i = 0, fragment = '', t = $(target)[0];
var github = (function(){
function render(target, repos){
var i = 0, fragment = '', t = $(target)[0];
for(i = 0; i < repos.length; i++)
fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
t.innerHTML = fragment;
for(i = 0; i < repos.length; i++) {
fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
}
return {
showRepos: function(options){
var feed = new jXHR();
feed.onerror = function (msg,url) {
$(options.target + ' li.loading').addClass('error').text("Error loading feed");
}
feed.onreadystatechange = function(data){
if (feed.readyState === 4) {
var repos = [];
var i;
for (i = 0; i < data.repositories.length; i++){
if (options.skip_forks && data.repositories[i].fork)
continue;
repos.push(data.repositories[i]);
}
repos.sort(function(a, b){
var a = new Date(a.pushed_at),
b = new Date(b.pushed_at);
t.innerHTML = fragment;
}
return {
showRepos: function(options){
var feed = new jXHR();
feed.onerror = function (msg,url) {
$(options.target + ' li.loading').addClass('error').text("Error loading feed");
};
feed.onreadystatechange = function(data) {
if (feed.readyState === 4) {
var repos = [];
for (var i = 0; i < data.repositories.length; i++){
if (options.skip_forks && data.repositories[i].fork) { continue; }
repos.push(data.repositories[i]);
}
repos.sort(function(a, b) {
var aDate = new Date(a.pushed_at).valueOf(),
bDate = new Date(b.pushed_at).valueOf();
if (a.valueOf() == b.valueOf()) return 0;
return a.valueOf() > b.valueOf() ? -1 : 1;
});
if (aDate === bDate) { return 0; }
return aDate > bDate ? -1 : 1;
});
if (options.count)
repos.splice(options.count);
render(options.target, repos)
}
};
feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?");
feed.send();
if (options.count) { repos.splice(options.count); }
render(options.target, repos);
}
};
};
feed.open("GET","http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?");
feed.send();
}
};
})();

View File

@ -1,24 +1,27 @@
function getNav() {
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>');
$('ul[role=main-navigation]').addClass('main-navigation');
$('ul.main-navigation a').each(function(link) {
mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>');
});
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() {
$('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e) {
e.preventDefault();
if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar');
} else {
$('body').addClass('collapse-sidebar');
}
});
if(!$('body').hasClass('sidebar-footer')) {
$('#content').append('<span class="toggle-sidebar"></span>');
$('.toggle-sidebar').bind('click', function(e) {
e.preventDefault();
if ($('body').hasClass('collapse-sidebar')) {
$('body').removeClass('collapse-sidebar');
} else {
$('body').addClass('collapse-sidebar');
}
});
}
var sections = $('aside.sidebar > section');
if (sections.length > 1) {
sections.each(function(section, index){
@ -49,13 +52,13 @@ function testFeatures() {
}
function addCodeLineNumbers() {
if (navigator.appName == 'Microsoft Internet Explorer') { return; }
if (navigator.appName === 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(code) {
var tableStart = '<table><tbody><tr><td class="gutter">',
lineNumbers = '<pre class="line-numbers">',
tableMiddle = '</pre></td><td class="code">',
tableEnd = '</td></tr></tbody></table>',
count = $('span.line', code).length;
count = $('.line', code).length;
for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line-number">'+i+'</span>\n';
}
@ -69,7 +72,7 @@ function flashVideoFallback(){
flashplayerskin = "/assets/jwplayer/glow/glow.xml";
$('video').each(function(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){
var src = $(source).attr('src'),
id = 'video_'+Math.round(1 + Math.random()*(100000)),
@ -89,7 +92,7 @@ function flashVideoFallback(){
function wrapFlashVideos() {
$('object').each(function(object) {
object = $(object);
if (object.children('param[name=movie]')) {
if ( $('param[name=movie]', object).length ) {
var wrapper = object.before('<div class="flash-video"><div>').previous();
$(wrapper).children().append(object);
}
@ -101,6 +104,15 @@ function wrapFlashVideos() {
});
}
function renderDeliciousLinks(items) {
var output = "<ul>";
for (var i=0,l=items.length; i<l; i++) {
output += '<li><a href="' + items[i].u + '" title="Tags: ' + items[i].t.join(', ') + '">' + items[i].d + '</a></li>';
}
output += "</ul>";
$('#delicious').html(output);
}
$.domReady(function() {
testFeatures();
wrapFlashVideos();

View File

@ -1,82 +1,76 @@
// JSON-P Twitter fetcher for Octopress
// (c) Brandon Mathis // MIT Lisence
function getTwitterFeed(user, count, replies) {
var feed = new jXHR();
feed.onerror = function (msg,url) {
$('#tweets li.loading').addClass('error').text("Twitter's busted");
}
feed.onreadystatechange = function(data){
if (feed.readyState === 4) {
var tweets = new Array();
var i = 0;
for (i in data){
if(tweets.length < count){
if(replies || data[i].in_reply_to_user_id == null){
tweets.push(data[i]);
}
}
}
showTwitterFeed(tweets, user);
}
};
feed.open("GET","http://twitter.com/statuses/user_timeline/"+user+".json?trim_user=true&count="+(parseInt(count)+60)+"&callback=?");
feed.send();
}
function showTwitterFeed(tweets, twitter_user){
var timeline = document.getElementById('tweets');
timeline.innerHTML='';
for (t in tweets){
timeline.innerHTML+='<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'))+'</p>'+'</li>';
}
}
function linkifyTweet(text){
return text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
}
// jXHR.js (JSON-P XHR) | v0.1 (c) Kyle Simpson | MIT License | http://mulletxhr.com/
// uncompressed version available in source/javascripts/libs/jXHR.js
(function(c){var b=c.setTimeout,d=c.document,a=0;c.jXHR=function(){var e,g,n,h,m=null;function l(){try{h.parentNode.removeChild(h)}catch(o){}}function k(){g=false;e="";l();h=null;i(0)}function f(p){try{m.onerror.call(m,p,e)}catch(o){throw new Error(p)}}function j(){if((this.readyState&&this.readyState!=="complete"&&this.readyState!=="loaded")||g){return}this.onload=this.onreadystatechange=null;g=true;if(m.readyState!==4){f("Script failed to load ["+e+"].")}l()}function i(o,p){p=p||[];m.readyState=o;if(typeof m.onreadystatechange==="function"){m.onreadystatechange.apply(m,p)}}m={onerror:null,onreadystatechange:null,readyState:0,open:function(p,o){k();internal_callback="cb"+(a++);(function(q){c.jXHR[q]=function(){try{i.call(m,4,arguments)}catch(r){m.readyState=-1;f("Script failed to run ["+e+"].")}c.jXHR[q]=null}})(internal_callback);e=o.replace(/=\?/,"=jXHR."+internal_callback);i(1)},send:function(){b(function(){h=d.createElement("script");h.setAttribute("type","text/javascript");h.onload=h.onreadystatechange=function(){j.call(h)};h.setAttribute("src",e);d.getElementsByTagName("head")[0].appendChild(h)},0);i(2)},setRequestHeader:function(){},getResponseHeader:function(){return""},getAllResponseHeaders:function(){return[]}};k();return m}})(window);
/* Sky Slavin, Ludopoli. MIT license. * based on JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */
function prettyDate(time) {
if (navigator.appName == 'Microsoft Internet Explorer') {
if (navigator.appName === 'Microsoft Internet Explorer') {
return "<span>&infin;</span>"; // because IE date parsing isn't fun.
}
var say = {
just_now: " now",
minute_ago: "1m",
minutes_ago: "m",
hour_ago: "1h",
hours_ago: "h",
yesterday: "1d",
days_ago: "d",
weeks_ago: "w"
};
var say = {};
say.just_now = " now",
say.minute_ago = "1m",
say.minutes_ago = "m",
say.hour_ago = "1h",
say.hours_ago = "h",
say.yesterday = "1d",
say.days_ago = "d",
say.weeks_ago = "w"
var current_date = new Date(),
current_date_time = current_date.getTime(),
current_date_full = current_date_time + (1 * 60000),
date = new Date(time),
diff = ((current_date_full - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
var current_date = new Date();
current_date_time = current_date.getTime();
current_date_full = current_date_time + (1 * 60000);
var date = new Date(time);
var diff = ((current_date_full - date.getTime()) / 1000);
var day_diff = Math.floor(diff / 86400);
if (isNaN(day_diff) || day_diff < 0) { return "<span>&infin;</span>"; }
if (isNaN(day_diff) || day_diff < 0) return "<span>&infin;</span>";
return day_diff == 0 && (
return day_diff === 0 && (
diff < 60 && say.just_now ||
diff < 120 && say.minute_ago ||
diff < 3600 && Math.floor(diff / 60) + say.minutes_ago ||
diff < 7200 && say.hour_ago ||
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
day_diff == 1 && say.yesterday ||
day_diff === 1 && say.yesterday ||
day_diff < 7 && day_diff + say.days_ago ||
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
}
function linkifyTweet(text, url) {
// Linkify urls, usernames, hashtags
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
// Use twitter's api to replace t.co shortened urls with expanded ones.
for (var u in url) {
if(url[u].expanded_url != null){
var shortUrl = new RegExp( url[u].url.replace(/https?:\/\//, ''), 'g');
text = text.replace(shortUrl, url[u].display_url);
console.log(text);
}
}
return text
}
function showTwitterFeed(tweets, twitter_user) {
var timeline = document.getElementById('tweets'),
content = '';
for (var t in tweets) {
content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
}
timeline.innerHTML = content;
}
function getTwitterFeed(user, count, replies) {
$.ajax({
url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (parseInt(count, 10)) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
, type: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { showTwitterFeed(data, user); }
})
}