Skip to content

Commit c1cbd53

Browse files
committed
More stuff added
1 parent 3325fb2 commit c1cbd53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4246
-0
lines changed

Rakefile.bak

+428
Large diffs are not rendered by default.

_config.yml.bak

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# ----------------------- #
2+
# Main Configs #
3+
# ----------------------- #
4+
5+
url: http://joshkerr.com
6+
title: Josh Kerr
7+
subtitle: Startups + Gadgets + Geekery
8+
author: Josh Kerr
9+
simple_search: http://google.com/search
10+
11+
# RSS / Email (optional) subscription links (change if using something like Feedburner)
12+
subscribe_rss: /atom.xml
13+
subscribe_email:
14+
# RSS feeds can list your email address if you like
15+
email:
16+
17+
# ----------------------- #
18+
# Jekyll & Plugins #
19+
# ----------------------- #
20+
21+
# If publishing to a subdirectory as in http://site.com/project set 'root: /project'
22+
root: /
23+
permalink: /:year/:month/:title/
24+
source: source
25+
destination: public
26+
plugins: plugins
27+
code_dir: downloads/code
28+
category_dir: blog/category
29+
markdown: rdiscount
30+
pygments: false # default python pygments have been replaced by pygments.rb
31+
32+
paginate: 40 # Posts per page on the blog index
33+
pagination_dir: / # Directory base for pagination URLs eg. /blog/page/2/
34+
recent_posts: 5 # Posts in the sidebar Recent Posts section
35+
excerpt_link: "Read on →" # "Continue reading" link text at the bottom of excerpted articles
36+
37+
# list each of the sidebar modules you want to include, in the order you want them to appear.
38+
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
39+
default_asides: [custom/asides/about.html]
40+
41+
# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
42+
# and add an array with the asides you want to use.
43+
# blog_index_asides:
44+
# post_asides:
45+
# page_asides:
46+
47+
# Site index
48+
# indextank settings
49+
indextank_index: joshkerr_index
50+
indextank_api_url: http://:[email protected]
51+
52+
# these values are applied as regular expressions
53+
indextank_excludes: [index.html, 404.html ]
54+
55+
# ----------------------- #
56+
# 3rd Party Settings #
57+
# ----------------------- #
58+
59+
# Github repositories
60+
github_user: joshkerr
61+
github_repo_count: 0
62+
github_show_profile_link: true
63+
github_skip_forks: true
64+
65+
# Twitter
66+
twitter_user: joshkerr
67+
twitter_tweet_count: 3
68+
twitter_show_replies: false
69+
twitter_follow_button: true
70+
twitter_show_follower_count: false
71+
twitter_tweet_button: true
72+
73+
# Google Plus
74+
google_plus_one: true
75+
google_plus_one_size: medium
76+
77+
78+
# Google Plus Profile
79+
# Hidden: No visible button, just add author information to search results
80+
googleplus_user: joshkerr
81+
googleplus_hidden: false
82+
83+
# Pinboard
84+
pinboard_user: joshkerr
85+
pinboard_count: 5
86+
87+
# Delicious
88+
delicious_user:
89+
delicious_count: 3
90+
delicious_archive_count: 25
91+
92+
# Disqus Comments
93+
disqus_short_name: joshkerr
94+
disqus_show_comment_count: true
95+
96+
97+
# Facebook Like
98+
facebook_like: true
99+
100+
# Google Analytics
101+
google_analytics_tracking_id: UA-9009358-1
102+
103+
# Embedly
104+
embedly:
105+
api_key: 73f5a094accd11e0b7c34040d3dc5c07
106+
107+
vimeo:
108+
width: 600
109+
110+
youtube:
111+
width: 600

plugins/backtick_code_block.rb.bak

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require './plugins/pygments_code'
2+
3+
module BacktickCodeBlock
4+
include HighlightCode
5+
AllOptions = /([^\s]+)\s+(.+?)(https?:\/\/\S+)\s*(.+)?/i
6+
LangCaption = /([^\s]+)\s*(.+)?/i
7+
def render_code_block(input)
8+
@options = nil
9+
@caption = nil
10+
@lang = nil
11+
@url = nil
12+
@title = nil
13+
input.gsub /^`{3} *([^\n]+)?\n(.+?)\n`{3}/m do
14+
@options = $1 || ''
15+
str = $2
16+
17+
if @options =~ AllOptions
18+
@lang = $1
19+
@caption = "<figcaption><span>#{$2}</span><a href='#{$3}'>#{$4 || 'link'}</a></figcaption>"
20+
elsif @options =~ LangCaption
21+
@lang = $1
22+
@caption = "<figcaption><span>#{$2}</span></figcaption>"
23+
end
24+
25+
if str.match(/\A {4}/)
26+
str = str.gsub /^ {4}/, ''
27+
end
28+
if @lang.nil? || @lang == 'plain'
29+
code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
30+
"<figure class='code'>#{@caption}#{code}</figure>"
31+
else
32+
if @lang.include? "-raw"
33+
raw = "``` #{@options.sub('-raw', '')}\n"
34+
raw += str
35+
raw += "\n```\n"
36+
else
37+
code = highlight(str, @lang)
38+
"<figure class='code'>#{@caption}#{code}</figure>"
39+
end
40+
end
41+
end
42+
end
43+
end

plugins/category_generator.rb.bak

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# encoding: utf-8
2+
#
3+
# Jekyll category page generator.
4+
# http://recursive-design.com/projects/jekyll-plugins/
5+
#
6+
# Version: 0.1.4 (201101061053)
7+
#
8+
# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
9+
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
10+
#
11+
# A generator that creates category pages for jekyll sites.
12+
#
13+
# Included filters :
14+
# - category_links: Outputs the list of categories as comma-separated <a> links.
15+
# - date_to_html_string: Outputs the post.date as formatted html, with hooks for CSS styling.
16+
#
17+
# Available _config.yml settings :
18+
# - category_dir: The subfolder to build category pages in (default is 'categories').
19+
# - category_title_prefix: The string used before the category name in the page title (default is
20+
# 'Category: ').
21+
22+
module Jekyll
23+
24+
# The CategoryIndex class creates a single category page for the specified category.
25+
class CategoryIndex < Page
26+
27+
# Initializes a new CategoryIndex.
28+
#
29+
# +base+ is the String path to the <source>.
30+
# +category_dir+ is the String path between <source> and the category folder.
31+
# +category+ is the category currently being processed.
32+
def initialize(site, base, category_dir, category)
33+
@site = site
34+
@base = base
35+
@dir = category_dir
36+
@name = 'index.html'
37+
self.process(@name)
38+
# Read the YAML data from the layout page.
39+
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
40+
self.data['category'] = category
41+
# Set the title for this page.
42+
title_prefix = site.config['category_title_prefix'] || 'Category: '
43+
self.data['title'] = "#{title_prefix}#{category}"
44+
# Set the meta-description for this page.
45+
meta_description_prefix = site.config['category_meta_description_prefix'] || 'Category: '
46+
self.data['description'] = "#{meta_description_prefix}#{category}"
47+
end
48+
49+
end
50+
51+
52+
# The Site class is a built-in Jekyll class with access to global site config information.
53+
class Site
54+
55+
# Creates an instance of CategoryIndex for each category page, renders it, and
56+
# writes the output to a file.
57+
#
58+
# +category_dir+ is the String path to the category folder.
59+
# +category+ is the category currently being processed.
60+
def write_category_index(category_dir, category)
61+
index = CategoryIndex.new(self, self.source, category_dir, category)
62+
index.render(self.layouts, site_payload)
63+
index.write(self.dest)
64+
# Record the fact that this page has been added, otherwise Site::cleanup will remove it.
65+
self.pages << index
66+
end
67+
68+
# Loops through the list of category pages and processes each one.
69+
def write_category_indexes
70+
if self.layouts.key? 'category_index'
71+
dir = self.config['category_dir'] || 'categories'
72+
self.categories.keys.each do |category|
73+
self.write_category_index(File.join(dir, category.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase), category)
74+
end
75+
76+
# Throw an exception if the layout couldn't be found.
77+
else
78+
throw "No 'category_index' layout found."
79+
end
80+
end
81+
82+
end
83+
84+
85+
# Jekyll hook - the generate method is called by jekyll, and generates all of the category pages.
86+
class GenerateCategories < Generator
87+
safe true
88+
priority :low
89+
90+
def generate(site)
91+
site.write_category_indexes
92+
end
93+
94+
end
95+
96+
97+
# Adds some extra filters used during the category creation process.
98+
module Filters
99+
100+
# Outputs a list of categories as comma-separated <a> links. This is used
101+
# to output the category list for each post on a category page.
102+
#
103+
# +categories+ is the list of categories to format.
104+
#
105+
# Returns string
106+
#
107+
def category_links(categories)
108+
dir = @context.registers[:site].config['category_dir']
109+
categories = categories.sort!.map do |item|
110+
"<a class='category' href='/#{dir}/#{item.gsub(/_|\P{Word}/, '-').gsub(/-{2,}/, '-').downcase}/'>#{item}</a>"
111+
end
112+
113+
case categories.length
114+
when 0
115+
""
116+
when 1
117+
categories[0].to_s
118+
else
119+
"#{categories[0...-1].join(', ')}, #{categories[-1]}"
120+
end
121+
end
122+
123+
# Outputs the post.date as formatted html, with hooks for CSS styling.
124+
#
125+
# +date+ is the date object to format as HTML.
126+
#
127+
# Returns string
128+
def date_to_html_string(date)
129+
result = '<span class="month">' + date.strftime('%b').upcase + '</span> '
130+
result += date.strftime('<span class="day">%d</span> ')
131+
result += date.strftime('<span class="year">%Y</span> ')
132+
result
133+
end
134+
135+
end
136+
137+
end
138+

plugins/code_block.rb.bak

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Title: Simple Code Blocks for Jekyll
2+
# Author: Brandon Mathis http://brandonmathis.com
3+
# Description: Write codeblocks with semantic HTML5 <figure> and <figcaption> elements and optional syntax highlighting — all with a simple, intuitive interface.
4+
#
5+
# Syntax:
6+
# {% codeblock [title] [url] [link text] %}
7+
# code snippet
8+
# {% endcodeblock %}
9+
#
10+
# For syntax highlighting, put a file extension somewhere in the title. examples:
11+
# {% codeblock file.sh %}
12+
# code snippet
13+
# {% endcodeblock %}
14+
#
15+
# {% codeblock Time to be Awesome! (awesome.rb) %}
16+
# code snippet
17+
# {% endcodeblock %}
18+
#
19+
# Example:
20+
#
21+
# {% codeblock Got pain? painreleif.sh http://site.com/painreleief.sh Download it! %}
22+
# $ rm -rf ~/PAIN
23+
# {% endcodeblock %}
24+
#
25+
# Output:
26+
#
27+
# <figure class='code'>
28+
# <figcaption><span>Got pain? painrelief.sh</span> <a href="http://site.com/painrelief.sh">Download it!</a>
29+
# <div class="highlight"><pre><code class="sh">
30+
# -- nicely escaped highlighted code --
31+
# </code></pre></div>
32+
# </figure>
33+
#
34+
# Example 2 (no syntax highlighting):
35+
#
36+
# {% codeblock %}
37+
# <sarcasm>Ooooh, sarcasm... How original!</sarcasm>
38+
# {% endcodeblock %}
39+
#
40+
# <figure class='code'>
41+
# <pre><code>&lt;sarcasm> Ooooh, sarcasm... How original!&lt;/sarcasm></code></pre>
42+
# </figure>
43+
#
44+
require './plugins/pygments_code'
45+
require './plugins/raw'
46+
47+
module Jekyll
48+
49+
class CodeBlock < Liquid::Block
50+
include HighlightCode
51+
include TemplateWrapper
52+
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
53+
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
54+
Caption = /(\S[\S\s]*)/
55+
def initialize(tag_name, markup, tokens)
56+
@title = nil
57+
@caption = nil
58+
@filetype = nil
59+
@highlight = true
60+
if markup =~ /\s*lang:(\w+)/i
61+
@filetype = $1
62+
markup = markup.sub(/lang:\w+/i,'')
63+
end
64+
if markup =~ CaptionUrlTitle
65+
@file = $1
66+
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
67+
elsif markup =~ CaptionUrl
68+
@file = $1
69+
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a></figcaption>"
70+
elsif markup =~ Caption
71+
@file = $1
72+
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
73+
end
74+
if @file =~ /\S[\S\s]*\w+\.(\w+)/ && @filetype.nil?
75+
@filetype = $1
76+
end
77+
super
78+
end
79+
80+
def render(context)
81+
output = super
82+
code = super.join
83+
source = "<figure class='code'>"
84+
source += @caption if @caption
85+
if @filetype
86+
source += " #{highlight(code, @filetype)}</figure>"
87+
else
88+
source += "#{tableize_code(code.lstrip.rstrip.gsub(/</,'&lt;'))}</figure>"
89+
end
90+
source = safe_wrap(source)
91+
source = context['pygments_prefix'] + source if context['pygments_prefix']
92+
source = source + context['pygments_suffix'] if context['pygments_suffix']
93+
end
94+
end
95+
end
96+
97+
Liquid::Template.register_tag('codeblock', Jekyll::CodeBlock)

0 commit comments

Comments
 (0)