Browse code

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

Conflicts:
plugins/category_generator.rb

Brandon Mathis authored on 04/09/2011 at 13:37:22
Showing 9 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 {% capture category %}{{ post.categories | size }}{% endcapture %}
2 2
 <h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1>
3
-<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>
3
+<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>
4 4
 {% if category != '0' %}
5 5
 <footer>
6 6
   <span class="categories">posted in {{ post.categories | category_links }}</span>
... ...
@@ -4,7 +4,7 @@
4 4
 <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
5 5
 <head>
6 6
   <meta charset="utf-8">
7
-  <title>{{site.title}}{% if page.title %}: {{page.title}}{% endif %}</title>
7
+  <title>{% if page.title %}{{page.title}} « {% endif %}{{site.title}}</title>
8 8
   <meta name="author" content="{{site.author}}">
9 9
   {% if page.description %}
10 10
     <meta name="description" content="{{page.description}}"/>
... ...
@@ -26,8 +26,5 @@
26 26
   <script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script>
27 27
   <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script>
28 28
   <link href="{{ site.subscribe_rss }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
29
-  {% include google_analytics.html %}
30
-  {% include google_plus_one.html %}
31
-  {% include twitter_sharing.html %}
32 29
   {% include custom/head.html %}
33 30
 </head>
... ...
@@ -3,8 +3,8 @@
3 3
 {% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
4 4
 {% capture was_updated %}{{ updated | size }}{% endcapture %}
5 5
 {% if has_date != '0' %}
6
-<time datetime="{{ date | datetime }}" pubdate {% if updated %} updated {% endif %}>{{ date | ordinalize }}</time>
6
+<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate {% if updated %} data-updated="true" {% endif %}>{{ date | ordinalize }}</time>
7 7
 {% endif %}
8 8
 {% if was_updated != '0' %}
9
-<time class="updated" datetime="{{ updated | datetime }}">{{ updated | ordinalize }}</time>
9
+<time class="updated" datetime="{{ updated | datetime | date_to_xmlschema }}">{{ updated | ordinalize }}</time>
10 10
 {% endif %}
... ...
@@ -3,6 +3,6 @@
3 3
   <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>
4 4
   {% endif %}
5 5
   {% if site.google_plus_one %}
6
-  <g:plusone size="{{ site.google_plus_one_size }}"></g:plusone>
6
+  <div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div>
7 7
   {% endif %}
8 8
 </div>
... ...
@@ -9,5 +9,8 @@
9 9
     </div>
10 10
   </div>
11 11
   <footer>{% include footer.html %}</footer>
12
+  {% include google_analytics.html %}
13
+  {% include google_plus_one.html %}
14
+  {% include twitter_sharing.html %}
12 15
 </body>
13 16
 </html>
... ...
@@ -10,4 +10,5 @@ gem 'haml', '>= 3.1'
10 10
 gem 'compass', '>= 0.11'
11 11
 gem 'rubypants'
12 12
 gem 'rb-fsevent'
13
-gem 'stringex'
14 13
\ No newline at end of file
14
+gem 'stringex'
15
+gem 'unicode_utils'
15 16
\ No newline at end of file
... ...
@@ -42,6 +42,7 @@ GEM
42 42
     sass (3.1.7)
43 43
     stringex (1.3.0)
44 44
     syntax (1.0.0)
45
+    unicode_utils (1.0.0)
45 46
 
46 47
 PLATFORMS
47 48
   ruby
... ...
@@ -58,3 +59,4 @@ DEPENDENCIES
58 58
   rdiscount
59 59
   rubypants
60 60
   stringex
61
+  unicode_utils
... ...
@@ -27,6 +27,9 @@ server_port     = "4000"      # port for preview server eg. localhost:4000
27 27
 
28 28
 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]"
29 29
 task :install, :theme do |t, args|
30
+  if File.directory?(source_dir) || File.directory?("sass")
31
+    abort("rake aborted!") if ask("A theme is already installed, proceeding will overwrite existing files. Are you sure?", ['y', 'n']) == 'n'
32
+  end
30 33
   # copy theme into working Jekyll directories
31 34
   theme = args.theme || 'classic'
32 35
   puts "## Copying "+theme+" theme into ./#{source_dir} and ./sass"
... ...
@@ -301,6 +304,20 @@ def ok_failed(condition)
301 301
   end
302 302
 end
303 303
 
304
+def get_stdin(message)
305
+  print message
306
+  STDIN.gets.chomp
307
+end
308
+
309
+def ask(message, valid_options)
310
+  if valid_options
311
+    answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
312
+  else
313
+    answer = get_stdin(message)
314
+  end
315
+  answer
316
+end
317
+
304 318
 desc "list tasks"
305 319
 task :list do
306 320
   puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
... ...
@@ -16,8 +16,9 @@
16 16
 # - category_dir:          The subfolder to build category pages in (default is 'categories').
17 17
 # - category_title_prefix: The string used before the category name in the page title (default is
18 18
 #                          'Category: ').
19
-module Jekyll
19
+require "unicode_utils"
20 20
 
21
+module Jekyll
21 22
 
22 23
   # The CategoryIndex class creates a single category page for the specified category.
23 24
   class CategoryIndex < Page
... ...
@@ -68,7 +69,7 @@ module Jekyll
68 68
       if self.layouts.key? 'category_index'
69 69
         dir = self.config['category_dir'] || 'categories'
70 70
         self.categories.keys.each do |category|
71
-          self.write_category_index(File.join(dir, category.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')), category)
71
+          self.write_category_index(File.join(dir, UnicodeUtils.nfkd(category).gsub(/[^\x00-\x7F]/, '').gsub(/_|\W/, '-').gsub(/-{2,}/, '-').to_s), category)
72 72
         end
73 73
 
74 74
       # Throw an exception if the layout couldn't be found.
... ...
@@ -105,7 +106,7 @@ module Jekyll
105 105
     def category_links(categories)
106 106
       dir = @context.registers[:site].config['category_dir']
107 107
       categories = categories.sort!.map do |item|
108
-        "<a class='category' href='/#{dir}/#{item.gsub(/[_\W]/, '-').gsub(/-{2,}/, '-')}/'>#{item}</a>"
108
+        "<a class='category' href='/#{dir}/#{UnicodeUtils.nfkd(item).gsub(/[^\x00-\x7F]/, '').gsub(/_|\W/, '-').gsub(/-{2,}/, '-').to_s}/'>#{item}</a>"
109 109
       end
110 110
 
111 111
       case categories.length