Skip to content

Commit

Permalink
Cleaned out public from repository, updated gitignore, added syntax
Browse files Browse the repository at this point in the history
highlighting tests, improved syntax highlighting and styling of pre
blocks.
Overriding dynamic gist styling.
Added a plugin for pygments caching which should speed things up
terrifically.
added ender.js as a lightweight way of scripting the DOM, events, etc.
Some general typography and semantic html improvements.
  • Loading branch information
imathis committed May 30, 2011
1 parent c7d5365 commit 8698a27
Show file tree
Hide file tree
Showing 74 changed files with 6,017 additions and 1,991 deletions.
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ site
.bundle
.DS_Store
.sass-cache
test
source/_stash
source/stylesheets
source/javascripts/libs/node_modules
source/javascripts/libs/syntax-highlighter
vendor/ruby
vendor/ruby
vendor/ruby
_cache
.gist_cache
public
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source :rubygems
source "http://rubygems.org"

gem 'rake'
gem 'jekyll'
Expand All @@ -8,6 +8,5 @@ gem 'haml', '>= 3.1'
gem 'compass', '>= 0.11'
gem 'rubypants'
gem 'rb-fsevent'
gem 'guard-shell'
gem 'guard-livereload'
gem 'serve'
23 changes: 11 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GEM
specs:
RedCloth (4.2.7)
activesupport (3.0.7)
addressable (2.2.5)
addressable (2.2.6)
chunky_png (1.2.0)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
Expand All @@ -24,10 +24,8 @@ GEM
em-websocket (~> 0.2.0)
guard (>= 0.2.2)
json (~> 1.5.1)
guard-shell (0.1.1)
guard (>= 0.2.0)
haml (3.1.1)
i18n (0.4.2)
i18n (0.6.0)
jekyll (0.10.0)
classifier (>= 1.3.1)
directory_watcher (>= 1.1.1)
Expand All @@ -37,19 +35,21 @@ GEM
liquid (2.2.2)
maruku (0.6.0)
syntax (>= 1.0.0)
rack (1.2.2)
rake (0.8.7)
rack (1.3.0)
rake (0.9.0)
rb-fsevent (0.4.0)
rdiscount (1.6.8)
rubypants (0.2.0)
sass (3.1.1)
serve (1.0.0)
activesupport (~> 3.0.1)
i18n (~> 0.4.1)
rack (~> 1.2.1)
tzinfo (~> 0.3.23)
serve (1.1.0)
activesupport (~> 3.0.7)
i18n (~> 0.6.0)
rack (~> 1.3.0)
tilt (~> 1.3.1)
tzinfo (~> 0.3.27)
syntax (1.0.0)
thor (0.14.6)
tilt (1.3.2)
tzinfo (0.3.27)

PLATFORMS
Expand All @@ -59,7 +59,6 @@ DEPENDENCIES
RedCloth
compass (>= 0.11)
guard-livereload
guard-shell
haml (>= 3.1)
jekyll
rake
Expand Down
3 changes: 1 addition & 2 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
guard 'livereload', :api_version => '1.6' do
watch(/public\/stylesheets\/(.*)\.css/);
watch(/public\/(.*)\.(js|html|png|jpg|gif|jpeg|ttf|otf|woff|svg)/i);
watch(/public\/\S[css|js|html|png|jpg|gif]/)
end
5 changes: 2 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "rubygems"
require "bundler"
Bundler.setup
require "bundler/setup"

port = "4000" # preview project port eg. http://localhost:4000
site = "public" # compiled site directory
Expand Down Expand Up @@ -104,7 +103,7 @@ end

desc "Watch the site and regenerate when it changes"
task :watch do
system "trap 'kill $jekyllPid $guardPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; sleep 0.5; compass watch & compassPid=$!; guard & guardPid=$!; wait"
system "trap 'kill $jekyllPid $guardPid $compassPid' Exit; jekyll --auto & jekyllPid=$!; compass watch & compassPid=$!; guard & guardPid=$!; wait"
end

desc "generate and deploy website via rsync"
Expand Down
10 changes: 4 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
source: source
destination: public
markdown: rdiscount
pygments: false
permalink: pretty
pygments: true

url: http://yoursite.com
title: My Octopress Blog
author: Your Name
email: [email protected] #Add your email (optional) for the atom feed
simple_search: http://google.com/search

recent_posts: 10
recent_posts: 20

twitter_user: imathis
tweet_count: 3
Expand All @@ -19,9 +18,8 @@ show_replies: false
delicious_user:
delicious_count: 3

pinboard_user: designenthusiast
pinboard_user: imathis
pinboard_count: 3

disqus_short_name: imathis

#disqus_short_name: designenthusiast
google_analytics_tracking_id:
109 changes: 109 additions & 0 deletions _plugins/blockquote.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#
# Author: Josediaz Gonzalez - https://github.com/josegonzalez
# Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb
# Modified by Brandon Mathis
#
require './_plugins/titlecase.rb'
module Jekyll

# Outputs a string with a given attribution as a quote
#
# {% blockquote John Paul Jones %}
# Monkeys!
# {% endblockquote %}
# ...
# <blockquote>
# Monkeys!
# <br />
# John Paul Jones
# </blockquote>
#
class Blockquote < Liquid::Block
FullCiteWithTitle = /([\w\s]+)(https?:\/\/)(\S+\s)([\w\s]+)/i
FullCite = /([\w\s]+)(https?:\/\/)(\S+)/i
Author = /([\w\s]+)/

def initialize(tag_name, markup, tokens)
@by = nil
@source = nil
@title = nil
if markup =~ FullCiteWithTitle
@by = $1
@source = $2 + $3
@title = $4.titlecase
elsif markup =~ FullCite
@by = $1
@source = $2 + $3
elsif markup =~ Author
@by = $1
end
super
end

def render(context)
output = super
if @by.nil?
'<blockquote><p>' + output.join + '</p></blockquote>'
elsif !@title.nil?
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
elsif !@source.nil?
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">source</a></cite></p>'
else
'<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
end
end
end

# Outputs a string with a given attribution as a pullquote
#
# {% blockquote John Paul Jones %}
# Monkeys!
# {% endblockquote %}
# ...
# <blockquote class="pullquote">
# Monkeys!
# <br />
# John Paul Jones
# </blockquote>
#
class Pullquote < Liquid::Block
FullCiteWithTitle = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)([\w\s]+)/i
FullCite = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)/i
Author = /([\w\s]+)/

def initialize(tag_name, markup, tokens)
@by = nil
@source = nil
@title = nil
if markup =~ FullCiteWithTitle
@by = $1
@source = $2 + $3
@title = $4
elsif markup =~ FullCite
@by = $1
@source = $2 + $3
elsif markup =~ Author
@by = $1
end
super
end

def render(context)
output = super
if @by.nil?
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>'
elsif @title
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
elsif @source
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">source</a></cite></p>'
elsif @by
'<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
end
end
end
end

Liquid::Template.register_tag('blockquote', Jekyll::Blockquote)
Liquid::Template.register_tag('pullquote', Jekyll::Pullquote)


65 changes: 65 additions & 0 deletions _plugins/category.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module Jekyll

class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'

self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
self.data['category'] = category

category_title_prefix = site.config['category_title_prefix'] || 'Category: '
self.data['title'] = "#{category_title_prefix}#{category}"
end
end

class CategoryList < Page
def initialize(site, base, dir, categories)
@site = site
@base = base
@dir = dir
@name = 'index.html'

self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_list.html')
self.data['categories'] = categories
end
end

class CategoryGenerator < Generator
safe true

def generate(site)
if site.layouts.key? 'category_index'
dir = site.config['category_dir'] || 'categories'
site.categories.keys.each do |category|
write_category_index(site, File.join(dir, category.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), category)
end
end

if site.layouts.key? 'category_list'
dir = site.config['category_dir'] || 'categories'
write_category_list(site, dir, site.categories.keys.sort)
end
end

def write_category_index(site, dir, category)
index = CategoryIndex.new(site, site.source, dir, category)
index.render(site.layouts, site.site_payload)
index.write(site.dest)
site.static_files << index
end

def write_category_list(site, dir, categories)
index = CategoryList.new(site, site.source, dir, categories)
index.render(site.layouts, site.site_payload)
index.write(site.dest)
site.static_files << index
end
end

end

7 changes: 6 additions & 1 deletion _plugins/custom_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def ordinal(number)
end
end
end
#YearlyPost = Struct.new('YearlyPost', :year, :posts)
def yearly_posts(site)
#site.posts.reverse.group_by { |p| p.date.strftime("%Y") }.map { |k,v| YearlyPost.new(k,v) }
site
end
end

Liquid::Template.register_filter OctopressFilters

49 changes: 49 additions & 0 deletions _plugins/iterator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##
## Author: Jose Gonzalez - https://github.com/josegonzalez
## Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/iterator.rb
##

#module Jekyll
#class Site
#alias_method :orig_site_payload, :site_payload

## Constuct an array of hashes that will allow the user, using Liquid, to
## iterate through the keys of _kv_hash_ and be able to iterate through the
## elements under each key.
##
## Example:
## categories = { 'Ruby' => [<Post>, <Post>] }
## make_iterable(categories, :index => 'name', :items => 'posts')
## Will allow the user to iterate through all categories and then iterate
## though each post in the current category like so:
## {% for category in site.categories %}
## h1. {{ category.name }}
## <ul>
## {% for post in category.posts %}
## <li>{{ post.title }}</li>
## {% endfor %}
## </ul>
## {% endfor %}
##
## Returns [ {<index> => <kv_hash_key>, <items> => kv_hash[<kv_hash_key>]}, ... ]

#def make_iterable(kv_hash, options)
#options = {:index => 'name', :items => 'items'}.merge(options)
#result = []
#kv_hash.sort.each do |key, value|
#result << { options[:index] => key, options[:items] => value }
#end
#result
#end

#def site_payload
#payload = orig_site_payload
#payload['site']['iterable'].merge!({
#'categories' => make_iterable(self.categories, :index => 'name', :items => 'posts'),
#'tags' => make_iterable(self.tags, :index => 'name', :items => 'posts')
#})
#payload
#end

#end
#end
Loading

0 comments on commit 8698a27

Please sign in to comment.