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
.DS_Store
.sass-cache
_gist_cache
_code_cache
.gist-cache
.pygments-cache
_deploy
public
sass.old

View File

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

View File

@ -60,7 +60,7 @@ $page-border-bottom: darken($footer-bg, 5) !default;
a {
@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);
}
a {

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,12 @@
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% endif %}
{% 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 %}
</header>
{% endunless %}

View File

@ -1,7 +1,7 @@
{% if site.delicious_user %}
<section>
<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>
</section>
{% endif %}

View File

@ -1,3 +1,3 @@
<!--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+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<!--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+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/archives">Archives</a></li>
</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]-->
<head>
<meta charset="utf-8">
<title>{% if page.title %}{{page.title}} - {% endif %}{{site.title}}</title>
<meta name="author" content="{{site.author}}">
{% if page.description %}
<meta name="description" content="{{page.description}}"/>
{% endif %}
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="author" content="{{ site.author }}">
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %}
<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 -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<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 %}
<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">
<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/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 %}
</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>
{% if site.subscribe_email %}
<li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li>
{% endif %}
</ul>
<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 class="search" type="text" name="q" results="0" placeholder="Search"/>
</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>

View File

@ -1,14 +1,15 @@
{% 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 %}>
<header>{% include header.html %}</header>
<nav role=navigation>{% include navigation.html %}</nav>
<header role="banner">{% include header.html %}</header>
<nav role="navigation">{% include navigation.html %}</nav>
<div id="main">
<div id="content">
{{ content | expand_urls: root_url }}
</div>
</div>
<footer>{% include footer.html %}</footer>
<footer role="contentinfo">{% include footer.html %}</footer>
{% include disqus.html %}
{% include google_analytics.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}

View File

@ -3,7 +3,7 @@ layout: default
---
<div>
<article>
<article role="article">
{% if page.title %}
<header>
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
@ -27,12 +27,12 @@ layout: default
{% if site.disqus_short_name and page.comments == true %}
<section>
<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>
{% endif %}
</div>
{% unless page.sidebar == false %}
<aside role=sidebar>
<aside class="sidebar">
{% if site.page_asides.size %}
{% include_array page_asides %}
{% else %}

View File

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

View File

@ -3,14 +3,14 @@ layout: default
---
<div class="blog-index">
{% assign index = true %}
{% for post in paginator.posts %}
{% assign content = post.content %}
{% assign index = true %}
{% for post in paginator.posts %}
{% assign content = post.content %}
<article>
{% include article.html %}
</article>
{% endfor %}
<nav role="pagination">
{% endfor %}
<nav class="pagination">
<div>
{% if paginator.next_page %}
<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>
{% endif %}
</div>
</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 %}
</nav>
</div>
<aside role=sidebar>
<aside class="sidebar">
{% if site.blog_index_asides.size %}
{% include_array blog_index_asides %}
{% else %}

View File

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

View File

@ -156,9 +156,9 @@ task :integrate do
FileUtils.mv Dir.glob("#{source_dir}/#{stash_dir}/*.*"), "#{source_dir}/#{posts_dir}/"
end
desc "Clean out caches: _code_cache, _gist_cache, .sass-cache"
desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache"
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
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
exclusions = [".", "..", ".DS_Store"]
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}"));
end
end
@ -225,14 +225,14 @@ desc "deploy public directory to github pages"
multitask :push do
puts "## Deploying branch to Github Pages "
(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}"
cd "#{deploy_dir}" do
system "git add ."
system "git add -u"
puts "\n## Commiting: 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"
system "git push origin #{deploy_branch}"
puts "\n## Github Pages deploy complete"
@ -284,7 +284,7 @@ task :config_deploy, :branch do |t, args|
system "git clean -fdx"
system "echo 'My Octopress Page is coming soon &hellip;' > index.html"
system "git add ."
system "git commit -m 'Octopress init'"
system "git commit -m \"Octopress init\""
rakefile = IO.read(__FILE__)
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")

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ module Jekyll
super
@text = text
@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
end

View File

@ -61,7 +61,7 @@ module Jekyll
@filetype = file.extname.sub('.','') if @filetype.nil?
title = @title ? "#{@title} (#{file.basename})" : file.basename
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>"
safe_wrap(source)
end

View File

@ -56,6 +56,13 @@ module OctopressLiquidFilters
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
def expand_urls(input, url='')
url ||= '/'

View File

@ -2,7 +2,7 @@ require 'pygments'
require 'fileutils'
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)
module HighlightCode
@ -30,12 +30,12 @@ module HighlightCode
highlighted_code
end
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 = ''
str.lines.each_with_index do |line,index|
table += "<span class='line'>#{index+1}</span>\n"
code += "<div class='line'>#{line}</div>"
table += "<span class='line-number'>#{index+1}</span>\n"
code += "<span class='line'>#{line}</span>"
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