fixed merge of _config

This commit is contained in:
Brandon Mathis 2011-12-10 10:36:19 -06:00
commit 284c5f98f8
47 changed files with 565 additions and 158 deletions

2
.rvmrc
View File

@ -1 +1 @@
rvm 1.9.2
rvm use 1.9.2

View File

@ -14,6 +14,10 @@ $sidebar-width-wide: 300px !default;
$indented-lists: false !default;
$header-font-size: 1em !default;
$header-padding-top: 1.5em !default;
$header-padding-bottom: 1.5em !default;
.group { @include pie-clearfix; }
@mixin collapse-sidebar {
@ -32,7 +36,10 @@ $indented-lists: false !default;
&.thirds section {
width: 30%;
margin-left: 5%;
&.first { margin-left: 0; }
&.first {
margin-left: 0;
clear: both;
}
}
}
@ -41,7 +48,7 @@ body {
max-width: $max-width;
position: relative;
margin: 0 auto;
> header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav.pagination {
> header, > nav, > footer, #content > article, #content > div > article, #content > div > section {
@extend .group;
padding-left: $pad-min;
padding-right: $pad-min;
@ -58,10 +65,27 @@ body {
padding-right: $pad-wide;
}
}
div.pagination {
@extend .group;
margin-left: $pad-min;
margin-right: $pad-min;
@media only screen and (min-width: 480px) {
margin-left: $pad-narrow;
margin-right: $pad-narrow;
}
@media only screen and (min-width: 768px) {
margin-left: $pad-medium;
margin-right: $pad-medium;
}
@media only screen and (min-width: 992px) {
margin-left: $pad-wide;
margin-right: $pad-wide;
}
}
> header {
font-size: 1em;
padding-top: 1.5em;
padding-bottom: 1.5em;
font-size: $header-font-size;
padding-top: $header-padding-top;
padding-bottom: $header-padding-bottom;
}
}
@ -95,14 +119,14 @@ body.sidebar-footer {
}
@media only screen and (min-width: 550px) {
body > header { font-size: 1em; }
body > header { font-size: $header-font-size; }
}
@media only screen and (min-width: 750px) {
aside.sidebar { @include collapse-sidebar; }
}
@media only screen and (min-width: 768px) {
body { -webkit-text-size-adjust: auto; }
body > header { font-size: 1.2em; }
body > header { font-size: $header-font-size * 1.2; }
#main {
@extend .group;
padding: 0;
@ -139,7 +163,7 @@ body.sidebar-footer {
}
@media only screen and (min-width: 992px) {
body > header { font-size: 1.3em; }
body > header { font-size: $header-font-size * 1.3; }
#content { margin-right: $sidebar-width-wide; }
#content {
> div, > article {

View File

@ -18,17 +18,29 @@ $solar-green: #859900 !default;
$solarized: dark !default;
@if $solarized == light {
$base03: #fdf6e3;
$base02: #eee8d5;
$base01: #93a1a1;
$base00: #839496;
$base0: #657b83;
$base1: #586e75;
$base2: #073642;
$base3: #002b36;
$_base03: $base03;
$_base02: $base02;
$_base01: $base01;
$_base00: $base00;
$_base0: $base0;
$_base1: $base1;
$_base2: $base2;
$_base3: $base3;
$base03: $_base3;
$base02: $_base2;
$base01: $_base1;
$base00: $_base0;
$base0: $_base00;
$base1: $_base01;
$base2: $_base02;
$base3: $_base03;
}
/* non highlighted code colors */
$pre-bg: $base03 !default;
$pre-border: $base02 !default;
$pre-border: darken($base02, 5) !default;
$pre-color: $base1 !default;

View File

@ -23,6 +23,8 @@ $type-border: #ddd !default;
/* Navigation */
$nav-bg: #ccc !default;
$nav-bg-front: image-url('noise.png') !default;
$nav-bg-back: linear-gradient(lighten($nav-bg, 8), $nav-bg, darken($nav-bg, 11)) !default;
$nav-color: darken($nav-bg, 38) !default;
$nav-color-hover: darken($nav-color, 25) !default;
$nav-placeholder: desaturate(darken($nav-bg, 10), 15) !default;
@ -46,6 +48,8 @@ $twitter-status-link: lighten($sidebar-link-color-subdued, 15) !default;
$footer-color: #888 !default;
$footer-bg: #ccc !default;
$footer-bg-front: image-url('noise.png') !default;
$footer-bg-back: linear-gradient(lighten($footer-bg, 8), $footer-bg, darken($footer-bg, 11)) !default;
$footer-color: darken($footer-bg, 38) !default;
$footer-color-hover: darken($footer-color, 10) !default;
$footer-border-top: lighten($footer-bg, 15) !default;

View File

@ -1,21 +1,30 @@
$blockquote: $type-border !default;
$mono: Menlo, Monaco, "Andale Mono", "lucida console", "Courier New", monospace;
$sans: "PT Sans", "Helvetica Neue", Arial, sans-serif !default;
$serif: "PT Serif", Georgia, Times, "Times New Roman", serif !default;
$mono: Menlo, Monaco, "Andale Mono", "lucida console", "Courier New", monospace !default;
$heading-font-family: "PT Serif", "Georgia", "Helvetica Neue", Arial, sans-serif !default;
$header-title-font-family: $heading-font-family !default;
$header-subtitle-font-family: $heading-font-family !default;
// Fonts
.heading {
font-family: "PT Serif", "Georgia", "Helvetica Neue", Arial, sans-serif;
font-family: $heading-font-family;
}
.sans { font-family: "PT Sans", "Helvetica Neue", Arial, sans-serif; }
.serif { font-family: "PT Serif", Georgia, Times, "Times New Roman", serif; }
.sans { font-family: $sans; }
.serif { font-family: $serif; }
.mono { font-family: $mono; }
body > header h1 {
font-size: 2.2em;
@extend .heading;
font-family: $header-title-font-family;
font-weight: normal;
line-height: 1.2em;
margin-bottom: 0.6667em;
}
body > header h2 {
font-family: $header-subtitle-font-family;
}
body {
line-height: 1.5em;
@ -56,12 +65,12 @@ h6, section h5, section section h4, section section section h3 {
p, blockquote, ul, ol { margin-bottom: 1.5em; }
ul { list-style-type: disc;
ul { list-style-type: circle;
ul { list-style-type: square; }}}
ul { list-style-type: circle; margin-bottom: 0px;
ul { list-style-type: square; margin-bottom: 0px; }}}
ol { list-style-type: decimal;
ol { list-style-type: lower-alpha;
ol { list-style-type: lower-roman; }}}
ol { list-style-type: lower-alpha; margin-bottom: 0px;
ol { list-style-type: lower-roman; margin-bottom: 0px; }}}
ul, ol { &, ul, ol { margin-left: 1.3em; }}
@ -115,7 +124,8 @@ blockquote {
}
}
.has-pullquote:before {
.pullquote-right:before,
.pullquote-left:before {
/* Reset metrics. */
padding: 0;
border: none;
@ -134,6 +144,13 @@ blockquote {
font-size: 1.4em;
line-height: 1.45em;
}
.pullquote-left:before {
/* Make left pullquotes align properly. */
float: left;
margin: .5em 1.5em 1em 0;
}
/* @extend this to force long lines of continuous text to wrap */
.force-wrap {
white-space: -moz-pre-wrap;

View File

@ -5,13 +5,18 @@
//$header-bg: #263347;
//$subtitle-color: lighten($header-bg, 58);
//$nav-bg: desaturate(lighten(#8fc17a, 18), 5);
//$nav-bg-front: image-url('noise.png');
//$nav-bg-back: linear-gradient(lighten($nav-bg, 8), $nav-bg, darken($nav-bg, 11));
//$sidebar-bg: desaturate(#eceff5, 8);
//$sidebar-link-color: saturate(#526f9a, 10);
//$sidebar-link-color-hover: darken(#7ab662, 9);
//$footer-bg: #ccc !default;
//$footer-bg-front: image-url('noise.png');
//$footer-bg-back: linear-gradient(lighten($footer-bg, 8), $footer-bg, darken($footer-bg, 11));
/* To use the light Solarized highlighting theme uncomment the following line */
//$solarized: light
//$solarized: light;
/* If you want to tweak the Solarized colors you can do that here */
//$base03: #002b36; //darkest blue
@ -34,5 +39,5 @@
/* Non highlighted code colors */
//$pre-bg: $base03;
//$pre-border: $base02;
//$pre-border: darken($base02, 5);
//$pre-color: $base1;

View File

@ -0,0 +1,10 @@
// Here you can easily change font faces which are used in your site.
// To give it a try, uncomment some of the lines below rebuild your blog, and see how it works. your sites's.
// If you love to use Web Fonts, you also need to add some lines to source/_includes/custom/head.html
//$sans: "Optima", sans-serif;
//$serif: "Baskerville", serif;
//$mono: "Courier", monospace;
//$heading-font-family: "Verdana", sans-serif;
//$header-title-font-family: "Futura", sans-serif;
//$header-subtitle-font-family: "Futura", sans-serif;

View File

@ -1,6 +1,10 @@
// Here you can easily change your sites's layout.
// To give it a try, uncomment some of the lines below, make changes, rebuild your blog, and see how it works.
//$header-font-size: 1em;
//$header-padding-top: 1.5em;
//$header-padding-bottom: 1.5em;
//$max-width: 1350px;
//$indented-lists: true;

View File

@ -74,6 +74,8 @@ article {
p.meta {
margin-bottom: .8em;
font-size: .85em;
clear: both;
overflow: hidden;
}
.byline + time:before, time +time:before, .comments:before, .byline ~ .categories:before {
@extend .separator;
@ -121,14 +123,12 @@ article + article {
display: inline-block;
}
#content nav.pagination {
#content div.pagination {
text-align: center;
font-size: .95em;
div {
position: relative;
background: $img-border top left repeat-x;
padding: {top: 1.5em; bottom: 1.5em;}
}
position: relative;
background: $img-border top left repeat-x;
padding: {top: 1.5em; bottom: 1.5em;}
a {
text-decoration: none;
color: $text-color-light;

View File

@ -4,7 +4,7 @@ body > footer {
color: $footer-color;
text-shadow: lighten($footer-bg, 5) 0 1px;
background-color: $footer-bg;
@include background(image-url('noise.png'), linear-gradient(lighten($footer-bg, 8), $footer-bg, darken($footer-bg, 11)));
@include background($footer-bg-front, $footer-bg-back);
border-top: 1px solid $footer-border-top;
position: relative;
padding-top: 1em;

View File

@ -1,7 +1,7 @@
body > nav {
position: relative;
background-color: $nav-bg;
@include background(image-url('noise.png'), linear-gradient(lighten($nav-bg, 8), $nav-bg, darken($nav-bg, 11)));
@include background($nav-bg-front, $nav-bg-back);
border: {
top: 1px solid $nav-border-top;
bottom: 1px solid $nav-border-bottom; }

View File

@ -1,4 +1,5 @@
@import "sidebar/base";
@import "sidebar/twitter";
@import "sidebar/googleplus";
@import "sidebar/pinboard";
@import "sidebar/delicious";

View File

@ -21,17 +21,19 @@
}
border: 1px solid $pre-border !important;
}
figure.code, .gist-file, pre {
@include box-shadow(rgba(#000, .06) 0 0 10px);
.highlight pre { @include box-shadow(none); }
}
html .gist .gist-file {
margin-bottom: 1.8em;
position: relative;
border: none;
padding-top: image-height("code_bg.png") !important;
.gist-syntax {
@if $solarized == dark {
border-bottom: 1px solid $base03 !important;
} @else if $solarized == light {
border-bottom: 0px;
}
border-bottom: 0 !important;
background: none !important;
.gist-highlight{
background: $base03 !important;
pre {
@ -46,6 +48,7 @@ html .gist .gist-file {
font-size: .7em !important;
@if $solarized == light {
background: lighten($base03, 2) $noise-bg;
border: 1px solid $pre-border !important;
border-top: 1px solid lighten($base03, 2) !important;
} @else {
background: $base02 $noise-bg;

View File

@ -0,0 +1,26 @@
.googleplus {
h1 {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
-o-box-shadow: none !important;
box-shadow: none !important;
border-bottom: 0px none !important;
}
a {
text-decoration: none;
white-space: normal !important;
line-height: 32px;
img {
float: left;
margin-right: 0.5em;
border: 0 none;
}
}
}
.googleplus-hidden {
position: absolute;
top: -1000em;
left: -1000em;
}

View File

@ -3,6 +3,7 @@
@include reset-html5;
@import "custom/colors";
@import "custom/fonts";
@import "custom/layout";
@import "base";
@import "partials";

View File

@ -1,5 +1,5 @@
{% include disqus.html %}
{% include facebook_like.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}
{% include google_analytics.html %}
{% include custom/after_footer.html %}

View File

@ -1,9 +1,9 @@
{% unless page.no_header %}
<header>
{% if index %}
<h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{{ post.title | titlecase }}</a></h1>
<h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a></h1>
{% else %}
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
<h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1>
{% endif %}
{% unless page.meta == false %}
<p class="meta">

View File

@ -2,7 +2,7 @@
<section>
<h1>On Delicious</h1>
<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>
<script type="text/javascript" src="http://feeds.delicious.com/v2/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 %}

View File

@ -0,0 +1,11 @@
{% if site.googleplus_user %}
<section class="googleplus{% if site.googleplus_hidden %} googleplus-hidden{% endif %}">
<h1>
<a href="https://plus.google.com/{{ site.googleplus_user }}?rel=author">
<img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32">
Google+
</a>
</h1>
</section>
{% endif %}

View File

@ -0,0 +1,27 @@
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[{{ page.title }} | {{ site.title }}]]></title>
<link href="{{ site.url }}/{{ page.feed_url }}" rel="self"/>
<link href="{{ site.url }}/"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>
<name><![CDATA[{{ site.author | strip_html }}]]></name>
{% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %}
</author>
<generator uri="http://octopress.org/">Octopress</generator>
{% for post in site.categories[page.category] limit: 5 %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify | cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

View File

@ -1,19 +1,18 @@
{% 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'
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'
var disqus_script = 'count.js';
{% endif %}
(function () {
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);

View File

@ -0,0 +1,10 @@
{% if site.facebook_like %}
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
{% endif %}

View File

@ -8,7 +8,7 @@
<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 }}">
<meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}">
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %}
<!-- http://t.co/dKP3o1e -->
@ -16,7 +16,7 @@
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% 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' | strip_slash }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}">
<link href="{{ root_url }}/favicon.png" rel="icon">
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
@ -25,4 +25,5 @@
<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 %}
{% include google_analytics.html %}
</head>

View File

@ -1,12 +1,15 @@
{% capture date %}{{ page.date }}{{ post.date }}{% endcapture %}
{% capture date_formatted %}{{ page.date_formatted }}{{ post.date_formatted }}{% endcapture %}
{% capture has_date %}{{ date | size }}{% endcapture %}
{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
{% capture updated_formatted %}{{ page.updated_formatted }}{{ post.updated_formatted }}{% endcapture %}
{% capture was_updated %}{{ updated | size }}{% endcapture %}
{% if has_date != '0' %}
{% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate {% if updated %} data-updated="true" {% endif %}>{{ date | ordinalize }}</time>{% endcapture %}
{% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate{% if updated %} data-updated="true"{% endif %}>{{ date_formatted }}</time>{% endcapture %}
{% endif %}
{% if was_updated != '0' %}
{% capture updated %}<time class="updated" datetime="{{ updated | datetime | date_to_xmlschema }}">Updated {{ updated | ordinalize }}</time>{% endcapture %}
{% else %}{% assign updated = false %}{% endif %}
{% capture updated %}<time datetime="{{ updated | datetime | date_to_xmlschema }}" class="updated">Updated {{ updated_formatted }}</time>{% endcapture %}
{% else %}{% assign updated = false %}{% endif %}

View File

@ -5,4 +5,7 @@
{% if site.google_plus_one %}
<div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div>
{% endif %}
{% if site.facebook_like %}
<div class="fb-like" data-send="true" data-width="450" data-show-faces="false"></div>
{% endif %}
</div>

View File

@ -6,7 +6,7 @@ layout: default
<article role="article">
{% if page.title %}
<header>
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
<h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1>
{% if page.date %}<p class="meta">{% include post/date.html %}{{ time }}</p>{% endif %}
</header>
{% endif %}

View File

@ -15,6 +15,14 @@ single: true
{% unless page.sharing == false %}
{% include post/sharing.html %}
{% endunless %}
<p class="meta">
{% if page.previous.url %}
<a class="basic-alignment left" href="{{page.previous.url}}" title="Previous Post: {{page.previous.title}}">&laquo; {{page.previous.title}}</a>
{% endif %}
{% if page.next.url %}
<a class="basic-alignment right" href="{{page.next.url}}" title="next Post: {{page.next.title}}">{{page.next.title}} &raquo;</a>
{% endif %}
</p>
</footer>
</article>
{% if site.disqus_short_name and page.comments == true %}

View File

@ -4,25 +4,24 @@ layout: nil
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ site.title }}</title>
<title><![CDATA[{{ site.title }}]]></title>
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}/"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>
<name>{{ site.author }}</name>
{% if site.email %}
<email>{{ site.email }}</email>
{% endif %}
<name><![CDATA[{{ site.author | strip_html }}]]></name>
{% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %}
</author>
<generator uri="http://octopress.org/">Octopress</generator>
{% for post in site.posts limit: 20 %}
<entry>
<title>{{ post.title }}</title>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
<content type="html">{{ post.content | expand_urls: site.url | xml_escape }}</content>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

View File

@ -10,17 +10,15 @@ layout: default
{% include article.html %}
</article>
{% endfor %}
<nav class="pagination">
<div>
{% if paginator.next_page %}
<a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
{% endif %}
<a href="/blog/archives">Blog Archives</a>
{% if paginator.previous_page %}
<a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
{% endif %}
</div>
</nav>
<div class="pagination">
{% if paginator.next_page %}
<a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
{% endif %}
<a href="/blog/archives">Blog Archives</a>
{% if paginator.previous_page %}
<a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
{% endif %}
</div>
</div>
<aside class="sidebar">
{% if site.blog_index_asides.size %}

View File

@ -9,14 +9,14 @@ var github = (function(){
}
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) {
$.ajax({
url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?"
, type: 'jsonp'
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
, success: function(data) {
var repos = [];
for (var i = 0; i < data.repositories.length; i++){
if (!data || !data.repositories) { return; }
for (var i = 0; i < data.repositories.length; i++) {
if (options.skip_forks && data.repositories[i].fork) { continue; }
repos.push(data.repositories[i]);
}
@ -31,9 +31,7 @@ var github = (function(){
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,12 +1,11 @@
// JSON-P Twitter fetcher for Octopress
// (c) Brandon Mathis // MIT Lisence
// (c) Brandon Mathis // MIT License
/* 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') {
return "<span>&infin;</span>"; // because IE date parsing isn't fun.
}
var say = {
just_now: " now",
minute_ago: "1m",
@ -15,6 +14,7 @@ function prettyDate(time) {
hours_ago: "h",
yesterday: "1d",
days_ago: "d",
last_week: "1w",
weeks_ago: "w"
};
@ -35,6 +35,7 @@ function prettyDate(time) {
diff < 86400 && Math.floor(diff / 3600) + say.hours_ago) ||
day_diff === 1 && say.yesterday ||
day_diff < 7 && day_diff + say.days_ago ||
day_diff === 7 && say.last_week ||
day_diff > 7 && Math.ceil(day_diff / 7) + say.weeks_ago;
}
@ -47,8 +48,10 @@ function linkifyTweet(text, url) {
// 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);
var shortUrl = new RegExp(url[u].url, 'g');
text = text.replace(shortUrl, url[u].expanded_url);
var shortUrl = new RegExp(">"+(url[u].url.replace(/https?:\/\//, '')), 'g');
text = text.replace(shortUrl, ">"+url[u].display_url);
}
}
return text

View File

@ -12,6 +12,7 @@ group :development do
gem 'rubypants'
gem 'rb-fsevent'
gem 'stringex'
gem 'liquid', '2.2.2'
end
gem 'sinatra', '1.2.6'

View File

@ -55,6 +55,7 @@ DEPENDENCIES
compass (>= 0.11)
haml (>= 3.1)
jekyll
liquid (= 2.2.2)
pygments.rb
rack
rake

View File

@ -3,15 +3,22 @@
Octopress is [Jekyll](https://github.com/mojombo/jekyll) blogging at its finest.
1. **Octopress sports a clean responsive theme** written in semantic HTML5, focused on readability and friendliness toward mobile devices.
2. **Code blogging is easy and beautiful.** Embed code (with [Solarized](http://ethanschoonover.com/solarized) styling) in your posts from gists or from your filesystem.
3. **Third party integration is simple** with built-in support for Twitter, Pinboard, Delicious, Disqus Comments, and Google Analytics.
2. **Code blogging is easy and beautiful.** Embed code (with [Solarized](http://ethanschoonover.com/solarized) styling) in your posts from gists, jsFiddle or from your filesystem.
3. **Third party integration is simple** with built-in support for Twitter, Pinboard, Delicious, GitHub Repositories, Disqus Comments and Google Analytics.
4. **It's easy to use.** A collection of rake tasks simplifies development and makes deploying a cinch.
5. **Ships with great plugins** some original and others from the Jekyll community &mdash; tested and improved.
5. **Ships with great plug-ins** some original and others from the Jekyll community &mdash; tested and improved.
## Documentation
Check out [Octopress.org](http://octopress.org/docs) for guides and documentation.
## Contributing
We love to see people contributing to Octopress, whether it's a bug report, feature suggestion or a pull request. At the moment, we try to keep the core slick and lean, focusing on basic blogging needs, so some of your suggestions might not find their way into Octopress. For those ideas, we started a [list of 3rd party plug-ins](https://github.com/imathis/octopress/wiki/3rd-party-plug-ins), where you can link your own Octopress plug-in repositories. For the future, we're thinking about ways to easier add them them into our main releases.
## License
(The MIT License)
@ -23,6 +30,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#### If you want to be awesome.
- Proudly display the 'Powered by Octopress' credit in the footer.
- Add your site to the wiki so we can watch the community grow.
- Add your site to the Wiki so we can watch the community grow.

View File

@ -51,6 +51,7 @@ desc "Generate jekyll site"
task :generate do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "## Generating Site with Jekyll"
system "compass compile --css-dir #{source_dir}/stylesheets"
system "jekyll"
end
@ -58,7 +59,8 @@ desc "Watch the site and regenerate when it changes"
task :watch do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass."
jekyllPid = Process.spawn("jekyll --auto")
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
compassPid = Process.spawn("compass watch")
trap("INT") {
@ -73,7 +75,8 @@ desc "preview the site in a web browser"
task :preview do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
jekyllPid = Process.spawn("jekyll --auto")
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
@ -89,7 +92,6 @@ end
desc "Begin a new post in #{source_dir}/#{posts_dir}"
task :new_post, :title do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
require './plugins/titlecase.rb'
mkdir_p "#{source_dir}/#{posts_dir}"
args.with_defaults(:title => 'new-post')
title = args.title
@ -99,10 +101,9 @@ task :new_post, :title do |t, args|
end
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
system "mkdir -p #{source_dir}/#{posts_dir}/";
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&amp;').titlecase}\""
post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
post.puts "comments: true"
post.puts "categories: "
@ -114,16 +115,22 @@ end
desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"
task :new_page, :filename do |t, args|
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
require './plugins/titlecase.rb'
args.with_defaults(:filename => 'new-page')
page_dir = source_dir
if args.filename =~ /(^.+\/)?([\w_-]+)(\.)?(.+)?/
page_dir += $4 ? "/#{$1}" : "/#{$1}#{$2}/"
name = $4 ? $2 : "index"
extension = $4 || "#{new_page_ext}"
filename = "#{name}.#{extension}"
page_dir = [source_dir]
if args.filename.downcase =~ /(^.+\/)?(.+)/
filename, dot, extension = $2.rpartition('.').reject(&:empty?) # Get filename and extension
title = filename
page_dir.concat($1.downcase.sub(/^\//, '').split('/')) unless $1.nil? # Add path to page_dir Array
if extension.nil?
page_dir << filename
filename = "index"
end
extension ||= new_page_ext
page_dir = page_dir.map! { |d| d = d.to_url }.join('/') # Sanitize path
filename = filename.downcase.to_url
mkdir_p page_dir
file = page_dir + filename
file = "#{page_dir}/#{filename}.#{extension}"
if File.exist?(file)
abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
@ -131,7 +138,7 @@ task :new_page, :filename do |t, args|
open(file, 'w') do |page|
page.puts "---"
page.puts "layout: page"
page.puts "title: \"#{$2.gsub(/[-_]/, ' ').titlecase}\""
page.puts "title: \"#{title}\""
page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
page.puts "comments: true"
page.puts "sharing: true"
@ -184,12 +191,14 @@ task :update_source, :theme do |t, args|
puts "## Removed existing #{source_dir}.old directory"
rm_r "#{source_dir}.old", :secure=>true
end
mkdir "#{source_dir}.old"
cp_r "#{source_dir}/.", "#{source_dir}.old"
puts "## Copied #{source_dir} into #{source_dir}.old/"
cp_r "#{themes_dir}/"+theme+"/source/.", source_dir, :remove_destination=>true
cp_r "#{source_dir}.old/_includes/custom/.", "#{source_dir}/_includes/custom/", :remove_destination=>true
cp "#{source_dir}.old/favicon.png", source_dir
mv "#{source_dir}/index.html", "#{blog_index_dir}", :force=>true if blog_index_dir != source_dir
cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir
cp "#{source_dir}.old/index.html", source_dir if blog_index_dir != source_dir && File.exists?("#{source_dir}.old/index.html")
puts "## Updated #{source_dir} ##"
end
@ -199,6 +208,13 @@ end
desc "Default deploy task"
task :deploy do
# Check if preview posts exist, which should not be published
if File.exists?(".preview-mode")
puts "## Found posts in preview mode, regenerating files ..."
File.delete(".preview-mode")
Rake::Task[:generate].execute
end
Rake::Task[:copydot].invoke(source_dir, public_dir)
Rake::Task["#{deploy_default}"].execute
end
@ -209,11 +225,8 @@ end
desc "copy dot files for deployment"
task :copydot, :source, :dest do |t, args|
exclusions = [".", "..", ".DS_Store"]
Dir["#{args.source}/**/.*"].each do |file|
if !File.directory?(file) && !exclusions.include?(File.basename(file))
cp(file, file.gsub(/#{args.source}/, "#{args.dest}"));
end
FileList["#{args.source}/**/.*"].exclude("**/.", "**/..", "**/.DS_Store", "**/._*").each do |file|
cp_r file, file.gsub(/#{args.source}/, "#{args.dest}") unless File.directory?(file)
end
end
@ -229,7 +242,7 @@ multitask :push do
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
Rake::Task[:copydot].invoke(public_dir, deploy_dir)
puts "\n## copying #{public_dir} to #{deploy_dir}"
system "cp -R #{public_dir}/* #{deploy_dir}"
cp_r "#{public_dir}/.", deploy_dir
cd "#{deploy_dir}" do
system "git add ."
system "git add -u"
@ -281,7 +294,7 @@ desc "Set up _deploy folder and deploy branch for Github Pages deployment"
task :setup_github_pages do
repo_url = get_stdin("Enter the read/write url for your repository: ")
user = repo_url.match(/:([^\/]+)/)[1]
branch = (repo_url.match(/\/\w+.github.com/).nil?) ? 'gh-pages' : 'master'
branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master'
project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''
unless `git remote -v`.match(/origin.+?octopress.git/).nil?
# If octopress is still the origin remote (from cloning) rename it to octopress

View File

@ -8,6 +8,12 @@ subtitle: A blogging framework for hackers.
author: Brandon Mathis
simple_search: http://google.com/search
# Default date format is "ordinal" (resulting in "July 22nd 2007")
# You can customize the format as defined in
# http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-strftime
# Additionally, %o will give you the ordinal representation of the day
date_format: "ordinal"
# RSS / Email (optional) subscription links (change if using something like Feedburner)
subscribe_rss: /atom.xml
subscribe_email:
@ -35,9 +41,11 @@ pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/
recent_posts: 5 # Posts in the sidebar Recent Posts section
excerpt_link: "Read on &rarr;" # "Continue reading" link text at the bottom of excerpted articles
titlecase: true # Converts page and post titles to tilecase
# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html]
default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html]
# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
# and add an array with the asides you want to use.
@ -63,10 +71,15 @@ twitter_follow_button: true
twitter_show_follower_count: false
twitter_tweet_button: true
# Google Plus
google_plus_one: true
# Google +1
google_plus_one: false
google_plus_one_size: medium
# Google Plus Profile
# Hidden: No visible button, just add author information to search results
googleplus_user:
googleplus_hidden: false
# Pinboard
pinboard_user:
pinboard_count: 4
@ -81,3 +94,6 @@ disqus_show_comment_count: false
# Google Analytics
google_analytics_tracking_id: UA-10876422-2
# Facebook Like
facebook_like: false

View File

@ -10,7 +10,7 @@ module BacktickCodeBlock
@lang = nil
@url = nil
@title = nil
input.gsub /^`{3} *([^\n]+)?\n(.+?)\n`{3}/m do
input.gsub(/^`{3} *([^\n]+)?\n(.+?)\n`{3}/m) do
@options = $1 || ''
str = $2
@ -22,8 +22,8 @@ module BacktickCodeBlock
@caption = "<figcaption><span>#{$2}</span></figcaption>"
end
if str.match(/\A {4}/)
str = str.gsub /^ {4}/, ''
if str.match(/\A( {4}|\t)/)
str = str.gsub(/^( {4}|\t)/, '')
end
if @lang.nil? || @lang == 'plain'
code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))

View File

@ -48,6 +48,35 @@ module Jekyll
end
# The CategoryFeed class creates an Atom feed for the specified category.
class CategoryFeed < Page
# Initializes a new CategoryFeed.
#
# +base+ is the String path to the <source>.
# +category_dir+ is the String path between <source> and the category folder.
# +category+ is the category currently being processed.
def initialize(site, base, category_dir, category)
@site = site
@base = base
@dir = category_dir
@name = 'atom.xml'
self.process(@name)
# Read the YAML data from the layout page.
self.read_yaml(File.join(base, '_includes/custom'), 'category_feed.xml')
self.data['category'] = category
# Set the title for this page.
title_prefix = site.config['category_title_prefix'] || 'Category: '
self.data['title'] = "#{title_prefix}#{category}"
# Set the meta-description for this page.
meta_description_prefix = site.config['category_meta_description_prefix'] || 'Category: '
self.data['description'] = "#{meta_description_prefix}#{category}"
# Set the correct feed URL.
self.data['feed_url'] = "#{category_dir}/#{name}"
end
end
# The Site class is a built-in Jekyll class with access to global site config information.
class Site
@ -63,6 +92,13 @@ module Jekyll
index.write(self.dest)
# Record the fact that this page has been added, otherwise Site::cleanup will remove it.
self.pages << index
# Create an Atom-feed for each index.
feed = CategoryFeed.new(self, self.source, category_dir, category)
feed.render(self.layouts, site_payload)
feed.write(self.dest)
# Record the fact that this page has been added, otherwise Site::cleanup will remove it.
self.pages << feed
end
# Loops through the list of category pages and processes each one.

View File

@ -90,6 +90,7 @@ module Jekyll
source = safe_wrap(source)
source = context['pygments_prefix'] + source if context['pygments_prefix']
source = source + context['pygments_suffix'] if context['pygments_suffix']
source
end
end
end

View File

@ -1 +0,0 @@
system "compass compile --css-dir source/stylesheets"

98
plugins/date.rb Normal file
View File

@ -0,0 +1,98 @@
module Octopress
module Date
# Returns a datetime if the input is a string
def datetime(date)
if date.class == String
date = Time.parse(date)
end
date
end
# Returns an ordidinal date eg July 22 2007 -> July 22nd 2007
def ordinalize(date)
date = datetime(date)
"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}"
end
# Returns an ordinal number. 13 -> 13th, 21 -> 21st etc.
def ordinal(number)
if (11..13).include?(number.to_i % 100)
"#{number}<span>th</span>"
else
case number.to_i % 10
when 1; "#{number}<span>st</span>"
when 2; "#{number}<span>nd</span>"
when 3; "#{number}<span>rd</span>"
else "#{number}<span>th</span>"
end
end
end
# Formats date either as ordinal or by given date format
# Adds %o as ordinal representation of the day
def format_date(date, format)
date = datetime(date)
if format.nil? || format.empty? || format == "ordinal"
date_formatted = ordinalize(date)
else
date_formatted = date.strftime(format)
date_formatted.gsub!(/%o/, ordinal(date.strftime('%e').to_i))
end
date_formatted
end
end
end
module Jekyll
class Post
include Octopress::Date
# Convert this post into a Hash for use in Liquid templates.
#
# Returns <Hash>
def to_liquid
date_format = self.site.config['date_format']
self.data.deep_merge({
"title" => self.data['title'] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
"url" => self.url,
"date" => self.date,
# Monkey patch
"date_formatted" => format_date(self.date, date_format),
"updated_formatted" => self.data.has_key?('updated') ? format_date(self.data['updated'], date_format) : nil,
"id" => self.id,
"categories" => self.categories,
"next" => self.next,
"previous" => self.previous,
"tags" => self.tags,
"content" => self.content })
end
end
class Page
include Octopress::Date
# Initialize a new Page.
#
# site - The Site object.
# base - The String path to the source.
# dir - The String path between the source and the file.
# name - The String filename of the file.
def initialize(site, base, dir, name)
@site = site
@base = base
@dir = dir
@name = name
self.process(name)
self.read_yaml(File.join(base, dir), name)
# Monkey patch
date_format = self.site.config['date_format']
self.data['date_formatted'] = format_date(self.data['date'], date_format) if self.data.has_key?('date')
self.data['updated_formatted'] = format_date(self.data['updated'], date_format) if self.data.has_key?('updated')
end
end
end

View File

@ -71,7 +71,13 @@ module Jekyll
def get_gist_from_web(gist, file)
gist_url = get_gist_url_for gist, file
raw_uri = URI.parse gist_url
https = Net::HTTP.new raw_uri.host, raw_uri.port
proxy = ENV['http_proxy']
if proxy
proxy_uri = URI.parse(proxy)
https = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port).new raw_uri.host, raw_uri.port
else
https = Net::HTTP.new raw_uri.host, raw_uri.port
end
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new raw_uri.request_uri

View File

@ -2,6 +2,7 @@
require './plugins/backtick_code_block'
require './plugins/post_filters'
require './plugins/raw'
require './plugins/date'
require 'rubypants'
module OctopressFilters
@ -33,6 +34,8 @@ end
module OctopressLiquidFilters
include Octopress::Date
# Used on the blog index to split posts on the <!--more--> marker
def excerpt(input)
if input.index(/<!--\s*more\s*-->/i)
@ -63,6 +66,11 @@ module OctopressLiquidFilters
return (content.nil?) ? input : content
end
# Escapes CDATA sections in post content
def cdata_escape(input)
input.gsub(/<!\[CDATA\[/, '&lt;![CDATA[').gsub(/\]\]>/, ']]&gt;')
end
# Replaces relative urls with full urls
def expand_urls(input, url='')
url ||= '/'
@ -71,6 +79,33 @@ module OctopressLiquidFilters
end
end
# Improved version of Liquid's truncate:
# - Doesn't cut in the middle of a word.
# - Uses typographically correct ellipsis (…) insted of '...'
def truncate(input, length)
if input.length > length && input[0..(length-1)] =~ /(.+)\b.+$/im
$1.strip + ' &hellip;'
else
input
end
end
# Improved version of Liquid's truncatewords:
# - Uses typographically correct ellipsis (…) insted of '...'
def truncatewords(input, length)
truncate = input.split(' ')
if truncate.length > length
truncate[0..length-1].join(' ').strip + ' &hellip;'
else
input
end
end
# Condenses multiple spaces and tabs into a single space
def condense_spaces(input)
input.gsub(/\s{2,}/, ' ')
end
# Removes trailing forward slash from a string for easily appending url segments
def strip_slash(input)
if input =~ /(.+)\/$|^\/$/
@ -91,33 +126,6 @@ module OctopressLiquidFilters
input.titlecase
end
# Returns a datetime if the input is a string
def datetime(date)
if date.class == String
date = Time.parse(date)
end
date
end
# Returns an ordidinal date eg July 22 2007 -> July 22nd 2007
def ordinalize(date)
date = datetime(date)
"#{date.strftime('%b')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}"
end
# Returns an ordinal number. 13 -> 13th, 21 -> 21st etc.
def ordinal(number)
if (11..13).include?(number.to_i % 100)
"#{number}<span>th</span>"
else
case number.to_i % 10
when 1; "#{number}<span>st</span>"
when 2; "#{number}<span>nd</span>"
when 3; "#{number}<span>rd</span>"
else "#{number}<span>th</span>"
end
end
end
end
Liquid::Template.register_filter OctopressLiquidFilters

View File

@ -0,0 +1,48 @@
# Monkeypatch for Jekyll
# Introduce distinction between preview/productive site generation
# so posts with YAML attribute `published: false` can be previewed
# on localhost without being published to the productive environment.
module Jekyll
class Site
# Read all the files in <source>/<dir>/_posts and create a new Post
# object with each one.
#
# dir - The String relative path of the directory to read.
#
# Returns nothing.
def read_posts(dir)
base = File.join(self.source, dir, '_posts')
return unless File.exists?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
# first pass processes, but does not yet render post content
entries.each do |f|
if Post.valid?(f)
post = Post.new(self, self.source, dir, f)
# Monkeypatch:
# On preview environment (localhost), publish all posts
if ENV.has_key?('OCTOPRESS_ENV') && ENV['OCTOPRESS_ENV'] == 'preview' && post.data.has_key?('published') && post.data['published'] == false
post.published = true
# Set preview mode flag (if necessary), `rake generate` will check for it
# to prevent pushing preview posts to productive environment
File.open(".preview-mode", "w") {}
end
if post.published && (self.future || post.date <= self.time)
self.posts << post
post.categories.each { |c| self.categories[c] << post }
post.tags.each { |c| self.tags[c] << post }
end
end
end
self.posts.sort!
# limit the posts if :limit_posts option is set
self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
end
end
end

View File

@ -1,10 +1,10 @@
#
# Author: Brandon Mathis
# Based on the sematic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
# Based on the semantic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
#
# Outputs a span with a data-pullquote attribute set from the marked pullquote. Example:
#
# {% pullquote %}
# {% pullquote %}
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful.
# It is important to note, {" pullquotes are merely visual in presentation and should not appear twice in the text. "} That is why it is prefered
# to use a CSS only technique for styling pullquotes.
@ -13,15 +13,20 @@
# <p>
# <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text.">
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful.
# It is important to note, pullquotes are merely visual in presentation and should not appear twice in the text. This is why a CSS only approach # for styling pullquotes is prefered.
# It is important to note, pullquotes are merely visual in presentation and should not appear twice in the text. This is why a CSS only approach
# for styling pullquotes is prefered.
# </span>
# </p>
#
# {% pullquote left %} will create a left-aligned pullquote instead.
#
# Note: this plugin now creates pullquotes with the class of pullquote-right by default
module Jekyll
class PullquoteTag < Liquid::Block
def initialize(tag_name, markup, tokens)
@align = (markup =~ /left/i) ? "left" : "right"
super
end
@ -29,7 +34,7 @@ module Jekyll
output = super
if output.join =~ /\{"\s*(.+)\s*"\}/
@quote = $1
"<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
"<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
else
return "Surround your pullquote like this {\" text to be quoted \"}"
end

View File

@ -21,11 +21,11 @@ module HighlightCode
if File.exist?(path)
highlighted_code = File.read(path)
else
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html')
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
File.open(path, 'w') {|f| f.print(highlighted_code) }
end
else
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html')
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
end
highlighted_code
end

View File

@ -11,8 +11,8 @@ class String
# capitalize first and last words
x.first.to_s.smart_capitalize!
x.last.to_s.smart_capitalize!
# small words after colons are capitalized
x.join(" ").gsub(/:\s?(\W*#{small_words.join("|")}\W*)\s/) { ": #{$1.smart_capitalize} " }
# small words are capitalized after colon, period, exclamation mark, question mark
x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
end
def titlecase!