Merge branch 'master' of https://github.com/fhemberger/octopress into fhemberger-master

Conflicts:
	plugins/category_generator.rb
This commit is contained in:
Brandon Mathis 2011-09-04 08:37:22 -05:00
commit ed0c220523
9 changed files with 33 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{% capture category %}{{ post.categories | size }}{% endcapture %}
<h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1>
<time datetime="{{ post.date | datetime }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time>
<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>
<span class="categories">posted in {{ post.categories | category_links }}</span>

View File

@ -4,7 +4,7 @@
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>{{site.title}}{% if page.title %}: {{page.title}}{% endif %}</title>
<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}}"/>
@ -26,8 +26,5 @@
<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"/>
{% include google_analytics.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}
{% include custom/head.html %}
</head>

View File

@ -3,8 +3,8 @@
{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
{% capture was_updated %}{{ updated | size }}{% endcapture %}
{% if has_date != '0' %}
<time datetime="{{ date | datetime }}" pubdate {% if updated %} updated {% endif %}>{{ date | ordinalize }}</time>
<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate {% if updated %} data-updated="true" {% endif %}>{{ date | ordinalize }}</time>
{% endif %}
{% if was_updated != '0' %}
<time class="updated" datetime="{{ updated | datetime }}">{{ updated | ordinalize }}</time>
<time class="updated" datetime="{{ updated | datetime | date_to_xmlschema }}">{{ updated | ordinalize }}</time>
{% endif %}

View File

@ -3,6 +3,6 @@
<a href="http://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-via="{{ site.twitter_user }}" data-counturl="{{ site.url }}{{ page.url }}" >Tweet</a>
{% endif %}
{% if site.google_plus_one %}
<g:plusone size="{{ site.google_plus_one_size }}"></g:plusone>
<div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div>
{% endif %}
</div>

View File

@ -9,5 +9,8 @@
</div>
</div>
<footer>{% include footer.html %}</footer>
{% include google_analytics.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}
</body>
</html>

View File

@ -10,4 +10,5 @@ gem 'haml', '>= 3.1'
gem 'compass', '>= 0.11'
gem 'rubypants'
gem 'rb-fsevent'
gem 'stringex'
gem 'stringex'
gem 'unicode_utils'

View File

@ -42,6 +42,7 @@ GEM
sass (3.1.7)
stringex (1.3.0)
syntax (1.0.0)
unicode_utils (1.0.0)
PLATFORMS
ruby
@ -58,3 +59,4 @@ DEPENDENCIES
rdiscount
rubypants
stringex
unicode_utils

View File

@ -27,6 +27,9 @@ server_port = "4000" # port for preview server eg. localhost:4000
desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]"
task :install, :theme do |t, args|
if File.directory?(source_dir) || File.directory?("sass")
abort("rake aborted!") if ask("A theme is already installed, proceeding will overwrite existing files. Are you sure?", ['y', 'n']) == 'n'
end
# copy theme into working Jekyll directories
theme = args.theme || 'classic'
puts "## Copying "+theme+" theme into ./#{source_dir} and ./sass"
@ -301,6 +304,20 @@ def ok_failed(condition)
end
end
def get_stdin(message)
print message
STDIN.gets.chomp
end
def ask(message, valid_options)
if valid_options
answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
else
answer = get_stdin(message)
end
answer
end
desc "list tasks"
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"

View File

@ -16,8 +16,9 @@
# - category_dir: The subfolder to build category pages in (default is 'categories').
# - category_title_prefix: The string used before the category name in the page title (default is
# 'Category: ').
module Jekyll
require "unicode_utils"
module Jekyll
# The CategoryIndex class creates a single category page for the specified category.
class CategoryIndex < Page
@ -68,7 +69,7 @@ module Jekyll
if self.layouts.key? 'category_index'
dir = self.config['category_dir'] || 'categories'
self.categories.keys.each do |category|
self.write_category_index(File.join(dir, category.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')), category)
self.write_category_index(File.join(dir, UnicodeUtils.nfkd(category).gsub(/[^\x00-\x7F]/, '').gsub(/_|\W/, '-').gsub(/-{2,}/, '-').to_s), category)
end
# Throw an exception if the layout couldn't be found.
@ -105,7 +106,7 @@ module Jekyll
def category_links(categories)
dir = @context.registers[:site].config['category_dir']
categories = categories.sort!.map do |item|
"<a class='category' href='/#{dir}/#{item.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')}/'>#{item}</a>"
"<a class='category' href='/#{dir}/#{UnicodeUtils.nfkd(item).gsub(/[^\x00-\x7F]/, '').gsub(/_|\W/, '-').gsub(/-{2,}/, '-').to_s}/'>#{item}</a>"
end
case categories.length