diff options
author | Brandon Mathis <brandon@imathis.com> | 2011-09-04 08:37:22 -0500 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2011-09-04 08:37:22 -0500 |
commit | ed0c220523f81a9f29009f8bbb75ff50052465d4 (patch) | |
tree | ed925f206fc9d72fe806856a07525ec0118a3972 | |
parent | 3cedd387a0fd4522023ef335307cbc096a3c2005 (diff) | |
parent | f03c4cdb2abe524e097fdfc67194e8d9fc0d19ab (diff) | |
download | my_new_personal_website-ed0c220523f81a9f29009f8bbb75ff50052465d4.tar.xz my_new_personal_website-ed0c220523f81a9f29009f8bbb75ff50052465d4.zip |
Merge branch 'master' of https://github.com/fhemberger/octopress into fhemberger-master
Conflicts:
plugins/category_generator.rb
-rw-r--r-- | .themes/classic/source/_includes/archive_post.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/head.html | 5 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/date.html | 4 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/sharing.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/default.html | 3 | ||||
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | Rakefile | 17 | ||||
-rw-r--r-- | plugins/category_generator.rb | 7 |
9 files changed, 33 insertions, 12 deletions
diff --git a/.themes/classic/source/_includes/archive_post.html b/.themes/classic/source/_includes/archive_post.html index b667b88b..fef3328e 100644 --- a/.themes/classic/source/_includes/archive_post.html +++ b/.themes/classic/source/_includes/archive_post.html @@ -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> diff --git a/.themes/classic/source/_includes/head.html b/.themes/classic/source/_includes/head.html index d6a6735b..5370cb4a 100644 --- a/.themes/classic/source/_includes/head.html +++ b/.themes/classic/source/_includes/head.html @@ -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> diff --git a/.themes/classic/source/_includes/post/date.html b/.themes/classic/source/_includes/post/date.html index dce92472..bc493138 100644 --- a/.themes/classic/source/_includes/post/date.html +++ b/.themes/classic/source/_includes/post/date.html @@ -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 %} diff --git a/.themes/classic/source/_includes/post/sharing.html b/.themes/classic/source/_includes/post/sharing.html index 7b074af5..f0f9b9db 100644 --- a/.themes/classic/source/_includes/post/sharing.html +++ b/.themes/classic/source/_includes/post/sharing.html @@ -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> diff --git a/.themes/classic/source/_layouts/default.html b/.themes/classic/source/_layouts/default.html index 57147575..5523ac1b 100644 --- a/.themes/classic/source/_layouts/default.html +++ b/.themes/classic/source/_layouts/default.html @@ -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> @@ -10,4 +10,5 @@ gem 'haml', '>= 3.1' gem 'compass', '>= 0.11' gem 'rubypants' gem 'rb-fsevent' -gem 'stringex'
\ No newline at end of file +gem 'stringex' +gem 'unicode_utils'
\ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index f2fc737d..000eec9b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 @@ -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(', ')}" diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index 52f2d7ef..a7658458 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -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 |