Merge branch 'linklog' into site-linklog

This commit is contained in:
Brandon Mathis 2012-02-18 14:50:06 -06:00
commit f14f0210f5
16 changed files with 229 additions and 172 deletions

View File

@ -6,6 +6,13 @@ $heading-font-family: "PT Serif", "Georgia", "Helvetica Neue", Arial, sans-serif
$header-title-font-family: $heading-font-family !default;
$header-subtitle-font-family: $heading-font-family !default;
$h1: 2.2em !default;
$h2: 1.5em !default;
$h3: 1.3em !default;
$h4: 1em !default;
$h5: .9em !default;
$h6: .8em !default;
// Fonts
.heading {
font-family: $heading-font-family;
@ -15,7 +22,7 @@ $header-subtitle-font-family: $heading-font-family !default;
.mono { font-family: $mono; }
body > header h1 {
font-size: 2.2em;
font-size: $h1;
@extend .heading;
font-family: $header-title-font-family;
font-weight: normal;
@ -31,15 +38,6 @@ body {
color: $text-color;
@extend .serif;
}
h1 {
font-size: 2.2em;
line-height: 1.2em;
}
@media only screen and (min-width: 992px) {
body { font-size: 1.15em; }
h1 { font-size: 2.6em; line-height: 1.2em; }
}
#{headings()}{
@extend .heading;
@ -47,21 +45,30 @@ h1 {
margin-bottom: 1em;
font-weight: bold;
}
h1 {
font-size: $h1;
line-height: 1.2em;
}
h2, section h1 {
font-size: 1.5em;
font-size: $h2;
}
h3, section h2, section section h1 {
font-size: 1.3em;
font-size: $h3;
}
h4, section h3, section section h2, section section section h1 {
font-size: 1em;
font-size: $h4;
}
h5, section h4, section section h3 {
font-size: .9em;
font-size: $h5;
}
h6, section h5, section section h4, section section section h3 {
font-size: .8em;
font-size: $h6;
}
@media only screen and (min-width: 992px) {
body { font-size: 1.15em; }
}
p, blockquote, ul, ol { margin-bottom: 1.5em; }
ul { list-style-type: disc;

View File

@ -2,6 +2,7 @@
#content > div { &, > article { padding-top: 0; } }
}
#blog-archives {
color: $text-color-light;
article {
padding: 1em 0 1em;
position: relative;
@ -9,25 +10,31 @@
&:last-child {
background: none;
}
footer { padding: 0; margin: 0;}
footer {
padding: 0; margin: 0;
font-size: .85em;
line-height: 1em;
}
}
h1 { color: $text-color; margin-bottom: .3em; }
h2 { display: none; }
h1 {
font-size: 1.5em;
.entry-title {
color: $text-color; margin-bottom: .3em;
font-size: $h3;
a {
@include hover-link;
color: inherit;
&:hover { color: $link-color-hover; }
font-weight: normal;
display: inline-block;
}
}
article[data-linklog] .entry-title {
font-size: $h4;
a { text-decoration: underline; }
}
a.category, time {
@extend .sans;
color: $text-color-light;
}
color: $text-color-light;
.entry-content { display: none; }
time {
font-size: .9em;
@ -36,10 +43,13 @@
.month { text-transform: uppercase; }
}
p { margin-bottom: 1em; }
&, .entry-content { a { @include link-colors(inherit, $link-color-hover); }}
a:hover { color: $link-color-hover; }
@media only screen and (min-width: 550px) {
article { margin-left: 5em; }
article {
padding: { left: 4.5em; bottom: .7em;}
margin-left: 5em;
}
h2 {
margin-bottom: .3em;
font-weight: normal;
@ -55,12 +65,7 @@
top: 1.8em;
}
.year { display: none; }
article {
padding:{left: 4.5em; bottom: .7em;}
}
a.category {
line-height: 1.1em;
}
a.category { line-height: 1.1em; }
}
}
#content > .category {

View File

@ -1,3 +1,8 @@
#content .blog-index {
padding: { top: 0; bottom: 0; }
article { padding-top: 2em; }
}
article {
padding-top: 1em;
a { @extend .force-wrap; }
@ -7,33 +12,92 @@ article {
padding-bottom: 1em;
margin-bottom: 1em;
background: $img-border bottom left repeat-x;
h1 {
margin: 0;
a { text-decoration: none;
&:hover { text-decoration: underline; } }
}
p {
font-size: .9em;
color: $text-color-light;
margin: 0;
&.meta {
@extend .sans;
text-transform: uppercase;
position: absolute; top: 0;
}
}
@media only screen and (min-width: 768px) {
margin-bottom: 1.5em;
padding-bottom: 1em;
background: $img-border bottom left repeat-x;
}
.blog-index & { background: none; padding-bottom: 0; }
p {
font-size: .9em;
margin: 0;
color: $text-color-light;
&.meta { @extend .sans; position: absolute; top: 0; }
}
time { text-transform: uppercase; }
}
.entry-title {
margin: 0;
a { text-decoration: none;
&:hover { text-decoration: underline; }
}
.blog-index & {
font-size: $h1;
a { color: inherit; &:hover { color: $link-color-hover; } }
}
}
a[rel=bookmark] { text-decoration: none; }
h2 {
padding-top: 0.8em;
background: $img-border top left repeat-x;
}
.entry-content & h2:first-child, header + h2 { padding-top: 0; }
h2:first-child, header + h2 { background: none; }
.entry-content & h2:first-child, header + h2 { padding-top: 0; }
&[data-linklog] {
.entry-title {
font-size: $h1;
a { text-decoration: underline; }
}
.blog-index & .entry-title { font-size: $h2; }
}
.linklog-marker {
color: $text-color-light;
font-size: .8em;
line-height: 1em;
position: relative; top: -.15em;
}
> footer {
padding-bottom: 2.5em;
margin-top: 2em;
@extend .sans;
.blog-index & { margin-top: 1em; }
.meta {
margin-bottom: .8em;
font-size: .85em;
clear: both;
overflow: hidden;
}
.byline + time:before, time +time:before, .comments:before, .byline ~ .categories:before {
@extend .separator;
}
}
a[rel=full-article] {
background: darken($main-bg, 5);
display: inline-block;
padding: .4em .8em;
margin-right: .5em;
text-decoration: none;
color: mix($text-color, $text-color-light);
@extend .serif;
@include transition(background-color .5s);
&:hover {
background: $link-color-hover;
text-shadow: none;
color: $main-bg;
}
}
.blog-index & + article {
background: $img-border top left repeat-x;
}
.feature {
padding-top: .5em;
margin-bottom: 1em;
@ -42,6 +106,7 @@ article {
font-size: 2.0em; font-style: italic;
line-height: 1.3em;
}
img, video, .flash-video {
@extend .flex-content;
@extend .basic-alignment;
@ -66,54 +131,6 @@ article {
}
}
}
> footer {
padding-bottom: 2.5em;
margin-top: 2em;
@extend .sans;
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;
}
}
}
article + article {
.blog-index & {
background: $img-border top left repeat-x;
}
}
#content .blog-index {
padding: { top: 0; bottom: 0; }
article { padding-top: 2em; }
article header { background: none; padding-bottom: 0; }
article h1 {
font-size: 2.2em;
a { color: inherit; &:hover { color: $link-color-hover; } }
}
a[rel=full-article] {
background: darken($main-bg, 5);
display: inline-block;
padding: .4em .8em;
margin-right: .5em;
text-decoration: none;
color: mix($text-color, $text-color-light);
@extend .serif;
@include transition(background-color .5s);
&:hover {
background: $link-color-hover;
text-shadow: none;
color: $main-bg;
}
}
footer {
@extend .sans;
margin-top: 1em;
}
}
.separator {

View File

@ -1,8 +1,12 @@
{% capture category %}{{ post.categories | size }}{% endcapture %}
<h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1>
{% include post/title.html %}
<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time>
{% if category != '0' %}
<footer>
{% if linklog %}
<a rel="bookmark" href="{{ permalink }}">{{ site.permalink_label }}</a>
{% endif %}
{% if category != '0' %}
{% if linklog %} &bull; {% endif %}
<span class="categories">posted in {{ post.categories | category_links }}</span>
{% endif %}
</footer>
{% endif %}

View File

@ -1,28 +1,27 @@
{% unless page.no_header %}
<header>
{% if index %}
<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">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1>
{% endif %}
{% include post/title.html %}
{% unless page.meta == false %}
<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>
&bull; <a href="{% if index %}{{ permalink }}{% endif %}#disqus_thread">Comments</a>
{% endif %}
&bull; <a rel="bookmark" href="{{ permalink }}">{{ site.permalink_label }}</a>
</p>
{% endunless %}
</header>
{% endunless %}
{% if index %}
{% capture excerpted %}{{ content | has_excerpt }}{% endcapture %}
{% if index and excerpted != 'false' %}
<div class="entry-content">{{ content | excerpt }}</div>
{% capture excerpted %}{{ content | has_excerpt }}{% endcapture %}
{% if excerpted == 'true' %}
<footer>
<a rel="full-article" href="{{ root_url }}{{ post.url }}">{{ site.excerpt_link }}</a>
</footer>
{% endif %}
<footer>
<a rel="full-article" href="{{ permalink }}">{{ site.excerpt_link }}</a>
</footer>
{% puts %}
title: {{ article_title }}
excerpted: {{ excerpted }}
{% endputs %}
{% else %}
<div class="entry-content">{{ content }}</div>
<div class="entry-content">{{ content }}</div>
{% endif %}

View File

@ -0,0 +1,5 @@
<h1 class="entry-title">
{% if linklog and site.linklog_marker and site.linklog_marker_position == 'before' %}{{ linklog_marker }}{% endif %}
{% if index or linklog %}<a href="{{ title_url }}">{% endif %}{% if site.titlecase %}{{ article_title | titlecase }}{% else %}{{ article_title }}{% endif %}{% if index or linklog %}</a>{% endif %}
{% if linklog and site.linklog_marker and site.linklog_marker_position == 'after' %}{{ linklog_marker }}{% endif %}
</h1>

View File

@ -0,0 +1,13 @@
{% assign linklog = false %}
{% assign index = false %}
{% if page.external-url %}
{% capture linklog %}{{ page.external-url }}{% endcapture %}
{% elsif post.external-url %}
{% capture linklog %}{{ post.external-url }}{% endcapture %}
{% endif %}
{% if post.url %}{% assign index = true %}{% endif %}
{% capture permalink %}{{ root_url }}{% if index %}{{ post.url }}{% else %}{{ page.url }}{% endif %}{% endcapture %}
{% capture title_url %}{% if linklog %}{{ linklog }}{% else %}{{ permalink }}{% endif %}{% endcapture %}
{% capture article_title %}{% if index %}{% unless linklog %}{{ site.standard_post_marker }}{% endunless %}{{ post.title }}{% else %}{% unless linklog %}{{ site.standard_post_marker }}{% endunless %}{{ page.title }}{% endif %}{% endcapture %}
{% capture linklog_marker %}<span class='linklog-marker'>{{ site.linklog_marker }}</span>{% endcapture %}

View File

@ -1,6 +1,7 @@
---
layout: page
footer: false
body_id: archive
---
<div id="blog-archives" class="category">
@ -10,7 +11,8 @@ footer: false
{% assign year = this_year %}
<h2>{{ year }}</h2>
{% endunless %}
<article>
{% include post/variables.html %}
<article {% if linklog %}data-linklog{% endif %}>
{% include archive_post.html %}
</article>
{% endfor %}

View File

@ -4,7 +4,8 @@ single: true
---
<div>
<article class="hentry" role="article">
{% include post/variables.html %}
<article class="hentry" role="article" {% if linklog %}data-linklog{% endif %}>
{% include article.html %}
<footer>
<p class="meta">
@ -41,3 +42,4 @@ single: true
{% endif %}
</aside>
{% endunless %}

View File

@ -3,7 +3,6 @@ layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[{{ site.title }}]]></title>
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}/"/>
@ -16,12 +15,17 @@ layout: nil
<generator uri="http://octopress.org/">Octopress</generator>
{% for post in site.posts limit: 20 %}
{% assign linklog = false %}
{% if post.external-url %}{% capture linklog %}{{ post.external-url }}{% endcapture %}{% endif %}
{% capture title_url %}{% if linklog %}{{ linklog }}{% else %}{{ site.url }}{{ post.url }}{% endif %}{% endcapture %}
{% capture title %}{% if linklog and site.linklog_marker_position_feed == 'before' %}{% unless linklog %}{{ site.standard_post_marker }}{% endunless %}{{ site.linklog_marker }} {% endif %}{{ post.title }}{% if linklog and site.linklog_marker_position_feed == 'after' %} {{ site.linklog_marker }}{% endif %}{% endcapture %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}{{ post.url }}"/>
<title type="html"><![CDATA[{{ title | cdata_escape }}]]></title>
<link href="{{ title_url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content>
{% capture content %}{{ post.content | expand_urls: site.url | cdata_escape }}<p><a rel="bookmark" href="{{ site.url }}{{ post.url }}">{{ site.feed_permalink_label }}</a></p>{% endcapture %}
<content type="html"><![CDATA[{{ content }}]]></content>
</entry>
{% endfor %}
</feed>

View File

@ -2,6 +2,7 @@
layout: page
title: Blog Archive
footer: false
body_id: archive
---
<div id="blog-archives">
@ -11,7 +12,8 @@ footer: false
{% assign year = this_year %}
<h2>{{ year }}</h2>
{% endunless %}
<article>
{% include post/variables.html %}
<article {% if linklog %}data-linklog{% endif %}>
{% include archive_post.html %}
</article>
{% endfor %}

View File

@ -3,10 +3,10 @@ layout: default
---
<div class="blog-index">
{% assign index = true %}
{% for post in paginator.posts %}
{% assign content = post.content %}
<article>
{% assign content = post.content %}
{% include post/variables.html %}
<article {% if linklog %}data-linklog{% endif %}>
{% include article.html %}
</article>
{% endfor %}

View File

@ -59,8 +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."
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
system "compass compile --css-dir #{source_dir}/stylesheets"
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
trap("INT") {
@ -75,8 +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}"
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
system "compass compile --css-dir #{source_dir}/stylesheets"
jekyllPid = Process.spawn("jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
@ -106,6 +106,7 @@ task :new_post, :title do |t, args|
post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
post.puts "comments: true"
post.puts "external-url: "
post.puts "categories: "
post.puts "---"
end
@ -199,6 +200,12 @@ task :update_source, :theme do |t, args|
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 && File.exists?("#{source_dir}.old/index.html")
if File.exists?("#{source_dir}/archives/index.html")
rm "#{source_dir}/archives/index.html"
mv "#{source_dir}/blog/archives/index.html", "#{source_dir}/archives/index.html"
rm_r "#{source_dir}/blog/archives"
rm_r "#{source_dir}/blog" if Dir.entries("#{source_dir}/blog").join == "..."
end
puts "## Updated #{source_dir} ##"
end

View File

@ -41,6 +41,12 @@ paginate: 10 # Posts per page on the blog index
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
permalink_label: "&infin;"
permalink_label_feed: "&infin; Permalink"
linklog_marker: "&rarr;"
linklog_marker_position: after
linklog_marker_position_feed: after
standard_post_marker:
titlecase: true # Converts page and post titles to titlecase

View File

@ -1,48 +0,0 @@
# 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

32
plugins/puts.rb Normal file
View File

@ -0,0 +1,32 @@
# Title: Puts Tag for Jekyll
# Author: Brandon Mathis http://brandonmathis.com
# Description: Puts is a liquid tag block which outputs its contents to the terminal
#
# Example Usage:
# Lets say you've assigned some variable you need to test.
# {% assign noun = "toaster" %}
#
# Drop it in a puts block along with a way to identify it in the output.
# {% puts %}
# Look out he's got a {{ noun }}.
# {% endputs %}
#
# Outputs:
# >>> {% puts %} <<<
# Look out he's got a toaster.
#
module Jekyll
class Puts < Liquid::Block
def initialize(tag_name, markup, tokens)
super
end
def render(context)
puts ">>> {% puts %} <<<"
puts super.map(&:strip).join
end
end
end
Liquid::Template.register_tag('puts', Jekyll::Puts)